0% found this document useful (0 votes)
15 views43 pages

Part6 Review State - Space

The document discusses state space systems, defining state variables and equations for modeling dynamical systems. It explains the advantages of state-space controls for analyzing multiple-input, multiple-output systems and provides guidelines for selecting state variables. Additionally, it includes examples of converting differential equations and transfer functions into state-space representations.

Uploaded by

Montaser Kassem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views43 pages

Part6 Review State - Space

The document discusses state space systems, defining state variables and equations for modeling dynamical systems. It explains the advantages of state-space controls for analyzing multiple-input, multiple-output systems and provides guidelines for selecting state variables. Additionally, it includes examples of converting differential equations and transfer functions into state-space representations.

Uploaded by

Montaser Kassem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

Modeling in the Time Domain

State Variable Models


What is a state space system?
A "matrix-form" representation of the dynamics of an N- order differential equation system
into a FIRST order differential equation in a vector form of size N, which is called the state.

Definition of a system state


⮚ The state of a dynamical system is the set of variables, known as state variables that
fully describe the system and its response to any given set of inputs. Any controls course
is generally about dynamical or dynamic systems. - By definition, dynamical systems are
dynamic because they change with time. Examples: coordinates of a drone, speed of a
car, body temperature, concentrations of chemicals in a centrifuge.

⮚ Mathematically, the knowledge of the initial values of the state variables at t0 (namely
xi (t0),i = 1,...,n), together with the knowledge of the system inputs for time t ≥ t0, are
sufficient to predict the behavior of the future system state and output variables (for t
≥ t0).

⮚ The state of a system is a set of variables whose values, together with the input signals
and the equations describing the dynamics, will provide the future state and output of the
system.

⮚ Using a state-variable approach gives us a straightforward way to analyze MIMO


(multiple-input, multiple output) systems.

⮚ A state variable model helps us understand some complex general concepts about
control systems, such as controllability and observability.
1- The State Equations
In the standard form, the mathematical description of the system is expressed as a set of n coupled
first-order ordinary differential equations, known as the state equations, in which the time
derivative of each state variable is expressed in terms of the state variables.
In the general case the form of the n state equations is:

For an LTI system of order n, and with r inputs, the above equations become a set of n coupled
first-order linear differential equations with constant coefficients:

Where the coefficients aij and bij are constants that describe the system. Which may be
summarized as:

Where the state vector x is a column vector of length n, the input vector u is a column vector
of length r,
A: is an n × n square matrix of the constant coefficients aij
B: is an n × r matrix of the coefficients bij that weight the inputs.
2- Output Equations
An arbitrary output variable in a system of order n with r inputs may be written:

Where the ci and di are constants. If a total of m system variables are defined as outputs,
the m such equations may be written as:

Where y is a column vector of the output variables yi(t), C is an m×n matrix of the constant
coefficients cij that weight the state variables, and D is an m × r matrix of the constant
coefficients dij that weight the system inputs.

For many physical systems the matrix D is the null matrix, and the output equation reduces to a
simple weighted combination of the state variables:
Summary
A system is represented in state space by the following equations:

For t > to and initial conditions, x(t0), where


x = state vector (𝑛 × 1)
𝑥̇ = derivative of the state vector with respect to time (𝑛 × 1)
y = output vector (𝑚 × 1)
u = input or control vector (𝑟 × 1)
A = system matrix (𝑛 × 𝑛)
B = input matrix (𝑛 × 𝑟)
C = output matrix (𝑚 × 𝑛)
D = feedforward matrix (𝑚 × 𝑟)
System state: minimum information needed in order to completely determine the
output of a system from a given moment, provided the input is known from that
moment.
System variable: any variable that responds to an input or initial conditions in a
system.
State variables: the smallest set of linearly independent system variables such
that the values of the set members at time t0 along with known inputs
completely determine the value of all system variables for all t≥t0.

State vector: vector whose elements are the state variables.

State space: The n-dimensional space whose bases are the state variables

State equations: set of n simultaneous, first order differential equations with


n variables, where the n variables to be solved are the state variables.

Output equation: algebraic expression of the output variables of a system as


linear combinations of the state variables and the inputs.

Advantages of State-Space Controls

► State-Space Controls is a method for modeling, analyzing and


designing a wide range of systems, such as:
■ Nonzero initial condition systems
► Classical restricted to zero initial conditions

■ Multiple-input, multiple-output systems (MIMO)


► Classical restricted to single-input, single-output system (SISO)

► State-space has other advantages that we will see later on. For
example:
■ Natural representation for nonlinear systems, time varying
systems (variable mass systems, …)
Selecting the state variables must follow these rules

