CS 290C: Formal Models for Web Software Lecture 2: Modeling States with Statecharts Instructor: Tevfik Bultan.

Slides:



Advertisements
Similar presentations
UML State Machine Diagrams and Modeling
Advertisements

UML Statechart semantics Speaker: Fei Mo Tutor: Priv.-Doz. Dr. Thomas Noll Lehrstuhl für Informatik 2 RWTH Aachen SS 07.
Statecharts Semantics
CS 267: Automated Verification Lecture 8: Automata Theoretic Model Checking Instructor: Tevfik Bultan.
Partial Order Reduction: Main Idea
Models of Concurrency Manna, Pnueli.
Vered Gafni – Formal Development of Real Time Systems 1 Statecharts Semantics.
Lecture 8: Three-Level Architectures CS 344R: Robotics Benjamin Kuipers.
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.
CS6133 Software Specification and Verification
CS 290C: Formal Models for Web Software Lecture 4: Implementing and Verifying Statecharts Specifications Using the Spin Model Checker Instructor: Tevfik.
CS5371 Theory of Computation
CS 290C: Formal Models for Web Software Lecture 3: Modeling Navigation Instructor: Tevfik Bultan.
Action Language: A Specification Language for Model Checking Reactive Systems Tevfik Bultan Department of Computer Science University of California, Santa.
Mastering the Unified Modeling Language -- State Transition Diagrams -- © Josef Schiefer, IBM Watson.
Slide 10B.1 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. An Introduction to Object-Oriented Systems Analysis and Design with.
1 CS 691z/791z Topics in Software Engineering Chapter 13: Activity Diagrams & Chapter 19: Basic Statecharts [Arlow and Neustadt, 2002] March 8, 2007.
FunState – An Internal Design Representation for Codesign A model that enables representations of different types of system components. Mixture of functional.
1 CS 691z/791z Topics in Software Engineering Chapter 20: Advanced Statechart Modeling [Arlow and Neustadt, 2002] March 8, 2007.
System behaviors: state machine diagrams
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.
CS5371 Theory of Computation Lecture 8: Automata Theory VI (PDA, PDA = CFG)
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.
02/06/05 “Investigating a Finite–State Machine Notation for Discrete–Event Systems” Nikolay Stoimenov.
Ch.2 Part A: Requirements, State Charts EECE **** Embedded System Design.
- 1 - Embedded Systems—State charts Specifications.
- 1 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2005/6 Universität Dortmund Specifications.
Lecture 4 Finite State Machine CS6133 Software Specification and Verification.
1 Object-Oriented Modeling Using UML (2) CS 3331 Fall 2009.
Slide 16B.51 © The McGraw-Hill Companies, 2005 Object-Oriented and Classical Software Engineering.
Business Informatics Group Institute of Software Technology and Interactive Systems Vienna University of Technology Favoritenstraße 9-11/188-3, 1040 Vienna,
Guide to State Transition Diagram. 2 Contents  What is state transition diagram?  When is state transition diagram used?  What are state transition.
StateCharts Peter Marwedel Informatik 12 Univ. Dortmund Germany.
Ch. 2. Specification and Modeling 2.1 Requirements Describe requirements and approaches for specifying and modeling embedded systems. Specification for.
Foundations of Software Testing Slides based on: Draft V1.0 August 17, 2005 Test Generation: Statecharts Last update: September 24, 2005 These slides are.
Information System Design IT60105
By: David Harel & Eran Grey Presenter: Elizabeth Antony CISC 836.
1 Kyung Hee University Statecharts Spring Kyung Hee University Specifying Objects’ Behaviour  Interaction diagrams show message-passing behaviour.
CS 290C: Formal Models for Web Software Lecture 2: Navigation Modeling with Statecharts Instructor: Tevfik Bultan.
Object Oriented Analysis & Design & UML (Unified Modeling Language)1 Part VI: Design Continuous Activity Diagams State Diagrams.
CSCI1600: Embedded and Real Time Software Lecture 7: Modeling II: Discrete Systems Steven Reiss, Fall 2015.
Documenting Control Problems with Statecharts Charles Wallace Michigan Technological University
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML State Diagrams.
UML: State Chart Diagrams
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.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
2/25/2016COSC , Lecture 191 Real-Time Systems, COSC , Lecture 19 Stefan Andrei.
Test Generation from UML Specifications Michael A. Gray American University Washington, DC.
York University Department of Computer Science © Castro, Mylopoulos and Easterbrook Lecture 11: Modelling “State”  What is State?  statespace.
® IBM Software Group © 2009 IBM Corporation Module 11: Creating State Machine Diagrams Essentials of Modeling with IBM Rational Software Architect V7.5.
UML Review: State Machines. Sept. 17, 2003Lecture 5: CS660 Fall Overview States Transitions Activities Modeling object lifeline Creating well-structured.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Advanced UML State Diagrams.
State Machine Diagram.
Marlon Dumas Institute of Computer Science
Advanced state modeling
State Machine Diagrams
Princess Nourah bint Abdulrahman University
UML Activity Diagrams & State Charts
The design, implementation, integration and evaluation of a Statechart service. By Xin Bai Feb 7, 2002.
Dynamic Modeling Lecture # 37.
CSCI1600: Embedded and Real Time Software
Advanced state modeling
CS 791Z State Machines & Advanced State Machines
UML State Diagrams.
Presentation transcript:

