Modeling and Analysis of Systems Lecture #2 - State …guilldrion/Files/SYST0002-20… ·  ·...

Preview:

Citation preview

Modeling and Analysis of SystemsLecture #2 - State-Space Representation

Guillaume DrionAcademic year 2015-2016

1

Outline

Systems modeling: signals (domain, image), systems (static, dynamic).

State-space representation: general form.

State-space representation in discrete-time.

State-space representation in continuous-time.

Interconnections of systems/models.

2

Outline

Systems modeling: signals (domain, image), systems (static, dynamic).

State-space representation: general form.

State-space representation in discrete-time.

State-space representation in continuous-time.

Interconnections of systems/models.

3

Systems modeling

Modeling and analysis of systems: open loop. “Observing and analyzing the environment”

SYSTEMInput Output

4

Systems modeling

Modeling and analysis of systems: open loop. “Observing and analyzing the environment”

Example (lecture #1): Input = flow of blood coming out of the heart (electric current). Output = blood pressure in the vascular system (voltage). System = aortic valve (resistance) + arteries (conductance) + capillaries (resistance).

SYSTEMInput Output

Left ventricle

Aortic valve (r)

Aorta

Arterial compliance (Ca)

Peripheryvessels

(R1, R2, ..., Rn)

r

RCaP(t)

u(t)

PCa(t)Pr(t)

5

Systems modeling

Modeling and analysis of systems: open loop. “Observing and analyzing the environment”

SYSTEMInput Output

6

Signals

Inputs and outputs are signals.Examples:

“Hi!” on a computer is “01001000 01101001 00100001” (Ascii) => Discrete, binary signal x[n].

7

Signals

Inputs and outputs are signals.Examples:

“Hi!” on a computer is “01001000 01101001 00100001” (Ascii) => Discrete, binary signal x[n].

Electrical signaling of a neuron:

=> Continuous signal x(t), larger than VK and smaller than VNa.

400 ms20 mV

VK

VNa

8

Signals: domain and image

Inputs and outputs are signals.

Signals (x) are defined by their domain (X) and their image (Y):

Domain (for us): (discrete signal) or (continuous signal).

Image: set of values that the signal can take (ex: probabilities/binary signals).

9

Signals: domain and image

Inputs and outputs are signals.Examples:

“Hi!” on a computer is “01001000 01101001 00100001” (Ascii) => Discrete, binary signal x[n].

Electrical signaling of a neuron:

=> Continuous signal x(t), larger than VK and smaller than VNa.

400 ms20 mV

Domain Image

Domain Image (+⊂ℝ)

VK

VNa

10

Signals: domain and image

A continuous signal can have a somehow “discrete image”... Ex: current flowing through an ion channel over time:

... and a discrete signal can have a “continuous image”. Ex: many digitized signals.

11

Why should we care about the domain of a signal?

Time-shift

Time-reversal

Time-scaling

Comparing continuous and discrete signals:

12

Time-shift

Time-reversal

Time-scaling

Why should we care about the domain of a signal?

Some values are not allowed for α

Comparing continuous and discrete signals:

13

Why should we care about the image of a signal?

In theory, you can design any system using mathematical modeling.

Ex: we want to design a system that controls the movement of a robot arm for weight lifting, and proudly come up with this system that works perfectly:

But in real-life, the values that the signals can take are constrained. You have to take this limitations of the signal image into account in your model!

Ex: in the robot, the voltage signal cannot exceed some saturation voltage. With your design, the robot can barely lift his arm, let alone any additional weight...

Input voltage

Lifted weight ( relative to arm weight)

123456

14

Why should we care about the image of a signal?

In theory, you can design any system using mathematical modeling.

Ex: we want to design a system that controls the movement of a robot arm for weight lifting, and proudly come up with this system that works perfectly:

But in real-life, the values that the signals can take (image) are constrained. You have to take this limitation into account in your model!

Ex: in the robot, the voltage signal cannot exceed some saturation voltage. With our design, the robot can barely lift his arm, let alone any additional weight...

Input voltage

Lifted weight ( relative to arm weight)

123456

Voltage saturation

15

Systems modeling

Modeling and analysis of systems: open loop. “Observing and analyzing the environment”

SYSTEMInput Output

16

Systems: static vs dynamic

Static: output value only depends on the current input value.

Otherwise: dynamic.

SYSTEMInput Output

Input 0

1

Output

0

K

17

Systems: static vs dynamic

Static: output value only depends on the current input value.

Otherwise: dynamic.

SYSTEMInput Output

Input 0

1

Output

0

K

Input 0

1

Output

0

K

18

Systems: static vs dynamic

Static: output value only depends on the current input value.

Otherwise: dynamic.

SYSTEMInput Output

Input 0

1

Output

0

K

Input 0

1

Output

0

K

19

Systems: static vs dynamic

Static: output value only depends on the current input value.

Ex: electrical resistance:

The value of VR(t*) only depends on i(t*).

Otherwise: dynamic.

Ex: electrical inductor:

The value of VL(t*) depends on i(t*) but also depends on i(t) with t<t*.

SYSTEMInput Output

20

Systems: static vs dynamic

In a dynamical system, the output value depends on past input values.It has memory, which has to be stored “somewhere”.

=> Concept of states and state-space representation (Ch2).

SYSTEMInput Output

Input 0

1

Output

0

K

21

Outline

Systems modeling: signals (domain, image), systems (static, dynamic).

State-space representation: general form.

State-space representation in discrete-time.

State-space representation in continuous-time.

Interconnections of systems/models.

22

Systems: state-space representation

The state-space is defined by 3 sets and 2 functions:

Sets:

U: Input space. “Everything that goes in”

Y: Output space. “Everything that goes out/is measured/you care about”

X: state space. “Everything that has some dynamics”

Functions:

f : X x U X. “update” function. Describes the dynamics of the system.

h : X x U Y. output function. Describes the output of the system.

23

Linear systems: A,B,C,D representation

Linear, time-invariant (LTI) dynamical systems can be represented in the form

where A describes how the dynamics of the system evolve (dynamics matrix) B describes how the input influences the states (input matrix) C describes how the states “are seen” in the output (output matrix). D describes how the input directly influences the output (feedthrough matrix).

The output is therefore a function of the input and the states. Simple but recurrent case: the output is one of the states.

y = Cx + Du

x = Ax + Bu

24

Finite-state machines and infinite-state machines

If the states can take a finite number of values (state function with finite image): finite-state machines (finite-state automata). Ex: binary systems: each state can only take the value 0 or 1.

Finite-state machines are studied in informatics.

Otherwise: infinite-state machines (this course).

25

Outline

Systems modeling: signals (domain, image), systems (static, dynamic).

State-space representation: general form.

State-space representation in discrete-time.

State-space representation in continuous-time.

Interconnections of systems/models.

26

State-space representation in discrete-time: general form

General form of a state-space representation in discrete-time:

Discrete systems are very intuitive to use, but can have interesting dynamics (be careful of the domain of the signals!)

27

Example #1: the Fibonacci sequence

The Fibonacci sequence is the series where each number is the sum of the two previous ones: 0,1,1,2,3,5,8,13,21,...

It writes

In this series, the ratio converges towards the golden ratio .

We will use the Fibonacci sequence to create a system whose output converges towards the golden ratio.

28

The Fibonacci sequence: states

First step: identify the states of the system. How many states are needed?

In a discrete system, for any function of n, look at the maximum time-shift.How many values do you need to “store” in memory?

Here:

2 states: and .

29

The Fibonacci sequence: update function

Fibonacci sequence:

States: and

Update function:

30

The Fibonacci sequence: output function

Output:

States: and

Output function:

31

The Fibonacci sequence: dynamical system

The full dynamical system reads

Implementation in matlab:

% Variables initialization n = 1:1:10; % "time" x1 = ones(1,length(n)); % state variable #1 x2 = ones(1,length(n)); % state variable #2 y = ones(1,length(n)); % Output % System for i = 2:length(n) % Update functions x1(i) = x1(i-1) + x2(i-1); x2(i) = x1(i-1); % Output functions y(i) = x1(i)/x2(i); end

32

The Fibonacci sequence: simulation

1 2 3 4 5 6 7 8 9 100

20

40

60

80

100Fibonacci sequence - x1[n]

1 2 3 4 5 6 7 8 9 100

20

40

60Fibonacci sequence - x2[n]

1 2 3 4 5 6 7 8 9 100

0.5

1

1.5

2Fibonacci sequence - y[n]

33

Example #2: the logistic map

In 1838, Pierre-François Verhulst proposed a dynamical model for the growth of a population (N) depending on the intrinsic growth rate (r) and the maximum number of individuals the environment can support (K).

This equation is called the logistic equation.

Simple behavior: If r >> and N << K: the population grows fast. If N = K: the population does not grow anymore.

Mathematical modeling is widely used in ecology.

34

Example #2: the logistic map

Simulation of the logistic equation for different growth rates and K=1.

1 1.5 2 2.5 3 3.5 4 4.5 50

0.2

0.4

0.6

0.8

1Logistic equation, r=2

1 1.5 2 2.5 3 3.5 4 4.5 50

0.2

0.4

0.6

0.8

1Logistic equation,r=4

time

N

N

35

Example #2: the logistic map

In 1976, Robert May proposed a “discrete equivalent”

As opposed to the continuous system, the dynamics of the discrete system is extremely rich, and can be “chaotic” for certain values of α.

vs

36

Example #2: the logistic map: simulations

0 10 20 30 40 50 600

0.2

0.4

0.6

0.8

1Logistic map, a=2

0 10 20 30 40 50 600

0.2

0.4

0.6

0.8

1Logistic map, a=3.3

0 10 20 30 40 50 600

0.2

0.4

0.6

0.8

1Logistic map, a=4

37

Example #2: the logistic map: simulations

0 10 20 30 40 50 600

0.2

0.4

0.6

0.8

1Logistic map, a=2

0 10 20 30 40 50 600

0.2

0.4

0.6

0.8

1Logistic map, a=3.3

0 10 20 30 40 50 600

0.2

0.4

0.6

0.8

1Logistic map, a=4

38

Example #2: the logistic map: simulations

0 10 20 30 40 50 600

0.2

0.4

0.6

0.8

1Logistic map, a=2

0 10 20 30 40 50 600

0.2

0.4

0.6

0.8

1Logistic map, a=3.3

0 10 20 30 40 50 600

0.2

0.4

0.6

0.8

1Logistic map, a=4

39

Example #2: the logistic map

In 1976, Robert May proposed a “discrete equivalent”

As opposed to the continuous system, the dynamics of the discrete system are extremely rich, and can be “chaotic” for certain values of α.

This dynamical richness comes from the nonlinearity of the system.But it highlights the fact that continuous and discrete systems are not always “equivalent”.

vs

40

Outline

Systems modeling: signals (domain, image), systems (static, dynamic).

State-space representation: general form.

State-space representation in discrete-time.

State-space representation in continuous-time.

Interconnections of systems/models.

41

State-space representation in continuous-time: general form

General form of a state-space representation in continuous-time:

!! State-space representations are not unique !! But all representations describe the same system, i.e. with the same (and unique) inputs, outputs and transfer function.

42

State-space representation in continuous-time: identifying states

Method #1

Identify inputs and outputs.

Identify independent means of energy storage.

Identify state variables.

Write model (using laws of physics, etc.).

Method #2

Write model (using laws of physics, etc.).

Identify inputs and outputs.

Identify state variables.

43

State-space representation in continuous-time: identifying states

Method #1

Identify inputs and outputs.

Identify independent means of energy storage.

Identify state variables.

Write model (using laws of physics, etc.).

Method #2

Identify inputs and outputs.

Write model (using laws of physics, etc.).

Identify state variables.

44

Example #1: modeling a RC circuit

R

CV

i

vC(t)vR(t)

45

RC circuit: method #1

Identify inputs and outputs.

Identify energy storage.

Identify state variables.

Write model.

R

CV

i

vC(t)vR(t)

46

RC circuit: method #1 - inputs and outputs

Identify inputs and outputs.

Identify energy storage.

Identify state variables.

Write model.

Inputs: active sources voltage source:

Outputs: or

R

CV

i

vC(t)vR(t)

47

RC circuit: method #1 - energy storage

Identify inputs and outputs.

Identify energy storage.

Identify state variables.

Write model.

A capacitor accumulates charges

R

CV

i

vC(t)vR(t)

48

RC circuit: method #1 - state variables

Identify inputs and outputs.

Identify energy storage.

Identify state variables.

Write model.

A capacitor accumulates charges

State variable:

R

CV

i

vC(t)vR(t)

49

RC circuit: method #1 - model

Identify inputs and outputs.

Identify energy storage.

Identify state variables.

Write model.

R

CV

i

vC(t)vR(t)

Input: . Output: or . State:

Kirchhoff:

Which gives

50

RC circuit: method #2

Identify inputs and outputs.

Write model

Identify state variables.

R

CV

i

vC(t)vR(t)

51

RC circuit: method #2 - model

Identify inputs and outputs.

Write model

Identify state variables.

Input: . Output: or .

Kirchhoff:

State variable:

R

CV

i

vC(t)vR(t)

52

RC circuit: method #2 - state variable

Identify inputs and outputs.

Write model

Identify state variables.

Input: . Output: or .

Kirchhoff:

State variable:

R

CV

i

vC(t)vR(t)

53

RC circuit: method #2 - state-space model

Identify inputs and outputs.

Write model

Identify state variables.

Input: . Output: or . State:

Kirchhoff:

Which gives

R

CV

i

vC(t)vR(t)

54

RC circuit: two different, but equivalent, state-space models

A capacitor accumulates charges

The accumulation of charges creates a voltage gradient .

They both represent the same energy storage.

55

Example #2: modeling a RL circuit

Exercise:

R

LV

i

vL(t)vR(t)

56

Example #3: modeling a RLC circuit

R

LV

i

vL(t)vR(t)

C

vC(t)

57

RLC circuit: inputs, outputs, states, equations

R

LV

i

vL(t)vR(t)

C

vC(t)

Identify inputs and outputs.

Identify energy storage.

Identify state variables.

Write model.

Input: . Output: or or .

Energy storage/variable. Capacitor: . Inductor: .

Kirchhoff:

58

RLC circuit: state-space model

R

LV

i

vL(t)vR(t)

C

vC(t)

Identify inputs and outputs.

Identify energy storage.

Identify state variables.

Write model.

Kirchhoff: with and .

State-space model:

59

RLC circuit: state-space model

R

LV

i

vL(t)vR(t)

C

vC(t)

Identify inputs and outputs.

Identify energy storage.

Identify state variables.

Write model.

Kirchhoff:

You could also use (try it at home)

or or

60

Example #4: driven pendulum

u

θ

m

l

mg

61

Driven pendulum: modelingu

θ

m

l

mg with moment of inertia.

which gives .

What do I do with a ?

62

Driven pendulum: statesu

θ

m

l

mg with moment of inertia.

which gives .

What do I do with a ?

States: . If I want to write the system in the form ,the second state should be (the energy is stored in the position and speed).

63

Driven pendulum: state-space modelu

θ

m

l

mg

with and .

This gives the state-space representation

This model is nonlinear, so out of the scope of this course.

However, we can study the effect of small variations around a specific point through a linearization of the system around this point.

64

Driven pendulum: linearizationu

θ

m

l

mgIdea behind linearizing a system around a specific point:

x

f(x)

See tutorials.

65

Outline

Systems modeling: signals (domain, image), systems (static, dynamic).

State-space representation: general form.

State-space representation in discrete-time.

State-space representation in continuous-time.

Interconnections of systems/models.

66

Interconnections of systems

Complex state-space models can be decomposed into simpler, interconnected models.

Useful for instance if you want to split the modeling work.

Feedforward interconnection:

Feedback interconnection: and .

u1 y1 u2 y2

u1 y1 u2 y2

67

Example: designing a DC motor

You want to design a DC motor, and ask team #1 to work on the electrical part and team #2 to work on the mechanical part separately (black board).

RL

Vin

i

vL(t)vR(t)vc(t) w

68

Outline

Systems modeling: signals (domain, image), systems (static, dynamic).

State-space representation: general form.

State-space representation in discrete-time.

State-space representation in continuous-time.

Interconnections of systems/models.

69

Recommended