A State represents a significant condition in the life of a Block. State Machines describe how a Block transitions from one State to another and defines what logical behaviour (Activities/Actions owned by the Block) are performed when entering or exiting a State. This type of diagram is great for describing an integrated view of a Block’s behaviour because all the individual threads of behaviour, defined for a Block using Activity Diagrams, are integrated into a single executable model using the stm diagram.
An example stm is:
The symbols available in stms are:
Symbol | Name | Description |
---|---|---|
Comment | Makes a note anywhere in the diagram. Are always surrounded by * characters. Note: If you do not want Cradle to automatically add an * go to the Graphics Settings section of Project Setup and turn off the Automatically add asterisks to diagram's comment symbols option. | |
Picture | Allows you to choose the location of a GIF or JPEG image to be displayed as a diagram symbol. An image can also be embedded in the other diagram symbols. | |
Note Callout | Multi-purpose symbol which attaches to other symbols in order to show certain attributes of the model element. It can show frames, categories, tags, related items, or simply a piece of standalone text. | |
Tag | The Tag symbol is used to display a Tag value contained in a symbol's stereotype frames, or cross reference link attributes, anchored to the selected symbol. In the following example the Tag symbol displays the at tag value specified in the Lifeline stereotype Time frame. The at tag value can be displayed on the diagram using the Tag symbol. | |
Initial Pseudo-State | An Initial Pseudo-State identifies the initial active state of a Block's state-based behaviour. It is represented by a named filled circle with a single exit transition arrow: The Initial Pseudo-State's symbol name is displayed or hidden on the diagram by using the Hide name component checkbox in the Control sidebar. The Initial Pseudo-State symbol has a single exit transition arrow. | |
Final State | The Final State identifies the final active state, in a specific region, of a Block's state-based behaviour. The Final State's symbol name is displayed or hidden on the diagram by using the Hide name component checkbox in the Control sidebar. The Final State symbol has a single entry transition arrow. | |
State | A State element represents some condition in the life of a Block, typically because it represents some change in how the Block responds to events. A State is represented by a rounded corner rectangle with a name. The State should be named after a condition of the Block (e.g. Operating, Power ON). A State may have entry/ and exit/ behaviours that are performed whenever the State is entered or exited, respectively. In addition, the State may perform a do/ activity that executes once the entry behaviour has completed and continues to execute until it completes or the State is exited. The entry/, exit/ and do/ behaviours are cross referenced to the «state» element and displayed in the behaviours compartment controlled by a checkbox in the Control sidebar. A behaviour can be an «activity», «stateMachine», or «interaction» and each can be cross referenced to the «state» with the following relationships: «entry behaviour», «do behaviour», «exit behaviour». An Event with a specified behaviour can also be specified. The state stereotype’s specification has a special stereotype frame named EVENT that can be used to define tags to be associated with the State on the diagram. The stereotype frame is displayed below along with the menus used to specify a tag and its value. In the following example the user specified a signal event and the behaviour effect to be performed when the signal is received by the owning Block. Display the event compartment by checking the attributes checkbox in the Control sidebar. Any tag expression can have an embedded reference to an actual stereotype element using the @REF_ID directive. The directive creates an item reference cross reference between the stereotype containing the tag and the referenced element. To use @REF_ID directive in a tag you need to:
If you want to see the referenced element in the EVENT frame follow the steps shown in the following figure. | |
Composite State | A Composite State symbol has one extra compartment showing either sub-states or construction compartment. The construction compartment can contain a nested mini-state machine diagram. Any states defined in the construction compartment are cross referenced to the state using the «composite» relationship. The links can be seen in the sidebar. A Composite State may have many (orthogonal) regions, where a region is used to show concurrent States. Each region defines a set of States and the States in a region are exclusive. Regions are separated by a dashed line. An active region has exactly one active State within it. Create a region by selecting the Composite State symbol and pressing the right mouse button and then selecting Swimlanes…. From the Swimlanes dialog specify the number swimlanes/regions. A State stereotype has the EVENT frame that is used to define a tag. See the discussion of the EVENT frame and the optional tags in the description of the State symbol above. Any tag expression can have an embedded reference to an actual stereotype element using the @REF_ID directive. See the discussion of this directive above in the definition of the State symbol. | |
Choice Pseudo-State | A Choice Pseudo-State is shown as a diamond with one input transition path and multiple output transition paths. Transition output flows are determined by Guards on the output paths. The Guards on the outgoing transitions of a Choice Pseudo-State are evaluated once it has been reached. For a description of how to specify the guard tags see the description of the Transition symbol. | |
Terminate Pseudo-State | If a Terminate Pseudo-State is reached, then the behaviour of the state machine terminates. The Terminate Pseudo-State is shown as an X. | |
Fork Pseudo-State | A Fork Pseudo-State, represented by a vertical or horizontal bar symbol, has one incoming transition, and multiple outgoing transitions. All the outgoing transitions are taken. | |
Join Pseudo-State | The Join Pseudo-State, represented by a vertical or horizontal bar symbol, has multiple incoming transitions, and one outgoing transition. Incoming transitions come from different orthogonal states. When all of the incoming transitions can be taken, and the join’s outgoing transition is valid, then all the transitions happen. | |
Junction-Pseudo State | A Junction Pseudo-State is used to construct a compound transition path between States. A Junction Pseudo-State is represented as a filled circle with one or more input transition paths, and one or more transition output paths. | |
Transition Effect | This symbol identifies the behaviour that is executed when the transition occurs. The behaviour can be an activity, state machine, or an interaction. There can also be a Guard to indicate that the behaviour only occurs if the Guard is true. For a description of the transition effect (also called behaviour effect), and the Guard, see the descriptions under the Transition symbol above. The Transition Effect and Guard are defined in the transition stereotype element EVENT frame using tags. See the discussion of the EVENT frame and the behaviour effect and guard tags in the definition of the State symbol above. Any tag expression can have an embedded reference to an actual stereotype element using the @REF_ID directive. See the discussion of this directive above in the definition of the State symbol. When doing rapid prototyping the user can just enter a descriptive name for the Transition Effect event symbol and then later go back and create tags to provide a more detailed definition. | |
Trigger Event | The Trigger Event symbol represents a transition trigger, with the description of the triggering events and the transition guard inside the symbol. The symbol is a rectangle with a triangle attached to left side. The four types of Trigger Events are: callEvents, signalEvents, changeEvents, and timeEvents. For a description of these Trigger Events, and the Guard, see the descriptions under the Transition symbol above. The Trigger Events and guard are defined in the transition stereotype element EVENT frame using tags. See the discussion of the EVENT frame and the optional tags in the definition of the State symbol above. Any tag expression can have an embedded reference to an actual stereotype element using the @REF_ID directive. See the discussion of this directive above in the definition of the State symbol. When doing rapid prototyping the user can just enter a descriptive name for the Trigger Event symbol and then later go back and create tags to provide a more detailed definition. | |
Send Signal | The Send Signal symbol represents a send signal action. Signals are very important when communicating between state machines, hence the separate treatment of this action. When the symbol is drawn on the diagram, the Name Symbol dialog is presented to allow the user to enter a symbol name and to specify the «signal» being sent. The «signal» element is specified by the Referenced Element selection menu. For a rapid prototype just specify the symbol name and later, the symbol Rename option can be used to specify the actual «signal» to be sent. The symbol name or Referenced Element name is displayed on the diagram by using the Hide replacement name checkbox in the Control sidebar. If the signal has arguments, they are also shown within the symbol by checking the parameters option in the Compartment section of the Control sidebar. The arguments are cross referenced to the signal using the «has parameter» relationship. There are no tags used with this symbol. | |
Entry-Point Pseudo-State | Entry-Point Pseudo-State symbol allows the state machine to define entry points that can be accessed from a submachine state symbol. Examples of entry-point symbols on Composite State and Submachine State are as follows. | |
Exit-Point Pseudo-State | Exit-Point Pseudo-State symbol allows the state machine to define exit points that can be accessed from a submachine state symbol. Examples of exit-point symbols on Composite State and Submachine State are as follows. | |
History Pseudo-State | A History Pseudo-State represents the last state of its owning region, and a transition ending on a History Pseudo-State has the effect of returning the region to the state it was last in. It has an optional name. | |
Submachine State | A kind of State called a Submachine State may reference/call another State Machine. This allows a State Machine to be reused. A Submachine State symbol contains a reference to another state machine that is executed as part of the execution of the submachine state’s parent. When the symbol is drawn on the diagram, the Name Symbol dialog is presented to allow the user to enter a symbol name and to specify the name of the state machine to be called/invoked using the Referenced Element selection menu. A Submachine State symbol includes an icon in the bottom right corner indicating that this symbol is a submachine state. A transition ending on a Submachine State will start (i.e. call) its referenced State Machine. | |
Transition | A Transition specifies a change of state within a State Machine. A transition arrow is drawn from the old state to the new state. A Transition may include a trigger event, a Guard, and/or Behaviour Effect. A Trigger event is the cause of the transition, which could be a signal, a change event (i.e. a change in some condition), the passage of time, or a call event. A Guard is a constraint/condition which must be true in order for the trigger to cause the transition. A Behaviour Effect is an activity/action which will be invoked as a result of the transition. When doing rapid prototyping the user can specify a name for the Transition symbol and then later go back and create tags to define the actual Trigger Event, Guard, and/or effect.
The Transition Trigger Event, Guard, and Behaviour Effect are defined in the transition stereotype element EVENT frame using tags. See the discussion of the EVENT frame and the optional tags in the definition of the State symbol above. Any tag expression can have an embedded reference to an actual stereotype element using the @REF_ID directive. See the discussion of this directive above in the definition of the State symbol. |
The symbols along with their default stereotypes, referenced elements, stereotype frames and cross reference link attributes are:
Symbol | Name | Default Stereotype | Referenced Element | Stereotype Frames or Cross Reference Link Attributes |
---|---|---|---|---|
Comment | None | None | None | |
Picture | None | None | None | |
Note Callout | None | None | None | |
Tag | None | None | None | |
Initial Pseudo-State | None | None | None | |
Final State | None | None | None | |
State | «state» | None | State frame: EVENT Tag: after Tag: at Tag: behaviourEffect Tag: callEvent Tag: guard Tag: signalEvent Tag: when @Ref can be used in any tag expression to specify an actual stereotype element in the tag expression. The elements are linked together using the item reference relationship | |
Composite State | «state» | None | Transition frame: EVENT Tag: after Tag: at Tag: behaviourEffect Tag: callEvent Tag: guard Tag: signalEvent Tag: when @Ref can be used in any tag expression to specify an actual stereotype element in the tag expression. The elements are linked together using the item reference relationship. | |
Choice Pseudo-State | None | None | None | |
Terminate Pseudo-State | None | None | None | |
Fork Pseudo-State | None | None | None | |
Join Pseudo-State | None | None | None | |
Junction Pseudo-State | None | None | None | |
Transition Effect | «transition» | None | Transition frame: EVENT Tag: behaviourEffect Tag: guard @Ref can be used in any tag expression to specify an actual stereotype element in the tag expression. The elements are linked together using the item reference relationship | |
Trigger Event | «transition» | None | Transition frame: EVENT Tag: after Tag: at Tag: callEvent Tag: guard Tag: signalEvent Tag: when @Ref can be used in any tag expression to specify an actual stereotype element in the tag expression. The elements are linked together using the item reference relationship | |
Send Signal | «sendSignalAction» | «signal» | None | |
Entry-Point Pseudo-State | «entryPoint» | None | None | |
Exit-Point Pseudo-State | «exitPoint» | None | None | |
History Pseudo-State | «historyPseudoState» | None | None | |
Submachine State | «submachineState» | stm diagram | None | |
Transition | «transition» | None | Transition frame: EVENT Tag: after Tag: at Tag: behaviourEffect Tag: callEvent Tag: guard Tag: signalEvent Tag: When @Ref can be used in any tag expression to specify an actual stereotype element in the tag expression. The elements are linked together using the item reference relationship |