Presentation is loading. Please wait.

Presentation is loading. Please wait.

CIS 540 Principles of Embedded Computation Spring 2015 Instructor: Rajeev Alur

Similar presentations


Presentation on theme: "CIS 540 Principles of Embedded Computation Spring 2015 Instructor: Rajeev Alur"— Presentation transcript:

1 CIS 540 Principles of Embedded Computation Spring 2015 http://www.seas.upenn.edu/~cis540/ Instructor: Rajeev Alur alur@cis.upenn.edu

2 Dynamical Systems  Controller interacting with the physical world via sensors and actuators  Thermostat controlling temperature  Cruise controller regulating speed of a car  Variables: Physical quantities evolving continuously over time  Temperature, pressure, velocity …  Continuous-time models using differential equations CIS 540 Spring 2015; Lecture March 30

3 Model-Based Design  Block Diagrams  Widely used in industrial design  Tools: Simulink, Modelica, RationalRose…  Key question: what is the execution semantics?  Similar to synchronous model, but continuous-time instead of discrete-time CIS 540 Spring 2015; Lecture March 30

4 Traditional Feedback Control Loop Plant Controller ActuatorsSensors CIS 540 Spring 2015; Lecture March 30

5 Example: Heat Flow  Input variables: h in and h out of type real h net = h in - h out  Output variable: h net of type real  No state variables  Signal: assignment of values to variables as function of time t  At each time t, value of output signal h net (t) equals h in (t) – h out (t)  Output as a function of inputs/state specified using algebraic equations (as opposed to assignments) h net h in h out CIS 540 Spring 2015; Lecture March 30

6 Car Model Position x Velocity v Force F Friction k v Newton’s law of motion gives F – kv = m d 2 x/dt CIS 540 Spring 2015; Lecture March 30

7 Continuous-time Component Car v F dx = v; dv = (F - kv) / m; real x L <= x <= x U ; v L <= v <= v U  For each state variable x, its rate of change dx/dt defined using an expression over input and state variables  For each output variable, its value is defined using an expression over input and state variables. CIS 540 Spring 2015; Lecture March 30

8 Executions of Car  Input signal: Function F(t) : real >=0 -> real that gives value of Force as a function of time  Should be continuous or piecewise-continuous  Given an initial state (x 0, v 0 ) and input signal F(t), the execution of the system is defined by state-signals x(t) and v(t) (from real >=0 to real) that satisfy the initial-value problem:  x(0) = x 0 ; v(0) = v 0  dx(t)/dt = v(t)  dv(t)/dt = (F(t) – k v(t)) / m CIS 540 Spring 2015; Lecture March 30

9 Executions of Car: Example 1  Suppose force is always 0, and initial position is 0. Then, we need to solve:  x(0) = 0; v(0) = v 0  dx(t)/dt = v(t)  dv(t)/dt = – k v(t) / m  Velocity decreases exponentially converging to 0 v(t) = v 0 exp (-kt/ m)  Position converges to mv 0 /k x(t) = (m v 0 / k) [ 1 – exp (-kt/m) ] CIS 540 Spring 2015; Lecture March 30

10 Executions of Car: Example 2  Suppose initial position is 0, initial velocity is 0, and force is constant F 0. Then, to get executions, we need to solve:  x(0) = 0; v(0) = 0  dx(t)/dt = v(t)  dv(t)/dt = (F 0 – k v(t)) / m  Compute the solution using MATLAB  Mass m = 1000kg  Coefficient of friction k =50  Force F 0 = 500 Newton  Velocity converges to 10 m/s CIS 540 Spring 2015; Lecture March 30

11 Definition: Continuous-Time Component  Set I of real-valued input variables  Type is either real or interval of real, real[L, U]  Set O of real-valued output variables  Set S of real-valued state variables  Initialization Init specifying set [Init] of initial states  For each output var y, a real-valued expression h y over I U S  For each state variable x, a real-valued expression f x over I U S  Given an input-signal I(t) : real >=0 -> real |I|, an execution consists of a differentiable state signal S(t) and output signal O(t) such that 1. S(0) is in [Init] 2.For each output var y and time t, y(t) = h y (I(t), S(t)) 3.For each state var x, (d/dt) (x(t)) = f x (I(t), S(t)) CIS 540 Spring 2015; Lecture March 30

12 Existence and Uniqueness  Given an input signal I(t), when are we guaranteed that the system has at least one execution? Exactly one execution?  The input signal should be continuous (or at least piecewise continuous), but also depends on right-hand-sides of equations defining state and output dynamics  Related to classical theory of ODEs (Ordinary Differential Equations)  Consider the initial value problem dx/dt = f(x); x(0) = x 0, x is k-dimensional signal  When does there exist a unique differentiable function x(t) as a solution? CIS 540 Spring 2015; Lecture March 30

