Trigger - Add trigger or function port to subsystem or model - Simulink (original) (raw)

Add trigger or function port to subsystem or model

Libraries:
Simulink / Ports & Subsystems
HDL Coder / Ports & Subsystems

Description

The Trigger block adds an external signal or message port to control the execution of a subsystem or a model. To enable this functionality, add this block to a Subsystem block or at the root level of a model that is referenced in aModel block.

Then, configure the Trigger block to execute a subsystem or model:

Examples

Ports

Output

expand all

If the Trigger type isrising,falling,either, orfunction-call, the port outputs a value that identifies a control signal, returned as a scalar or vector. For each element of the input signal, the value at a given time step is:

If the Trigger type ismessage, the port outputs data extracted from message received at the control port.

Dependencies

To enable this port, select Show output port or set Trigger type tomessage.

Data Types: double | int8

Parameters

expand all

Main

Select the type of control signal that executes a subsystem or model.

Programmatic Use

Block Parameter: TriggerType
Type: character vector
Values: 'rising' | 'falling' 'either' 'function-call' 'message'
Default: 'rising'

Select this parameter to create a Simulink Function block by configuring a Subsystem block that is callable with arguments from a function caller. The Trigger block must reside within the subsystem. You can edit the function prototype that displays on the block face to specify input and output arguments for the block.

Clear this parameter to remove the configuration.

Dependencies

To display and enable this parameter, set Trigger type tofunction-call.

Programmatic Use

Block Parameter: IsSimulinkFunction
Type: character vector
Values: 'off' | 'on'
Default: 'off'

Specify whether to execute the Simulink Function block asynchronously for a subsystem containing this Trigger port block.

Dependencies

To display and enable this parameter, set Trigger type to function-call, select Treat as a Simulink Function, and setFunction visibility toport.

Programmatic Use

Block Parameter:AsynchronousFunction
Type: character vector
Values:'on' | 'off'
Default:'off'

Specify the function name for a Simulink Function block. Alternatively, you can specify the name by editing the function prototype on the face of the block.

Dependencies

To display and enable this parameter, set Trigger type to function-call and select Treat as a Simulink Function.

Programmatic Use

Block Parameter: FunctionName
Type: character vector
Values: 'f' | function name in quotes
Default: 'f'

Select scope of Simulink Function block within subsystem or model.

Dependencies

To display and enable this parameter, set Trigger type to function-call and select Treat as a Simulink Function.

Programmatic Use

Block Parameter: FunctionVisibility
Type: character vector
Values: 'scoped' | 'global' 'port'
Default: 'scoped'

For a Simulink Function block with port visibility, specify the name of the exporting function port created by a Function Element block through which the function can be called.

Example: 'ServerPort'

Dependencies

To display and enable this parameter, set Trigger type to function-call, select Treat as a Simulink Function, and setFunction visibility toport.

Programmatic Use

Block Parameter: ScopeName
Type: character vector
Values: port name in quotes
Default: ''

Control activating the variant control (condition) defined with theVariant Control parameter.

Select this parameter to activate variant control of the subsystem. Selecting this parameter:

Clear this parameter to deactivate variant control of the subsystem.

Dependencies

To display and enable this parameter, set Trigger type to function-call and select Treat as Simulink function.

Programmatic Use

Block Parameter: Variant
Type: character vector
Values: 'off' | 'on'
Default: 'on'

Specify variant control (condition) expression that executes a variantSimulink Function block when the expression evaluates to true.

Dependencies

To display and enable this parameter, set Trigger type to function-call, select Treat as a Simulink Function, and select Enable variant condition.

Programmatic Use

Block Parameter: VariantControl
Type: character vector
Values: '(inherit)' | logical expression Simulink.VariantExpression object
Default: '(inherit)'

Control enclosing variant choices within C preprocessor conditional statements.

