{"id":2169,"date":"2013-05-03T10:34:33","date_gmt":"2013-05-03T15:34:33","guid":{"rendered":"https:\/\/blogs.mathworks.com\/seth\/?p=2169"},"modified":"2017-05-02T18:57:58","modified_gmt":"2017-05-02T23:57:58","slug":"comparing-runs-using-simulink-data-inspector","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2013\/05\/03\/comparing-runs-using-simulink-data-inspector\/","title":{"rendered":"Comparing Runs using Simulation Data Inspector"},"content":{"rendered":"<p>Do you use the <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/ug\/simulation-data-inspector-overview.html\">Simulation Data Inspector<\/a>? Here is an example where it saved me a lot of debugging time.<\/p>\r\n\r\n<p><strong>Simulation Accuracy<\/strong><\/p>\r\n\r\n<p>I recently had to validate system behavior and analyze numerical accuracy of a model. Making small modifications in one part of the model was leading to unexpectedly large differences at the outputs. Since the model was very large, I thought it would be painful to insert <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/scope.html\">Scopes<\/a> or <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/toworkspace.html\">To Workspace<\/a> blocks in the model to try identifying the source of the problem.<\/p>\r\n\r\n<p>I found out that the Simulation Data Inspector can be very useful to <a title=\"https:\/\/www.mathworks.com\/help\/simulink\/ug\/comparison-of-all-logged-signal-data-from-multiple-simulations.html (link no longer works)\">compare simulation results<\/a> without adding blocks to your model and without writing any scripts. Let's see how this work!<\/p>\r\n\r\n<p><strong>Logging Signals<\/strong><\/p>\r\n\r\n<p>The first step is to <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/ug\/configuring-a-signal-for-signal-logging.html\">configure signals for logging<\/a>. I like to use the <a title=\"https:\/\/www.mathworks.com\/help\/simulink\/ug\/the-model-explorer-overview.html (link no longer works)\">Model Explorer<\/a> for that. It is significantly faster than right-clicking on the signal lines one by one. Here are a few tips to configure the Model Explorer with the goal of controlling signal logging.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q2\/configure_logging.png\" alt=\"Configuring signals for logging using the model explorer\" \/><\/p>\r\n\r\n<p>Also, ensure that signal logging is enabled in the model configuration.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q2\/enable_logging.png\" alt=\"Enabling logging\" \/><\/p>\r\n\r\n<p><strong>Record & Inspect Simulation Output<\/strong><\/p>\r\n\r\n<p>In your model, click on the Record button.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q2\/enable_sdi.png\" alt=\"Record & Inspect Simulation Output\" \/><\/p>\r\n\r\n<p>When the simulation is completed, open the Simulation Data Inspector using the link that pops up.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q2\/launching_sdi.png\" alt=\"Launching Simulation Data Inspector\" \/><\/p>\r\n\r\n<p><strong>Compare Runs<\/strong><\/p>\r\n\r\n<p>Make some changes to your model and simulate it again. In the Simulation Data Inspector, go to the <strong>Compare Runs<\/strong> Tab, select your 2 runs and click <strong>Compare<\/strong>.<\/p>\r\n\r\n<p>Using the absolute tolerance I specified, the Simulation data Inspector helped me to quickly identify where the divergence appear in my model.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q2\/compare_runs.png\" alt=\"Comparing Runs in Simulation Data Inspector\" \/><\/p>\r\n\r\n\r\n\r\n<p><strong>Now it's your turn<\/strong><\/p>\r\n\r\n<p>Give a look and the Validate System Behavior section of the documentation to learn more about the Simulation Data Inspector and let us know if it helps your workflow by leaving a <a href=\"https:\/\/blogs.mathworks.com\/seth\/?p=2169&#comment\">comment here<\/a>.\r\n\r\n\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\/2013Q2\/compare_runs.png\" onError=\"this.style.display ='none';\" \/><\/div><p>Do you use the Simulation Data Inspector? Here is an example where it saved me a lot of debugging time.\r\n\r\nSimulation Accuracy\r\n\r\nI recently had to validate system behavior and analyze numerical... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2013\/05\/03\/comparing-runs-using-simulink-data-inspector\/\">read more >><\/a><\/p>","protected":false},"author":41,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[121,43,24,11,33],"tags":[322,321,320],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/2169"}],"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=2169"}],"version-history":[{"count":29,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/2169\/revisions"}],"predecessor-version":[{"id":6529,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/2169\/revisions\/6529"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=2169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=2169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=2169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}