{"id":8770,"date":"2017-07-28T09:00:00","date_gmt":"2017-07-28T13:00:00","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=8770"},"modified":"2017-07-24T16:33:39","modified_gmt":"2017-07-24T20:33:39","slug":"real-time-pacer-for-simulink","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2017\/07\/28\/real-time-pacer-for-simulink\/","title":{"rendered":"Real-Time Pacer for Simulink"},"content":{"rendered":"<div xmlns:mwsh=\"https:\/\/www.mathworks.com\/namespace\/mcode\/v1\/syntaxhighlight.dtd\" class=\"content\">\n   <introduction><\/p>\n<p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/3208495\">Sean<\/a>&#8216;s pick this week is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/29107-real-time-pacer-for-simulink\">Real-Time Pacer for Simulink<\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/1056585\">Gautam Vallabha<\/a>.\n      <\/p>\n<p>   <\/introduction><\/p>\n<h3>Contents<\/h3>\n<div>\n<ul>\n<li><a href=\"#1\">Slow Down!<\/a><\/li>\n<li><a href=\"#2\">Speed Up!<\/a><\/li>\n<li><a href=\"#3\">Comments<\/a><\/li>\n<\/ul><\/div>\n<h3>Slow Down!<a name=\"1\"><\/a><\/h3>\n<p>Have you ever wanted your Simulink model to run slower?  Perhaps so your boss will think you&#8217;re busy?  Or you want to see<br \/>\n      a scope animating or display updating?  If so, then the Pacer for Simulink is for you.  It slows the model to a set speed<br \/>\n      compared to wall time and optionally provides that wall time as an output.  Note that it is very similar to the <a href=\"https:\/\/www.mathworks.com\/help\/aeroblks\/simulationpace.html\">Aerospace Toolbox Simulation Pace Block<\/a> but does not require the toolbox.\n   <\/p>\n<p>If you run a Simulink model, it will run as quickly as possible which often times means you&#8217;ll only see the end result.  Here&#8217;s<br \/>\n      a short video of running a simulation with and without the pacer to demonstrate.\n   <\/p>\n<p>   <div style=\"width: 640px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-8770-1\" width=\"640\" height=\"360\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/blogs.mathworks.com\/pick\/files\/simpacer.mp4?_=1\" \/><a href=\"https:\/\/blogs.mathworks.com\/pick\/files\/simpacer.mp4\">https:\/\/blogs.mathworks.com\/pick\/files\/simpacer.mp4<\/a><\/video><\/div><\/p>\n<h3>Speed Up!<a name=\"2\"><\/a><\/h3>\n<p>What if you want to speed up your simulation?  In that case, you should check out <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/parsim.html\"><tt>parsim<\/tt><\/a>, the latest and greatest in parallel simulation technology!\n   <\/p>\n<h3>Comments<a name=\"3\"><\/a><\/h3>\n<p>Give it a try and let us know what you think <a href=\"https:\/\/blogs.mathworks.com\/pick\/?p=8770#respond\">here<\/a> or leave a <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/29107-real-time-pacer-for-simulink#comments\">comment<\/a> for Gautam.\n   <\/p>\n<p><script language=\"JavaScript\">\n<!--\n\n    function grabCode_68ee526f58294caf8687ff6ebf424c6c() {\n        \/\/ Remember the title so we can use it in the new page\n        title = document.title;\n\n        \/\/ Break up these strings so that their presence\n        \/\/ in the Javascript doesn't mess up the search for\n        \/\/ the MATLAB code.\n        t1='68ee526f58294caf8687ff6ebf424c6c ' + '##### ' + 'SOURCE BEGIN' + ' #####';\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 68ee526f58294caf8687ff6ebf424c6c';\n    \n        b=document.getElementsByTagName('body')[0];\n        i1=b.innerHTML.indexOf(t1)+t1.length;\n        i2=b.innerHTML.indexOf(t2);\n \n        code_string = b.innerHTML.substring(i1, i2);\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\n\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \n        \/\/ in the XML parser.\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\n        \/\/ doesn't go ahead and substitute the less-than character. \n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\n\n        author = 'Sean de Wolski';\n        copyright = 'Copyright 2017 The MathWorks, Inc.';\n\n        w = window.open();\n        d = w.document;\n        d.write('\n\n<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add author and copyright lines at the bottom if specified.\r\n        if ((author.length > 0) || (copyright.length > 0)) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (author.length > 0) {\r\n                d.writeln('% _' + author + '_');\r\n            }\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\n\n\\n');\n      \n      d.title = title + ' (MATLAB code)';\n      d.close();\n      }   \n      \n-->\n<\/script><\/p>\n<p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><a href=\"javascript:grabCode_68ee526f58294caf8687ff6ebf424c6c()\"><span style=\"font-size: x-small;        font-style: italic;\">Get<br \/>\n            the MATLAB code<br \/>\n            <noscript>(requires JavaScript)<\/noscript><\/span><\/a><\/p>\n<p>      Published with MATLAB&reg; R2017b<\/p>\n<\/div>\n<p><!--\n68ee526f58294caf8687ff6ebf424c6c ##### SOURCE BEGIN #####\n%% Real-Time Pacer for Simulink\n%\n% <https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/3208495 Sean>'s pick this week is\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/29107-real-time-pacer-for-simulink Real-Time Pacer for Simulink> by\n% <https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/1056585 Gautam Vallabha>.\n% \n\n%% Slow Down!\n% Have you ever wanted your Simulink model to run slower?  Perhaps so your\n% boss will think you're busy?  Or you want to see a scope animating or\n% display updating?  If so, then the Pacer for Simulink is for you.  It\n% slows the model to a set speed compared to wall time and optionally\n% provides that wall time as an output.  Note that it is very similar to\n% the <https:\/\/www.mathworks.com\/help\/aeroblks\/simulationpace.html\n% Aerospace Toolbox Simulation Pace Block> but does not require the\n% toolbox.\n%\n% If you run a Simulink model, it will run as quickly as possible which\n% often times means you'll only see the end result.  Here's a short\n% video of running a simulation with and without the pacer to demonstrate.\n\n\n%% Speed Up!\n% What if you want to speed up your simulation?  In that case, you should\n% check out <https:\/\/www.mathworks.com\/help\/simulink\/slref\/parsim.html\n% |parsim|>, the latest and greatest in parallel simulation technology!\n\n%% Comments\n% \n% Give it a try and let us know what you think\n% <https:\/\/blogs.mathworks.com\/pick\/?p=8770#respond here> or leave a\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/29107-real-time-pacer-for-simulink#comments\n% comment> for Gautam.\n%\n \n\n##### SOURCE END ##### 68ee526f58294caf8687ff6ebf424c6c\n--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sean&#8216;s pick this week is Real-Time Pacer for Simulink by Gautam Vallabha.<\/p>\n<p>Contents<\/p>\n<p>Slow Down!<br \/>\nSpeed Up!<br \/>\nComments<\/p>\n<p>Slow Down!<br \/>\nHave you ever wanted your Simulink model to run&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2017\/07\/28\/real-time-pacer-for-simulink\/\">read more >><\/a><\/p>\n","protected":false},"author":87,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/8770"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/87"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=8770"}],"version-history":[{"count":5,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/8770\/revisions"}],"predecessor-version":[{"id":8776,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/8770\/revisions\/8776"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=8770"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=8770"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=8770"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}