Embedded Systems 2. REVIEW: Actor models. A system is a function that accepts an input signal and yields an output signal.

Similar documents
Embedded Systems. Embedded Systems

Embedded Real-Time Systems

Discrete Dynamics Finite State Machines גרא וייס המחלקה למדעי המחשב אוניברסיטת בן-גוריון

Finite State Machines. CS 447 Wireless Embedded Systems

Cyber-Physical Systems Discrete Dynamics

Embedded Systems 5. Synchronous Composition. Lee/Seshia Section 6.2

The STATEMATE Semantics of Statecharts. Presentation by: John Finn October 5, by David Harel

Embedded Systems Development

An introduction to Uppaal and Timed Automata MVP5 1

Hybrid Systems Modeling, Analysis and Control

Symbolic Verification of Hybrid Systems: An Algebraic Approach

Model-Based Design. Chapter Modeling Physical Dynamics Newtonian Mechanics

Information System Design IT60105

Introduction to Embedded Systems

Introduction to Embedded Systems

EE 144/244: Fundamental Algorithms for System Modeling, Analysis, and Optimization Fall 2016

Combining STATEMATE and FNLOG for the specification and the verification of complex real time systems

Modelling Real-Time Systems. Henrik Ejersbo Jensen Aalborg University

EECS 144/244: Fundamental Algorithms for System Modeling, Analysis, and Optimization

A Compositional Approach to Bisimulation of Arenas of Finite State Machines

SPECIFICATION MODELS. Chapter 3. Overview. Introducing Hierarchy. StateCharts

CSE 311 Lecture 23: Finite State Machines. Emina Torlak and Kevin Zatloukal

The algorithmic analysis of hybrid system

Analysis and Optimization of Discrete Event Systems using Petri Nets

TRANSITION CONFLICTS DETECTION IN BINARY MODULAR STATECHART DIAGRAMS 1. Grzegorz Łabiak

Automata-theoretic analysis of hybrid systems

Logic Model Checking

Bridging the Semantic Gap Between Heterogeneous Modeling Formalisms and FMI

Automata-Theoretic Model Checking of Reactive Systems

State modeling. Marlon Dumas. Institute of Computer Science

540 IEEE TRANSACTIONS ON AUTOMATIC CONTROL, VOL. 43, NO. 4, APRIL Algorithmic Analysis of Nonlinear Hybrid Systems

COM364 Automata Theory Lecture Note 2 - Nondeterminism

Part I: Definitions and Properties

{},{a},{a,c} {},{c} {c,d}

Overview. Discrete Event Systems Verification of Finite Automata. What can finite automata be used for? What can finite automata be used for?

Monitoring Distributed Controllers

The State Explosion Problem

Automatic Synthesis of Distributed Protocols

Finite Automata. Dr. Neil T. Dantam. Fall CSCI-561, Colorado School of Mines. Dantam (Mines CSCI-561) Finite Automata Fall / 35

Theoretical Foundations of the UML Lecture 18: Statecharts Semantics (1)

Using the Principles of Synchronous Languages in Discrete-event and Continuous-time Models

Finite Automata - Deterministic Finite Automata. Deterministic Finite Automaton (DFA) (or Finite State Machine)

Finite Automata. Dr. Neil T. Dantam. Fall CSCI-561, Colorado School of Mines. Dantam (Mines CSCI-561) Finite Automata Fall / 43

Abstractions and Decision Procedures for Effective Software Model Checking

An Introduction to Hybrid Systems Modeling

Formal Methods Engineering Nasreen Iqbal De Montfort University

Synchronous Sequential Circuit Design. Dr. Ehab A. H. AL-Hialy Page 1

Laurea Specialistica in Ingegneria. Ingegneria dell'automazione: Sistemi in Tempo Reale

Finite Automata. Mahesh Viswanathan

Supervisory Control of Hybrid Systems

Using the Principles of Synchronous Languages in Discrete-event and Continuous-time Models

Failure Diagnosis of Discrete-Time Stochastic Systems subject to Temporal Logic Correctness Requirements

Lecture 2 Automata Theory

Opus: University of Bath Online Publication Store

