Main Content

Using Enabled and Triggered Subsystems

AnEnabled and Triggered Subsystem是一个有条件地执行子系统运行ce 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.

AnEnabled and Triggered Subsystemblock contains both anEnableport block and aTriggerport 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:

  1. Add anEnabled and Triggered Subsystemblock to your model.

    • Copy a block from the Simulink®Ports & Subsystems library to your model.

    • Click the model diagram, start typingenabled, and then selectEnabled and Triggered Subsystem.

  2. Set initial and disabled values for theOutportblocks. SeeConditional Subsystem Initial Output ValuesandConditional Subsystem Output Values When Disabled.

  3. Set how the control signal triggers execution.

    Open the subsystem block, and then open the block parameters dialog box for theTriggerport block. From theTrigger typedrop-down list, select:

    • rising——subsy触发执行stem when the control signal rises from a negative or zero value to a positive value.

    • falling——subsy触发执行stem when the control signal falls from a positive or zero value to a negative value.

    • either——subsy触发执行stem with either a rising or falling control signal.

    Different symbols appear on theTriggerandSubsystemblocks to indicate rising and falling triggers.

  4. Specify how subsystem states are handled when enabled.

    Open the subsystem block, and then open theEnableport block. From theStates when enablingdrop-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. SeeUnderspecified initialization detection.

    For nested subsystems whoseEnableblocks 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 haveSample timeset to inherited (-1or 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 anIntegratorblock.

Model Examples

See Also

Blocks

Related Examples

More About