Event Listener
Event port for Initialize Function, Reinitialize Function, Reset Function, and Terminate Function blocks
Description
The Event Listener block serves as an event port for the Initialize Function, Reinitialize Function, Reset Function, and Terminate Function blocks.
Examples
Initialize, Reset, and Terminate State of Simulink Block
Use the Initialize Function, Reset Function, and Terminate Function blocks to respond to events in a Simulink model.
Reading and Writing States with the Initialize Function and Terminate Function Blocks
In this example, the Initialize Function block uses the State Writer block to set the initial condition of a Discrete Integrator block to 10.
Parameters
Event type — Select event type for subsystem
Initialize
(default) | Reinitialize
| Reset
| Terminate
Select event type for subsystem to execute initialize, reinitialize, reset, or terminate algorithms.
Initialize
Select to trigger the execution of an Initialize Function block with an initialize event.
Reinitialize
Select to trigger the execution of an Reinitialize Function block with an reinitialize event.
Reset
Select to trigger the execution of a Reset Function block with a reset event.
Terminate
Select to trigger the execution of a Terminate Function block with a terminate event.
Programmatic Use
Block Parameter:
EventType |
Type: character vector |
Value:
'Initialize' | 'Reinitialize'
| 'Reset' |
'Terminate' |
Default:
'Initialize' |
Event name — Specify event name
reinit
| reset
| event name
Specify event name for Reinitialize Function or Reset Function block. Simulink® displays the name on the face of the Reinitialize Function or Reset Function block. The event name is also the name of the reinitialize event port on the Model or Subsystem block containing the Reinitialize Function block or the name of the reset event port on the Model block containing the Reset Function block.
reinit
Default event name when Event type is set to
Reinitialize
.reset
Default event name when Event type is set to
Reset
.
When entering the Event name, the auto-completion list provides some suggestions. The list is not complete.
The Event name must be a valid MATLAB® variable name.
Dependency
To enable this parameter, set the Event type
parameter to Reinitialize
or
Reset
.
Programmatic Use
Block Parameter:
EventName |
Type: character vector |
Value:
'reinit' | 'reset' |
'<event name>' |
Default:
'reinit' or 'reset' |
Enable variant condition — Control activating the variant control (condition)
off (default) | on
Control activating the variant control (condition) defined with the Variant control parameter.
- off
Deactivate variant control of subsystem.
- on
Activate variant control of subsystem.
When you select Enable variant condition, a badge indicates the change:
Programmatic Use
Block Parameter:
Variant |
Type: character vector |
Value:
'off' | 'on' |
Default:
'off' |
Note
A reinitialize event port of a Model or Subsystem block can be conditional and propagates the net variant conditions defined on the corresponding Reinitialize Function block in the referenced model or subsystem.
A reset event port of a Model block can be conditional and propagates the net variant conditions defined on the corresponding Reset Function block 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.
Variant control — Specify variant control (condition) expression
Variant
(default) | logical expression
Specify variant control (condition) expression that executes a variant
Initialize Function, Reinitialize
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.VariantExpression
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' |
Generate preprocessor conditionals — Select if variant choices are enclosed within C preprocessor conditional statements
off (default) | on
Select if variant choices are enclosed within C preprocessor conditional statements.
- off
Do not enclose variant choices within C preprocessor conditional statements.
- on
When generating code for an ERT target, enclose 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, a badge indicates the change:
Programmatic Use
Block Parameter:
GeneratePreprocessorConditionals |
Type: character vector |
Value:
'off' | 'on' |
Default:
'off' |
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)