Main Content

Using Triggered Subsystems

A triggered subsystem is a conditionally executed atomic subsystem that runs each time the control signal (trigger signal):

  • Either rises from a negative value to a positive value or zero, or rises from a zero value to a positive value.

  • Either falls from a positive value to a negative value or zero, or falls from a zero value to a negative value.

  • Rises or falls through or to a zero value.

Unlike an Enabled Subsystem block, a Triggered Subsystem block always holds its outputs at the last value between triggers. Also, triggered subsystems cannot reset block states when executed; the states of any discrete block are held between triggers.

Create a Triggered Subsystem

To create a triggered subsystem:

  1. Add a Triggered Subsystem block to your model.

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

    • Click the model diagram, start typing trigger, and then select Triggered Subsystem.

  2. Set initial and disabled values for the Outport blocks. See Conditional Subsystem Initial Output Values and Conditional Subsystem Output Values When Disabled.

  3. Set how the control signal triggers execution.

    Open the subsystem block, and then open the parameter 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.

  4. Output the enable control signal from the Trigger port block. Open the Trigger port block. Select the Show output port check box to pass the control signal into the triggered subsystem.

    You can use this signal with an algorithm that depends on the value of the control signal.

  5. From the Output data type drop-down list, select auto, int8, or double.

    The auto option causes the data type of the output signal to be the data type (either int8 or double) of the block port connected to the signal.

Triggering with Discrete Time Systems

For a discrete time system, the trigger control signal must remain at zero for more than one time step. This triggering strategy eliminates false triggers caused by control signal sampling.

In the following timing diagram for a discrete system, a rising trigger signal (R) does not occur at time step 3. The trigger signal remains at zero for only one time step before the signal increases from zero.

Triggered Model Versus a Triggered Subsystem

You can place a Trigger port block in a Model block (referenced model) to simplify your model design instead of using one of these blocks:

  • A Triggered Subsystem block in a Model block.

  • A Model block in a Triggered Subsystem block.

For information about using Trigger port blocks in referenced models, see Conditionally Execute Referenced Models.

To convert a subsystem to use model referencing, see Convert Subsystems to Referenced Models.

Blocks in a Triggered Subsystem

All blocks in a 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 block.

Model Examples

For model examples, see:

See Also

| | |

Related Topics