(Control Theory : Systems : Modelling physical systems)
Before working with systems, it's obviously important to understand how they are represented mathematically. With this writeup I hope to bridge the general idea of control theory with the specific mathematical and heuristic techniques used in control design. My approach will be mostly conceptual here for the sake of readability and clarity. As you can no doubt imagine, this stuff gets really ugly really quickly in the mathematical sense, so I'd like to avoid that mess and simply stick to a general overview.
There are three main ways to model a physical system:
Differential equations
Everyone who has studied calculus has in one form or another encountered differential equations. They tend to scare off most students probably because of the way they're presented formally, but really, no one actually works with them in their analytical form other than mathematicians. Instead, DEs are usually converted into a form far easier to compute with via some kind of transform, which is exactly what the last two models covered in this writeup involve. Of course, one must still be able to construct the differential equations for a particular physical system in order to transform them in the first place!
Probably the best way to demonstrate how this is done is through some simple examples.
Suppose we want to model the speed and forward motion of a car, assuming that the rotational inertia of the wheels is negligible and the friction working against the car is proportional to its speed. (How realistic!) We can then approximate the car for modelling purposes with the following free body diagram (don't laugh):
|
|------> x
|
+-----+
| |
f <---| m |---> u
| |
------+-----+------
///////////////////
where
m is the car's mass
x is the car's position
u is the force exerted by the car's engine to move it forward
f is the friction force acting in the opposite direction
t is time
So now all we need to do is use Newton's law to come up with a differential equation relating all these variables together:
F = m*a
u - f = m*a
u - b*dx/dt = m*d2x/dt2
or
d2x/dt2 + (b/m)*dx/dt = (1/m)*u
Done!
What about circuits? Suppose we want to model the voltage output of a simple RC circuit (a low-pass filter, actually):
i -->
R
+---/\/\---+---o
+ | | +
u O C === y
- | | -
+----------+---o
where
u is the voltage supplied by the voltage source, specified in volts
y is the voltage at the output of the circuit, specified in volts
i is the current running through the single loop, specified in amps
R is a resistor, specified in ohms
C is a capacitor, specified in farads
Using circuit theory, we can construct the differential equation as follows:
Kirchhoff's Voltage Law gives us:
u = R*i + y
The current through the capacitor:
ic = C*dy/dt = i
(Since there is only one loop and therefore the current is the same
throughout the circuit--see Kirchhoff's Current Law.)
Substituting, we get:
u = RC*dy/dt + y
or
dy/dt = -(1/RC)*y + (1/RC)*u
Done!
After deriving a set of differential equations (or discrete time difference equations) for your system, you're ready to get some real work done with them! Unfortunately, while the form they're in now is great for trying to understand how your model works, it's extremely inconvenient for design purposes.
As far as control is concerned, you should now choose the form that best suits the particular design process you plan to follow. Generally speaking, for classical control techniques you want the transfer function of the system, while for modern control techniques you want the state space equations instead.
Transfer function
A detailed discussion of transfer functions belongs in its respective node, but essentially it's the Laplace transform of your differential equation rearranged as a ratio of output over input. For this reason, transfer functions are only useful for single-input/single-output (SISO) systems and therefore not suitable for more complicated systems that require modern control techniques (the last model in this writeup is what you would use instead).
A simple example:
Our differential equation:
d2y/dt2 + 6*dy/dt +25*y = 9*u + 3*du/dt
where
y(t) is the output
u(t) is the input
Taking the Laplace transform (assuming initial conditions are zero):
s2*Y(s) + 6s*Y(s) + 25Y(s) = 9*U(s) + 3s*U(s)
Factor:
(s2 + 6s + 25)*Y(s) = (9 + 3s)*U(s)
Form transfer function:
G(s) = Y(s)/U(s) = (9 + 3s)/(s2 + 6s + 25)
Done! Well, almost. Transfer functions are usually much more useful
when they're factored:
G(s) = 3*(s + 3)/(s + 3 - 4i)(s + 3 + 4i)
Note: EEs traditionally use 'j' instead of 'i' for complex numbers.
Now the factored transfer function can be represented very efficiently in the complex plane using a pole-zero plot. Poles are the points at which the transfer function goes to infinity, while zeros are the points at which the transfer function goes to zero (obviously). Because we factored the transfer function, it's easy to see that we have one zero at -3 and two poles at -3+4i and -3-4i respectively. Their position on the complex plane determines the behaviour of the system and its stability. Controlling a system involves adding more poles and zeros (belonging to the controller) in order to shift the system's poles and zeros to more desirable locations. This is where the root locus method comes into play, which is a graphical technique for evaluating system behaviour and performance based on the combined poles and zeros of the controlled system.
State space equations
The term "state space" means exactly what it implies: the space of all possible states (or "modes") of a particular system. The state of a system is defined to be the minimum number of variables that contain sufficient information about the system in order to predict its future behaviour given a set of inputs. So if we define our state variables to be position and velocity, assuming they'll be sufficient for predicting our system's behaviour, then our two-dimensional state space encompasses all the possible combinations of positions and velocities the system can have.
The basic state space equations are as follows:
dx/dt = Ax + Bu
y = Cx + Du
where
x is the state vector
u is the input vector
y is the output vector
dx/dt is the change in the current state with respect to time
A is the system matrix (nxn)
B is the input matrix (nx1)
C is the output matrix (1xn)
D is the direct transmission term (scalar)
And the above matrices are constructed from the coefficients of the system's
differential equations.
I say "basic" since these equations can be extended to model external disturbances, for example, simply by adding more (matrix)*(vector) terms.
When constructing a state space model, perhaps the trickiest part is determining what your state variables (contained in the state vector) should be. Of course, they should be independent otherwise you won't have enough information to make accurate predictions about the system's behaviour. There isn't any heuristic for determining them exactly, so it's probably best to demonstrate the process through an example:
In the very first car example, we came up with the following differential
equation:
d2x/dt2 + (b/m)*dx/dt = (1/m)*u
Because our highest-order derivative is second order, we need the velocity
(first derivative of x) as one of our state variables. Naturally then, we also
need x as the other state variable. Recall that the first state equation gives
us the change in the current state, so these variables will be differentiated to
give us d2x/dt2 and dx/dt respectively as in the original DE.
So our state variables are:
x1 = x and x2 = dx/dt = dx1/dt.
We can rewrite our single second-order equation as a set of two first-order equations:
dx1/dt = x2
dx2/dt = d2x1/dt2 = -(b/m)*dx2/dt + (1/m)*u
And now we can construct our state space model:
dx/dt = Ax + Bu
y = Cx + Du
[dx1/dt] = [ 0 1 ][ x1 ] + [ 0 ]*u
[dx2/dt] [ 0 -(b/m)][ x2 ] [(1/m)]
y = [ 1 0 ][ x1 ]
[ x2 ]
(The single output is the position of the car and D = 0)
At this point, you can easily get the equivalent transfer function
representation using the following formula:
G(s) = C(sI - A)-1B + D
(I'll leave this as an exercise for the reader :)
Moving in the opposite direction, however, is a bit more complicated and beyond the scope of this node (see Transforming system models).
Please feel free to /msg me with any corrections.
REFERENCES
Franklin, G.F., J.D. Powell, A. Emami-Naeini. Feedback Control of Dynamic Systems, 3rd ed. Addison-Wesley, 1994.
ECE311F lecture notes, University of Toronto