Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fall 2010 CS4310 Requirements Engineering UML: Dynamic Modeling Dr. Guoqiang Hu Department of Computer Science UTEP 1.

Similar presentations


Presentation on theme: "Fall 2010 CS4310 Requirements Engineering UML: Dynamic Modeling Dr. Guoqiang Hu Department of Computer Science UTEP 1."— Presentation transcript:

1 Fall 2010 CS4310 Requirements Engineering UML: Dynamic Modeling Dr. Guoqiang Hu Department of Computer Science UTEP 1

2 Outline: 1.Key Concepts & Their UML Notations 2.Basic State Diagram UML Notations 3.Examples 4.Exercises 5.Nested State Diagram, Nested State 6.Sequence Diagram 7.Activity Diagram 2

3 3 1 Key Concepts & Their UML Notations 1.1 State model Describes the sequences of operations of objects that occur in response to stimuli Consists of multiple state diagrams, one for each class with temporal behavior that is important to an application 1.2 State An abstraction of the values and links of an object: sets of values and links grouped together into a state according to the gross behavior of the object Ignore attributes that do not affect the behavior of the object, and lump together in a single state all combinations of values and links with the same response to events Solvent Insolvent Powered Waiting Dialing

4 4 1.3 Event An occurrence at a point in time Can be causally related or unrelated (concurrent) The most common types of event: 1.Signal event: Sending or receiving a signal (message) 2.Change event: Caused by the satisfaction of a boolean expression (continuously tested)  when (room temperature < heating set point)  when (room temperature < cooling set point) 3.Time event: Caused by the occurrence of an absolute time or the elapse of a time interval  when (date = October 28, 2010)  after (10 seconds)

5 5 1.4 Event vs. state Events: points in time State: intervals in time All events are ignored in a state, except those for which behavior is explicitly prescribed. The response may include the invocation of behavior or a change of state. power turned on power turned off power turned on time Powered Not powered 1.5 Transitions and conditions Transitions: An instantaneous change from one state to another Guard condition: A boolean expression that must be true for a transition to occur (only checked once)

6 6 event (attribs) [condition] / effect State diagram name 2 Basic State Diagram UML Notation State1 do / activity event / effect State2 … For example: right button down / display pop-up menu Idle Menu visible Activities for pop-up menu right button up / erase pop-up menu cursor moved / highlight menu item

7 7 For example: Paper jam do / flash warning light Do-activity for copy machine White’s turn Black’s turn black moves Black wins Draw White wins checkmate stalemate For example: Initial & final state white moves Chess

8 8 depress / motor up DoorOpener 3 Examples (1) Closed Open Opening Closing door open / motor off depress / motor down depress / motor up door closed / motor off

9 9 timeout SmartTrafficLights 3 Examples (2) North/South May go straight timeout [cars in N/S left lanes] North/South May turn left East/West May go straight East/West May turn left timeout timeout [cars in E/W left lanes] timeout [no cars in E/W left lanes] timeout [no cars in N/S left lanes]

10 4 In-Class Exercises (1) Draw a state diagram for a digital watch (8 minutes) The watch has a single mode button and a single advance button. Pressing the mode button once and then pressing the advance button increments the hours by 1. Each press of the advance button increments the hour. Pressing the mode button the second time allows advancing the minutes by 1. Pressing the mode button a third time displays the current time. While displaying the current time, the advance button is ignored. Pressing the mode button allows the user to set the hour again. 10

11 DigitalWatch 4 In-Class Exercises (1) Display Current Time Set Hours Set Minutes Mode button Advance / hours=(hours+1) mod 24 Advance / min=(min+1) mod 60 11

12 4 In-Class Exercises (2) Draw a state diagram for an office phone when making a call. (15 minutes) Assume that the phone has keys for the digits 0-9, #, and *. It can detect when the receiver is on-hook or off-hook. Hint: The phone is idle when the receiver is on-hook. Based on your past experiences, you can decide the possible states of the phone, for example, dialing, connecting, talking, etc. 12

13 4 In-Class Exercises (2) 13

14 5 Nested State Diagram, Nested State 14

15 5 Nested State Diagram, Nested State (cont’d) 15

16 5 In-Class Exercises (3) Draw a state diagram for an automatic transmission (10 minutes). The transmission can be in reverse, neutral, or forward. If it is in forward, it can be in first, second, or third gear. States first, second, and third are nested states of forward. Selecting “N” in any forward gear shifts the transmission to neutral. Selecting “F” in neutral always shifts the transmission to first, In any forward gear, stopping the car always shifts the transmission to first. 16

17 5 In-Class Exercises (3) 17

18 6 Sequence Diagram 18

19 6 Sequence Diagram (cont’d) 19

20 7 Activity Diagram 20

21 7 Activity Diagram (cont’d) 21


Download ppt "Fall 2010 CS4310 Requirements Engineering UML: Dynamic Modeling Dr. Guoqiang Hu Department of Computer Science UTEP 1."

Similar presentations


Ads by Google