How computationally intensive are switch case action blocks in Simulink?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Vinh
el 9 de Abr. de 2024
Comentada: Vinh
el 9 de Abr. de 2024
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 comentarios
Respuesta aceptada
Fangjun Jiang
el 9 de Abr. de 2024
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 comentarios
Fangjun Jiang
el 9 de Abr. de 2024
"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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Sources 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!