Software Verification

September 7, Formal Definition of a Nondeterministic Finite Automaton

Temporal Logic. M φ. Outline. Why not standard logic? What is temporal logic? LTL CTL* CTL Fairness. Ralf Huuck. Kripke Structure

Lecture 2 Automata Theory

Hybrid Control and Switched Systems. Lecture #1 Hybrid systems are everywhere: Examples

Computer Science 520/620 Spring 2013 Prof. L. Osterweil" Software Models and Representations" Part 3" Graphs Other than DFGs" Hierarchy"

DISTINGUING NON-DETERMINISTIC TIMED FINITE STATE MACHINES

Bridging the Semantic Gap Between Heterogeneous Modeling Formalisms and FMI

Computer Science 520/620 Spring 2013 Prof. L. Osterweil" Software Models and Representations" Part 3" Graphs Other than DFGs"

Modal and Temporal Logics

What You Must Remember When Processing Data Words

Foundations of System Development

Formal Verification Techniques. Riccardo Sisto, Politecnico di Torino

Embedded systems specification and design

Safety-Critical Medical Device Development Using the UPP2SF Model

Verification. Arijit Mondal. Dept. of Computer Science & Engineering Indian Institute of Technology Patna

Formal Verification of Mobile Network Protocols

Computation Tree Logic (CTL) & Basic Model Checking Algorithms

EECS 144/244: System Modeling, Analysis, and Optimization

Finite-state machines (FSMs)

From CCS to Hybrid π via baby steps. Bill Rounds CSE, U of Michigan

Finite State Machines Transducers Markov Models Hidden Markov Models Büchi Automata

TESTING is one of the most important parts of the

What is Temporal Logic? The Basic Paradigm. The Idea of Temporal Logic. Formulas

Course 4 Finite Automata/Finite State Machines

Computer-Aided Program Design

Nondeterminism. September 7, Nondeterminism

Formalizing Non-Concurrent UML State Machines Using Colored Petri Nets

Decision, Computation and Language

Runtime Verification of Stochastic, Faulty Systems

Limitations of OCAML records

CSE 105 THEORY OF COMPUTATION

Outline F eria AADL behavior 1/ 78

Temporal Logic. Stavros Tripakis University of California, Berkeley. We have designed a system. We want to check that it is correct.

FAIRNESS FOR INFINITE STATE SYSTEMS

Exam Computability and Complexity

Synchronous Sequential Circuit Design

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2

Finite-State Model Checking

From Sequential Circuits to Real Computers

Dynamic Noninterference Analysis Using Context Sensitive Static Analyses. Gurvan Le Guernic July 14, 2007

Introduction to Embedded Systems

Concurrent Models of Computation

Analysis of a Boost Converter Circuit Using Linear Hybrid Automata

Course on Hybrid Systems

DIAGNOSING MULTIPLE FAULTS IN COMMUNICATING FINITE STATE MACHINES

Transcription:

Embedded Systems 2 REVIEW: Actor models A system is a function that accepts an input signal and yields an output signal. The domain and range of the system function are sets of signals, which themselves are functions. Parameters may affect the definition of the function S. - 2-1

REVIEW: Actor models of continuous-time systems Input is the net torque of the tail rotor and the top rotor. Output is the angular velocity around the y axis. - 3 - Actor Model of an FSM - 4-2

REVIEW: Discrete Systems Lee/Seshia, Chapter 3 Example: count the number of cars that enter and leave a parking garage: Pure signal: Discrete actor: - 5 - Discrete Signals Let e be a signal where X is any set of values. X Let Then e is discrete iff there exists a one-to-one function that is order-preserving, i.e., for all t 1 t 2, f(t 1 ) f(t 2 ). - 6-3

REVIEW: Extended State Machines Extended state machines augment the FSM model with variables that may be read or written. E.g.: - 7 - General Notation for Extended State Machines We make explicit declarations of variables, inputs, and outputs to help distinguish the three. - 8-4

