Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

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 an external signal to trigger its execution. You can configure the Trigger block to execute the subsystem:

A subsystem or model can contain only one Trigger block. For more information, see Defining Function-Call Models, Function-Call Subsystems, and Triggered Subsystems.

Data Type Support

The Trigger block accepts signals of any numeric data type supported by Simulink software, including fixed-point data types. For more information, see Data Types Supported by Simulink in the Simulink documentation.

Parameters and Dialog Box

Trigger type

Select the type of event that triggers execution of the subsystem.

Settings

Default: rising

rising

Triggers execution of the subsystem when the control signal rises from a negative or zero value to a positive value. If the initial value is negative, rising to zero triggers execution.

falling

Triggers execution of the subsystem when the control signal falls from a positive or a zero value to a negative value. If the initial value is positive, falling to zero triggers execution.

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. The Trigger type must be function-call for Trigger ports at the root-level of a model. Only function-call signals can trigger execution of a model.

Command-Line Information

Parameter: TriggerType
Type: string
Value: 'rising' | 'falling' | 'either' | 'function-call'
Default: 'rising'

States when enabling

Specify the state values when triggered by a function-call.

Settings

Default: held

held

Leaves the states at their current values.

reset

Resets the states.

inherit

Uses the held/reset setting from the parent subsystem initiating the function-call. If the parent of the initiator is the model root, the inherited setting is held. If the trigger has multiple initiators, set the parents of all initiators to either held or reset.

Dependencies

If you select function-call as the block trigger type, the dialog enables this parameter. The parameter setting applies only if the model explicitly enables and disables the function-call subsystem. For example:

Command-Line Information

Parameter: StatesWhenEnabling
Type: string
Value: 'held' | 'reset' | 'inherit'
Default: 'held'

Propagate sizes of variable-size signals

Specify when to propagate a variable-size signal.

Settings

Default: During execution

Only when enabling

Propagates variable-size signals only when enabling the subsystem containing the Trigger Port block.

During execution

Propagates variable-size signals at each time step.

Dependencies

Selecting Function-call from the Trigger type list enables this parameter.

Command-Line Information

Parameter: PropagateVarSize
Type: string
Value: 'Only when enabling' | 'During execution'
Default: 'During execution'

Show output port

Select this check box to output the trigger signal.

Settings

Default: On

On

Shows the Trigger block output port and outputs the trigger signal if this block is in a subsystem. This action 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

Off

Removes the output port.

Dependencies

This dialog box disables this parameter for function-call Trigger blocks residing at the root level of a model.

Command-Line Information

Parameter: ShowOutputPort
Type: string
Value: 'on' | 'off'
Default: 'on'

Output data type

Specify the trigger output data type.

Settings

Default: Auto

Auto

Specifies the data type is the same as the port connected to output.

double

Sets the date type to double.

int8

Sets the data type to integer.

Dependencies

Selecting Function-call from the Trigger type list and selecting the Show output port check box enables this parameter.

The Trigger block ignores the Data type override setting of the Fixed-Point Tool.

Sample time type

Specify the calling frequency of a subsystem.

Settings

Default: triggered

triggered

Applies to applications that do not have a periodic calling frequency.

periodic

Applies if the caller of the parent function-call subsystem calls the subsystem once per time step when the subsystem is active (enabled). A Stateflow chart is an example of a caller.

Dependencies

Selecting Function-call from the Trigger type list enables this parameter.

Command-Line Information

Parameter: SampleTimeType
Type: string
Value: 'triggered' | 'periodic'
Default: 'triggered'

Sample time

Specify the sample time.

Settings

Default: 1

Set this parameter to the sample time you expect for the calling rate of the function-call subsystem containing this Trigger block. If the actual calling rate for the subsystem differs from the rate that this parameter specifies, Simulink software displays an error.

Dependencies

Setting Trigger type to function-call and Sample time type to periodic enables this parameter.

Command-Line Information

Parameter: SampleTime
Type: string
Value: 1
Default: 1

Enable zero-crossing detection

Select to enable zero-crossing detection.

Settings

Default: On

On

Detects zero-crossings.

Off

Does not detect zero-crossings.

Command-Line Information

Parameter: ZeroCross
Type: string
Value: 'on' | 'off'
Default: 'on'

Characteristics

Sample Time

Specified by the Sample time parameter if:

  • Trigger type is function-call

  • Sample time type is periodic

Otherwise, specified by the signal at the trigger port.

Dimensionalized

Yes

Virtual

Yes, when the output port is not present

For more information, see Virtual Blocks in the Simulink documentation.

Zero-Crossing Detection

Yes, if enabled

See Also

Function-Call Subsystem

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

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