Lecture 4 Finite State Machine CS6133 Software Specification and Verification.

Slides:



Advertisements
Similar presentations
1 CIS224 Software Projects: Software Engineering and Research Methods Lecture 6 State Machine and Activity Diagrams (Based on Stevens and Pooley (2006,
Advertisements

State Charts Mehran Najafi. Reactive Systems A reactive, event-driven, object is one whose behavior is best characterized by its response to events dispatched.
Nested state diagrams:Problems with flat state diagram
UML Statechart semantics Speaker: Fei Mo Tutor: Priv.-Doz. Dr. Thomas Noll Lehrstuhl für Informatik 2 RWTH Aachen SS 07.
Concepts & Notations. Acknowledgements  The material in this tutorial is based in part on: Concurrency: State Models & Java Programming, by Jeff Magee.
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
UML State chart/machine diagram State machine diagram is a behavior diagram which shows discrete behavior of a part of designed system through finite state.
Statecharts Semantics
Vered Gafni – Formal Development of Real Time Systems 1 Statecharts Semantics.
Week 6Fall 2001 CS5991 The STATEMATE Semantics of Statecharts D. Harel and A. Naamand Ahmad Alsawi 1-4 Bob Chen 5-8 Dapeng Xie 9-11.
CS 290C: Formal Models for Web Software Lecture 4: Implementing and Verifying Statecharts Specifications Using the Spin Model Checker Instructor: Tevfik.
Mastering the Unified Modeling Language -- State Transition Diagrams -- © Josef Schiefer, IBM Watson.
Software engineering Methods Software Engineering Methods State Diagrams Zvi Avidor Written By With additions by Zvika Gutterman and Adam Carmi.
CS 425/625 Software Engineering System Models
1 CS 691z/791z Topics in Software Engineering Chapter 13: Activity Diagrams & Chapter 19: Basic Statecharts [Arlow and Neustadt, 2002] March 8, 2007.
1 CS 691z/791z Topics in Software Engineering Chapter 20: Advanced Statechart Modeling [Arlow and Neustadt, 2002] March 8, 2007.
1 CS/CPE 426 Senior Projects Chapter 21: State Machines Chapter 22:Advanced State Machines [Arlow and Neustadt 2005] March 24, 2009.
THE OBJECT-ORIENTED DESIGN WORKFLOW Statechart Diagrams.
State Change Modelling. Aim: To introduce the concept and techniques for describing the changes in state that may occur to an object in its lifetime.
CS 290C: Formal Models for Web Software Lecture 2: Modeling States with Statecharts Instructor: Tevfik Bultan.
Advanced Behavioral Modeling
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 10: Statecharts.
University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution.
Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.
Ch.2 Part A: Requirements, State Charts EECE **** Embedded System Design.
State Machine Diagram Chapter 10. State Machine Diagram Used to describe system behavior.
Chapter 10 State Machine Diagrams
מידול התנהגותי 1. Today’s Session Sequence Diagrams State Machines 2.
Business Informatics Group Institute of Software Technology and Interactive Systems Vienna University of Technology Favoritenstraße 9-11/188-3, 1040 Vienna,
NJIT Modeling Behavior in State Chart Diagrams Chapter 29 Rafael Mello.
Behavioral diagrams Lecture p4 T120B pavasario sem.
Object-Oriented Modeling Using UML CS 3331 Section 2.3 of Jia 2003.
1 Modeling interactions and behavior Lecturer Dr. Mai Fadel.
Ch. 2. Specification and Modeling 2.1 Requirements Describe requirements and approaches for specifying and modeling embedded systems. Specification for.
Information System Design IT60105
1 Kyung Hee University Statecharts Spring Kyung Hee University Specifying Objects’ Behaviour  Interaction diagrams show message-passing behaviour.
Real Time Systems Advanced State Machines. Behaviour (part 2) - 2 Outline  Simple and Composite States  Transition Segments and Junction Points  Run-to-Completion.
Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity.
Object Oriented Analysis & Design & UML (Unified Modeling Language)1 Part VI: Design Continuous Activity Diagams State Diagrams.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML State Diagrams.
States.
CS3773 Software Engineering Lecture 06 UML State Machines.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 10: Statecharts.
Modeling Object Lifecycles and State-Dependent Behavior ©SoftMoore ConsultingSlide 1.
State Machine Diagram Chapter 5 Introduction Pages
2/25/2016COSC , Lecture 191 Real-Time Systems, COSC , Lecture 19 Stefan Andrei.
York University Department of Computer Science © Castro, Mylopoulos and Easterbrook Lecture 11: Modelling “State”  What is State?  statespace.
State Modeling. Introduction A state model describes the sequences of operations that occur in response to external stimuli. As opposed to what the operations.
® IBM Software Group © 2009 IBM Corporation Module 11: Creating State Machine Diagrams Essentials of Modeling with IBM Rational Software Architect V7.5.
1 Object Oriented Analysis System modeling = Functional modeling + Object modeling + Dynamic modeling Functional modeling = Use cases Object modeling =class.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Advanced UML State Diagrams.
State Machine Model.
State Machine Diagram.
State Machine Diagrams
Marlon Dumas Institute of Computer Science
Activity Diagram.
State Machine Diagrams
CSC 422 Kutztown University Dr. Spiegel
UML Activity Diagrams & State Charts
States.
Object Oriented System Design
CS/CPE 426 Senior Projects
Chapter 5 state Modeling
CS/CPE 426 Senior Projects
Dynamic Modeling Lecture # 37.
Marlon Dumas Institute of Computer Science
States.
CHAPTER 2 Object-Oriented Modeling Using UML (Continued)
CS 791Z State Machines & Advanced State Machines
UML State Diagrams.
Presentation transcript:

Lecture 4 Finite State Machine CS6133 Software Specification and Verification

2 Finite State Machine Finite state machine (FSM) was designed for expressing the behavior of computer-based systems A finite state machine is a four tuple,, where S is a finite set of control states S I is a finite set of initial control states V is a finite set of variables T is a finite set of transitions CS6133

3 Elements of FSM Control state represents progress in the execution of the system by indicating what to execute next System state is an assignment of values to the system variables. System state captures some information of the system at a certain moment in the execution Transition transforms a system from one state into another state Initial states indicate the starting points of execution CS6133

4 FSM-Based Notations Statecharts Harel’s statecharts RSML UML state machines Labeled transition systems (LTS) Hierarchical transition systems (HTS) CS6133

5 UML State Machine Shows how an object's behavior changes over time How to react to events How to react to messages received, and shows when it outputs messages to other objects State partitions class behavior Transition describes a change in state due to the occurrence of an event CS6133

6 Transition event(args): the event or message that triggers the transition [condition]: boolean value; the transition cannot fire unless the guard condition is “true” /activity: simple, fast, non-interruptible action e.g., variable assignment, ^object.event(args): send a message to an object Each of these parts is optional CS6133

7 Event An event is: Calls or signals an object can detect  External: a change in the environment e.g., “off-hook”  Internal: a message from another object (operation call) Change in a condition: external or internal e.g., when(temperature > 100 degrees Temporal: the occurrence of a specific date/time or passage of time e.g., after (20 minutes) CS6133

8 Events Events make an object change state If the object is in a state and there is not outgoing transition triggered by an event, the event is ignored CS6133

9 State Activities A state can have activities associated with it State activities can manipulate object attributes or other variables Activity: simple, non-interruptible  Associated with a transition or a state  Performed on state entry or exit Do activity: interruptible; may require much computation  Associated with a state  Interrupted by a transition CS6133

10 State Activities States can be annotated with entry or exit activities, internal activities, and activities: entry/activity event/activity (way to describe reactions to events that don't cause a state change -- internal transitions) exit/activity do/activity CS6133

11 State Activities In a transition, the order of effects: Exit activities of source Transition activities Entry activities of destination, and State activities CS6133

12 Self-Transition A self-transition will cause reactivation of exit and then entry events If you want a self-transition that does not activate these events, you can use an internal transition, labeled with the event and the associated activity e.g., “req/reply” in state “S” CS6133

13 Self-Transition Compared to an activity on a transition, one could achieve the same behavior As activity in state as activity in another, special state CS6133

14 More on Transition If a transition has no event label, it can occur once any activity associated with the state is complete Guards on transitions (triggered by the same event) leaving a state should be mutually exclusive CS6133

15 State Hierarchy Super-state: a state can contain other states Super-state combines states and transitions that work together towards a common goal If a transition leaves a super-state, this transition applies to all the sub-states and has higher priority than the transitions within the super-state The sub-states “inherit” the transitions of the super- state Basic state: a state do not contain other states CS6133

16 State Diagram Without Super-State CS6133

17 State Diagram with Super-State CS6133

18 History State History is a mechanism by which a re-entered super-state can continue executing from the sub- state that was current when control last transitioned out of the super-state Deep history Shallow history CS6133

19 History State – An Example CS6133

20 Concurrent State A concurrent state captures two or more behaviors of the object that happen concurrently each with its own control thread If there are many concurrent states for one object, you should consider dividing the behavior between more objects CS6133

21 Composite State Nonorthogonal composite state Super-state contains no concurrent states System (object) is in exactly one basic state Orthogonal composite state Concurrent state contains two or more orthogonal regions, which have their own threads of control respectively System (object) is in every region concurrently CS6133

22 Types of Orthogonal States Aggregation concurrency State diagram for an aggregate object is a collection of state diagrams, each of which corresponds to a constituent object Synchronization of concurrent activities within one object Object performs two or more activities concurrently Object completes all concurrent activities before it progress to anther state CS6133

23 Semantics of UML State Machine An object executes by performing run-to- completion steps 1. An event is removed from the object’s event pool for the object to process 2. A maximal set of non-conflicting enabled transitions are executed 3. The events generated by these transitions are sent to the targeted objects 4. Step 2 and step 3 are repeated, until no more transitions are enabled CS6133