Modeling Hybrid Systems Yerang Hur CIS 640, October 10, 2002 Department of Computer and Information Science University of Pennsylvania Code generation.

Slides:



Advertisements
Similar presentations
Integration of MBSE and Virtual Engineering for Detailed Design
Advertisements

INTRODUCTION TO SIMULATION WITH OMNET++ José Daniel García Sánchez ARCOS Group – University Carlos III of Madrid.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
CS 290C: Formal Models for Web Software Lecture 4: Implementing and Verifying Statecharts Specifications Using the Spin Model Checker Instructor: Tevfik.
Timed Automata.
Model Checker In-The-Loop Flavio Lerda, Edmund M. Clarke Computer Science Department Jim Kapinski, Bruce H. Krogh Electrical & Computer Engineering MURI.
ECE 720T5 Fall 2012 Cyber-Physical Systems Rodolfo Pellizzoni.
Semantic Translation of Simulink/Stateflow Models to Hybrid Automata using Graph Transformations A. Agarwal, Gy. Simon, G. Karsai ISIS, Vanderbilt University.
MotoHawk Training Model-Based Design of Embedded Systems.
Modular Specification of Hybrid Systems in CHARON R. Alur, R. Grosu, Y. Hur, V. Kumar, I. Lee University of Pennsylvania SDRL and GRASP.
Modeling and Verification of Embedded Software Rajeev Alur POPL Mentoring Workshop, Jan 2012 University of Pennsylvania.
SSP Re-hosting System Development: CLBM Overview and Module Recognition SSP Team Department of ECE Stevens Institute of Technology Presented by Hongbing.
7M701 1 Software Engineering Object-oriented Design Sommerville, Ian (2001) Software Engineering, 6 th edition: Chapter 12 )
Integrated Design and Analysis Tools for Software-Based Control Systems Shankar Sastry (PI) Tom Henzinger Edward Lee University of California, Berkeley.
System Design Research Lab University of Pennylvania 2/8/2006 CHARON modeling language.
EECE Hybrid and Embedded Systems: Computation T. John Koo, Ph.D. Institute for Software Integrated Systems Department of Electrical Engineering and.
SDRL and GRASP University of Pennsylvania 6/27/00 MoBIES 1 Design, Implementation, and Validation of Embedded Software (DIVES) Contract No. F C-1707.
From Hybrid Models to Embedded Software Rajeev Alur System Design Research Lab University of Pennsylvania Workshop on Robustness,
University of Pennsylvania 1 SDRL CHARON SDRL and GRASP University of Pennsylvania Funded by DARPA ITO.
EECE Hybrid and Embedded Systems: Computation
Design of Fault Tolerant Data Flow in Ptolemy II Mark McKelvin EE290 N, Fall 2004 Final Project.
©Ian Sommerville 2006Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
Introduction What is this ? What is this ? This project is a part of a scientific research in machine learning, whose objective is to develop a system,
Ch5: Software Specification. 1 Overview  Use of specifications  Specification qualities  Classification of specification styles  Verification of specifications.
Designing Predictable and Robust Systems Tom Henzinger UC Berkeley and EPFL.
DIVES Alur, Lee, Kumar, Pappas: University of Pennsylvania  Charon: high-level modeling language and a design environment reflecting the current state.
Testing and Monitoring at Penn An Integrated Framework for Validating Model-based Embedded Software Li Tan University of Pennsylvania September, 2003.
Tool Integration of Ptolemy II EE290N Class Project Haiyang Zheng May
MOBIES Project Progress Report Engine Throttle Controller Design Using Multiple Models of Computation Edward Lee Haiyang Zheng with thanks to Ptolemy Group.
Code Generation from CHARON Rajeev Alur, Yerang Hur, Franjo Ivancic, Jesung Kim, Insup Lee, and Oleg Sokolsky University of Pennsylvania.
SE-565 Software System Requirements More UML Diagrams.
Object-oriented design CS 345 September 20,2002. Unavoidable Complexity Many software systems are very complex: –Many developers –Ongoing lifespan –Large.
Architectural Design Establishing the overall structure of a software system Objectives To introduce architectural design and to discuss its importance.
Basic Concepts The Unified Modeling Language (UML) SYSC System Analysis and Design.
Katanosh Morovat.   This concept is a formal approach for identifying the rules that encapsulate the structure, constraint, and control of the operation.
Chapter 6 System Engineering - Computer-based system - System engineering process - “Business process” engineering - Product engineering (Source: Pressman,
(C) 2009 J. M. Garrido1 Object Oriented Simulation with Java.
ECE 720T5 Winter 2014 Cyber-Physical Systems Rodolfo Pellizzoni.
Mathematical Modeling and Formal Specification Languages CIS 376 Bruce R. Maxim UM-Dearborn.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 10Slide 1 Architectural Design l Establishing the overall structure of a software system.
Unified Modeling Language, Version 2.0
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. C How To Program - 4th edition Deitels Class 05 University.
SOFTWARE DESIGN (SWD) Instructor: Dr. Hany H. Ammar
SOFTWARE DESIGN.
- 1 - Embedded Systems - SDL Some general properties of languages 1. Synchronous vs. asynchronous languages Description of several processes in many languages.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Modeling Shari L. Pfleeger and Joanne M. Atlee, Software Engineering: Theory and Practice, 4 th edition, Prentice Hall, Hans Van Vliet, Software.
Lyra – A service-oriented and component-based method for the development of communicating systems (by Sari Leppänen, Nokia/NRC) Traditionally, the design,
System Design Research Lab University of Pennylvania 1/29/2002 CHARON modeling language.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHSIC Hardware Description Language  Required Reading: –These Slides –VHDL Tutorial  Very High Speed.
SOFTWARE DESIGN. INTRODUCTION There are 3 distinct types of activities in design 1.External design 2.Architectural design 3.Detailed design Architectural.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
1 Model Checking of Robotic Control Systems Presenting: Sebastian Scherer Authors: Sebastian Scherer, Flavio Lerda, and Edmund M. Clarke.
Abstract A Structured Approach for Modular Design: A Plug and Play Middleware for Sensory Modules, Actuation Platforms, Task Descriptions and Implementations.
Week 04 Object Oriented Analysis and Designing. What is a model? A model is quicker and easier to build A model can be used in simulations, to learn more.
Course: COMS-E6125 Professor: Gail E. Kaiser Student: Shanghao Li (sl2967)
Title 11/5/2000 eSimplex Architecture Using MaCS Insup Lee Oleg Sokolsky Moonjoo Kim Anirban Majumdar Sampath Kannan Mahesh Viswanathan Insik Shin and.
CS 351/ IT 351 Modeling and Simulation Technologies Review ( ) Dr. Jim Holten.
Introduction to Simulink Matlab based Both Continuous Time and Discrete Time Simulation Based on Blocksets Model Based Design: a software model of the.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Software Systems Verification and Validation Laboratory Assignment 4 Model checking Assignment date: Lab 4 Delivery date: Lab 4, 5.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Slide 1 Chapter 8 Architectural Design. Slide 2 Topics covered l System structuring l Control models l Modular decomposition l Domain-specific architectures.
Slide 1 Unified Modeling Language, Version 2.0 Object-Oriented SAD.
Autonomous Cyber-Physical Systems: Dynamical Systems
Component-Level Design
Compositional Refinement for Hierarchical Hybrid Systems
CHARON modeling language
Presentation transcript:

Modeling Hybrid Systems Yerang Hur CIS 640, October 10, 2002 Department of Computer and Information Science University of Pennsylvania Code generation demo: Jesung Kim Some slides are edited from previous slides made together with others in Hybrid Systems Group.

Outline Hybrid Systems Simulink State-machine-based Representation C HARON Framework C HARON Language Examples Tool Demo

Hybrid Systems Differential equations Algebraic equations Invariant constraints Collisions Decision logic Discrete communication (send/receive) Guarded transitions between modes Represented with Physical processes in control system e.g. robots, aircraft,... Continuous BehaviorsDiscrete Events

Hybrid Systems - two views Control engineering-oriented view discrete control command generator dynamical system reference output

Hybrid Systems - two views (con’t) Computer scientist-oriented view - State machine embedding dynamics dx/dt=f(x)dx/dt=g(x) guard reset x - Continuous state variables with discrete state variables guard reset x cont x disc y dx/dt=f(x,y) Y=1update y cont x disc y dx/dt=g(x,y)

Simulink system block diagram sources sinks Elements of Simulink model Simulink is block diagram-based notations for modeling dynamical systems.

Simulink (cont’d) Blocks for representing continuous components State-Space Block Gain Block k yx : algebraic equation y=kx Sum Block Derivative Block Integrator Block a b c : algebraic equation c=a-b + - du/dt xy : differential equation y=dx/dt  x Y: Y = y 0 +  x(t)dt X=Ax+Bu Y=Cx+Du y u.

Simulink (cont’d) Hybrid system representation - +Kp Ki Kd zero order holder discrete time integrator derivative approximation physical plant reference

State-machine-based Representation x > 80.0 x < 70.0 x := 73.0 Thermostat On x>=82.0 dx/dt=-x+100 Off 68.0<=x dx/dt=-x

Framework for Developing Hybrid System 1. High-level modeling platform independent hierarchical and modular –parallel composition of agents –specify modes and constraints –sequential composition of modes 2. Simulation, analysis, and automatic code generation 3. Deploy the code on actual target platform

C HARON Framework C HARON Code (High level language) Java Code C HARON to Java Translator Control Code Generator Java Libraries Human Interface Analysis Simulator Generator Drivers

C HARON Language Individual components described as agents Composition, Instantiation, and Hiding Individual behaviors described as modes Encapsulation, Instantiation, and Scoping of variables Shared variables as well as message passing Support for discrete and continuous behavior Well-defined formal semantics

Example: TwoAgent mode0 mode1 Mode choppy ATop a1 a2 Agent TwoAgentA top (10.0,0.0) (9.0,-1.0) Architectural Hierarchy Behavioral Hierarchy

Example: TwoAgent mode0 mode1 Mode choppy ATop a1 a2 Agent TwoAgentA top (10.0,0.0) (9.0,-1.0) agent TwoAgent() { private analog real v1,v2; agent a1 = A (10.0, 0.0) [vIn, vOut := v2, v1] ; agent a2 = A (9.0, -1.0) [vIn, vOut := v1, v2] ; } agent A(real initValue, real c) { read analog real vIn ; write analog real vOut ; mode top=Atop(initValue,c) ; } mode Atop(real iVal, real c) { read analog real vIn ; write analog real vOut ; mode mode0=choppy(2.0,-50.0,c); mode mode1=choppy(2.0,1.0,c) ; trans initTrans from default to mode0 when true do {vOut=iVal} …

Modes of Agent A1 ATop write analog real v1 write discrete int p1 inv invChoppy {v1>0.0} diff fv1 {d(v1)==2.0*v c } mode0mode1 write analog real v1 write discrete int p1 inv invChoppy {v1>0.0} diff fv1 {d(v1)==2.0*v1+1.0+c } v1<8.0 && |v1-v2|>1.1 v1>12.0 && |v1-v2|>1.0 transition guard: g1 mode name variable declaration dynamics invariant: flow constraint do {p1:=1} do {p1:=0}

Architectural Hierarchy Robots Monitor pos 1 pos 2 write analog position pos 1, pos 2 class position {double x; double y;} Variable Specifiers Update: discrete/analog I/O interface: read/write/private

Architectural Hierarchy Robot 1 Robots Robot 2 pos 1 pos 2 r1Est 1 r1Est 2 r2Est 1 r2Est 2 Robots Monitor pos 1 pos 2

Behavioral Hierarchy pos r2Est 1 r2Est 2 r1Est 1 r1Est 2 Robot 1 dTimer timer == 1. private analog real timer awTarget dPlan iAway atTarget dStop iAt arrive pos == target moving dSteer aOmega iFreq sensing dStop iConst sense move arrive timer/updateFreq == 0 omega == k * (theta – phi) pos.x == v * cos(phi) pos.y == v * sin(phi)..

Example: the Simplex Architecture- based Inverted Pendulum Safety Controller Baseline Controller Experimental Controller Decision Module Physical System usus ubub ueue xu Safety Controller Baseline Controller Experimental Controller x0x0 Equilibrium state

The Inverted Pendulum m l  x g M ufuf

Control Task and C HARON Description Control objective: to move the cart from one position to a desired target position x t maintaining the pendulum at the upright position. Planner: generates a set point x s every T seconds with rate c until the generated set point reaches the target position. Lower level: stabilizes the system about [ x s, 0, 0, 0 ]

Controllers

Physical System

Decision Module

Simulation Results Sampling Frequency 50Hz Maximum Position Tracking Error : 0.17m < 0.2m Initial Position : 0.0 Initial Cart Velocity : 0.0 m/s Initial Angle : 5.0 deg Initial Angular Velocity : 0.0 deg/s Maximum Control Value : 3.78V < 4.96V Maximum Cart Velocity : 0.32m/s < 1.0m/s Maximum Angle : 5.0 deg< 10.0 deg

C HARON Simulator Generation Process C HARON model Agent and Mode generator Simulator main generator Agents Modes Simulator main Trace Plotter Trace generator User-defined external classes Numerical integrator Differential Equations Invariants Algebraic Equations Guards Actions Assertions

Wrap-up: Two Worlds Affect Each Other - Simulink is augemented with a hierarchical state machine. We call it Simulink/Stateflow. - Among other design tools of interest are Ptolemy II with continuous time domain, S HIFT /Teja, Modelica, and RT-UML. - Controllers/Decision Module/Physical system case study in C HARON : E.g. the Simplex-Architecture-based inverted pendulum controller[RTSSWIP 2000] and autonomous distributed multi-robots.

Wrap-up: Features of C HARON - Discrete event/discrete state representation: discrete int/bool - Discrete event/continuous state representation: discrete real - Continuous time/continuous state representation: analog real - Behavior description: mode with hierarchy - Architecture description: agent with hierarchy -Structured modern programming language : variable scoping, type-checking rules, formal semantics

Wrap-up: Features of C HARON (cont’d) - Software engineering tool : reusable agent/mode definition, : simulator generator, verification tool box, code generator - Non-determinism : non-deterministic execution of agents when more than one agent observe enabled transitions at once, currently interleaving semantics : non-deterministic choice of transitions when more than one transitions are enabled at once, currently randomly selected or user-guided : non-deterministic non-urgent jump when a guard is enabled while the invariant is not violated, currently probabilistically taken and 80/20 rule is embedded : non-deterministic differential and algebraic constraints with inequalities, currently only front-end supports this

Wrap-up: Interface Qualifiers of Agent Variables Input from environment: input (v0.1) --> read (v0.37) Output to environment: output (v0.1) --> write (v0.37) --> write/readwrite (v0.4) --> write exclusive/write shared (v0.7) Local private (v0.1) --> hiding operation (v0.12) --> private (v0.6)

Wrap-up: Other Type Qualifiers Update Qualifiers: analog for continuous update or reset discrete for discrete update Channel Qualifiers: buffered non-blocking communication channel combined with buffer size, message type, buffer management policy Example: write channel [2] of real cold chan1;

Tool Demo For manuals and more examples, visit