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.
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.
For more information, see Communicate with Stateflow Charts by Sending Messages.
Name of the message. For more information, see Rules for Naming Stateflow Objects.
Scope of the message. The scope specifies where the message occurs relative to the parent object.
Scope | Description |
---|---|
Input | 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 block. |
Output | Message that is sent through an output port to another block in the Simulink model. |
Local | 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.
Complexity Setting | Description |
---|---|
Off | Data field does not accept complex values. |
On | Data field accepts complex values. |
Inherited | 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.
Note
In charts that use C as the action language, messages do not support multiword
fixed-point data or data of type int64
and
uint64
.
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.
Specifies that the message data inherits its initial value from a Simulink parameter in the MATLAB base workspace. This property applies only to local and output messages. For more information, see Initialize Data from the MATLAB Base Workspace.
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.
These properties define the behavior of receiving queues and apply only to input and local messages.
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.
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.
Specifies the level of diagnostic action when the number of incoming messages exceeds
the queue capacity. The default option is Error
.
Diagnostic Setting | Description |
---|---|
Error | When the queue overflows, the simulation stops with an error. |
Warning | When the queue overflows, the queue drops the last message and simulation continues with a warning. |
None | 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 FIFO
.
Queue Type Setting | Description |
---|---|
FIFO | First in, first out |
LIFO | Last in, first out |
Priority | Remove messages according to the value in the data field. Choosing this setting exposes the Priority order field, which has these options:
|