SysML State Machine Diagram

From Training Material
Revision as of 18:00, 3 June 2018 by Fstachecki (talk | contribs) (SysML State Machine Diagram⌘)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


SysML State Machine Diagram⌘

  • State machine diagram is a behavior diagram which shows discrete event-driven behavior of a part of designed system through finite state transitions.
  • The UML concept of protocol state machines is excluded from SysML to reduce the complexity of the language.
Vertex⌘
  • Vertex is named element which is an abstraction of a node (State or Pseudostate) in a state machine graph.
  • It can be the source or destination of any number of transitions.
State⌘

  • State models a situation during which some invariant condition holds.
  • In most cases this condition is not explicitly defined.

Transition⌘

  • Directed relationship between a source vertex and a target vertex.
  • Syntax: [<trigger> [‘,’ <trigger>]* [‘[‘ <guard>’]’] [‘/’ <behavior-expression>]]
    • trigger specifies events that may cause state transition,
      • SignalEvent triggers and CallEvent triggers are not distinguishable by syntax
    • guard is a boolean expression,
    • optional behavior-expression is an expression specifying the effect (is executed when the transition fires)
Transition Kind⌘

The semantics of a Transition depend on its relationship to its source Vertex:

  • external - transition exits its source vertex (executes exit action of source state)
  • local - transition does not exit its containing State (exit action of the containing state will not be executed)
    • Target vertex may be different from its source Vertex.
    • Local transition can only exist within a composite State.
  • internal is a special case of a local transition with the same source and target states,
    • the state is never exited (and not re-entered)
    • no exit or entry actions are executed
Internal Transition example⌘

source: wikipedia.org

Internal Behaviors⌘

  • syntax: <behavior-type-label> ['/' <behavior-expression>]
  • entry - a Behavior which is performed upon entry to the State (entry Behavior).
  • do - starts execution when the State is entered, (but only after the State entry Behavior has completed) and executes concurrently with any other Behaviors that may be associated with the State, until:
    • it completes (in which case a completion event is generated) or
    • the State is exited, in which case execution of the doActivity Behavior is aborted.
  • exit - a Behavior that is performed upon exit from the State (exit Behavior).

Pseudo State⌘

  • Pseudostate is an abstract vertex that describes different types of transient vertices in the state machine graph.
  • Pseudostates are transitive - a compound transition execution simply passes through them, arriving on an incoming Transition and leaving on an outgoing Transition without pause.
Initial ⌘

  • Initial Pseudostate represents a starting point for a Region.
  • It is the source for at most one Transition, which may have an associated effect Behavior, but not an associated trigger or guard.
  • There can be at most one initial Vertex in a Region.
Choice⌘

  • Choice is used to realize a dynamic conditional branch.
  • It allows splitting of compound transitions into multiple alternative paths.
  • The decision on which path to take may depend on the results of Behavior executions performed in the same compound transition prior to reaching the choice point.
  • If more than one guard evaluates to true, one of the corresponding Transitions is selected.
  • If none of the guards evaluates to true, then the model is considered ill formed
Junction ⌘

  • Junction can be used to merge multiple incoming Transitions into a single outgoing Transition or,
  • it can be used to split an incoming Transition into multiple outgoing Transition segments with different guard Constraints.
  • Such guard Constraints are evaluated before any compound transition containing this Pseudostate is executed, which is why this is referred to as a static conditional branch.
Fork⌘

  • Splits an incoming Transition into two or more Transitions terminating on Vertices in orthogonal Regions of a composite State.
  • The Transitions outgoing from a Fork cannot have a guard or a trigger.
Join⌘

  • Common target Vertex for two or more Transitions originating from Vertices in different orthogonal Regions.
  • Transitions terminating on a Join cannot have a guard or a trigger.
Terminate ⌘

  • Execution of the State Machine is terminated immediately.
  • The State Machine does not exit any States nor does it perform any exit Behaviors. Any executing doActivity Behaviors are automatically aborted.
Entry Point ⌘

  • Represents an entry point for a State Machine or a composite State that provides encapsulation of the insides of the State or StateMachine.
  • In each Region of the StateMachine or composite State owning the Entry Point, there is at most a single Transition from the entry point to a Vertex within that Region.

If the owning State has an associated entry Behavior, this Behavior is executed before any behavior associated with the outgoing Transition. If multiple Regions are involved, the entry point acts as a fork Pseudostate.

Exit Point ⌘

  • Represents an exit point of a StateMachine or composite State that provides encapsulation of the insides of the State or State Machine.
  • Transitions terminating on an exit point within any Region of the composite State or a State Machine referenced by a submachine State implies exiting of this composite State or submachine State (with execution of its associated exit Behavior).

If multiple Transitions from orthogonal Regions within the State terminate on this Pseudostate, then it acts like a join Psuedostate.

Shallow History⌘

  • Represents the most recent active substate of its containing Region, but not the substates of that substate.
  • Transition terminating on this Pseudostate implies restoring the Region to that substate.
  • A single outgoing Transition from this Pseudostate may be defined terminating on a substate of the composite State.
  • Shallow History can only be defined for composite States and, at most one such Pseudostate can be included in a Region of a composite State.
Deep History⌘

  • Represents the most recent active state configuration of its owning Region.
  • Transition terminating on this Pseudostate implies restoring the Region to that same state configuration.
  • The entry Behaviors of all States in the restored state configuration are performed in the appropriate order starting with the outermost State.
  • Deep History Pseudostate can only be defined for composite States and, at most one such Pseudostate can be contained in a Region of a composite State.

Final State⌘

  • Final State is a special kind of State (not Pseudo State) signifying that the enclosing Region has completed.
  • Transition to a Final State represents the completion of the behaviors of the Region containing the Final State.

STM Diagram example⌘