How to reduce start time of my simulink model

14 views (last 30 days)
D D
D D on 20 Jun 2023
Edited: Vinayak Agrawal on 26 Jun 2023
I want to reduce the time to start the simulink model. I found the compilation is taking more time (5 minutes) before starting the model. I am using some reference models in my top model.
So I plan to precompile the model and start from precombiled state when required.
I used below steps to precompile and I think it working
myModel([], [], [], 'compile')
myModel([], [], [], 'term')
But when I start model, again the compilation happens and same time is elapsed Can someone help to start the model from precombiled state.

Answers (1)

Vinayak Agrawal
Vinayak Agrawal on 21 Jun 2023
Edited: Vinayak Agrawal on 26 Jun 2023
Hi DD,
It looks like you're on the right track with precompiling your model. To start the model from the precompiled state, you need to use the `sim` command with the `'internal'` option. Here are the steps you can try:
1. Load the precompiled model by running the `myModel([], [], [], 'load')` command. This loads the precompiled binary file.
2. Run the `sim` command with the `'internal'` option to start the simulation. For example: `sim('myModel', 'internal')`. This starts the simulation from the precompiled state and should skip the compilation step.
Note that the command `'myModel([], [], [], 'term')'` you mentioned is not required for precompiling the model. It is used to terminate a simulation that is running.
Also, keep in mind that if you make any changes to the model or dependencies after precompiling, you will need to re-precompile the model for the changes to take effect.
If you continue to experience issues with the model compiling time, you may also want to consider making optimizations to your model or looking into methods for efficient model execution.k
Hope it helps!

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!