| Simulink Reference | ![]() |
Add a trigger port to a subsystem
Library
Description
Adding a Trigger block to a subsystem makes it a triggered subsystem. A triggered subsystem executes once on each integration step when the value of the signal that passes through the trigger port changes in a specifiable way (described below). A subsystem can contain no more than one Trigger block. For more information about triggered subsystems, see Creating a Model in the Using Simulink documentation.
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 causes execution of the subsystem to be controlled by logic internal to an S-function (for more information, see Function-Call Subsystems).
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
Data Type Support
The Trigger block accepts signals of any data type supported by Simulink, including fixed-point data types.
For a discussion on the data types supported by Simulink, refer to Data Types Supported by Simulink in the Using Simulink documentation.
Parameters and Dialog Box
function-call as the block's trigger type. It specifies whether a function-call enable trigger causes Simulink to reset the states of the subsystem containing this Trigger block to their initial values. Selecting held (the default) causes Simulink to leave the states at their current values. Selecting reset for this option causes Simulink 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. For more information about the States when enabling setting, see Function-Call Subsystems in the "Implementing Block Features" section of Writing S-Functions.
function-call.
double or int8) of the trigger output. If you select auto, Simulink 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 signals an error.
| Note The Trigger block ignores the Data Type Override setting of the Fixed-Point Settings interface. |
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 Using Stateflow and the "Function-Call Subsystems" section of Writing S-functions for more information.
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 displays an error if the actual rate at which the subsystem is called differs from the rate that this parameter specifies.
Characteristics
| Transport Delay | Trigger-Based Linearization | ![]() |
© 1994-2005 The MathWorks, Inc.