Trigger - Add trigger port to subsystem or function-call model

Library

Ports & Subsystems

Description

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:

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® 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.

Parameters and Dialog Box

Trigger type

The type of event that triggers execution of the subsystem.

States when enabling

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:

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.

Show output port

If selected and this block is in a subsystem, Simulink software displays the Trigger block output port and outputs the trigger signal.

Output data type

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.

Enable zero crossing detection

Select to enable zero crossing detection. For more information, see Zero-Crossing Detection.

Sample time type

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.

Sample time

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.

Characteristics

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

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS