MATLAB Answers

Why does my model rebuild when using Simulink Accelerator?

24 views (last 30 days)
I noticed that my model rebuilds when running the Simulink Accelerator even though I think I have not changed anything that would cause a rebuild.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 28 Feb 2012
This is expected behavior in Simulink Accelerator as explained in the documentation section titled "Handling Changes in Model Structure". An excerpt of this document is below:
Handling Changes in Model Structure
After you use the Simulink Accelerator to simulate a model, the MEX-file containing the compiled version of the model remains available for use in later simulations. Even if you exit MATLAB, you can reuse the MEX-file in later MATLAB or Simulink sessions.
If you alter the structure of your Simulink model, for example, by adding or deleting blocks, the Accelerator automatically regenerates the C code and updates (overwrites) the existing MEX-file.
Examples of model structure changes that require the Accelerator to rebuild include
Changing the solver type, for example from Variable-step to Fixed-step
Adding or deleting blocks or connections between blocks
Changing the values of nontunable block parameters, for example, the Initial seed parameter of the Random Number block (see Tunable Parameters for more information)
Changing the number of inputs or outputs of blocks, even if the connectivity is vectorized
Changing the number of states in the model
Changing function in the Trigonometric Function block
Changing the signs used in a Sum block
Adding a Target Language Compiler (TLC) file to inline an S-function
The Simulink Accelerator displays a warning when you attempt any impermissible model changes during simulation. The warning does not stop the current simulation. To make the model alterations, stop the simulation, make the changes, and restart.
Some changes are permitted in the middle of simulation. Simple changes like adjusting the value of a Gain block do not cause a warning. When in doubt, try to make the change. If you do not see a warning, the Accelerator accepted the change.
Note: The Simulink Accelerator does not display warnings that blocks generate during simulation. Examples include divide-by-zero and integer overflow. This is a different set of warnings from those discussed previously.
The Simulink Accelerator rebuilds the model anytime the generated code will need to change.
Also, the "dot" (structure membership) operator is not supported.
This means that expressions that include a structure member are not tunable.
For more information on why Simulink Accelerator is rebuilding code see the demo titled: "Determining Why Simulink Accelerator is Regenerating Code". This demo is accessible by navigating to "Help ->Product Help" in the MATLAB window, and then navigating to "Simulink ->Demos-> Modeling Features ->Simulation Performance" in the help browser window.


Sign in to comment.

More Answers (0)

Translated by