Model saving and compiling takes forever

40 次查看(过去 30 天)
Amir
Amir 2024-10-30
编辑: Walter Roberson 2024-11-4,18:22
I am trying to run a relatively simple model, with no referened model (one referenced subsystem) and it generally was quick to execute but with time it starts to take longer and longer to save,compile and run the model, until it comes to the point where autosave takes easily up to 15-20 minutes and update/compiling even longer, especially the first time I open and run the model.
Model feature MPC block, as I am currently in the process of evaulating the toolbox, and it would be easy to point fingers there since its the most complex functionality in the entire model (a lot going on with the mask, and I think it prompts autosave and re-compile each time, but not sure), but in the past I removed the block as I have one version of the model without MPC used for linearization and the issue was still there.
In the past the issue dissapeared when I stopped using saved workspace that contained MPC objects, but now even saving model takes long when there is basically nothing loaded in the workspace.
Typically what I do is either restore the whole folder from the git in the version that last worked well or go via deduction and make new model and c/p part by part and typically new model works fine.
I checked out RAM as it was basically working on nearly 100%, so I cleaned it up a bit, but even with only 50% of RAM being used it was still slow.
I used the profiler and found that certain signal related functions are called many thousands of times on save, and consume a lot, but since they are p-scripts, I can't look into them to see which signals are problematic. I really do not have so many signals, and I also disabled the logging, so I remain quite puzzled what could be the case.
To be more specific, most time is spent in 'SLXPartHandler handler.doSave' calls and in the end a p-script "signalSpecification.signalSpecification", which is called around 260000 times.
What could this be related to? I have 3 signal logs and linearization few in/out ports set, but other there is no complicated signal flow in the model. THe most complex signal operation is 2-d Matrix concatenation that generates 1x15 vector of prediction values (besides whatever goes on in MPC block). I do load x-init, but there is not more then ~15-20 states.
Thank you in advance and I will gladly provide more information when needed.
>> version
ans = '9.7.0.1737446 (R2019b) Update 9'
EDIT: Today is the compile simply got stock and when I interrupted output was following:
Operation terminated by user during Simulink.scopes.LAScope/updateBoundSignals>addSignals
In Simulink.scopes.LAScope/updateBoundSignals
In Simulink.scopes.LAScope.connectSignals
So it seems it got stuck in that particular functionality. Profiler shows the following:
Further more, I have copied the content of that file into a new simulink file and copied all the simulation settings I could think of, and now it runs really fast. I tried cleaning many "cache" memories that I found recommened on different answered posts including the toolbox cache, but that wasnt helpful. I know its just a matter of time when this one becomes slow as well and I have to redo the process.
  3 个评论
Harald
Harald 2024-11-4,15:11
编辑:Harald 2024-11-4,15:11
Unfortunately, I cannot tell what's going on here. On:
Further more, I have copied the content of that file into a new simulink file and copied all the simulation settings I could think of, and now it runs really fast.
Could you do a model comparison to see what the differences between the original model and that copy are?
Beyond that, you may want to contact the Technical Support team to investigate the issue.
Best wishes,
Harald

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear Plant Specification 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by