How computationally intensive are switch case action blocks in Simulink?
조회 수: 2 (최근 30일)
이전 댓글 표시
So I need to switch between different linear models based on a switch condition and computational load is a big concern for my application. I was wondering, does anyone know how costly it is to implement these switch case action blocks?:
https://www.mathworks.com/help/simulink/slref/switchcaseactionsubsystem.html
I was thinking of having a ton of them in the model but only selecting a few based on a switch condition. Like a switch case in code, does having more of these switch action blocks not matter in terms of the computational load of checking them? Like if I had 190 different switch action blocks, the simulink simulation wouldnt check all 190 action blocks to see if it would run them, and rather it would just directly go and simulate the ones the switch case selects? I was hoping this would be the case, but I would much rather check before implementing the 190ish switch case action blocks I need.
댓글 수: 0
채택된 답변
Fangjun Jiang
2024년 4월 9일
Yes. More cases will not increase the computation load. Only the activated cases will be executed. It is called the Condtionally Executed Subsystem.
However, 190ish cases are extream. I would not implement like that in Simulink. Explain the need. There might be a better solution.
댓글 수: 3
Fangjun Jiang
2024년 4월 9일
"at all times I usually need to be running 4 out of the 190 linear models at a time while only selecting the output of 1 of them, and which models are selected for running or for their output varies based on my current operating condition."
I think I understand the need.
I would suggest using a MATLAB Function block. Basically, you would "code" whatever you want to do. Implementing 190ish LTIs using block diagram would be hard to manage.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Sources에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!