lecture 2- state-space modeling...state-space modeling using first-principles lecture 2 principles...

84
State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 1

Upload: others

Post on 27-Apr-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

State-space modeling using first-principles

Lecture 2

Principles of Modeling for Cyber-Physical Systems

Instructor: Madhur Behl

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 1

Page 2: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Download Matlab

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 2

Campus-wide license for MATLAB, Simulink, and companion toolboxes

http://its.virginia.edu/software/matlab.html

Contact [email protected] for questions regarding access to Matlab licenses.

Page 3: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Assignment 1 is out

• Due in 1 week: Thursday, September 5, 2019 by 2pm (EST) [before the lecture]• State-Space modeling w. Matlab• Submission instructions:• Submit on UVA collab. • Upload a single .zip file with the filename

<firstname_lastname_UVA_computing_ID>.zipe.g. madhur_behl_mb2kg.zip

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 3

Page 4: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

In today’s lecture we will learn about…

How to predict the future !

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 4

Page 5: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

In today’s lecture we will learn about…

How to predict the future states and outputs of systems using physics based mathematical modeling

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 5

Page 6: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

In today’s lecture we will learn about…

• Ordinary differential equations (ODEs).• Linear dynamical systems• State-space representation• Elements of first-principles based modeling:• Mechanical and electrical modeling

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 6

Page 7: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

What is a System ?

Cruise control systemAutopilot system

Taxation system

Cardio-pulmonary system

Economic system

Communication system

Governance system

Healthcare system

Tropical storm system

Grading system

Complex system

System of systems

Cyber-Physical systems

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 7

Page 8: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

What is a System ? Intuitive defintion

Non-trivial interactions

Collection of components

Well defined boundary with the environment

Inputs u(t) Outputs y(t)

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 8

Page 9: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

What is a System ?

Mapping from time dependent inputs to time dependent outputs

Inputs u(t) Outputs y(t)

(causal definition)

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 9

Page 10: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Differential equationsMany phenomena can be expressed by equations which involve the rates of change of quantities (position, population, concentraition, temperature…) that describe the state of the phenomena.

Economics Chemistry Mechanics

Engineering Social Science Biology

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 10

Page 11: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

The state of a system describes enough information about the system to determine its future behavior in the absence of any external inputs affecting the system.

The set of possible combinations of state variable values is called the state space of the system.

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 11

Page 12: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Differential equationsThe state of the system is characterized by state variables, which describe the system.

The rate of change is (usually) expressed with respect to time

Economics Chemistry Mechanics

Engineering Social Science Biology

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 12

Page 13: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Differential equations – A simple example

After drinking a cup of coffee, the amount C of caffeine in person’s body follows the differential equation:

!"!# = −&'

Where the constant & has a value of 0.14 hour-1

How many hours will it take to metabolize half of the initial amount of caffeine ?

∫ !"" = −& ∫)* ; ' * = ',-./# ; 01 ' * = ',/2, * = ⁄672 &

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 13

Page 14: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Recall: Differential equations

• Ordinary differential equation (ODE): all derivatives are with respect to single independent variable, often representing time.

• Order of ODE is determined by highest-order derivative of state variable function appearing in ODE.

• ODE with higher-order derivatives can be transformed into equivalent first-order system.

•Most ODE software's are designed to solve only first-order equations.

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 14

Page 15: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Higher order ODE’s

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 15

Page 16: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

What makes a system dynamic ?

Currency ExchangeSystem

USD Euro

$100 €85

$200 €170

$300 €255

Inputs change with time ?

Outputs change with time ?

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 16

Page 17: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Static vs Dynamic Systems

Output is determined only by the current input, reacts instantaneously

Relationship between the inputs and outputs does not change (it is static!)

Relationship is represented by an algebraic equation

Output takes time to react

Relationship changes with time, depends on past inputs and initial conditions (it is dynamic!)

Relationship is represented by a differential equation

Static System Dynamic System

SystemInputs Outputs2 10

2V 10 rad/sec

Motor

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 17

Page 18: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Static vs Dynamic Systems

Static System viewpoint Dynamic System viewpoint

0 0.5 1 1.5 2 2.5 30

50

100

150

200

250

300

350

400

450

500

Mot

or S

peed

Time

0 0.5 1 1.5 2 2.5 30

1

2

3

4

5

6

