Vitech CORE: Create State Transition Diagrams in CORE
I recently sat in a class where we worked through State Machine diagrams and how they are used, specifically we looked at how UML 2.0 and SysML want them to be used. This prompted me to finally get my head around the use of State Transition Diagrams in Vitech's CORE. After some testing and questions to Vitech support, I quickly got the hang of how CORE implements the State Machine Diagram.
In this post I will walk you through the most important elements and relationships needed in CORE to create a State Transition diagram including sources and sinks, States, Transitions (including guards), Events, and actions on states (enter, exit, and do). By the end of this post you will be able to create a State machine diagram in CORE that is perfectly aligned with SysML. This post will not discuss best practice or the theory behind State Transition Diagrams, but instead will focus on the implementation in CORE.
Create a root state
So where to start. Well, we will need a root state to be our container for modelling our state behaviour. Whenever you create a new component in CORE, a root State element is automatically created for the Component and given the name “_Exhibit [Your Component Name] States”. Now we have our starting point.
You can create new states directly on the State Transition Diagram in CORE by simply dragging from the diagram palette on the right of the diagram. When you create new States in this way, CORE automatically creates the decomposes relationship between these elements and the container State element for which we are creating the diagram.
Sources and sinks
We need a starting point for our diagram as well as an end point. This is accomplished with sources and sinks, and in CORE™ the implementation of sources and sinks are Transitions. Sources are Transitions that only enter[s] a State and do not exit[s] a state. Sinks on the other hand only exit[s] a State and do not enter[s] a State. They can be added by dragging and dropping new exit and entry Transitions from the diagram pallete.
Create transitions between states
Now we need to create Transitions between States i.e. Transitions from State A to State B. This is done by selecting the first State element on the diagram and then holding down the Shift key and selecting the second State element. Now press the Connect button above the diagram on the toolbar (see below)
NB! The order in which you select the State elements determine the direction of the Transition.
Events that triggers Transitions
On State Transition Diagrams, the text displayed on a Transition line is the Event that triggers the Transition and not the name of the Transition. So what we need next are some Events that triggers our Transitions. To create new Events that triggers our Transitions, simply drag and drop new Events from the diagram palette directly on to our Transition lines on the diagram.
Transitions can also be serviced by Functions. On the diagram this is displayed by a backslash and the name of the Function after the Event name on the Transition line.
Transitions can also have Guard Conditions which prohibit the Transition from taking place. Guard conditions are an attribute on the Transition element in CORE™ and can be added in the property sheet. Guard conditions are displayed on the Transition line within square brackets.
The final thing we need are the actions on our specific states. Actions are either entry, exit, or do actions or they happen irrespective of the transition used to enter our State.
In CORE™ a State element can incorporate[s] Function elements and these represent the actions on the State. To set the different types of actions, we need to set the Behavior Type attribute on this incorporates relationship to either: “Entry” for entry actions; “Integrated Root” for do actions; or “Exit” for exit actions.
You can set these attributes by clicking on the “+” next to the relationship and double-clicking on the Behavior Type attribute. This will bring forth a drop-down selection window where you can select the appropriate Behavior Type.
Finally, Events can also have conditions for happening and this is set on the Event element in the Condition attribute as well as a “Type” which can be set on the Event element in the Type attribute. This Type attribute is populated by a drop-down menu with the following 5 options: Absolute Time; Call; Change; Relative Time; and Signal.
You now have the basic building blocks for creating State Transition Diagrams in CORE™.
Read more about State Transition Diagrams from Vitech.