# Embedded Systems ECEC 356 – Fall 2014 - PowerPoint PPT Presentation

Embedded Systems ECEC 356 – Fall 2014

1 / 31
Embedded Systems ECEC 356 – Fall 2014

## Embedded Systems ECEC 356 – Fall 2014

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

1. Embedded SystemsECEC 356 – Fall 2014 • Chapter 4: Extended State Machines and Hybrid Automata • Chapter 5: Composition of machines Andrew R. Cohen 10/14/2014

2. Last time • - what’s on the test? You tell me… • Today • - review (1-4, etc) • - start chapter 5 • - hw3 due • - Next time • - exam 1

3. Example: Mouse Double Click Detector This simple form of hybrid system is called a timed automaton, where the dynamics is just passage of time.

4. Example: Mouse Double Click Detector • How many states does this automaton have?

5. 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.

6. Example: “Tick” Generator (Timer) • How would you model a timer that generates a ‘tick’ • each time T time units elapses? • A similar timed automaton can model a generator • of a timer interrupt.

7. 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?

8. Hybrid Automaton for Bouncing Ball • y – vertical distance from ground (position) • a – coefficient of restitution, 0 ·a· 1

9. When do reactions occur in a hybrid automaton? • Reactions are occurring continually, with the continuous state variable x being continually updated.

10. When do reactions occur in a hybrid automaton? • Suppose x and y are discrete and pure signals. When does the transition occur? • Answer: at the earliest time t when x is absent after entering s1.This will always be the same time when s1 is entered. Why? • If x is absent when s1 is entered, then the transition is taken then.If x is present when s1 is entered, then it will be absent at a timeinfinitesimally larger. How to model this rigorously?

11. Example: Newton’s Cradle • Image src: Wikipedia Commons • A middle ball does not move, so its momentum must be 0. • But the momentum of the first ball is transferred somehow to the fifth. So there is an instant at which it is non-zero!

12. Sneak Preview: Super-Dense Time • We will solve this problem by modeling signals as functions of super-dense time: • In this way, x can be present and absent at the same time, with a well-defined order between its presence and absence.

13. Chapter 5 – composition of state machines

14. Modeling with State Machines • Questions: • How to represent the system for: • Systematic analysis • So that a computer program can manipulate it • How to model its environment • How to compose subsystems to make bigger systems • How to check whether the system satisfies its specification in its operating environment

15. Notation for Extended State Machines

16. Actor Model for State Machines • Expose inputs and outputs, enabling composition:

17. Composition of State Machines • Side-by-side composition • Cascade composition • Feedback composition

18. Side-by-Side Composition A key question: When do these machines react? Two possibilities: • Together (synchronous composition) • Independently (asynchronous composition)

19. Note that these two states are not reachable. Synchronous Composition Synchronous composition

20. Asynchronous composition using interleaving semantics Asynchronous Composition Note that now all states are reachable.

21. Syntax vs. Semantics Synchronous or Asynchronous composition? If asynchronous, does it allow simultaneous transitions in A & B?

22. Asynchronous composition is not synchronous composition with stuttering transitions. Stuttering is a reaction where no output is produced and the state is not changed. Synchronous composition These two FSMs cannot stutter. If they react, they change state.

23. Asynchronous composition is not synchronous composition with stuttering transitions. Stuttering is a reaction where no output is produced and the state is not changed. Asynchronous composition with interleaving semantics These two FSMs cannot stutter. If they react, they change state.

24. Side-by-Side Synchronous Composition

25. Asynchronous Composition • M1 = (S1, I1, O1, U1, s10) and M2 = (S2, I2, O2, U2, s20) • M is the asynchronous composition of M1 and M2 • = (S1× S2, I1× I2, O1× O2, U, (s10, s20)) • where • U((s1, s2), (i1, i2)) = ((s1’, s2’), (o1, o2)) • and • (s1’, o1) = U1(s1, i1) AND s2’ = s2 & o2 is absent • OR (s2’, o2) = U2(s2, i2) AND s1’ = s1 & o1 is absent (note interleaving semantics)

26. Cascade Composition A B Output port(s) of A connected to input port(s) of B

27. Example: Pedestrian Light This light stays green for 55 seconds, then goes red. Upon receiving a sigR input, it repeats the cycle.

28. Example: Car Light

29. Pedestrian Light with Car Light sigY sigG sigR sigR pedG What is the size of the state space of the composite machine? pedR

30. Homework • Exam 1 – Thursday 10/16/2014 • Chapters 1-4 of L&S, Appendix A • All material from lab • Open book / notes – NO ELECTRONIC DEVICES • Next Week • Chapter 5 – composition of state machines

31. Instructor Contact Information Andrew R. Cohen Associate Prof. Department of Electrical and Computer Engineering Drexel University 3120 – 40 Market St., Suite 110 Philadelphia, PA 19104 office phone: (215) 571 – 4358 http://bioimage.coe.drexel.edu/courses acohen@coe.drexel.edu