CS 290C: Formal Models for Web Software Lecture 2: Modeling States with Statecharts Instructor: Tevfik Bultan

Statecharts A visual formalism for specifying hierarchical state machines – “A Visual Formalism for Complex Systems,” David Harel, Science of Computer Programming, 1987 Especially useful for modeling reactive systems –systems which continuously react to internal or external events without terminating State machines in UML are based on Statecharts Statecharts is a formal language, it has formal semantics

Statecharts Statecharts characteristics: Hierarchical grouping of states –superstates are formed by grouping other states Superstates can be formed using AND composition or OR composition –When the system is in an AND-state it is in all of its substates –When the system is in an OR-state it is in only one of its substates –If a state has no substates it is an atomic state Synchronization and communication between different parts of the system is achieved using events

Statecharts A B C D A basic state machine Initial (default) state is A If event x occurs while in state A, the next state will be B If event y occurs while in state A, the next state will be C x y t Given the event sequence: y, x, t Behavior of the state machine is: A  C  D The x event is ignored since it does not enable any transition when the system is in state C Note that we are interested in the behavior of the machine — the paths it takes (including the states it visits. This is different then using the state machines as language recognizers (as in automata theory or compilers) yt

Statecharts: OR-states D A C D is an OR-state, its substates are A and C When the system is in state D it is either in A or C (but not both) The default state of D is A. When the system transitions to state D it will go to state A unless it is explicitly specified otherwise While the system is in state A or C (meaning it is in state D) if event t occurs it transitions to B While the system is in state B if event x occurs the system transitions to state D, since the default state in D is A, it transitions to A A hierarchical state machine B x y t z A C B x y t z t Equivalent basic state machine Given the event sequence: x, y, t, z Behavior of the hierarchical state machine: B  D(A)  D(C)  B  D(C) Behavior of the equivalent basic state machine: B  A  C  B  C x z ty xytz

Statecharts: Transitions Statechart transitions have a source state and a target state and are labeled as trigger-event [guard-condition] / generated-events trigger-event[guard-condition]/action source statetarget state

Statecharts: Transitions The transition is enabled if the trigger-event occurs and the guard-condition is true while the system is in the source state of the transition A transition can be taken if it is enabled The events can be generated by the state machine itself (internal events) or can be generated by the environment (external events) When a transition is taken it generates the generated-events (a set of events) which may enable other transitions and it transitions to its destination state Guard condition is a boolean expression that combines predicates in the form In(state) (such a predicate is true when the system is in the specified state)

Statecharts: Transitions Two transitions are conflicting if they cannot be taken at the same time If two conflicting transitions are enabled at the same time, one of them is taken non-deterministically A CB t t Two outgoing transitions from state A are conflicting (they cannot be taken at the same time). When event t occurs if the system is in state A both transitions are enabled. Since they are conflicting one of them is taken nondeterministically

Statecharts: AND-states (concurrency) B C xy[in G] AD G E F x t z v R R is and AND-state When the system is in the AND-state R, it is both in state A and state D A and D are OR-states When the system is in state A it is either in state B or in state C (but not in both) When the system is in state D it is in only one of E or F or G A hierarchical state machine B-E C-E B-F x z t B-G C-G C-F y x z v v x x Equivalent basic state machine t Note that event x causes a synchronization between states A and D when A is in B and D is in F. They make a concurrent transition: A goes from B to C D goes from F to G

Statecharts: State hierarchy B C xy[in G] AD G E F x t z v R A hierarchical state machine We can think of the state hierarchy as a tree: R(AND) A(OR)D(OR) BCEFG H is the root state B,C, E, F, G are the leaf (atomic) states Other than the atomic (leaf) states each state is marked as an OR or an AND state Given the event sequence: x, z, y, t, v The behavior of the statechart is: R(A(B))-R(D(F))  R(A(C))-R(D(G))  R(A(C))-R(D(F))  R(A(C))-R(D(E))  R(A(C))-R(D(G)) It is hard to read the above representation. We can show the behavior using only the atomic states (assuming they have unique names): B-F  C-G  C-F  C-E  C-G x vt xztv z

Statecharts: Internal vs. External events Internal events have higher priority –when an internal event is generated, first the transitions enabled by the internal event is taken before the next external event is considered A CB x/t t y Given the input event sequence: x,y The behavior of the statechart is: A  C  B  C xt y y

Statecharts: History States B C xy[in G] AD G R E F x t z v K w H Entering the history state (marked with H in a circle) in state D means that enter the most recently visited substate of D What if substates of D have their own substates? –H* (deep history state) means enter all the most recently visited descendants z Given the input event sequence: x,w,z The behavior of the statechart is: B-F  C-G  K  B-G xwz

Statecharts: An Example Alarm Shut Op On Off 1 2 ModeVol t_on start stop t_offt_on incdec Given the input event sequence: start, t_on, inc, dec, stop The behavior of the statechart is: Shut  Off-1  On-1  On-2  On-1  Shut startt_on incdecstop