MATLAB Answers

Extremely slow compilation time in referenced model (Simulink)

33 ビュー (過去 30 日間)
Leonardo Maia
Leonardo Maia 2020 年 7 月 29 日
コメント済み: Jesús Zambrano 2020 年 9 月 9 日
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.

  2 件のコメント

Niklas Högemann
Niklas Högemann 2020 年 8 月 21 日
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
Leonardo Maia
Leonardo Maia 2020 年 8 月 31 日
It's been happening here for a couple versions already (2018 and on). I haven't found a solution to this yet


回答 (1 件)

Jesús Zambrano
Jesús Zambrano 2020 年 9 月 8 日
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.

  3 件のコメント

Leonardo Maia
Leonardo Maia 2020 年 9 月 9 日
Thanks. Going to try those and report back.
Leonardo Maia
Leonardo Maia 2020 年 9 月 9 日
Didn't work. I have some S-functions coming from C++ code in the model and I'm getting some strange build errors in Accelerator mode.
Jesús Zambrano
Jesús Zambrano 2020 年 9 月 9 日
Then please check the following link regarding consideration for S-functions:





Community Treasure Hunt

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

Start Hunting!

Translated by