Using Enabled and Triggered Subsystems
An Enabled and Triggered Subsystem is a conditionally executed subsystem that runs once at each simulation time step when both these conditions apply:
Enabled control signal has a positive value.
Trigger control signal rises or falls through zero.
An Enabled and Triggered Subsystem block contains both an Enable port block and a Trigger port block. When a trigger signal rises or falls through zero, the enable input port is checked to evaluate the enable control signal. If its value is greater than zero, the subsystem is executed. When both inputs are vectors, the subsystem executes if at least one element of each vector is nonzero.
Creating an Enabled and Triggered Subsystem
To create an enabled and triggered subsystem:
Add an Enabled and Triggered Subsystem block to your model.
Copy a block from the Simulink® Ports & Subsystems library to your model.
Click the model diagram, start typing
enabled, and then select Enabled and Triggered Subsystem.
Set how the control signal triggers execution.
Open the subsystem block, and then open the block parameters dialog box for the Trigger port block. From the Trigger type drop-down list, select:
rising— Trigger execution of the subsystem when the control signal rises from a negative or zero value to a positive value.
falling— Trigger execution of the subsystem when the control signal falls from a positive or zero value to a negative value.
either— Trigger execution of the subsystem with either a rising or falling control signal.
Different symbols appear on the Trigger and Subsystem blocks to indicate rising and falling triggers.
Specify how subsystem states are handled when enabled.
Open the subsystem block, and then open the Enable port block. From the States when enabling drop-down list, select:
held— States maintain their most recent values.
reset— States revert to their initial conditions if the subsystem is disabled for at least one time step.
In simplified initialization mode, the subsystem elapsed time is always reset during the first execution after becoming enabled. This reset happens regardless of whether the subsystem is configured to reset when enabled. See Underspecified initialization detection.
For nested subsystems whose Enable blocks have different parameter settings, the settings for the child subsystem override the settings inherited from the parent subsystem.
Blocks in an Enabled and Triggered Subsystem
All blocks in an enabled and triggered subsystem must have Sample
time set to inherited (
-1 or constant
inf). This requirement allows the blocks in a triggered subsystem to
run only when the triggered subsystem itself runs. This requirement also means that a
triggered subsystem cannot contain continuous blocks, such as an Integrator