Simulink slower to compile when 'SrcWorkspace' set to 'current' (call to sim a function)
3 ビュー (過去 30 日間)
古いコメントを表示
I received a rather heavy model (.slx ~57Mo, 40k parameters and signals) from a client, and I need to run it several times for test purposes. To run the model, I call a function (e.g. runTest()) that load every parameters and signals and then call sim function. Here is the problem :
When the sim function is called with option SrcWorkspace set to current (i.e. runTest() workspace), the model is stuck at step "Compiling : Evaluating block parameter." for a very long time (hours scale)
However, when I assign all variables in base workspace and I call sim with SrcWorkspace set to base, this step take a reasonable amount of time (minutes scale).
Do you have any idea why calling sim within function workspace slow down the compilation step ?
0 件のコメント
採用された回答
Fangjun Jiang
2020 年 7 月 16 日
Do you have an apple-to-apple fair comparison? Might it be that when you specify 'SrcWorkspace' as 'current' in runTest(), the data is also loaded in base workspace thus reduces the availability of memory?
Put a breakpoint in runTest() and run "memory" in Command Window to compare.
The default SrcWorkspace for a Simulink model is base, speifying function workspace might slow down a little bit but should not be that significant.
The Simulink model itself is always loaded into the memory used by MATLAB, even though you run load_system() inside runTest().
Another alternative is to use Simulink Data Dictionary or Simulink Model Workspace to store the data.
2 件のコメント
Fangjun Jiang
2020 年 7 月 16 日
Contact Mathworks tech support if you have to use "current" workspace. It sounds like a bug or a significant performance issue.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Configure and View Diagnostics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!