{"id":4346,"date":"2014-12-18T08:24:04","date_gmt":"2014-12-18T13:24:04","guid":{"rendered":"https:\/\/blogs.mathworks.com\/seth\/?p=4346"},"modified":"2014-12-18T08:24:04","modified_gmt":"2014-12-18T13:24:04","slug":"displaying-simulation-data","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2014\/12\/18\/displaying-simulation-data\/","title":{"rendered":"Displaying Simulation Data"},"content":{"rendered":"<p>This week, I am working on a project with <a href=\"https:\/\/www.mathworks.com\/services\/consulting\/\">MathWorks consulting<\/a> where I have been asked to implement in Simulink a simulator already existing in a different language.<\/p>\r\n\r\n<p>As you can imagine, to debug and validate my work, I need to compare a lot of signals in my model with the original data I received.<\/p>\r\n\r\n<p>As a first step, I am trying to validate the static behavior of the model. This means that I simulate the model for only one time step and validate that the outputs are as expected for different inputs.<\/p>\r\n\r\n<p>If the output does not match, then I need to inspect intermediary signals to figure out where the difference originates.<\/p>\r\n\r\n<p><strong>Display blocks<\/strong><\/p>\r\n\r\n<p>The first, most obvious, way to see the value of a signal in Simulink is the <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/display.html\">Display block<\/a>. In my case, using Display blocks quickly made my model look like:<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2014Q4\/withDisplays.png\" alt=\"Viewing data using displays\" \/><\/p>\r\n\r\n<p>As you can see, the model quickly becomes a mess. And since those displays are only temporary, I will need to remove them later.<\/p>\r\n\r\n<p><strong>Value Label Display<\/strong><\/p>\r\n\r\n<p>Another option that I often find more convenient to quickly view the value of a signal for debugging is the <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/ug\/displaying-block-outputs.html\">Value Label Display<\/a>.<\/p>\r\n\r\n<p>In the Display menu, I can decide if I want the label to be displayed when hovering over the block, or when clicking on it.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2014Q4\/portValueMenu.png\" alt=\"Value Labels\" \/><\/p>\r\n\r\n<p>There are also options to control how often the labels are updated, and their accuracy. In my case, I chose the long format to see all the digits available.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2014Q4\/PortValuesOptions.png\" alt=\"Port Values Options\" \/><\/p>\r\n\r\n<p>Once this is enabled, you can simply click on blocks to enable the displays and simulate the model to see the values.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2014Q4\/withPortValues.png\" alt=\"Port Values\" \/><\/p>\r\n\r\n<p>Once your debugging is completed, you can remove all the labels in one click from the Display menu.<\/p>\r\n\r\n<p><strong>Now it's your turn<\/strong><\/p>\r\n\r\n<p>What is your preferred method to to view signal values during debugging? Let us know by leaving a <a href=\"https:\/\/blogs.mathworks.com\/seth\/?p=4346&#comment\">comment here<\/a>.<\/p>\r\n\r\n\r\n\r\n\r\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2014Q4\/withPortValues.png\" onError=\"this.style.display ='none';\" \/><\/div><p>This week, I am working on a project with MathWorks consulting where I have been asked to implement in Simulink a simulator already existing in a different language.\r\n\r\nAs you can imagine, to debug... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2014\/12\/18\/displaying-simulation-data\/\">read more >><\/a><\/p>","protected":false},"author":41,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[11,33],"tags":[413,414],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/4346"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/comments?post=4346"}],"version-history":[{"count":6,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/4346\/revisions"}],"predecessor-version":[{"id":4352,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/4346\/revisions\/4352"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=4346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=4346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=4346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}