Extremely slow compilation time in referenced model (Simulink)
Show older comments
I have a Simulink model (model1) which has a model reference to model2.
Model2 compilation time (checked with sldiagnostics) is pretty fast, takes 10s or so. However, when I compile model1, the compilation times takes more than 3 minutes, and according to sldiagnostics, the only step that's taking too long is exactly this:
Cstat28: 190.56 seconds -- Check And Compile Model Reference Normal Modes
which is the compilation of the referenced model (model2).
How's this possible? What could I do to alleviate this, as a 3-minute compilation time is a huge hindrance for my test environment.
6 Comments
Niklas Högemann
on 21 Aug 2020
I guess i have the same problem. There are 10 referenced subsystems on my Top Level Model. Compiling the model takes round about 3 minutes, sldiagnostics shows 120 seconds for "Check and Compile Model Reference Normal Modes". If i updating the diagram by ctrl-d it takes the same time. Im not sure but i mean the problem occurs suddenly, maybe it is caused by a update or something ? I dont know.
Do you already found a solution for this issue ?
Best regards
maiaL
on 31 Aug 2020
Charles Collins
on 16 Mar 2021
So few blocks support code generation. I have the same problem and have been dealing with insane compile times for quite some time now. I am not sure what could possibly make some of the blocks so terribly slow to compile.
Eugene Ofori
on 20 Jul 2021
Hi I'm running into the exact same issue were you able to improve the compilaiton time. My reference model takes a minute to compile when I run sldiagnostics but 5mins when I compile the parent model.
Mark Hiteshew
on 5 Nov 2021
I have this same issue. I have a lot of model references and it takes a while to 'update' them before starting to run the model, even if I haven't changed anything in the model references. It's rather annoying
D D
on 19 Jun 2023
I also have same problem. I have a lot of model references and it takes a while to compule them when starting to run the model, even if I haven't changed anything in the model references. Please share if any solution is identified..
Answers (1)
Jesús Zambrano
on 8 Sep 2020
0 votes
Try running the top-level model in Accelerator or Rapid Accelerator mode.
Here are a few tips when using the Accelerator and Rapid Accelerator mode:
- Avoid blocks that do not support code generation. They run in interpreted mode and can slowdown your model.
- Try switching the Compiler Optimization Level from faster build to faster run.
- For maximum speed, start your simulation using the sim command when using these modes.
5 Comments
maiaL
on 9 Sep 2020
maiaL
on 9 Sep 2020
Jesús Zambrano
on 9 Sep 2020
Then please check the following link regarding consideration for S-functions:
D D
on 19 Jun 2023
I also have same problem. I have a lot of model references and it takes a while to compule them when starting to run the model, even if I haven't changed anything in the model references. Please share if any solution is identified..
Eric Racicot
on 20 Jun 2023
I run optimizer for a patch antenna... showing Building Model for about 15 minutes and nothing change... I look computer task manager and mathlab using less than 2% of processor. Why is so long?
Categories
Find more on Component-Based Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!