13 Existence  Consider the initial value problem dx/dt = f(x); x(0) = x 0, x is k-dimensional signal  There exists at least one solution x(t) if the function f is a continuous function  Definition of continuity relies on definition of distance between points (e.g. Euclidean distance)  The function f is (uniformly) continuous if for all  >0, there exists  > 0 such that for all u,v in real k, if ||u-v||<  then ||f(u)-f(v)|| <   Example when solution does not exist: dx/dt = if (x=0) then 1 else 0  Natural to require all right-hand-side expressions h y and f x in definition of a continuous-time component to be continuous  Discontinuous case -> Hybrid Systems CIS 540 Spring 2015; Lecture March 30

14 Uniqueness  Consider the initial value problem dx/dt = f(x); x(0) = x 0, x is k-dimensional signal  Cauchy-Lipschitz Theorem of Calculus: There exists a unique solution x(t) if the function f is Lipschitz-continuous  Informally, Lipschitz-continuous means there is a constant upper bound on how fast a function changes  Function f is Lipschitz-continuous if there exists a constant K such that for all u, v in real k, ||f(u) – f(v)|| <= K ||u-v||  Examples:  A linear function such as (F – kv)/m is Lipschitz-cont  Quadratic function x 2 ? Lipschitz-cont if domain of x is bounded  x 1/3 is not Lipschitz-cont: dx/dt=x 1/3 ; x(0)=0 has multiple solutions  x(t) = 0  x(t) = (2t/3) 3/2 CIS 540 Spring 2015; Lecture March 30

15 Lipschitz Continuous Component  A continuous-time component has Lipschitz-continuous dynamics if  Each expression h y corresponding to output variable y is a Lipschitz-continuous function of I U S  Each expression f x corresponding to state variable x is a Lipschitz- continuous function over I U S  If we supply a Lipschitz continuous component with a continuous input signal I(t), then it has a unique response signals S(t) and O(t), both of which are continuous  Note: Continuity of output signals means these can be fed to other components in a block diagram  Henceforth, we will assume all components are Lipschitz continuous CIS 540 Spring 2015; Lecture March 30

16 Car on a graded road Position x Velocity v Force F Friction k v Newton’s law of motion gives F – kv – mg sin  = m d 2 x/dt Angle  Weight mg CIS 540 Spring 2015; Lecture March 30

17 Continuous-time Component Car2 v F dx = v; dv = (F – kv - mg sin  ) / m; real x L <= x <= x U ; v L <= v <= v U  The grade of the road, denoted , models disturbance, or an uncontrolled input  Design problem: Find a controller with v as input and F as output such that composed system works correctly for all continuous input signals  (t) with  (t) always in [-  /6,  /6]  CIS 540 Spring 2015; Lecture March 30

18 Simple Pendulum  External torque applied by the motor at the pivot: u  Dynamics captured by the second-order non-linear differential eqn: m l 2 (d 2 /dt)  = u – mg l sin  Length l Torque u Weight mg Displacement  mg sin  CIS 540 Spring 2015; Lecture March 30

19 Pendulum Model  u d  = ; d = -(g/l) sin  + u/ (ml 2 ); real -  <=  <  ; = 0 CIS 540 Spring 2015; Lecture March 30

20 Angular Displacement  External torque = 0; Initial displacement =  /4  Oscillatory motion plotted by MATLAB  What are equilibria of this pendulum ? CIS 540 Spring 2015; Lecture March 30

21 Stability of Dynamical Systems  Key correctness requirement for dynamical systems: stability  Small perturbations in the input values should not cause disproportionately large changes in the outputs  For cruise controller, correctness requirements:  Safety: Speed should always be within certain threshold values  Liveness: Actual speed should eventually get close to desired speed  Stability: If grade of the road changes, speed should change only slowly  Classical mathematical formalization of stability:  Lyapunov stability of equilibria  Bounded-Input-Bounded-Output stability of response CIS 540 Spring 2015; Lecture March 30

22 Equilibria of Dynamical Systems  Consider a closed (i.e. without inputs) continuous-time component H  If H has inputs, then we can analyze equilibria by setting inputs to a fixed value  Assume state x is k-dimensional, and dynamics is Lipschitz- continuous given by dx/dt = f(x)  A state x e is called an equilibrium of H if f(x e ) = 0  If initial state of H equals an equilibrium state x e, then the system stays in this state at all times CIS 540 Spring 2015; Lecture March 30

23 Pendulum Equilibria Dynamics when external torque is 0: d  = ; d = - g sin  / l Length l Torque u Weight mg Displacement  mg sin  Equilibrium states: =0; sin  =0 Equilibrium state 1: =0;  =0; Pendulum is vertically downwards Equilibrium state 2: =0;  =-  ; Pendulum is vertically upwards CIS 540 Spring 2015; Lecture March 30


Download ppt "CIS 540 Principles of Embedded Computation Spring 2015 Instructor: Rajeev Alur"

Similar presentations


Ads by Google