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 CenterFile Exchange에서 Block and Blockset Authoring에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by