Extended state machine model of a traffic light controller at a pedestrian crossing: Default transition with implicit guard / action (true / none) - 9 - When does a reaction occur? When a reaction occurs is not specified in the state machine itself. It is up to the environment. This traffic light controller design assumes one reaction per second. This is a time-triggered model. - 10-5

When does a reaction occur? Suppose all inputs are discrete and a reaction occurs when any input is present. Then the above transition will be taken whenever the current state is s1 and x is present. This is an event-triggered model. - 11 - When does a reaction occur? Suppose x and y are discrete and pure signals. When does the transition occur? Answer: when the environment triggers a reaction and x is absent. If this is a (complete) event-triggered model, then the transition will never be taken because the reaction will only occur when x is present! - 12-6

Definitions Stuttering transition: Implicit default transition that is enabled when inputs are absent and that produces absent outputs. Receptiveness: For any input values, some transition is enabled. Our structure together with the implicit default transition ensures that our FSMs are receptive. Determinism: In every state, for all input values, exactly one (possibly implicit) transition is enabled. - 13 - Example: Nondeterministic FSM Nondeterministic model of pedestrians arriving at a crosswalk: Formally, the update function is replaced by a function - 14-7

Uses of nondeterminism 1. Modeling unknown aspects of the environment or system 2. Hiding detail in a specification of the system - 15 - Non-deterministic Behavior: Tree of Computations For a fixed input sequence: A deterministic system exhibits a single behavior A non-deterministic system exhibits a set of behaviors Deterministic FSM behavior for a particular input sequence:............... Non-deterministic FSM behavior for an input sequence: - 16-8

Behaviors and Traces FSM behavior is a sequence of (non-stuttering) steps. A trace is the record of inputs, states, and outputs in a behavior. A computation tree is a graphical representation of all possible traces. FSMs are suitable for formal analysis. For example, safety analysis might show that some unsafe state is not reachable. - 17 - It is sometimes useful to even model continuous systems as FSMs by discretizing their state space. - 18-9

Continuous System Lee/Seshia, Chapter 4 Discrete System (FSM) Hybrid System jump flow - 19 - Where do Hybrid Systems arise? Digital controller of physical plant o thermostat o intelligent cruise control in cars o aircraft auto pilot Phased operation of natural phenomena o bouncing ball o biological cell growth Multi-agent systems o ground and air transportation systems o interacting robots - 20-10

FSM with continous-time input - 21 - State refinement: continuous output - 22-11

Timed automata A clock is a continous-time signal s with constant rate while the system is in some mode m Timed automata are FSMs extended with clocks. - 23 - Example: Mouse Double Click Detector - 24-12

Example: Mouse Double Click Detector How many states does this automaton have? - 25 - Timed automaton model of a traffic light controller This light remains green at least 60 seconds, and then turns yellow if a pedestrian has requested a crossing. It then remains red for 60 seconds. - 26-13

Example: Tick Generator (Timer) How would you model a timer that generates a tick each time T time units elapse? - 27 - Hybrid Automaton for Bouncing Ball y vertical distance from ground (position) a coefficient of restitution, 0 < a < 1 If you plotted y(t), what would it look like? - 28-14

Hybrid Automaton for Bouncing Ball y vertical distance from ground (position) a coefficient of restitution, 0 a 1-29 - Sticky Masses - 30-15

- 31 - StateCharts Additional features compared to FSMs Hierarchy Concurrency - 32-16

StateCharts Statecharts introduced in Harel: StateCharts: A visual formalism for complex systems. Science of Computer Programming, 1987. More detailed in Drusinsky and Harel: Using statecharts for hardware desription and synthesis, IEEE Trans. On Computer Design, 1989. Formal semantics in Harel, Naamad: The statemate semantics of statecharts, ACM Trans. Soft. Eng. Methods, 1996. many variations of the semantics implemented in tools - 33 - Non-deterministic transitions Edge label (simple version): A f/g B Transition from A to B iff event f is present. Effect of transition from A to B: Event g is produced. Events may be External events (provided by the environment) Internal events (produced by internal transitions) Produced events exist only for one step. - 34-17

