MATLAB: Event triggered subsystems in Simulink

event triggered modelssimulink

Good morning,
I have two different dynamic models in the same file and I would like that thee second block (which is the 2nd model) executes when the first block output reaches/exceeds certain values and stops when this output goes down below this threshold. Both blocks have other inputs and outputs but the above-mentioned signal determines the execution. Do you have any idea how to deal with this? Thanks in advance.
Joseph

Best Answer

Joseph,
You could use conditional subsystems, which include Enabled and Triggered subsystems.
Enabled subsystems have their own sample time, so they will continuously execute as long as the condition (your threshold, for instance) is true.
Triggered subsystems will execute once every time there is an "edge" or transition in the value of the condition -- for example, on the rising edge when the condition goes from false to true.
- Sebastian
Related Question