Several Sfunction or one is better?

1 回表示 (過去 30 日間)
Federico Manfrin
Federico Manfrin 2021 年 11 月 1 日
編集済み: Federico Manfrin 2021 年 11 月 2 日
My next Simulink project can be:
  • one S-function with all the comnplexity inside
  • several S-function with an easy to debug situation ..
Of course I'd like to divide the problem in easy to solve small problems, but the question is:
will a lot of S-function turn my simulation in a slaw, useless design? Or several S-function will be exectuted in different core of the processor (if possible, due to the parallelism of my design) or at lest should reduce the speed as little as I even don't appreciate it?
Thanks
  2 件のコメント
Walter Roberson
Walter Roberson 2021 年 11 月 1 日
Simulink itself cannot execute different blocks in parallel.
If I understand correctly, Simulink Real Time (the one deployed to SpeedGoat systems) can execute blocks in parallel.
In places, Simulink might need to solve algebraic equations between blocks, potentially using linear algebra. When running with Rapid Acceleration turned off, or with Rapid Acceleration on its lowest setting, those operations would be executed at the MATLAB level, using multiple cores. With Rapid Acceleration set to higher levels, so that Simulink is generating code, I do not know whether the generated code will take advantage of multiple cores (not something I have happened to have reason to investigate.)
Inside S functions coded in MATLAB, the same considerations would apply about multiple cores: math being done at the interpreter level could potentially use multiple cores, and I do not have information about whether generated code would use multiple cores or not.
Are you planning to deploy to Simulink Real Time ?
Federico Manfrin
Federico Manfrin 2021 年 11 月 2 日
編集済み: Federico Manfrin 2021 年 11 月 2 日
No, I'm not going to use Simulink Real Time. But thank you very much for your feedback, it's an interesting option for further investigation. For this step of the project I will try to design a simulink simulation with just one S-function and compare the execution time with the same S-function splittend in 10, 20 little S-function. This should help on debug (placing some scope) but I'm afraid to have a very slow enviroment.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by