Description
States represent distinct modes or configurations that a system or component can occupy during its lifecycle. In SysML v2, states are fundamental elements of state machine modeling, capturing the behavioral aspects of systems that exhibit mode-based or event-driven behavior. A state defines what the system does while in that particular mode, including actions that execute when entering the state (entry actions), actions that execute continuously while in the state (do actions), and actions that execute when leaving the state (exit actions). States are connected by transitions that define the conditions and events that cause the system to move from one state to another. State machines built from states and transitions provide a powerful way to model complex behavioral logic, such as control systems, protocols, operational modes, and lifecycle phases. States can be hierarchical, containing nested sub-states to represent refinements of behavior at different levels of abstraction. This enables modular design of complex state-based systems where high-level states can be decomposed into detailed state machines.The interval property defines how frequently the do action executes while the system remains in this state. This is particularly useful for periodic monitoring, control loops, or continuous operations.
View Types
| View | Description |
|---|---|
| State | Visualize the state machine diagram showing states and transitions. |
| Properties | Edit the object’s properties, attributes, and metadata. |
| Tree | View the hierarchical structure of nested states. |
| Block | Visual block diagram showing state composition. |
| History | Track changes to attributes. |
Properties Fields
Name of the object.
Short name of the object.
Description of the state and its purpose in the state machine.
Reference to an Action object that executes once when the system enters this state.Entry actions are typically used for initialization, setup, or notification tasks that should occur at the beginning of the state.Read more about Actions
Reference to an Action object that executes repeatedly while the system remains in this state.The frequency of execution is controlled by the Interval property. Do actions are used for continuous monitoring, control loops, or ongoing operations.Read more about Actions
Reference to an Action object that executes once when the system leaves this state.Exit actions are typically used for cleanup, finalization, or notification tasks that should occur at the end of the state.Read more about Actions
Time interval between executions of the do action while in this state.Value: Numeric value for the interval duration.Unit: Time unit (Seconds, Minutes, Hours, etc.).Example:
{ value: "0.1", unit: "Seconds" } executes the do action every 100 milliseconds.A list of all Relationships this object has with other model objects.Read more about Relationships
State Machine Modeling
States are the fundamental building blocks of state machines, which model systems that exhibit distinct behavioral modes. A complete state machine consists of:- States: The different modes or configurations the system can be in
- Transitions: The paths between states, triggered by events or conditions
- Actions: The behaviors that execute in response to state changes or while in a state
- Initial State: The starting point when the state machine begins execution
- Final States: Terminal states that end the state machine execution
Entry, Do, and Exit Actions
The three action types provide precise control over state behavior: Entry Actions execute once when entering the state: Do Actions execute repeatedly at the specified interval: Exit Actions execute once when leaving the state:Hierarchical States
States can contain nested sub-states, creating hierarchical state machines. This enables:- Abstraction: High-level states hide internal complexity
- Reusability: Sub-state machines can be reused in different contexts
- Modularity: Complex behaviors are broken into manageable pieces
- Inheritance: Transitions at higher levels apply to all sub-states