1- A minimum number of state variables must be selected.


The minimum number of state variables required equals the order of the differential equation
describing the system.

❖ From the transfer: The order of the differential equation is the order of the denominator
of the TF after canceling common factors in the numerator and denominator.

❖ A practical way to determine the number of state variables is to count the number of
independent energy-storage elements in the system

⮚ Capacitors and inductors in electrical system


⮚ Masses and springs in mechanical system
For electrical systems you would then write the derivative equation for each energy-storage
element

⮚ For electricalsystem: for inductors, choose current as the state variable, for
capacitors choose voltage Another perspective is to consider the relevant quantities in
the energy equations:
Kinetic Energy Inductor E = ½ L i2
Potential Energy Capacitor E = ½ C v2
Dissipative Energy Resistor E = R i2
⮚ For mechanical system (translational and rotational), choose position x and speed
(v where v= dx/dt)

Kinetic Energy Mass E = ½ m v2
Inertia E = ½ J 𝜔2

Potential Energy Spring E = ½ K x2

Dissipative Energy Damper E = ½D v2

2- They must be linearly independent.

Q) What is meant by linear independence?


No variable in the set can be written as a linear sum of the other variables in the set.

Recommended procedure:
- Write the simple derivative eq for each energy-storage element.
- Solve for each derivative term as a linear combination of system variables and the input.
- Each differentiated variable is selected as a state variable.
- All other system variables and the output are written in terms of the state variables and the
input.

Note:-
A state space representation is not unique , since a different choice of state variables leads to
different representation of the same system.
Example
Find the state equations for the electrical network in figure below. The output is V c

The state variable


𝑑𝑥 𝑑𝑖𝐿
𝑥1 = 𝑖𝐿 → 1 = 𝑥̇1 =
𝑑𝑡 𝑑𝑡

𝑑𝑥2 𝑑𝑣𝐶
𝑥2 = 𝑣𝐶 → = 𝑥̇ 2 =
𝑑𝑡 𝑑𝑡

𝑣𝑖 = 𝑣𝑅 + 𝑣𝐿 + 𝑣𝐶

𝑣𝐿 = 𝑣𝑖 − 𝑣𝑅 − 𝑣𝐶

𝑑𝑖𝐿 𝑑𝑖𝐿 1 𝑅 1
𝐿. = 𝑣𝑖 − 𝑅. 𝑖𝐿 − 𝑣𝐶 → = 𝐿 𝑣𝑖 − 𝐿 . 𝑖𝐿 − 𝐿 𝑣𝐶
𝑑𝑡 𝑑𝑡

𝑅 1 1
𝑥̇ 1 = − . 𝑥1 − 𝑥2 + 𝑣𝑖
𝐿 𝐿 𝐿
𝑥̇ 1 = −𝑥1 − 𝑥2 + 𝑣𝑖

𝑑𝑣𝐶
𝐶. = 𝑖𝐶 But 𝑖𝐶 = 𝑖𝐿
𝑑𝑡

𝑑𝑣𝐶 1
𝑑𝑡
=
𝐶 𝐿
𝑖
1
𝑥̇ 2 = 𝑥1 = 𝑥1
𝐶
The output
𝑦 = 𝑣0 = 𝑣𝐶
𝑦 = 𝑥2
𝑥̇ −1 −1 𝑥1
State Equations [ 1] = [ ] [𝑥 ] + [1] 𝑣𝑖
𝑥̇ 2 1 0 2 0
𝑥1 0 𝑥1
Output Equation [ ] [ ]
𝑦 = 0 1 [𝑥 ] + [ ] 𝑣𝑖 = 0 1 [𝑥 ]
2 0 2
Example
Find a state-space representation of the system shown in the figure if the output is the
current through the resistor (iR).

Step 1 Label all the branch currents in the network: ic,ir,il

Step 2 Select the state variables: write the derivative equation for all energy-storage elements
(L and C) and choose the differentiated quantities as the state variables (V c, il )

Step 3 Write the right-had sides of “step 2” and the output equations as linear combinations of
the state variables and the input. Network theory (Kirchhoff, etc.) will be used for the electric
systems.

Step 4 Obtain the S-S representation in vector-matrix form


Example

Consider the parallel electrical circuit shown in figure below. We take the input to be the current
produced by the independent current source u(t) = i(t) and the output to be the capacitor voltage
y(t) = v(t).

It is often convenient to associate state variables with the energy storage elements in the network,
namely, the capacitors and inductors. Specifically, capacitor voltages and inductor currents.
Example
Find the state equations for the electrical network in figure if the output y(t)is the current
through the resistor R1.
Example

