Several Sfunction or one is better?

2 visualizaciones (últimos 30 días)
Federico Manfrin
Federico Manfrin el 1 de Nov. de 2021
Editada: Federico Manfrin el 2 de Nov. de 2021
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?
  2 comentarios
Walter Roberson
Walter Roberson el 1 de Nov. de 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 ?
Federico Manfrin
Federico Manfrin el 2 de Nov. de 2021
Editada: Federico Manfrin el 2 de Nov. de 2021
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.

Iniciar sesión para comentar.

Respuestas (0)


Más información sobre Simulink Coder 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