Event Listener

Add event port to a subsystem block

  • Library:
  • Ports & Subsystems

  • Event Listener block

Description

Add event port to a Subsystem block.

Parameters

expand all

Select event type for subsystem to execute initialize, reset, or terminate algorithms.

Initialize

Select to trigger the execution of an Initialize Function block with an initialize event.

Terminate

Select to trigger the execution of a Terminate Function block with a terminate event.

Reset

Select to trigger the execution of an Initialize Function block reconfigured as a Reset Function block with a reset event.

Programmatic Use

Block Parameter: EventType
Type: character vector
Value: 'Initialize' | 'Terminate' | 'Reset'
Default: 'Initialize'

Specify event name for Reset Function block

Reset

Default name on the face of the Reset Function block.

event name

User entered name displayed on the face of the Reset Function block, and the name of the reset event port on the Model block containing the Reset Function block.

When tying the name for a reset function, the auto-completion list provides some suggestions. The list is not complete.

Dependency

To enable this parameter, set the Event parameter to Reset.

Programmatic Use

Block Parameter: EventName
Type: character vector
Value: 'reset' | '<event name>'
Default: 'reset'

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

off

Deactivate variant control of subsystem.

on

Activate variant control of subsystem.

Dependency

Selecting this parameter, enables the Variant control and Generate preprocessor conditionals parameters.

When you select Enable variant condition parameter, the badge indicates the change.

Programmatic Use

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

Note

  • The Reset event port of a Model block can be conditional and propagates the net Variant conditions defined on the corresponding Reset Function block(s) in the referenced model.

  • Initialize and Terminate event ports are always unconditional because they control both the model default and block-specific initialize and terminate events of the referenced model. If you define an Initialize function block in the referenced model, it corresponds to an explicit initialize event.

Specify variant control (condition) expression that executes a variant Initialize function, Reset function, or Terminate function block when the expression evaluates to true.

Variant

Default name for a logical (Boolean) expression.

logical expression

A logical (Boolean) expression or a Simulink.Variant object representing a boolean expression.

If you want to generate code for your model, define the variables in the expression as Simulink.Parameter objects.

Dependency

To enable this parameter, select the Enable variant condition parameter.

Programmatic Use

Block Parameter: VariantControl
Type: character vector
Value: 'Variant' | '<logical expression>'
Default: 'Variant'

Select if variant choices are enclosed within C preprocessor conditional statements.

off

Does not enclose variant choices within C preprocessor conditional statements.

on

When generating code for an ERT target, encloses variant choices within C preprocessor conditional statements (#if).

Dependency

To enable this parameter, select the Enable variant condition parameter.

When you select Generate preprocessor conditionals parameter, the badge indicates the change.

Programmatic Use

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