Why does simulink recompiles the simulation every time when using sim command?

6 visualizaciones (últimos 30 días)
omer
omer el 21 de Jun. de 2016
Comentada: omer el 21 de Jun. de 2016
Im trying to call to sim multiple times through a for loop. The only things that changes each iteration are the values of the plecs parameters blocks inside(the simulation input).
But every time i click the run button of the model it shows the recompilation process in a green box below(a picture is attached).
How can i do compilation only once and in the other times the simulation will just run with the new input ? The problem is that each compilation takes about two seconds and it a long time when using long for loops.

Respuestas (2)

Andreas Goser
Andreas Goser el 21 de Jun. de 2016
The "Plecs" keyword suggests there might be a non MathWorks product involved. Can you confirm? Can you try to remove that 3rd party block(s) for debugging purpose and see whether it still recompiles? This is to narrow down if a Simulink or a Plecs specialist is needed.

omer
omer el 21 de Jun. de 2016
Editada: omer el 21 de Jun. de 2016
Hey Andreas , thanks for the quick answer. Becasue my model are with only plecs blocks there will be nothing left if i remove it. So i created a blank model -constant conected to outport in simulink. and I pressed the run button . Every time i press the run button its doing fast intialization and compilation(i mean there is still the green box but its very fast , i guess because of the simple model).
when clicking the run button in the original simulation with plecs , its compiling in two stages :
"Compiling:Performing precompile notifications: Started" and right after : "Compiling: Evaluating block parameters : Started"
Another important detail is that in these plecs blocks i use C script Blocks that calculate the outputs for current inputs
  2 comentarios
Andreas Goser
Andreas Goser el 21 de Jun. de 2016
I see. When this green progress bar promts "compiling" it does very differnt things under the hood. Some of them may be actual "compiling", some not. So basically you point is how to speed that up. I really cannot say that for PLECS. Maybe there is a PLECS specific forum? Certainly also here on MATLAB Answers other users maybe have that experience.
omer
omer el 21 de Jun. de 2016
Thing is , that even if i dont change the input, and press on 'run' it recompiles. I checked the PLECS manual and it says that i should define this parameters as tunable instead of inline in simulink. but the problem is that i dont know how to do so. Any suggestions?

Iniciar sesión para comentar.

Categorías

Más información sobre Programmatic Model Editing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by