Given the linear single-input, single-output, mass-spring damper translational mechanical


system as shown in figure below, we now derive the system model and then convert it to a state-
space description. For this system, the input is force f (t) and the output is displacement y(t).

Using Newton’s second law, the dynamic force balance for the free body diagram yields the
following second-order ordinary differential equation

Because this is a single second-order differential equation, we need to select a 2 × 1 state vector.

In general, energy storage is a good criterion for choosing the state variables. The total system
energy at any time is composed of potential spring energy plus kinetic energy associated with
the mass displacement and velocity. We then choose to define the state variables as the mass
displacement and velocity:

The original single second-order differential equation can be written as a coupled system of two
first-order differential equations, that is,
Example
Consider the translational mechanical system as shown in figure below, in which y 1(t) and y2(t)
denote the displacement of the associated mass from its static equilibrium position, and f (t)
represents a force applied to the first mass m1. The input is the applied force u(t) = f (t), and
the outputs are taken as the mass displacements.

Newton’s second law applied to each mass yields the coupled second order differential
equations, that is,

Here, the energy-storage elements are the two springs and the two masses. Defining state
variables in terms of mass displacements and velocities yields
Example
Find the state equations for the translational mechanical system in figure below
EX: Represent the following system in state space. Give your answer in vector-matrix form.
Converting from the Differential Equation to State Space
Extract the state space using simulink]

1- Save the differential equation in the following model

2- in the command windows type the following command

>> [A,B,C,D]=linmod('DE_model')

A=
0 1 0
0 0 1
-4 -3 -2

B=
0
0
1

C=
1 0 0

D=
0
Converting from a Transfer Function to State Space
1- Converting a transfer function with constant term in numerator
This case corresponds to a linear system that can be represented as an nth-order linear
differential equation with constant coefficients like:

The classical Transfer Function (TF) representation of that system is obtained applying the
Laplace Transform to the diff. eq.

If
the

State Space (SS) representation has to be obtained, a convenient way to select state variables is
to choose the output, y(t), and its n-1 derivatives as the state variables. This is called the phase-
variable choice.
A SS representation using the phase-variable choice for the state variables is said to be in the
Controller Canonical Form (CCF).
Example
Find the state-space representation in phase-variable form for the following transfer function
𝐶(𝑠) 24
= 3
𝑅(𝑠) 𝑠 + 9𝑠 2 + 26𝑠 + 24

Step 1 Find the associated differential equation. Since


𝐶(𝑠) 24
= 3 2
𝑅(𝑠) 𝑠 + 9𝑠 + 26𝑠 + 24

Cross-multiplying yields

(𝑠 3 + 9𝑠 2 + 26𝑠 + 24)𝐶(𝑠) = 24 𝑅(𝑠)

Taking the inverse Laplace transform, assuming zero initial conditions

𝑐⃛ + 9𝑐̈ + 26𝑐̇ + 24𝑐 = 24 𝑟

Step 2 Select the state variables

𝑥1 = 𝑐

𝑥2 = 𝑐̇

𝑥3 = 𝑐̈

The combined state equations are


𝑥1̇ = 𝑥2
𝑥2̇ = 𝑥3
𝑥3̇ = −24𝑥1 − 26𝑥2 − 9𝑥3 + 24𝑟

The output equation

𝑦 = 𝑐 = 𝑥1

We draw three integral blocks as shown in figure below and label each output as one of the
state variables, x (t), as shown
Equivalent block diagram showing phase variables

In vector-matrix form

Matlab Code
clc
num=1;
den=[1 9 26 24];
G=tf(num,den)
[A,B,C,D]=tf2ss(num,den)

' convert to canonical form'


Af=flipud(A);
Af=fliplr(Af)
Bf=flipud(B)
Cf=fliplr(C)

'statespace'
statespace = ss(Af,Bf,Cf,D)
2- Converting a transfer function with polynomial in numerator

For example, consider a third order SISO system with second-order numerator polynomial

First, separate the transfer function into two cascaded modules

We can write:
Example

Represent the following transfer function in state space. Give your answer in vector-matrix
form.

𝑌(𝑠) 𝑠 2 + 3𝑠 + 7
=
𝑅(𝑠) 𝑠 3 + 6𝑠 2 + 9𝑠 + 24

The transfer function can be represented as a block diagram as follows:

Writing the
differential equation for the first box:

Defining the state variables:

Thus

From the second box,


MATLAB Code
clc
num=[1 3 7];
den=conv([ 1 1],[ 1 5 4]);
G=tf(num,den)
[A,B,C,D]=tf2ss(num,den)

