cis 4930 6930 principles of cyber physical systems
play

CIS 4930/6930: Principles of Cyber-Physical Systems Chapter 5: - PowerPoint PPT Presentation

CIS 4930/6930: Principles of Cyber-Physical Systems Chapter 5: Composition of State Machines Hao Zheng Department of Computer Science and Engineering University of South Florida H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 1 / 28


  1. CIS 4930/6930: Principles of Cyber-Physical Systems Chapter 5: Composition of State Machines Hao Zheng Department of Computer Science and Engineering University of South Florida H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 1 / 28

  2. Introduction • State machines are useful for modeling system behaviors. • How to represent a system for systematic analysis? • Complete systems though often have a very large state space. • Can represent complicated system as composition of simpler systems. • Modular approaches are always needed to handle large complex problems. • Care must be taken though as the same syntax (model notation) often has different semantics (meaning). H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 2 / 28

  3. Actor Model and Extended SM Notation i 1 o 1 ... ... o m i n H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 3 / 28

  4. Overview • Side-by-side synchronous composition (simultaneous reactions). • Side-by-side asynchronous composition (independent reactions). • Communication through shared variables. • Cascade (serial) composition. • General composition that combines side-by-side and cascade. • Hierarchical state machines. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 4 / 28

  5. Side-by-side Composition H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 5 / 28

  6. Side-by-side Composition Example H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 6 / 28

  7. Synchronous Side-by-side Composition = ( States A , Inputs A , Outputs A , update A , initialState A ) A = ( States B , Inputs B , Outputs B , update B , initialState B ) B The synchronous side-by-side composition C is given by: = States C States A × States B = Inputs C Inputs A × Inputs B = Outputs C Outputs A × Outputs B = ( initialState A , initialState B ) initialState C (( s ′ A , s ′ update C (( s A , s B ) , ( i A , i B )) = B ) , ( o A , o B )) where ( s ′ A , o A ) = update A ( s A , i A ) ( s ′ B , o B ) = update B ( s B , i B ) for all s A ∈ States A , s B ∈ States B , i A ∈ Inputs A , and i B ∈ Inputs B . H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 7 / 28

  8. Synchronous Side-by-side Composition H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 8 / 28

  9. Asynchronous Side-by-side Composition • Semantics 1 : a reaction of C is a reaction of one of A or B , where the choice is nondeterministic ( interleaving semantics ). (( s ′ A , s ′ B ) , ( o ′ A , o ′ update C (( s A , s B ) , ( i A , i B )) = B )) where either ( s ′ A , o ′ A ) = update A ( s A , i A ) and s ′ B = s B and o ′ B = absent or ( s ′ B , o ′ B ) = update B ( s B , i B ) and s ′ A = s A and o ′ A = absent for all s A ∈ States A , s B ∈ States B , i A ∈ Inputs A , and i B ∈ Inputs B . • Semantics 2 : a reaction of C is a reaction of A , B , or both A and B , where the choice is nondeterministic. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 9 / 28

  10. Asynchronous Side-by-side Composition H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 10 / 28

  11. Shared Variables • Extended state machines have variables that are read/written by transitions. • These can be shared when composing state machines. • Useful when modeling interrupts and threads. • Ensuring correct semantics though can be challenging. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 11 / 28

  12. Shared Task Queue Example H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 12 / 28

  13. Semantic Subtleties • Interleaving semantics makes accesses to the shared variable atomic. • Tricky to satisfy in practice. • What if both machines react or machines use synchronous semantics? • Leads to non-deterministic outputs. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 13 / 28

  14. Cascade Composition H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 14 / 28

  15. Cascade Composition Example H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 15 / 28

  16. Synchronous Cascade Composition Example H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 16 / 28

  17. A Model of a Pedestrian Crossing Light H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 17 / 28

  18. Traffic Light Model H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 18 / 28

  19. Synchronous Cascade Composition H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 19 / 28

  20. Arbitrary Interconnections of State Machines H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 20 / 28

  21. Hierarchical FSM H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 21 / 28

  22. Semantics of a Hierarchical FSM H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 22 / 28

  23. Preemptive Transition Example H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 23 / 28

  24. Semantics of a Preemptive Transition H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 24 / 28

  25. History Transition Example H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 25 / 28

  26. Semantics of a History Transition H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 26 / 28

  27. Concluding Remarks • Any well-engineered system is a composition of simpler components. • Considered concurrent composition and hierarchical composition. • For concurrent composition, introduced both synchronous and asynchronous composition. • Several possible semantics for asynchronous composition. • Hierarchical models similar to Statecharts introduced by Harel (1987). H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 27 / 28

Recommend


More recommend