Several Sfunction or one is better?
2 views (last 30 days)
Show older comments
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 Comments
Walter Roberson
on 1 Nov 2021
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 ?
Answers (0)
See Also
Categories
Find more on Block and Blockset Authoring in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!