| Simulink® | ![]() |
Ports & Subsystems
Adding a Trigger block to a subsystem or a model allows its execution to be triggered by an external signal. You can configure the Trigger block to enable a change in the value of the external signal (described below) to trigger execution of a subsystem once on each integration step when the value of the signal that passes through the trigger port changes in a specifiable way (seeTriggered Subsystems). You can also configure the Trigger block to accept a function-call trigger. This allows a Function-Call Generator block or S-function to trigger execution of a subsystem or model multiple times during a time step. A subsystem or model can contain only one Trigger block. For more information, see Defining Function-Call Models and Function-Call Subsystems.
The Trigger type parameter allows you to choose the type of event that triggers execution of the subsystem:
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.
function-call allows a Function-Call Generator or S-function to control execution of the subsystem or model.
Note The Trigger type must be function-call for Trigger ports at the root-level of a model. In other words, only function-call signals can trigger execution of a model. |
You can output the trigger signal by selecting the Show output port check box. Selecting this option allows the system to determine what caused the trigger. The width of the signal is the width of the triggering signal. The signal value is
1 for a signal that causes a rising trigger
-1 for a signal that causes a falling trigger
2 for a function-call trigger
0 otherwise
The Trigger block accepts signals of any data type supported by Simulink® software, including fixed-point data types.
For a discussion on the data types supported by Simulink software, see Data Types Supported by Simulink® in the Simulink documentation.

The type of event that triggers execution of the subsystem.
This option is enabled only if you select function-call as the block's trigger type and the setting applies only if the function-call subsystem is explicitly enabled and disabled. For example:
The function-call subsystem resides inside of an enabled subsystem. In this case, the function-call subsystem is enabled and disabled along with the parent subsystem.
The function-call initiator that controls the function-call subsystem resides in an enabled subsystem. In this case, the function-call subsystem is enabled and disabled along with the enabled subsystem containing the function-call initiator.
The function-call initiator is a Stateflow® event that is bound to a particular state. See Using Bind Actions to Control Function-Call Subsystems in the Stateflow documentation.
The function-call initiator is an S-function that explicitly enables and disables the function-call subsystem. See ssEnableSystemWithTid for an example.
Selecting held (the default) causes Simulink software to leave the states at their current values.
Selecting reset for this option causes Simulink software to reset the states.
Selecting inherit causes the trigger's held/reset setting to be the same as that of the function-call initiator's parent subsystem, for example, an enabled subsystem, or the model's root system if the function-call initiator is at the model's root level. If the parent of the initiator is the model root, the inherited setting is held. If the trigger has multiple initiators and its States when enabling setting is inherit, the parents of all initiators must have the same held/reset setting, i.e., either all held or all reset.
If selected and this block is in a subsystem, Simulink software displays the Trigger block output port and outputs the trigger signal.
Note This option is disabled for function-call Trigger blocks residing at the root-level of a model. |
Specifies the data type (double or int8) of the trigger output. If you select auto, Simulink software sets the data type to be the same as that of the port to which the output is connected. If the port's data type is not double or int8, Simulink software signals an error.
Note The Trigger block ignores the Data type override setting of the Fixed-Point Tool. |
Select to enable zero crossing detection. For more information, see Zero-Crossing Detection.
This parameter is active only when Trigger type is set to function-call. Its value may be triggered or periodic. Select periodic if the caller of the parent function-call subsystem, for example, a Stateflow chart, calls the subsystem once per time step when the subsystem is active (enabled). Otherwise, select triggered. See "Using Bind Actions to Control Function-Call Subsystems" in the Using Stateflow documentation and the "Function-Call Subsystems" section of Writing S-functions for more information.
This parameter is active only when the Trigger type is function-call and the Sample time type is periodic. Set this parameter to the sample time at which you expect the function-call subsystem that contains this block to be called. See Specifying Sample Time in the online documentation for information on how to the value of this parameter. Simulink software displays an error if the actual rate at which the subsystem is called differs from the rate that this parameter specifies.
Sample Time | Determined by the sample time parameter if the trigger type is function-call and the sample time type is periodic; otherwise, by the signal at the trigger port. |
Dimensionalized | Yes |
Zero Crossing | Yes, if enabled |
![]() | Transport Delay | Trigger-Based Linearization | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |