At this point you probably know how to represent systems with transfer
functions and differential equations. Both of those kinds of models
- transfer functions and differential equations - are good ways to represent
the relationship between the input and the output of a system. Why
can't we just stick with those kinds of models. Here are some reasons.
Transfer functions cannot
be used to represent nonlinear systems.
Differential equations
can be used to represent nonlinear systems, but you can't solve very many
nonlinear differential equations. It's a pretty good bet that any
system you encounter won't fall into any of the special situations that
you can solve.
Any
time you design systems, you may do a lot of linear analysis but there
will always be nonlinearities. Things like the following will happen.
Amplifiers will saturate.
Sensors will be nonlinear.
The thing you are trying
to control is not related linearly to the control effort
Lift of a wing is not
linearly related to aileron angle.
Temperature rise of a
heater is not linearly related to the voltage you apply, although it might
be linearly related to the power you can put into it.
Magnetic field is not
proportional to current.
If
you have to deal with nonlinear systems - and you may not have any choice
in the matter - you can't rely on the tried and true transfer functions
and linear differential equations. If you want to predict how a nonlinear
system will behave - and sooner or later every system is nonlinear - you
will have to have a way of computing how they behave. And, if you
want to compute behavior, the only algorithms available will require you
represent your system with a state variable representation. You're
stuck, so you might as well just move on and start learning about state
variables.
State
Variables
Despite the fact that you need to learn about state variables because you
will need to deal with nonlinear systems, we are going to begin by getting
a few state variable representations for linear systems. As we go
along, we will discuss state variable models.
The first system is a first order linear system. Here is the example.
Example - 1 - A First Order System
The example will be a
first order system with a transfer function:
G(s) = X(s)/U(s) =
Gdc/(ts
+ 1)
Here:
G(s) = the transfer function
of the system
X(s) = the output of the
system
U(s) = the input of the
system
Gdc
= DC Gain of the system
t
= Time Constant of the system
This system satisfies
a differential equation given by:
tdx(t)/dt
+ x(t) = Gdcu(t)
dx(t)/dt = - x(t)/t+
Gdcu(t)/t
This differential
equation is written in a form that emphasizes that it is really a state
equation - the only state equation - for a
first order system. That form is the second equation above where
the derivative of the output - the derivative of the state - appears on
the left hand side of the equation and everything else is moved to the
right hand side of the equation.
The example illustrates an important feature of state equations.
We have identified an important dynamic variable in the system above -
the output - and manipulated things so that the derivative of that variable
- the state - is on the left side of the equation and everything else is
on the right hand side. That's the first fact you will need to note
about state equations
A state equation is just
an equation for the derivative of a state.
All that is on the right
hand side is an expression that involves state(s), input(s) and the time
variable.
Now,
let us consider a more complex system - one that is second order.
Let's look at a second example.
Example - 2 - A Second
Order System
The secondexample will
be a second order system with a transfer function:
G(s) = X(s)/U(s) =
Gdcwn2/(s2
+ 2zwn
+ wn2)
Here:
G(s) = the transfer function
of the system
X(s) = the output of the
system
U(s) = the input of the
system
Gdc
= DC Gain of the system
wn
= Undamped Natural Frequency of the system
z
= Damping Ratio of the system
This system satisfies
a differential equation given by:
d2x/dt2
+ 2zwndx/dt
+ wn2x
= wn2Gdcu(t)
This differential
equation is not a state equation, but we can get two state equations from
it.
The first state is going
to be the output, x(t).
The second state is going
to be the derivative of the output, dx/dt.
You may not realize it,
but we already have one of the two state equations we need, because we
have just said:
x1(t)
= x(t) (The first state) and we have
dx1(t)/dt
= x2(t)
Note that the left side
of the equation is the derivative of the first state, and the right hand
side involves only the second state.
We get the second state
equation from the differential equation that describes the system.
Remember we have:
x2(t)
= dx1(t)/dt So then
we must have:
dx2(t)/dt
= d2x1/dt2 and
the differential equation tells us:
d2x1/dt2
= - 2zwndx1/dt
- wn2x1
+ wn2Gdcu(t)
So:
dx2/dt
= - 2zwnx2
- wn2x1
+ wn2Gdcu(t)
and
this is the second state equation.
Note that the second state
equation involves both states and the input on the right hand side.
That's what we said above that a state equation should be.
Here are the final two
state equations for this system.
dx1(t)/dt
= x2(t)
dx2(t)/dt
= - 2zwnx2(t)
- wn2x1
(t)+ wn2Gdcu(t)
Now, the technique above can be used to generate state equations for higher
order systems, and they don't have to be linear. If you have a nonlinear
system described by a nonlinear differential equation, you can still use
the technique above.
You probably want to see an example of a nonlinear system, so here is an
example of a system that is well known - the Van der Pol Oscillator.
Example - 3 - The
Van der Pol Oscillator
The Van der Pol oscillator is a second order system. It is a second
order system where the damping term is nonlinear. Let's look at the
state equations for a linear second order system again. Here they
are again.
dx1(t)/dt
= x2(t)
dx2(t)/dt
= - 2zwnx2(t)
- wn2x1(t)+
wn2Gdcu(t)
The damping ratio, z,
appears in only one place in the second state equation. If a linear
system is an oscillator the damping ratio would be zero. Actually,
to get the oscillations started the damping ratio should be negative so
that the oscillations will grow. In a purely linear system they would
continue to grow forever. Let's consider the idea of putting something
in the damping term that makes the damping negative (so the oscillations
grow at the start) when the states are small, but makes the damping become
positive if the states are large. Also, we won't have any input in
the oscillator, so we will remove the input term. Let's summarize
what we are going to do.
Let u(t) = 0
Set the undamped natural
frequency to 1.0 to get a numerical example.
Fix the damping so that
it becomes positive for larger states.
The way this is done in the Van der Pol oscillator is to use state equations
as shown below.
dx1(t)/dt
= x2(t)
dx2(t)/dt
= - 2z(1
- x12(t))x2(t) - x1
(t)
The addition of the (1
- x12(t)) term modifies the damping, and if
the damping ratio is negative - for growing oscillations - as the oscillations
grow and x1(t) gets larger - the effective damping will
become positive, preventing the oscillations from growing.
Actually, if you go into the literature you will find that the damping
term is represented slightly differently. Here is the way you will
find this system represented.
dx1(t)/dt
= x2(t)
dx2(t)/dt
= e(1
- x12(t))x2(t) - x1
(t)
Here, the term -
2z (which
is negative) as been replaced with a positive term, e.
In the simulation below you can experiment with this system (which has
been simulated using the Euler Integration Algorithm). The simulation
shows a plot of x1 against x2 - a phase-plane
plot. Here is the simulation.
Do the following:
Run the simulation with
the values given for the starting value of x1 and e.
You should notice that the system exhibits a limit cycle. (Click
here to go to limit cycle portion of the lesson on the phase plane
where this system is also examined.)
Run the simulation using
different starting values of x1. Use values that
put the starting point within the limit cycle you saw in the first part.
Run the simulation again
using starting values that put the starting point outside the limit cycle
you saw in the first part.
Compare the results.
You should be able to see that the system goes to the same limit cycle
behavior no matter where the system starts.