Set Properties for a Message
A message is a Stateflow® object that communicates data locally or between charts in a Simulink® model. For more information, see Communicate with Stateflow Charts by Sending Messages.
When you create Stateflow charts in Simulink models, you can specify message properties in either the Property Inspector or the Model Explorer.
To use the Property Inspector:
In the Modeling tab, under Design Data, select Symbols Pane and Property Inspector.
In the Symbols pane, select the message.
In the Property Inspector pane, edit the message properties.
To use the Model Explorer:
In the Modeling tab, under Design Data, select Model Explorer.
In the Contents pane, select the message.
In the Message pane, edit the message properties.
Stateflow Message Properties
Name of the message. For more information, see Guidelines for Naming Stateflow Objects.
Scope of the message. The scope specifies where the message occurs relative to the parent object.
|Message that is received from another block in the Simulink model. Each input message can use an internal receiving queue that is maintained by the Stateflow chart or an external receiving queue that is managed by a Queue (Simulink) block.|
|Message that is sent through an output port to another block in the Simulink model.|
|Message that is local to the Stateflow chart. The Stateflow chart maintains an internal receiving queue for each local message. When you send a local message, it is visible by state and transition actions in the same chart. You cannot send a local message outside the chart.|
Index of the port associated with the message. This property applies only to input and output messages.
Size of the message data field. For more information, see Specify Size of Stateflow Data.
Specifies whether the message data field accepts complex values.
|Data field does not accept complex values.|
|Data field accepts complex values.|
|Data field inherits the complexity setting from a Simulink block.|
The default value is
Off. For more information,
see Complex Data in Stateflow Charts.
Type of the message data field. To specify the data type:
From the Type drop-down list, select a built-in type.
In the Type field, enter an expression that evaluates to a data type.
Additionally, in the Model Explorer, you can open the Data Type Assistant by clicking the Show data type assistant button . Specify a data Mode, and then specify the data type based on that mode. For more information, see Specify Type of Stateflow Data.
In charts that use C as the action language, messages do not support multiword fixed-point data.
Initial value of the message data. Enter an expression or parameter defined in the Stateflow hierarchy, MATLAB® base workspace, or Simulink masked subsystem. This property applies only to local and output messages.
If you do not specify a value, the default value for numeric data is 0. For enumerated
data, the default value typically is the first one listed in the
enumeration section of the definition. You can specify a different
default enumerated value in the
methods section of the definition. For
more information, see Define Enumerated Data Types.
Priority for the message. If two distinct messages occur at the same time, this property determines which message is processed first. A smaller numeric value indicates a higher priority. This property is visible only for local and output messages in discrete-event charts. For more information, see Create Custom Queuing Systems Using Discrete-Event Stateflow Charts (SimEvents).
Add to Watch Window
Enables watching the message queue and data field in the Stateflow Breakpoints and Watch window. For more information, see View Data in the Breakpoints and Watch Window.
Message Queue Properties
These properties define the behavior of receiving queues and apply only to input and local messages.
Use Internal Queue
Specifies that the Stateflow chart maintains an internal receiving queue for the input message. By default, this property is enabled. When you disable this property, you can connect the message input port to:
For more information on external message queues, see Messages (Simulink).
Specifies the maximum number of messages held in an internal receiving queue. If a chart sends a message when the queue is full, a queue overflow occurs. To avoid dropped messages, set the queue capacity high enough that incoming messages do not cause the queue to overflow. The maximum queue capacity is 216–1.
Queue Overflow Diagnostic
Specifies the level of diagnostic action when the number of incoming messages exceeds
the queue capacity. The default option is
|When the queue overflows, the simulation stops with an error.|
|When the queue overflows, the queue drops the last message and simulation continues with a warning.|
|When the queue overflows, the queue drops the last message and simulation continues without issuing a warning.|
Specifies the order in which messages are removed from the receiving queue. The
default option is
|Queue Type Setting||Description|
|First in, first out|
|Last in, first out|
Remove messages according to the value in the data field. Choosing this setting exposes the Priority order field, which has these options: