MECH 567 – Systems Architecture “Behavioral Modeling in SysML” Stephen Milton and Sandra Biedron Stephen.Milton@colostate.edu , Sandra.Biedron@colostate.edu (970) 491-8742 Introduction SysML has three kinds of modeling abstractions: structural modeling, requirements modeling and behavioral modeling. Last week we got an introduction to structural modeling by doing some simple projects with the Block Definition Diagram. This week, we will introduce the second type of SysML diagram, the behavioral diagram. As shown in Figure 1, SysML contains 4 different types of behavioral diagram. Any one of them can be appropriate depending on the type of modeling that one is performing. Today we are going to demonstrate the State Machine Diagram as an exemplar of the types of behavior that can be modeled using SysML. Figure 1 As always, the authoritative reference for using SysML is entitled, “OMG Systems Modeling Language (OMG SysML™).” It is available for no cost at http://www.omg.org/spec/SysML/1.3/. You are encouraged to use the language definition document as the ultimate resource for this course. Laboratory Learning Objectives 1. Learn SysML behavioral modeling concepts 2. Gain experience with state machine diagrams in SysML 3. Model systems’ behavior using SysML state machine diagrams 1 Task 1 – Behavioral Modeling SysML has 4 types of behavioral models. We will start out using the state machine diagram. Any block that has behavior must have an associated state machine diagram. For example, last laboratory, we designed the following block to describe the function of a centrifuge. In this case, the swinging head centrifuge has some behavior that is represented by the function angle(). To more fully describe the function of this block, we can link the SysML block definition diagram to a behavioral diagram with the objective of describing the behavior of the block in more detail. Figure 2. Example Structural Model with Embedded Operations There are many types of behavioral modeling that are available to systems engineering including flow charts, state diagrams, flow diagrams, and state charts. State Diagram flow diagrams 2 Flow chart The most familiar functional model in SysML is called the State Machine Diagram (SMD). The SMD is derived from the State chart type of diagram, which has some simple rules that apply to SysML as well. The states are meant to represent either a: Condition – This might be the case if the state is an operating condition or status (e.g. Emergency, Normal ) Activity – This might be the case if the block is to perform some task (e.g. Sound Alarm) Idling – The block is waiting for a signal or input (e.g. Event Driven Systems) The block should only occupy a single state at a time (as per UML and SysML definitions). The transitions between states are assumed to be performed instantaneously. Task 2 – State Machine Diagram Definitions and Examples As with the BDD structural diagram, SysML defines the entities that make up the diagram. The meta model for the state machine diagram is shown in Figure 2. Reviewing the makeup of the BDD, we can see: The State Machine Diagram is made up of 1 or more states and 0 or more transitions. The state has a variety of specializations including final states, composite states, simple states, and initial states. The transition is made up of events, actions, and guard conditions… 3 Figure 1. State Machine Diagram meta-model A subset of the symbols that are used in State Machine Diagrams are shown in the following diagrams: Figure . Elements of a State Machine Diagram Armed with this information, we can begin to model the behavior of systems using state machine diagrams. States may or may not have activities or actions associated with them, but any activities or actions should correspond to the operations from the Block Definition Diagram. The only way to go from one state to another is to cross a transition. Generally transitions are assumed to take zero time, so your system is assumed to occupy one state at any given time. Events and messages can be received from other state machine diagrams. The initial and final states tell the SMD where to start and stop the evaluation of the diagram. Guard conditions enable transitions when they are Boolean TRUE. Here is an example State Machine Diagram for the function of a hybrid car, let’s read it together. 4 Task 3 – State Machine Diagram for Functional Modeling Like always, when we start to develop these architecture diagrams, we should most likely begin with pencil and paper. We can start together by drawing the BDD and State Machine Diagram to describe the function of logging into your computer. Let’s put this State Machine Diagram into Visio. 5 Task 3 – Homework 1) Read Chapter 1 and Chapter 3.5 of Holt and Perry, SysML for Systems Engineering, 2008, available to all CSU students at: http://discovery.library.colostate.edu/Record/.b40132456 2) Construct a ~7 entity block definition diagram (BDD) for a system of interest to you. Make sure that there are actions associated with a few of the entities in the BDD. 3) Construct the state machine diagram that goes along with your system to construct a simple system model describing both structure and function. The most important part of this exercise is to construct a STM that is consistent with your BDD. You may type directly into this document, please replace my name with yours in the header. Due Feb 3th, 2014, 11:59pm, MST. Turn in by email to milton@engr.colostate.edu and nihan@engr.colostate.edu using the subject line “567 HW2 – YourLastName” in pdf format. 6