' convert to canonical form'


Af=flipud(A);
Af=fliplr(Af)
Bf=flipud(B)
Cf=fliplr(C)

'statespace'
statespace = ss(Af,Bf,Cf,D)
Example

Represent the following transfer function in state space. Give your answer in vector-matrix
form.
𝑌(𝑠) 5𝑠 2 + 7𝑠 + 9
=
𝑅(𝑠) 𝑠 2 + 2𝑠 + 15

𝑌(𝑠) −3𝑠 − 66
=5+ 2
𝑅(𝑠) 𝑠 + 2𝑠 + 15

𝑌2 (𝑠) −3𝑠−66
=
𝑅(𝑠) 𝑠 2 +2𝑠+15
𝑥̇ 1 1 𝑥1
] [𝑥 ] + [0] 𝑟
0
[ ]=[
𝑥̇ 2 −15 −2 2 1
𝑥
𝑦2 = [−66 − 3 ] [𝑥1 ] + 0 . 𝑟
2
𝑌1 (𝑠)
=5
𝑅(𝑠)
𝑦 = 𝑦1 + 𝑦2
𝑥̇ 1 1 𝑥1
] [𝑥 ] + [0] 𝑢
0
[ ]=[
𝑥̇ 2 −15 −2 2 1
𝑥
𝑦 = 𝑦1 + 𝑦2 = [−66 − 3] [𝑥1 ] + 5 . 𝑟
2
Converting from a State Space to a Transfer Function
Ex Convert the state space and output equations to a transfer function
Ex: Convert the state space and output equations to a transfer function

MATLAB code
A=[ -4 -1.5 ; 4 0 ];
B=[ 2 ; 0 ];
C=[1.5 0.625];
D=0;
[num,den]= ss2tf(A,B,C,D);
G= tf(num,den)
Conversion between different models using Matlab
Signal-Flow Graphs of State Equations
Example: Draw a signal-flow graph for the following state and output equations:

−2 1 0 0
𝑥̇ = [ 0 −3 1 ] 𝑥 + [0] 𝑟 , 𝑦 = [0 1 0]𝑥
−3 −4 −5 1

--------------------------------------------------------------------------------------
Example: Draw a signal-flow graph for the following state and output equations:
Alternative Representations in State Space
In previews section, systems were represented in state space in phase-variable form.
We will now look at a few representative forms and show how to generate the state-
space representation for each

1- Cascaded Form
The output of each first-order system block has been labeled as a state variable. These state
variables are not the phase variables.
Example

−9 1 0 0
𝑥̇ = [ 0 −8 1 ] 𝑥 + [ 0 ] 𝑟
0 0 −7 10

𝑦 = [1 0 0]𝑥
Example
𝑌(𝑠) 𝑠+3
=
𝑅 (𝑠) (𝑠 + 4)(𝑠 + 5)

𝑥̇ 2 = −4𝑥2 + 𝑟
𝑥̇ 1 = −5𝑥1 + 𝑥2
𝑦 = 𝑥̇ 1 + 3𝑥1 = −5𝑥1 + 𝑥2 + 3𝑥1 = −2𝑥1 + 𝑥2
2- Parallel Form
𝐶(𝑠) 10 5 10 5
= 𝐺 (𝑠) = 3 = − +
𝑅(𝑠) 𝑠 + 24𝑠 2 + 191𝑠 + 504 𝑠 + 7 𝑠 + 8 𝑠 + 9

𝑥̇ 1 = −7𝑥1 + 5𝑟
𝑥̇ 2 = −8𝑥2 − 10𝑟
𝑥̇ 3 = −9𝑥3 + 5𝑟

𝑦 = 𝑥1 + 𝑥2 + 𝑥3

−7 0 0 5
𝑥̇ [ 0 −8 0 ] 𝑥 + [−10] 𝑟
0 0 −9 5

𝑦 = [1 1 1]𝑥

Notes
1. Diagonal system matrix.
2. Each equation is a first order differential equation is only one variable.
3. The equations are said to be decoupled.
Example
3- Phase Variable Form

0 1 0 0
𝑥̇ = [ 0 0 1 ]𝑥 + [ 0 ]𝑟
−504 −191 −24 10

𝑦 = [1 0 0]𝑥
4- Controller Canonical Form
This form is obtained from the phase-variable form simply by ordering the phase variables in
the reverse order. For example, consider the transfer function

numg=[l 7 2];
deng=[l 9 2 6 24];
[Acc,Bcc, Ccc, Dec] = tf 2ss(nurag, deng)

You might also like