CS620, IIT BOMBAY An Introduction to Hybrid Systems Modeling Ashutosh Trivedi Department of Computer Science and Engineering, IIT Bombay CS620: New Trends in IT: Modeling and Verification of Cyber-Physical Systems (2 August 2013) A. Trivedi 1 of 12
Course overview 1. Formal Modeling of CPS Discrete Dynamical Systems (Extended Finite State Machines) Continuous Dynamical Systems (Ordinary Differential Equations) Hybrid Dynamical Systems Timed automata, Hybrid automata, PCDs, Multi-mode systems, and other decidable subclasses 2. Tools for modeling CPS UPPAAL HyTech Stateflow/Simulink 3. Verification and Synthesis Classical temporal logics LTL and CTL Real-time extensions of these logics, in particular MTL Model-Checking for timed and hybrid automata Automatic Synthesis for CPS (satisfiability, controller-environment games, code-generations, etc.) A. Trivedi 2 of 12
Grading 20% 30% 20% 30% End-semester Project Mid-semester Quizzes A. Trivedi 3 of 12
Dynamical Systems Dynamical System: A system whose state evolves with time governed by a fixed set of rules or dynamics. state: valuation to variables (discrete or continuous) of the system time: discrete or continuous dynamics: discrete, continuous, or hybrid A. Trivedi 4 of 12
Dynamical Systems Dynamical System: A system whose state evolves with time governed by a fixed set of rules or dynamics. state: valuation to variables (discrete or continuous) of the system time: discrete or continuous dynamics: discrete, continuous, or hybrid Discrete System Continuous System Hybrid Systems. A. Trivedi 4 of 12
Dynamical Systems Discrete Dynamical Systems A. Trivedi 5 of 12
Most General Model for Dynamical Systems Definition (State Transition Systems) A state transition system is a tuple T = (S, S 0, Σ, ) where: S is a (potentially infinite) set of states; S 0 S is the set of initial states; Σ is a (potentially infinite) set of actions; and S Σ S is the transition relation; A. Trivedi 6 of 12
Most General Model for Dynamical Systems Definition (State Transition Systems) A state transition system is a tuple T = (S, S 0, Σ, ) where: S is a (potentially infinite) set of states; S 0 S is the set of initial states; Σ is a (potentially infinite) set of actions; and S Σ S is the transition relation; tick tick tick tick, 0, 1, 2, 3 tick tick tick count, 0 count, 1 count, 2 count, 3 tick A. Trivedi 6 of 12
State Transition Systems Definition (State Transition Systems) A state transition system is a tuple T = (S, S 0, Σ, ) where: S is a (potentially infinite) set of states; S 0 S is the set of initial states; Σ is a (potentially infinite) set of actions; and S Σ S is the transition relation; Finite and countable state transition systems A finite run is a sequence s 0, a 1, s 1, s 2, s 2,..., s n such that s 0 S 0 and for all 0 i < n we have that (s i, a i+1, s i+1 ). Reachability and Safe-Schedulability problems A. Trivedi 7 of 12
State Transition Systems Definition (State Transition Systems) A state transition system is a tuple T = (S, S 0, Σ, ) where: S is a (potentially infinite) set of states; S 0 S is the set of initial states; Σ is a (potentially infinite) set of actions; and S Σ S is the transition relation; Finite and countable state transition systems A finite run is a sequence s 0, a 1, s 1, s 2, s 2,..., s n such that s 0 S 0 and for all 0 i < n we have that (s i, a i+1, s i+1 ). Reachability and Safe-Schedulability problems We need efficient computer-readable representations of infinite systems! A. Trivedi 7 of 12
Extended Finite State Machines Let X be the set of variables (real-valued) of the system let X = N. A valuation ν of X is a function ν : X R. We consider a valuation as a point in R N equipped with Euclidean Norm. A. Trivedi 8 of 12
Extended Finite State Machines Let X be the set of variables (real-valued) of the system let X = N. A valuation ν of X is a function ν : X R. We consider a valuation as a point in R N equipped with Euclidean Norm. A predicate is defined simply as a subset of R N represented (non-linear) algebraic equations involving X. Non-linear predicates, e.g. x + 9.8 sin(z) = 0 A. Trivedi 8 of 12
Extended Finite State Machines Let X be the set of variables (real-valued) of the system let X = N. A valuation ν of X is a function ν : X R. We consider a valuation as a point in R N equipped with Euclidean Norm. A predicate is defined simply as a subset of R N represented (non-linear) algebraic equations involving X. Non-linear predicates, e.g. x + 9.8 sin(z) = 0 Polyhedral predicates: a 1x 1 + a 2x 2 + + a nx n k where a i R, x i X, and = {<,, =,, >}. A. Trivedi 8 of 12
Extended Finite State Machines Let X be the set of variables (real-valued) of the system let X = N. A valuation ν of X is a function ν : X R. We consider a valuation as a point in R N equipped with Euclidean Norm. A predicate is defined simply as a subset of R N represented (non-linear) algebraic equations involving X. Non-linear predicates, e.g. x + 9.8 sin(z) = 0 Polyhedral predicates: a 1x 1 + a 2x 2 + + a nx n k where a i R, x i X, and = {<,, =,, >}. Octagonal predicates x i x j k or x i k where x i, x j X, and = {<,, =,, >}. Rectangular predicates x i k where x i X, and = {<,, =,, >}. Singular Predicates x i = c. A. Trivedi 8 of 12
Poly-, Rect-, and Octa- Predicates x y y x z x z y (a) (b) (b) (c) A. Trivedi 9 of 12
Extended Finite State Machines x<3, tick, x =x + 1,, x =x, tick, x =x count,, x =x x=3, tick, x =0 Extended Finite State Machines (EFSMs): Finite state-transition systems coupled with a finite set of variables The valuation remains unchanged while system stays in a mode (state) The valuation changes during a transition when it jumps to the valuation governed by a predicate over X X specified in the transition relation. Transitions are guarded by predicates over X Mode invariants Initial state and valuation A. Trivedi 10 of 12
Extended Finite State Machines x<3, tick, x =x + 1,, x =x, tick, x =x count,, x =x x=3, tick, x =0 Definition (EFSM: Syntax) An extended finite state machine is a tuple M = (M, M 0, Σ, X,, I, V 0 ) such that: M is a finite set of control modes including a distinguished initial set of control modes M 0 M, Σ is a finite set of actions, X is a finite set of real-valued variable, M pred(x) Σ pred(x X ) M is the transition relation, I : M pred(x) is the mode-invariant function, and V 0 pred(x) is the set of initial valuations. A. Trivedi 11 of 12
EFSM: Semantics x<3, tick, x =x + 1,, x =x, tick, x =x count,, x =x x=3, tick, x =0 tick tick tick tick, 0, 1, 2, 3 tick tick tick count, 0 count, 1 count, 2 count, 3 tick A. Trivedi 12 of 12
EFSM: Semantics The semantics of an EFSM M = (M, M 0, Σ, X,, I, V 0 ) is given as a state transition graph T M = (S M, S0 M, Σ M, M ) where S M (M R X ) is the set of configurations of M such that for all (m, ν) S M we have that ν I(m); S M 0 S M such that (m, ν) S M if m M 0 and ν V 0 ; Σ M = Σ is the set of labels; M S M Σ M S M is the set of transitions such that ((m, ν), a, (m, ν )) M if there exists a transition δ = (m, g, a, j, m ) such that the current valuation ν satisfies the guard of δ, i.e. ν g; the pair of current and next valuations (ν, ν ) satisfies the jump constraint of δ, i.e. (ν, ν ) j; and the next valuation satisfies the invariant of the target mode of δ, i.e. ν I(m ). A. Trivedi 13 of 12