Why does my enabled subsystem access parameters although it is disabled?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have a very simple model consisting only of an Enabled Subsystem which is permanently disabled:
Within the Enabled Subsystem, there is a gain block with gain x, where x is NOT defined in the workspace.
When I run the model, I get "Error evaluating parameter 'Gain' in 'Demo/Enabled Subsystem/Gain' Undefined function or variable 'x'." although the subsystem is obviously disabled.
But why? How can I avoid this error?
Background of my question: I want to avoid simulating unnecessary components of my model, so I put them into an Enabled Subsystem which is dynamically activated by a parameter. If it is disabled, I currently still have to provide its parameters in workspace (represented by x in my minimal example) because otherwise I end up with an error, which is quite annoying.
Thank you for any help. Heiko
0 comentarios
Respuestas (1)
Vidya Viswanathan
el 1 de Abr. de 2016
Hi Heiko,
I am not sure if such an option is available in Simulink. Although that subsystem would not be executed (because it is permanently disabled), when you try to simulate a model, the first step in the process is called model compilation. In this stage, Simulink evaluates all the parameters of the blocks present in the model and determines their value. Only after this check is passed, other steps like performing block reduction optimizations, determining the execution order happen. You could specify Simulink to enable execution of only conditionally active blocks. This comes into play only during the execution of the model and increases the speed of execution. However, you would still be required to specify values of all the parameters in the model.
I hope this answers your query.
Regards,
Vidya
0 comentarios
Ver también
Categorías
Más información sobre Subsystems 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!