Comments on: 5 Resources for Simulation Performance https://blogs.mathworks.com/simulink/2010/12/06/5-resources-for-simulation-performance/?s_tid=feedtopost Guy Rouleau is an Application Engineer for MathWorks. He writes here about Simulink and other MathWorks tools used in Model-Based Design. Mon, 02 Jan 2017 20:21:05 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: Paul J. https://blogs.mathworks.com/simulink/2010/12/06/5-resources-for-simulation-performance/#comment-1381 Sat, 19 Mar 2011 03:02:14 +0000 https://blogs.mathworks.com/seth/2010/12/06/5-resources-for-simulation-performance/#comment-1381 @Eike, one possibility: when you inline paramters, the sample times of Constant blocks (can) change from FiM to Inf. This can affect blocks downstream with inherited sample times. I thought I saw a bug report with an example of this behavior, but I can’t find it right now. Anyway, if you don’t have the the Sample Times/Colors displayed, you might want to try that and see if any issues pop out.

]]>
By: Eike Petersen https://blogs.mathworks.com/simulink/2010/12/06/5-resources-for-simulation-performance/#comment-1369 Wed, 16 Mar 2011 13:34:32 +0000 https://blogs.mathworks.com/seth/2010/12/06/5-resources-for-simulation-performance/#comment-1369 I’m also quite interested in the answers to Pauls questions…

However, there seems to be a reason for not using inline parameters when never changing the parameters: I’m just working on a model that only behaves as expected when built using noninline parameters. Unfortunately, I currently have no idea about the reason.

]]>
By: Paul J. https://blogs.mathworks.com/simulink/2010/12/06/5-resources-for-simulation-performance/#comment-1315 Tue, 21 Dec 2010 03:02:13 +0000 https://blogs.mathworks.com/seth/2010/12/06/5-resources-for-simulation-performance/#comment-1315 Seth,

I forgot to mention that all of my timing experiments were in Normal mode. Do you think that relative timing would change in Accelerator mode?

Paul

]]>
By: Paul J. https://blogs.mathworks.com/simulink/2010/12/06/5-resources-for-simulation-performance/#comment-1314 Tue, 21 Dec 2010 02:53:48 +0000 https://blogs.mathworks.com/seth/2010/12/06/5-resources-for-simulation-performance/#comment-1314 Seth,

I just came across an interesting aspect of simulation performance that I hadn’t fully appreciated and I don’t fully understand.

I have a model with four identical masked subsystems. Each masked subsystem takes a single parameter which is a structure. The parameter pane of the mask editor has Tunable unchecked for the parameter (though this hasn’t seemed to make a difference one way or the other). One field of the structure parameter is an Nx4 array and the other is an Nx1 array. Each of these is a parameter in a Constant Block (there are a few other blocks in the subsystem, but the profiler showed the constant block with the Nx4 near the top of the list). I’ve been experimenting with running the simulation in four different configurations and got the following run time measurements:

parameter defined in base workspace, Inline Parameters On: 1.06 seconds

parameter defined in model workspace, Inline Parameters On: 1.8 seconds

parameter defined in base workspace, Inline Parameters Off: 7.7 seconds

parameter defined in base workspace, Inline Parameters Off: 9.2 seconds.

Based on this, perhaps you can help with the following:

0. Is this expected behavior (assuming I gave enough information)? If this is the case, is the reason just the inlining or is it really that in this simple model with inlining on, the optimization can honor the inf sample time of the constant blocks? In other words, would inlining not show this performance benefit if the output of the constant block were connected to the output of a conditionally executed system (for example)?

1. Why is there extra overhead with using the model workspace?

2. What is the purpose of the Tunable check box in the mask editor paramteter pane? It didn’t seem to do anything in my example.

3. My understanding is that Model Workspace variables are not tunable. If this is the case, why aren’t Model Workspace variables automatically inlined? Maybe this would cause problems for Reference Model Arguments?

4. I don’t want to ever change any parameters during a simulation. Consequently, is there any reason to not have Inline Parameters On? Assuming that ALL of my model parameters are defined in the Model Workspace, does having Inline Parameters On or Off have any implications as to whether or not an Accelerator rebuild is necessary if a parameter in the model workspace changes (e.g., through an hws.assignin command)?

5. How does Inline Parameters work relative to Embedded Function parameter inputs? Suppose that Inline Parameters is checked in the model configuration and an Embedded Function parameter is checked as Tunable? Which takes precedence?

As always, Thanks!

Paul

]]>
By: Seth Popinchalk https://blogs.mathworks.com/simulink/2010/12/06/5-resources-for-simulation-performance/#comment-1312 Thu, 16 Dec 2010 21:03:32 +0000 https://blogs.mathworks.com/seth/2010/12/06/5-resources-for-simulation-performance/#comment-1312 @Mahaboob Basha Qureshi – I reccomend you post your question to the MATLAB Newsgroup.

]]>
By: Mahaboob Basha Qureshi https://blogs.mathworks.com/simulink/2010/12/06/5-resources-for-simulation-performance/#comment-1309 Thu, 16 Dec 2010 06:27:31 +0000 https://blogs.mathworks.com/seth/2010/12/06/5-resources-for-simulation-performance/#comment-1309 Dear sir,
I have tried to draw the simulation of TCSC to subsynchronous resonance in power system. please help me in this matter

]]>
By: Seth Popinchalk https://blogs.mathworks.com/simulink/2010/12/06/5-resources-for-simulation-performance/#comment-1302 Wed, 08 Dec 2010 16:49:18 +0000 https://blogs.mathworks.com/seth/2010/12/06/5-resources-for-simulation-performance/#comment-1302 @Bob – I am glad the information was timely, and I am sorry it is also a bit out of date. We review the tech-note information as we use it and update it as needed, however, I don’t think we have done much review of 1806 recently. I’ll take a look through it and get it updated soon. Thanks!

]]>
By: Bob https://blogs.mathworks.com/simulink/2010/12/06/5-resources-for-simulation-performance/#comment-1301 Wed, 08 Dec 2010 14:52:47 +0000 https://blogs.mathworks.com/seth/2010/12/06/5-resources-for-simulation-performance/#comment-1301 This felt very timely. I had just gotten an email from a colleague complaining about running out of memory with a Simulink model, and then I saw that your post mentioned Tech Note 1806 about “How do I avoid out of memory errors in Simulink?”

I sent him a link to the post, and he came back with “Well, it all seems to be out of date.” He tried the MATLAB_MEM_MGR suggested in Tech Note 1806 using R2009b, and it spit out:

Warning: Changing the memory manager using any of the following is deprecated: 
           the '-memmgr' command line switch 
           the '-check_malloc' command line switch 
           the 'MATLAB_MEM_MGR' environment variable 
         Support for these settings will be removed in a future release. 
Warning: Using the 'native' memory manager.

How often do these tech notes get reviewed & updated? How far back do you preserve information? (Do you mark it as this advice is useful in R12-R14 SP2, or do you just remove it if it no longer applies to the latest release?)

]]>