Select this parameter to enclose variant choices within C preprocessor conditional statements (#if) when generating code for an ERT target.

Dependencies

To display and enable this parameter, select Enable variant condition .

Programmatic Use

Block Parameter: GeneratePreprocessorConditionals
Type: character vector
Values: 'off' | 'on'
Default: 'off'

Select how to set block state values when the subsystem or model is disabled.

Dependencies

To enable this parameter, set Trigger Type tofunction-call.

This parameter setting applies only if the model explicitly enables and disables the function-call subsystem. For example:

Programmatic Use

Block Parameter: StatesWhenEnabling
Type: character vector
Values: 'held' | 'reset'
Default: 'held'

Select when to propagate variable-size signals.

Dependencies

To display and enable this parameter for a Trigger port block, set Trigger type toFunction-call.

Programmatic Use

Block Parameter: PropagateVarSize
Type: character vector
Values: 'During execution' | 'Only when enabling'
Default: 'During execution'

Control display of an output port for a signal that identifies the trigger signal or function-call event signal.

Select this parameter to display the output port and determine which signal caused the trigger signal or function-call event. The width of the output port signal is the width of the control signal. The signal value is:

Clear this parameter to remove the output port.

Dependencies

To display and enable this parameter, set Trigger type to an option other thanmessage.

Programmatic Use

Block Parameter: ShowOutputPort
Type: character vector
Values: 'off' | 'on'
Default: 'off'

Select the output port data type for the signal that identifies the trigger signal or function-call event signal.

Dependencies

To enable this parameter, select Show output port.

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

Programmatic Use

Block Parameter:OutputDataType
Type: character vector
Values:'auto' | 'double' 'int8'
Default:'auto'

Select the calling rate for a subsystem or model.

Dependencies

To enable this parameter, set Trigger type to Function-call.

Programmatic Use

Block Parameter:SampleTimeType
Type: character vector
Values:'triggered' |'periodic'
Default:'triggered'

Specify the time interval between function calls to a subsystem or model containing this Trigger port block. If the actual calling rate for the subsystem or model differs from the time interval this parameter specifies, the software displays an error.

Dependencies

To enable this parameter, set Trigger type to function-call and Sample time type toperiodic.

Programmatic Use

Block Parameter:SampleTime
Type: character vector
Values:'1' | 'Ts' '[Ts, To]'
Default:'1'

Select this parameter to detect zero crossings.

Dependencies

To enable this parameter, set Trigger type torising,falling, oreither.

Programmatic Use

Block Parameter: ZeroCross
Type: character vector
Values: 'on' | 'off'
Default: 'on'

Select the initial state of the trigger control signal.

Dependencies

To display and activate this parameter, set Trigger type to rising,falling, oreither.

Programmatic Use

Block Parameter:InitialTriggerSignalState
Type: character vector
Values:'compatibility (no trigger on first evaluation)' | 'zero' 'positive' 'negative'
Default:'compatibility (no trigger on first evaluation)'

For a subsystem triggered by message input, specify timing of execution.

Dependencies

To display and activate this parameter, set Trigger type to message.

Programmatic Use

Block Parameter:TriggerTime
Type: character vector
Values: 'on message available' | 'on sample time hit'
Default: 'on message available'

For a subsystem triggered by message availability, specify execution mode.

Clear this parameter for immediate mode, in which the subsystem executes as soon as a message is available at the control port, which pushes the message to the subsystem without a queue buffering the message.

Select this parameter for scheduled mode, which allows subsystem execution to be deferred after a specific Simulink® task while staying at the same time step.

Dependencies

To display and activate this parameter, set Trigger type to message andTrigger time to on message available.

Programmatic Use

Block Parameter:ScheduleAsAperiodic
Type: character vector
Values:'on' | 'off'
Default:'on'

Signal Attributes

Specify dimensions for the trigger signal attached externally aModel block and passed into the referenced model.

Dependencies

To display and enable this parameter for a Trigger port block at the root-level of a model, set Trigger type to rising,falling, oreither.

Programmatic Use

Block Parameter:PortDimensions
Type: character vector
Values:'1' | '[n]' '[m n]' -1
Default:'1'

Specify time interval between block method executions for the block driving the trigger signal.

Dependencies

To display and enable this parameter for a Trigger port block at the root-level of a model, set Trigger type to rising,falling, oreither.

Programmatic Use

Block Parameter:TriggerSignalSampleTime
Type: character vector
Values:'-1' | 'Ts'
Default:'-1'

Specify minimum value for the trigger signal attached externally to aModel block and passed to the inside of the block.

The software uses this value to perform:

Dependencies

To display and enable this parameter for a Trigger port block at the root-level of a model, set Trigger type to rising,falling, oreither.

Programmatic Use

Block Parameter:OutMin
Type: character vector
Values:'[]' | real scalar in quotes
Default:'[]'

Specify maximum value for the trigger signal attached externally to aModel block and passed to the inside of the block.

The software uses this value to perform:

Dependencies

To display and enable this parameter for a Trigger port block at the root-level of a model, set Trigger type to rising,falling, oreither.

Programmatic Use

Block Parameter:OutMax
Type: character vector
Values:'[]' | real scalar in quotes
Default:'[]'

Select data type for the trigger signal attached externally to aModel block and passed to the inside of the block.

You cannot enter the name of a Simulink.Bus object as a data type expression.

Dependencies

To display and enable this parameter for a Trigger port block at the root-level of a model, set Trigger type to rising,falling, oreither.

Programmatic Use

Block Parameter:OutDataTypeStr
Type: character vector
Values: 'Inherit: auto' | 'double' 'single' 'int8' 'uint8' 'int16' 'uint16' 'int32' 'uint32' 'int64' 'uint64' 'boolean' 'fixdt(1,16)' 'fixdt(1,16,0)' 'fixdt(1,16,2^0,0)' ''
Default: 'Inherit: auto'

Select data type category and display drop-down lists to help you define the data type.

Dependencies

To enable this parameter, select the Show data type assistant button .

Control how missing workspace data is estimated when loading data from the MATLAB® workspace.

Select this parameter to linearly interpolate output at time steps for which no corresponding workspace data exists.

Clear this parameter to set the output at such time steps equal to the output at the most recent time step for which data exists.

Dependencies

To display and enable this parameter for a Trigger port block at the root-level of a model, set Trigger type to rising,falling, oreither.

Programmatic Use

Block Parameter:Interpolate
Type: character vector
Values:'on' | 'off'
Default:'on'

Block Characteristics

Data Types Boolean | double enumerated fixed point integer single
Direct Feedthrough no
Multidimensional Signals yes
Variable-Size Signals no
Zero-Crossing Detection yes

Extended Capabilities

expand all

HDL Coder™ provides additional configuration options that affect HDL implementation and synthesized logic.

For more information, see HDL Code Generation in Triggered Subsystem.

HDL Architecture

This block has one default HDL architecture.

Restriction

You cannot generate HDL code for a Trigger Block that has Trigger type set to function-call ormessage.

Version History

Introduced before R2006a