Mot

or T

orqu

e

Time

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 18

Page 19: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Dynamical System

SystemInputs

Output y(t)Initial State

!"!# = " = &(" # , ) # , #)

""+)(#)

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 19

Page 20: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Dynamical System

!"!# = " = &(" # , ) # , #)

Rate of change

Possibly a non-linear function

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 20

Page 21: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

!"!# = " = &(" # , ) # , #)

Rate of change

Possibly a non-linear function

The state "(#+) at any future time, may be determined exactly given knowledge of

the initial state, "(#,) and the time history of the inputs, )(#) between #, and #+

System order: n, min number of states required for the above statement to be true.

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 21

Page 22: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Inverted pendulum

• Inverted pendulum mounted to a motorized

cart.

• Unstable without control : • pendulum will simply fall over if the cart isn't

moved to balance it.

Balance the inverted pendulum by applying a

force to the cart on which the pendulum is

attached.

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 22

Page 23: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Inverted pendulum

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 23

Page 24: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Inverted pendulum

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 24

Page 25: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

• Initially pendulum begins with ! = #• Requirements:

• Settling time for ! less than 5 secs.• Pendulum angle ! never exceeds 0.05 radians

from the vertical.

.

Inverted pendulum

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 25

Page 26: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

!# + %# + N = FForces in the horizontal direction

' = )# +)*+ cos + − )*0+0 sin +Reaction force N:

Governing equation (1) of this system: Horizontal

(! +))# + %# + )*+ cos + − )*0+0 sin + = F

Inverted pendulum – ODEs

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 26

Page 27: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

−"# sin ' − (# cos ' = ,'Get rid of the P and the N terms:(moment balance equation)

Governing equation (2) of this system: Vertical

, + /#0 ' + /1# sin ' = −/#2 cos '

" sin ' + Ncos ' − /1 sin ' = ml' + /2 cos 'Forces in the vertical direction:

Inverted pendulum - – ODEs

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 27

Page 28: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

cos $ + ∅ ≈ −1

Assuming that the system remains within a small neighborhood of the equilibrium* = $For small deviations ∅:

sin $ + ∅ ≈ −∅*0 = ∅0 ≈ 0

Inverted pendulum

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 28

Page 29: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Equations of motion are:

! + #$% ∅ + #($∅ = #$*

(, +#)* + .* -#$∅ = F

Inverted pendulum - Dynamics

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 29

Page 30: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Rearranging – State-Space representation

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 30

Page 31: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

From State-Space to Space..and back

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 31

Page 32: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

From state-space to Space

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 32

Page 33: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Dynamical System

!"!# = " = &(" # , ) # , #)

Rate of change

Possibly a non-linear function

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 33

Page 34: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Time invariant system: Simplifying assumption #1

!"!# = " = &(", ))

Rate of change

f does not depend on time

• The underlying physical laws themselves do not typically depend on time.• Inputs u(t) may be time dependent • The parameters/constants which describe the function f remain the same.

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 34

Page 35: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Linearity: Simplifying assumption #2

" = $" + &'

Over a sufficiently small operating range (think tangent line near a curve), the dynamics of most systems are approximately linear

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 35

Page 36: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

State-Space representation

A state-space model represents a system by a series of first-order differential state equations and algebraic output equations.

Differential equations have been rearranged as a series of first order differential equations.

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 36

Page 37: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

ExampleConsider the following system where ! " is the input and $(") is the output.

$ + 5$ + 3$ + 2$ = ! , y = $Can create a state-space model by pure mathematical manipulation through changing variables

$0 = $, $1= $, $2 = $Resulting in the following three first order differential equations (ODEs)

$0 = $1,$1 = $2,

$2 = −5$2 − 3$1 − 2$0 + !

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 37

Page 38: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

"# = "%"% = "&

"& = −5"& − 3"% − 2"# + ,State Equations

- = "%Output Equation

System has 1 input (u), 1 output (y), and 3 state variables (x1, x2, x3)

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 38

Page 39: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

In general state-space models have the following form (equations

can be nonlinear and time varying)

"# = %#("#, "(, … , "*, +#, … , +,):

"* = %*("#, "(, … , "*, +#, … , +,)

/# = ℎ#("#, "(, … , "*, +#, … , +,):

/* = ℎ*("#, "(, … , "*, +#, … , +,)

State Equations

Output Equations

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 39

Page 40: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

State-space representation

# = %# + '(

) = *# + +(

for linear systems

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 40

Page 41: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

From our prior example

"# = "%"% = "&"& = −5"& − 3"% − 2"# + ,

- = "% - = [ 0 1 0 ]"#"%"&

+ 0 ,

"#"%"&=

0 1 00 0 1−2 −3 −5

"#"%"&

+001

,

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 41

Page 42: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

The State-Space Modeling Process

1) Identify input variables (actuators and exogenous inputs).2) Identify output variables (sensors and performance variables).3) Identify state variables. (Hmmm…how ? – indep. energy storage)4) Use first principles of physics to relate derivative of state variables

to the input, state, and the output variables.

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 42

Page 43: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Why use state-space representations ?

State-space models:• are numerically efficient to solve, • can handle complex systems, • allow for a more geometric understanding of dynamic systems, and • form the basis for much of modern control theory

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 43

Page 44: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Linear dynamical system Continuous-time linear dynamical system (CT LDS) has the form

" = $ % "(%) + )(%)*(%) + = , % "(%) + -(%)*(%)

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 44

Page 45: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Continuous-time linear dynamical system (CT LDS)

" = $ % "(%) + )(%)*(%) + = , % "(%) + -(%)*(%)

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 45

Page 46: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Linear dynamical system Some terminology

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 46

Page 47: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Linear dynamical system Some terminology

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 47

Page 48: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Linear dynamical system Some terminology

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 48

Page 49: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Linear dynamical system Some terminology

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 49

Page 50: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Discrete-time linear dynamical system (DT LDS)

!(# + 1) = ( # !(#) + )(#)*(#)+(#) = , # !(#) + -(#)*(#)

#

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 50

Page 51: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Many dynamical systems are nonlinear (a fascinating topic) so why study linear systems?

•Most techniques for nonlinear systems are based on linear systems.

•Methods for linear systems often work unreasonably well, in practice, for nonlinear systems.

• If you do not understand linear dynamical systems, you certainly cannot understand nonlinear dynamical systems.

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 51

Page 52: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Many dynamical systems are nonlinear (a fascinating topic) so why study linear systems?

“Finally, we make some remarks on why linear systems are so important. The answer is simple: because we can solve them! ”

- Richard Feynman [Fey63, p. 25-4]

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 52

Page 53: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Elements of..

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 53

Page 54: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Modeling Mechanical Systems

Mechanical systems consist of three basic types of elements:

1. Inertia elements2. Spring elements3. Damper elements

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 54

Page 55: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Vehicle suspension – Mass-spring-damper

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 55

Page 56: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Inertia elements

• Example: any mass in the system, or moment of inertia.

• Each inertia element with motion needs its own differential equation (Newton’s 2nd Law, Euler’s 2nd

law)

• Inertia elements store kinetic energy

! = #$% &' = #(%% &' = 12(%

,

F ma=å M Ja=å

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 56

Page 57: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Spring elements

• Force is generated to resist deflection.

• Examples: translational and rotational springs

• Spring elements store potential energy

! = #$% &' = #()) &' = 12()

-

1 2( )F k x x= -

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 57

Page 58: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Damper elements

• Force is generated to resist motion.• Examples: dashpots, friction, wind drag• Damper elements dissipate energy

! = #( &' − &))

linear damping friction drag

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 58

Page 59: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

How many state variables are required ?

• There is an intuitive way to find state-space models

• What initial conditions do I need to capture the system’s state?

• Definition: the state of a dynamic system is the set of variables (called state variables) whose knowledge at t = t0 along with knowledge of the inputs for t ≥ t0 completely determines the behavior of the system for t ≥ t0

• # of state variables = # of independent energy storage elements

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 59

Page 60: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Example

!"$ + b $ − ) + k y − z = 0

!/) + b ) − $ + k z − y = u

Equations of motion

1" = $, 1/ = $13 = ), 14 = )

Choice of state variables

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 60

Page 61: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Example

!" $% + b $% − $) + k $" − $+ = 0

!% $) + b $) − $% + k $+ − $" = u

Equations of motion

$" = /, $% = /$+ = 1, $) = 1

Choice of state variables

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 61

Page 62: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Example

"# =−b "# − "' − k ") − "*

+)

") = "#

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 62

"* = "'

"' =, − b "' − "# − k "* − ")

+#

")"#"*"'=

0 1 0 0/012

/312

012

312

0014

0314

0 1/014

/314

")"#"*"'

+000)14

,

Is this the minimum set of states ?

Page 63: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Example

Look at where energy is stored

Energy Storage Element State Variable

spring (stores elastic PE)

mass 1 (stores KE)

mass 2 (stores KE)

!" = (% − ')!) = %!+ = '

damper does not store energy, it dissipates energy

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 63

Page 64: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Example

!" = (% − ')!) = %!+ = '

,"% + b % − ' + k y − z = 0

,)' + b ' − % + k z − y = u

!" = !) − !+

!) = % = 1,"

−6 !) − !+ − 7!"

!+ = ' = 1,)

−6 !+ − !) + 7!" + 8Rewriting in state-space representation

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 64

Page 65: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Example

"# = "% − "'

"% = ) = 1+#

−, "% − "' − -"#

"' = . = 1+%

−, "' − "% + -"# + 0

"#"%"'=

0 1 −12345

2645

645

347

647

2647

"#"%"'

+00#47

0

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 65

Page 66: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Modeling electrical systems

Capacitor[storage]

Inductor[storage]

Resistor[dissipative]

Voltage source

Current source

Passive elements Active elements

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 66

Page 67: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Mechanical – Electrical equivalency

We recognize a common form to the ODE describing each system and create analogs in the various energy domains, for example:

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 67

Page 68: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Capacitor - Mass

Electrical Capacitance

Translational Mass

i Ctv21

dd× E

12

M× v212×

F Mtv2

dd× E

12

M× v22×

Describing Equation Energy

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 68

q = CV

Page 69: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Inductor - Spring

v21 Ltid

d× E

12

L× i2×

v211k t

Fdd× E

12

F2

Electrical Inductance

Translational Spring

Describing Equation Energy

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 69

Page 70: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Resistor - Damper

Electrical Resistance

Translational Damper

F b v21× P b v212×

i1R

v21× P1R

v212×

Describing Equation Energy

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 70

Page 71: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

System

Flow

Effort

Generalized system representation.

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 71

Page 72: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

!"#$% = 'ℎ%")*ℎ +,%-,./$ × 12%"33 +,%-,./$

System

Through variable

Across variable

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 72

Page 73: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

!"#$% = 'ℎ%")*ℎ +,%-,./$ × 12%"33 +,%-,./$

! = -× 4Power is voltage times current

! = 5× +Power is velocity times force

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 73

Page 74: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

!"#$% = 'ℎ%")*ℎ +,%-,./$ × 12%"33 +,%-,./$

Through variables: • Variables that are measured through an element.

• Variables sum to zero at the nodes on a graph/circuit/free body diagram.

• Variables that are measured with a gauge connected in series to an element.

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 74

Page 75: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

!"#$% = 'ℎ%")*ℎ +,%-,./$ × 12%"33 +,%-,./$Across variables: • Variables that are defined by measuring a difference, or drop, across an element,

that is between nodes on a graph (across one or more branches).• Variables sum to zero around any closed loop on the graph• Variables that are measured with a gauge connected in parallel to an element.

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 75

Page 76: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

!"#$% = 'ℎ%")*ℎ +,%-,./$ × 12%"33 +,%-,./$

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 76

Page 77: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Energy storage : A-Type elements

Stored energy is a function of the Across-variable.

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 77

Page 78: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Generalized, Capacitance

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 78

Page 79: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Energy storage: T-Type elements

Stored energy is a function of the Through-variable.

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 79

Page 80: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Generalized inductance, L

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 80

Page 81: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Dissipative elements : D-Type

Dissipative elements (non-energy storage)

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 81

Page 82: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Generalized resistance, R

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 82

Page 83: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Cyber-Physical Energy Systems Modeling

Thermal Capacitance

q CttT2

dd× E Ct T2×

Thermal Resistance

q1Rt

T21× P1Rt

T21×

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 83

Page 84: Lecture 2- State-Space Modeling...State-space modeling using first-principles Lecture 2 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of modeling

Next lecture..

Learn how to get paid for doing nothing while saving the environment !

….the answer might have to do with drinking tea.

Principles of modeling for CPS – Fall 2019 Madhur Behl - [email protected] 84