Introducing hierarchy FSM will be in exactly one of the substates of S if S is active (either in A or in B or..) superstate substates - 35 - Definitions Current states of FSMs are also called active states. States which are not composed of other states are called basic states. States containing other states are called super-states. For each basic state s, the super-states containing s are called ancestor states. Super-states S are called OR-super-states, if exactly one of the sub-states of S is active whenever S is active. ancestor state of E - 36-18

Hierarchy Statechart SC Hierachy information may be represented by a hierarchy tree with basic states as leaves. S SC A B C D E Z Transitions between all levels of hierarchy possible! When a basic state is active, then all its ancestor states are active, too. - 37 - Hierarchy - transitions to super-states What is the meaning of transitions to superstates, i.e., what basic state is entered when a superstate is entered? default state mechanism history mechanism - 40-19

Default state mechanism Filled circle indicates sub-state entered whenever superstate is entered. Not a state by itself! Allows internal structure to be hidden for outside world - 41 - History mechanism For event m, S enters the state it was in before S was left (can be A, B, C, D, or E). If S is entered for the very first time, the default mechanism applies. - 42-20

History and default state mechanism History and default mechanisms may be used at different levels of hierarchy. - 43 - History and deep history S Default states Active states DC ID CO OP H History connectors remember states at the same level as the history connector! SL FA - 44-21

History and deep history Default states Active states DC S ID CO SL remembers OP What state is entered H after sequence SENSOR_DISCONNECTED, SENSOR_CONNECTED? OP FA - 45 - History and deep history * S Default states Active states DC ID CO OP H* Deep history connectors H* remember basic states! SL FA - 46-22

History and deep history * Default states Active states DC S ID CO SL remembers OP, FA What state is entered H* after sequence SENSOR_DISCONNECTED, SENSOR_CONNECTED? OP FA - 47 - Variables with complex data types Similar to extended FSMs: Include typed variables (e.g. integers, reals, strings, records) to represent data Both graphical states and variables contribute to the state of the statechart. Notation: graphical states = states graphical states + variables = status - 48-23

Events and variables Events: Exist only until the next evaluation of the model Can be either internally or externally generated Variables: Values of variables keep their value until they are reassigned. - 49 - General form of edge labels event [condition] / action Meaning: Transition may be taken, if event occurred in last step and condition is true If transition is taken, then reaction is carried out. Conditions: Refer to values of variables Actions: Can either be assignments for variables or creation of events Example: a & [x = 1023] / overflow; x:=0-50 - 24

Events, conditions, actions Possible events (incomplete list): Atomic events Basic events: A, B, BUTTON_PRESSED Entering, exiting a state: en(s), ex(s) Condition test: [cond], e.g. [X>5] Timeout events: tm (e,d): event tm(e,d) is emitted d time units after event e has occurred Compound events: logical connectives and, or, not Possible conditions (incomplete list): Atomic conditions Constants: true, false Condition variables (i.e. variables of type boolean) Relations between values: X > 1023, X Y Residing in a state: in(s) Compound events: logical connectives and, or, not - 51 - Events, conditions, actions Possible actions (incomplete list): Atomic actions Emitting events: E (E is event variable) Assignments: X := expression Scheduled actions: sc!(a, N) (means perform action after N time units) Compound actions List of actions: A1; A2; A3 Conditional action: if cond then A1 else A2-52 - 25

Concurrency AND-super-states: FSM is in all (immediate) substates of a AND-super-state; Example: - 53 - Concurrency Example for active states: answ. Default states off on AND-super-state Active states l-m. k-m. L.w. L.p. K.w. K.p. - 54-26

Benefits of AND-decomposition - 55 - Entering and leaving AND-super-states incl. Line-monitoring and key-monitoring are entered and left, when key-on and key-off events occur. - 56-27

Types of states In StateCharts, states are either basic states, or AND-super-states, or OR-super-states. - 57 - Timers In StateCharts, special edges can be used for timeouts. If event a does not happen while the system is in the left state for 20 ms, a timeout will take place. - 58-28

Using timers in answering machine - 59 - Condition connector - 60-29

Connectors Example: Traffic light control with two programs - 61 - Join and Fork Connectors - 62-30

Compound transitions t1 and t2 must be executed together - 63-31