Create a Triggered Subsystem

What Are Triggered Subsystems?

Triggered subsystems are subsystems that execute each time a trigger event occurs.

A triggered subsystem has a single control input, called the trigger input, that determines whether the subsystem executes. You can choose from three types of trigger events to force a triggered subsystem to begin execution:

  • rising triggers execution of the subsystem when the control signal rises from a negative or zero value to a positive value (or zero if the initial value is negative).

  • falling triggers execution of the subsystem when the control signal falls from a positive or a zero value to a negative value (or zero if the initial value is positive).

  • either triggers execution of the subsystem when the signal is either rising or falling.

      Note   For discrete systems: If after rising, a signal remains at zero for more than one time step, then and only then, does the subsequent rising of the signal constitute a trigger event. Similarly, a falling trigger event occurs only if there are at least two time steps between two occurrences of the signal falling. This trigger event scheme eliminates false triggers caused by control signal sampling.

For example, in the following timing diagram for a discrete system, a rising trigger (R) does not occur at time step 3 because the signal remains at zero for only one time step prior to the rise.

A simple example of a triggered subsystem is illustrated.

In this example, the subsystem is triggered on the rising edge of the square wave trigger control signal.

Using Model Referencing Instead of a Triggered Subsystem

You can use triggered ports in referenced models. Add a trigger port to a referenced model to create a simpler, cleaner model than when you include either:

  • A triggered subsystem in a referenced model

  • A Model block in a triggered subsystem

For information about using trigger ports in referenced models, see Create and Reference Conditional Referenced Models.

To convert a subsystem to use model referencing, see Convert a Subsystem to a Referenced Model.

Creating a Triggered Subsystem

You create a triggered subsystem by copying the Trigger block from the Ports & Subsystems library into a subsystem. The Simulink® software adds a trigger symbol and a trigger control input port to the Subsystem block.

To select the trigger type, open the Trigger block dialog box and select one of the choices for the Trigger type parameter.

Different symbols appear on the Trigger and Subsystem blocks to indicate rising and falling triggers (or either). This figure shows the trigger symbols on Subsystem blocks.

Outputs and States Between Trigger Events

Unlike enabled subsystems, triggered subsystems always hold their outputs at the last value between triggering events. Also, triggered subsystems cannot reset their states when triggered; the states of any discrete block is held between trigger events.

Outputting the Trigger Control Signal

An option on the Trigger block dialog box lets you output the trigger control signal. To output the control signal, select the Show output port check box.

In the Output data type field, specify the data type of the output signal as 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 port to which the signal connects.

Blocks That a Triggered Subsystem Can Contain

All blocks in a triggered subsystem must have either inherited (-1) or constant (inf) sample time. This is to indicate that the blocks in the triggered subsystem run only when the triggered subsystem itself runs, for example, when it is triggered. This requirement means that a triggered subsystem cannot contain continuous blocks, such as the Integrator block.

More About

Was this topic helpful?