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.

You can specify message properties in either the Property Inspector or the Model Explorer.

  • To use the Property Inspector:

    1. In the Modeling tab, under Design Data, select Symbols Pane and Property Inspector.

    2. In the Symbols pane, select the message.

    3. In the Property Inspector pane, edit the message properties.

  • To use the Model Explorer:

    1. In the Modeling tab, under Design Data, select Model Explorer.

    2. In the Contents pane, select the message.

    3. In the Message pane, edit the message properties.

For more information, see Communicate with Stateflow Charts by Sending Messages.

Stateflow Message Properties

Name

Name of the message. For more information, see Rules for Naming Stateflow Objects.

Scope

Scope of the message. The scope specifies where the message occurs relative to the parent object.

ScopeDescription
InputMessage 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.
OutputMessage that is sent through an output port to another block in the Simulink model.
LocalMessage 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.

Port

Index of the port associated with the message. This property applies only to input and output messages.

Size

Size of the message data field. For more information, see Specify Size of Stateflow Data.

Complexity

Specifies whether the message data field accepts complex values.

Complexity SettingDescription
OffData field does not accept complex values.
OnData field accepts complex values.
InheritedData field inherits the complexity setting from a Simulink block.

The default value is Off. For more information, see Complex Data in Stateflow Charts.

Type

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

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.

Allow Initial Value to Resolve to a Parameter

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.

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:

  • A Queue block that manages an external queue in your Simulink model

  • A root-level Inport block that enables messages to cross the model boundary

For more information on external message queues, see Message-Based Communication (Simulink).

Queue Capacity

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 Error.

Diagnostic SettingDescription
ErrorWhen the queue overflows, the simulation stops with an error.
WarningWhen the queue overflows, the queue drops the last message and simulation continues with a warning.
NoneWhen the queue overflows, the queue drops the last message and simulation continues without issuing a warning.

Queue Type

Specifies the order in which messages are removed from the receiving queue. The default option is FIFO.

Queue Type SettingDescription
FIFOFirst in, first out
LIFOLast 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:

  • Ascending - The messages are removed in ascending order of the message data value.

  • Descending - The messages are removed in descending order of the message data value.

See Also

Related Topics