{"id":6744,"date":"2017-09-27T16:03:17","date_gmt":"2017-09-27T21:03:17","guid":{"rendered":"https:\/\/blogs.mathworks.com\/simulink\/?p=6744"},"modified":"2017-09-27T16:03:17","modified_gmt":"2017-09-27T21:03:17","slug":"new-in-matlab-r2017b-the-simulation-manager","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2017\/09\/27\/new-in-matlab-r2017b-the-simulation-manager\/","title":{"rendered":"New in MATLAB R2017b: The Simulation Manager"},"content":{"rendered":"<p>MATLAB R2017b has recently been released. For this first post about R2017b, I want to highlight a feature that I think most of you will find very useful: The <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/simulationmanager-app.html\">Simulation Manager<\/a><\/p>\n<p>The Simulation Manager makes your life a lot easier when using the <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/parsim.html\">parsim<\/a> function, released in R2017a. It has been added in R2017b to help visualizing the progress of your simulations, and to conveniently access results and diagnostics.<\/p>\n<p><em> Note: If you are not familiar with the <tt>parsim<\/tt> function, I recommend going through this <a href=\"https:\/\/blogs.mathworks.com\/simulink\/2017\/04\/14\/simulating-models-in-parallel-made-easy-with-parsim\">past blog post<\/a> to learn more about it.<\/em><\/p>\n<p><strong>Launching the Simulation Manager<\/strong><\/p>\n<p>Let's begin by setting an example: I will simulate this simple mechanical system 10 times, with different values for the Mass block highlighted in yellow:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2017Q3\/simpleMech.png\" alt=\"Simscape Example\" \/><\/p>\n<p>To run those simulations, I create an array of 10 <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/simulink.simulationinput-class.html\">Simulink.SimulationInput<\/a> objects. For each of them, I use the <a title=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/setblockparameter.html (link no longer works)\">setBlockParameter<\/a> method to specify a different value for the Mass block. Then I pass this array to parsim, with the new <strong>ShowSimulationManager<\/strong> option set to <strong>on<\/strong>.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2017Q3\/parsimCode.png\" alt=\"Parsim Example\" \/><\/p>\n<p>and the Simulation Manager window opens:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2017Q3\/simManager1.png\" alt=\"Simulation Manager\" \/><\/p>\n<p><strong>Progress<\/strong><\/p>\n<p>The first thing you will notice is the progress of each simulation. For each run, you can see if it is active, completed, or got an error.<\/p>\n<p>When selecting one run, you can see the list of parameters specific to this run, time info and diagnostics in the Simulation Details pane.<\/p>\n<p>If you have a large number of runs, you probably want to try the Grid view instead of the default List view. This will allow you to get a big picture on the success of all your runs more easily.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2017Q3\/gridView.png\" alt=\"Grid View\" \/><\/p>\n<p>One convenient thing to note: If you click the <strong>Stop Job<\/strong> button, parsim will return the results for already completed runs. This is more convenient than hitting Ctrl+C, which would have caused you to lose all the results from the job.<\/p>\n<p><strong>Viewing Results<\/strong><\/p>\n<p>When you are ready to visualize and compare results, the <strong>Show Results<\/strong> button will launch the Simulation Data Inspector for the selected runs (You can use Ctrl+click to select multiple runs). Notice how the Simulation Data Inspector has been revamped in R2017b, more on that in another blog post.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2017Q3\/parsimSDI.png\" alt=\"Simulation Data Inspector\" \/><\/p>\n<p><strong>Diagnosing Errors<\/strong><\/p>\n<p>In this example, the Diagnostics tab help me quickly see that the first simulation failed because the Mass value I specified is zero, which is not allowed. I like how the diagnostic is displayed with the same look and feel as the Diagnostic Viewer.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2017Q3\/parsimError.png\" alt=\"Diagnostics\" \/><\/p>\n<p><strong>My Favorite Thing!<\/strong><\/p>\n<p>Now it's time to talk about my favorite feature of the Simulation Manager: <strong>Open Selected<\/strong>.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2017Q3\/openSelected.png\" alt=\"Open Selected\" \/><\/p>\n<p>Anybody who tried to debug errors happening on a remote cluster will probably agree that this can be challenging. Since the parallel workers have no user interface, getting information out of there can be tricky. Debugging in a local MATLAB session is significantly easier.<\/p>\n<p>This is what the Open Selected button does. It opens the model and configures your local MATLAB session like the parallel worker for the selected run. This allows you to add Scopes, log more data, do whatever you typically do while debugging models.<\/p>\n<p><strong>Now it's your turn<\/strong><\/p>\n<p>Give a try at the Simulation Manager and let us know how you like it.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2017Q3\/openSelected.png\" onError=\"this.style.display ='none';\" \/><\/div>\n<p>MATLAB R2017b has recently been released. For this first post about R2017b, I want to highlight a feature that I think most of you will find very useful: The Simulation Manager<br \/>\nThe Simulation Manager... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2017\/09\/27\/new-in-matlab-r2017b-the-simulation-manager\/\">read more >><\/a><\/p>\n","protected":false},"author":41,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[121,143,16],"tags":[84,494,504],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/6744"}],"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=6744"}],"version-history":[{"count":23,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/6744\/revisions"}],"predecessor-version":[{"id":6785,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/6744\/revisions\/6785"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=6744"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=6744"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=6744"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}