System Modeling
Highlight:
Mathematical Modeling of Mechanical Systems Mathematical Modeling of Electrical Systems Linearization of Nonlinear Systems
Real Systems: usually very complicated, nonlinear, and time varying. Mathematical Models: Often very simple, linear, and time-invariant.
We always start by using simple models:
convenience, suciency, can always go back if model is too simple.
Mathematical Modeling of Mechanical Systems
We need to know to model mechanical systems because in many real systems the control rules are eventually applied through mechanical actuators such as motors.
Translational Systems
Simples models are based on Newton's second law, i.e. for each free-body
F = m a F: : a m:
where: vector sum of all forces applied to each body in the system in Newtons (N), vector acceleration of each body in m/s , and mass of the body in kg.
(1)
To use Newton's Second Law
1. Dene coordinates In particular, dene the positive direction. The displacement, velocity, acceleration must be consistent in their positive direction.
2. Use a free-body-diagram to nd all forces. Free-body-diagram is diagram used to show the relative magnitude and directions of all forces acting upon an object. (a) External forces (input, disturbance, etc.), (b) Spring,
x,
where
k is spring constant,
b m, b x,
where
(c) Friction (e.g. piston in a cylinder), 3. Use
b is friction coecient.
F = m, a
to get all dierential equations that describe the dependencies between coor-
dinates and forces. 4. Get the transfer function of interest. Example: One-mass system
Neglect rotational inertia of wheels, friction, etc. to get free-body-diagram:
Apply Newton's Law
u(t) = M x(t)
The Laplace transform
(2)
U (s) = M s2 X(s) X(s) 1 = U (s) M s2
Note that
1 s2
corresponds to a double integrator, i.e.,
x(t)
is much smoother than
u(t).
Example: one-mass system with friction
We model friction as proportional to velocity.
u bx = M x
Take Laplace transform
(3)
U (s) bsX(s) = X(s) = U (s)
Example: Two-mass system
M s2 X(s) 1 2 + bs Ms
Free-body diagram
Figure 1: Free-body diagram
m1 .
How to determine sign?
If If
x2 > x1 , x2 > x1 ,
spring is extended
force is pulling to the right.
m 2 is leaving away from m 1 force is pulling to the right.
Figure 2: Free-body diagram
m2 .
u + k(x2 x1 ) + b(x2 x1 ) = m1 x1 k(x2 x1 ) b(x2 x1 ) = m2 x2
Note: don't need to nd the sign again; simply use reaction force opposite to the acting force. Take Laplace transforms
X1 (s) m1 s2 + bs + k X2 (s) [bs + k] = U (s) X1 (s) [bs + k] + X2 (s) m2 s2 + bs + k = 0
Solve for
X1
and
X2 .
If we are only interested in
X2 .
X1 (s) =
X2 (s) [bs + k] + U (s) [m1 s2 + bs + k]
X2 (s) [bs + k] + U (s) [bs + k] + X2 (s) m2 s2 + bs + k = 0 [m1 s2 + bs + k] bs + k X2 (s) = 4 + (m + m )bs3 + (m + m )ks2 U (s) m1 m2 s 1 2 1 2
Rotational Systems
Newton's Second Law now reads:
M = I
where:
(4)
M : sum of all torques on body (N.m)
torque
= force distance
from the axis of rotation
I : moment of inertia of body around its axis of rotation (kg.m2 )
I
of a point mass
= mass (distance
from the axis of rotation)
of a more complex mass
=
0
r2 dm
: angular acceleration around the axis rotation (rad/s2 )
Figure 3: Rotational systems.
For Figure (3.a)
M =F l
For Figure (3.b)
M = F l mgr sin I = mr2 =
Note: To use
M = I
correctly, need to choose the right axis of rotation,
1. If the axis is static/xed, use it. 2. Use to body's center of mass as the axis. Caution: do not use an axis that is moving unless it is the center of mass. Example: The rotational equivalent of the two-mass system from previous example.
applied torque
=U R
I1 1 = U R + k (2 1 ) + b 2 1 I2 2 = k (2 1 ) b 2 1
Dimension of Freedom
One dimension of freedom
Figure 4: (a) One dimension of freedom, (b) two dimensions of freedom.
F = m x
Two dimension of freedom
Fx Fy
= =
m x m y
Translational and Rotational Systems
Example: Inverted pendulum - segway HT, space shuttle.
Figure 5: (a) Inverted pendulum, (b) Free body diagram.
Objective: apply force
u to keep the inverted pendulum in the upright position. For this system, the object m has both translational and rotational motions.
We can consider it as the combination of translational motion at the center of mass and rotational motion around the center of mass
two sets of equations for object
m.
1. Set up coordinate, Figure (5.a) 2. Free body diagram for
M, Figure (5.b)
U H = Mx
3. Free body diagram for
m, Figure (5.b) m in the horizontal direction?
H=m d2 (x + l sin ) dt2 d2 (l cos ) dt2
Apply Newton's Law on the horizontal direction. Q: What is the displacement of A: Relative to
M : l sin , relative to earth: x + l sin .
On the vertical direction
V mg = m
Around the center of mass
V l sin H l cos = I
There are four equations. Quantities of interest:
x. Additional unknown: V, H
will be eliminated.
d (sin ) = cos dt d d2 (sin ) = (cos ) = sin + cos dt2 dt d (cos ) = sin dt d d2 (cos ) = ( sin ) = cos sin dt2 dt
Hence
U H = Mx
(5)
2 H = m ml sin () + ml cos x 2 V mg = ml cos () ml sin V l sin H l cos = I
Eliminate
(6)
(7)
(8)
H H
with (5) + (6)
2 U = (M + m) ml sin () + ml cos x
Eliminate and
(9)
by substituting (6) and (7) into (8),
mgl sin ml2 ml cos = I x mgl sin ml cos = I + ml2 x
Equations (9) and (10) describe the relationship between There are non-linear terms
(10)
u and x, .
sin () , cos , sin , cos x
Q: How to linearized those equations?
Mathematical Modeling of Electrical Systems
Models of some common elements
Element
Resistor Capacitor Inductor Voltage Source Current Source
Time Domain Laplace Transform Complex Impedance
v(t) = Ri(t) dv(t) i=C dt di(t) v(t) = L dt v(t) = Vs i(t) = Is V (s) = RI(s) I(s) = CsV (s) V (s) = LsI(s) 1 sC sL
Operational Amplier (op-amp)
Figure 6: Ideal operational amplier.
We usually assume that the op-amp is ideal:
e0 = K(e2 e1 ) = K(e1 e2 )
innite input impedance zero output impedance gain
zero current drain by input,
i+ = i = 0
and
e+ = e .
e0
does not change due to load.
K = +
Kirchho's Laws
Governs the relationship between the various currents and voltages.
Kirchho current law (KCL)
The algebraic sum of all currents leaving and coming from/to junction or node in the circuit is zero.
Kirchho voltage law (KVL)
The algebraic sum if all voltages taken around a closed path in a circuit is zero. Example: Use KCL to nd voltages at nodes.
Current equation at each node
Ei E2 E2 Eo C1 sE2 =0 R1 R2 C2 s (Ei Eo ) +
Eliminating
(11)
E2 Eo =0 R2 Ei (s)
and output
(12)
E2 (s),
to obtain the relationship between input
Eo (s),
we have:
Eo R1 R2 C1 C2 s2 + (R1 + R2 ) C2 s + 1 = Ei R1 R2 C1 C2 s2 + ((R1 + R2 ) C2 + R1 C1 ) s + 1
Derive (13) for exercise. Example: Inverting op-amp and ideal. Using KCL
(13)
i1 i2 i3 = 0 ei e e eo d C (e eo ) =0 R1 dt R2
Because
e = 0,
then
deo eo ei +C + =0 R1 dt R2
Take Laplace transform
Ei Eo + CsEo + =0 R1 R2 Eo = Ei
Putting everything together:
1 R1 1 Cs + R2
R2 1 R1 1 + R2 Cs
mechanical electrical block diagram
10
An electro-mechanical system
Armature control of a DC serve-motor
Figure 7: Electro-mechanical system.
1. Input voltage 2.
i through the armature (rotor winding). The current i caused a torque T on the rotor and load. T is proportional to i
ei
sends a certain current
T = ki.
3. The rotor + load is modeled as a rotational system with damping. 4. The rotation of the rotor also generate a back voltage (emf ) velocity
m .
eb
proportional to the angular
This can be viewed as a feedback that impact the armature current .
eb = Kb m
Thus, we have the set of equations as
ei eb = i R + sL T = ki T b = J m m m e = K b b m
where
m =
T Jm s2 + bs eb = sKb m
Jm
is moment of inertia and
b is friction coecient.
We could model this as a block diagram
(s) ei (s)
1 1 k Ls + R Jm s2 + bs 1 1 1 + sKb k Ls + R Jm s2 + bs k 2 + s (bL + RJ ) + (Rb K k)] s [Jm Ls m b
11
Linearization of Nonlinear Systems
A linear function satises the following superposition property
f (x1 + x2 ) = f (x1 ) + f (x2 )
for all
x1 , x2 .
Linear systems are those where the principle of superposition applies
an y (n) + an1 y (n1) + + a1 y (1) + a0 y(t) = bm u(m) + bm1 u(m1) + + b1 u(1) + b0 u(t)
If
then so does
(y1 (t), u1 (t)) and (y2 (t), u2 (t)) both satisfy (y1 (t) + u1 (t), y2 (t) + u2 (t)).
the dierential equation,
We can rewrite a linear system as
f (y, y, , y (n) , u, u, , u(m) ) = 0
where
f ( ) = an y (n) +an1 y (n1) + +a1 y (1) +a0 y(t) bm u(m) + bm1 u(m1) + + b1 u(1) + b0 u(t)
Then
f (.)
is a linear function of its variables.
IMPORTANT: We can take Laplace transform only for linear systems.
Non-linear systems are those where the principle of superposition does NOT apply.
Example: Non-linear systems 1. Inverted pendulum, equation (9) and (10).
2 U = (M + m) ml sin () + ml cos x mgl sin ml cos = I + ml2 x
If we rewrite these equations as
f (, , , x, x, x, u) = 0
The function
is NOT a linear function of its variables.
2. Non-linear circuit.
Non-linear resistor
VR = i3 R. Vi = i3 R + L
di dt
We CANNOT take Laplace transform for non-linear systems. However, we could derive a linear system that is an approximation of the original system, then take Laplace transform.
12
Linearization
Basic idea: If the system operates only around a small neighborhood of an equilibrium points, by expanding the nonlinear functions into a Taylor series about the equilibrium point, we can retain the linear terms, and neglect the higher-order terms. In this way we obtain linear approximation of the original system. Such linear model would work, if the deviation of the signals from the equilibrium point is small. We can the study the linear system by taking Laplace transform.
Linearization of a function
Suppose
y = f (x),
f
y
is non-linear. Take Taylor series expansion, assuming all derivatives exist.
= =
f (x) f (x) + df dx (x x) +
x=x
1 d 2f 2! dx2 x
(x x)2 +
x=x
derivatives evaluated at when
(constant)
|x x|
is small,
df y f (x) + = dx
Letting
(x x)
x=x
y = y f (x),
and
x = x x,
we have
y=
Deviations from
df dx
x
x=x
f (x)
of the output
y are linear in deviations from x of the input x.
Linearization of a function with multiple variables
y = f (x1 , x2 , u1 , u2 )
13
f (x1 , x2 , u1 , u2 ) + f = x1 + f x2
x1 = x1 u1 = u1
x2 = x2 (x1 x1 ) u2 = u2 x1 = x1 u1 = u1 x2 = x2 (u1 u1 ) u2 = u2
x1 = x1 u1 = u1
f x2 = x2 (x2 x2 ) + u1 u2 = u2 x2 = x2 (u2 u2 ) u2 = u2
++
f u2
x1 = x1 u1 = u1
The coecient in front of each variable is simply the partial derivative evaluated at the equilibrium point.
Procedures for linearization
Given the dierential equation 1. Find equilibrium point by setting all
x, x, u, u,
to zero
solve for the equilibrium point.
2. For each term that is non-linear, view it as a non-linear function of the variables Evaluate the partial derivative at the equilibrium point: linear approximation.
x, x, x, u, u, u, .
x, 0, 0, u, 0, 0, .
Write down the
3. Simplify the linear equations. Replace each variables by its deviation from the equilibrium.
Linearization of the dierential equation of one variable
nonlinear. 1. Find equilibrium point of the system by setting the system. (Idea: If Hopefully, if
Suppose
dx = f (x(t)), dt
where
x = 0 f (x) = 0.
The set of solutions that satisfy the above equation is called the set of equilibrium points of
x(0)
is close to
x(0) = x, then x(t) = x for all t. The system is at equilibrium. x, x(t) will stay close to x for at least some interval (0, T )).
2. Evaluate partial derivatives for each non-linear term
dx df f (x) + dt dx
3. Simplify the linear equation. Note that Let
(x x)
x=x
f (x) = 0
by denition of equilibrium points
x.
x = x x.
Then
d d df x = x x = dt dt dx
x
x=x
Linearization of a dierential equation with inputs and higher order derivatives
d2 x(t) = f (x(t), x(t), u(t)) dt2
1. Find the equilibrium points. For a reference (constant) input solutions of
uref ,
the equilibrium points are
f (xeq , 0, ueq ) = 0
14
2. Evaluate partial derivatives for non-linear terms
d2 x(t) dt2
= f (xeq , 0, ueq ) +
f (x(t) xeq ) x x = xeq x=0 u = ueq
f f (x(t) 0) + (x(t) xeq ) x x = xeq x x = xeq x=0 x=0 u = ueq u = ueq
Let
3. Simplify. Note that
f (xeq , 0, ueq ) = 0.
x = x xeq , u = u ueq
x =
f f f x + x + u x x = xeq x x = xeq x x = xeq x=0 x=0 x=0 u = ueq u = ueq u = ueq
Rearrange
Example:
Vi = i3 R + L
di . dt
di Vi R = i3 dt L L Vref = 1 Vi R i3 = 0 L L ieq =
3
1. Find equilibrium points. Suppose Set
di = 0, dt
we have
Vref = R
1 R
2. Evaluate partial derivatives. Let
f (i) =
R 3 i L f i (i ieq )
i=ieq
f (i) f (ieq ) + f i
=
i=ieq
3R 2 i L
=
i=ieq
3 3 R L
Hence, the linear approximation is
di dt
= = =
Vi + f (i) L Vi f + f (ieq ) + (i ieq ) L i i=ieq Vi 3 3 + f (ieq ) R(i ieq ) L L
3. Simplify. Let
Vi = Vi Vref , i = i ieq i = Vi Vref 3 3 + + f (ieq ) Ri L L L
=0
3 Vi 3 Ri L L
15
Take Laplace transform
si(s) i(s) s + 3 3 R L i(s) Vi (s)
Example: pendulum
= =
Vi (s) 3 3 Ri(s) L L Vi (s) L 1 L 3 s+ 3R L
I = ul cos mgl sin bl
1. Find equilibrium points Suppose
uref = 0.
Set
, = 0.
We have
mgl sin = 0 = 0.
2. Evaluate partial derivatives. Let
f (, u) = ul cos mgl sin f (, u) = f (, uref ) + f u = uref ( ) =0
f (u uref ) u u = uref =0
u = uref =0
ul sin mgl cos | u = u = mgl ref =0 l cos | u = u =l ref =0
f u u = uref =0
Hence, the linear approximation is
I = f (, uref ) mgl( ) + l(u uref ) bl
16
3. Simplify. Note that Let
and
f (, uref ) = 0. u = u uref I = mgl + lu bl
Take Laplace transform
s2 I(s) (s) s I + sbl + mgl (s) u(s)
2
= mgl(s) + lu(s) sbl(s) = lu(s) = l s2 I + sbl + mgl