State and Output Feedback
State and Output Feedback
State and Output Feedback
5.1
Introduction
The idea of using feedback to shape the dynamic behavior was discussed in broad terms in Section 1.4. In this chapter we will discuss this in detail for linear systems. In particular it will be shown that under certain conditions it is possible to assign the system eigenvalues to arbitrary values by feedback, allowing us to design the dynamics of the system. The state of a dynamical system is a collection of variables that permits prediction of the future development of a system. In this chapter we will explore the idea of controlling a system through feedback of the state. We will assume that the system to be controlled is described by a linear state model and has a single input (for simplicity). The feedback control will be developed step by step using one single idea: the positioning of closed loop eigenvalues in desired locations. It turns out that the controller has a very interesting structure that applies to many design methods. This chapter may therefore be viewed as a prototype of many analytical design methods. If the state of a system is not available for direct measurement, it is often possible to determine the state by reasoning about the state through our knowledge of the dynamics and more limited measurements. This is done by building an observer that uses measurements of the inputs and outputs of a linear system, along with a model of the system dynamics, to 109
110
estimate the state. The details of the analysis and designs in this chapter are carried out for systems with one input and one output, but it turns out that the structure of the controller and the forms of the equations are exactly the same for systems with many inputs and many outputs. There are also many other design techniques that give controllers with the same structure. A characteristic feature of a controller with state feedback and an observer is that the complexity of the controller is given by the complexity of the system to be controlled. Thus the controller actually contains a model of the system. This is an example of the internal model principle which says that a controller should have an internal model of the controlled system.
5.2
Reachability
We begin by disregarding the output measurements and focus on the evolution of the state which is given by dx = Ax + Bu, dt (5.1)
where x Rn , u R, A is an n n matrix and B an n 1 matrix. A fundamental question is if it is possible to nd control signals so that any point in the state space can be reached. First observe that possible equilibria for constant controls are given by Ax + bu0 = 0 This means that possible equilibria lies in a one (or possibly higher) dimensional subspace. If the matrix A is invertible this subspace is spanned by A1 B . Even if possible equilibria lie in a one dimensional subspace it may still be possible to reach all points in the state space transiently. To explore this we will rst give a heuristic argument based on formal calculations with impulse functions. When the initial state is zero the response of the state to a unit step in the input is given by
t
x(t) =
0
eA(t ) Bd.
(5.2)
The derivative of a unit step function is the impulse function (t), which may be regarded as a function which is zero everywhere except at the origin
111
(t)dt = 1.
The response of the system to a impulse function is thus the derivative of (5.2) dx = eAt B. dt Similarly we nd that the response to the derivative of a impulse function is d2 x = AeAt B. dt2 The input (t) + (t) + + n (n1) (t) u(t) = 1 (t) + 2 thus gives the state x(t) = 1 eAt B + 2 AeAt B + 3 A2 eAt B + + n An1 eAt B. Hence, right after the initial time t = 0, denoted t = 0+, we have x(0+) = 1 B + 2 AB + 3 A2 B + + n An1 B The right hand is a linear combination of the columns of the matrix Wr = B AB . . . An1 B . (5.3)
To reach an arbitrary point in the state space we thus require that there are n linear independent columns of the matrix Wc . The matrix is called the reachability matrix. An input consisting of a sum of impulse functions and their derivatives is a very violent signal. To see that an arbitrary point can be reached with smoother signals we can also argue as follow. Assuming that the initial condition is zero, the state of a linear system is given by
t
x(t) =
0
eA(t ) Bu( )d =
0
eA Bu(t )d.
x(t) = B
0
0 ( )u(t ) d + AB
1 ( )u(t ) d +
t 0
. . . + An1 B
n1 ( )u(t ) d.
Again we observe that the right hand side is a linear combination of the columns of the reachability matrix Wr given by (5.3). We illustrate by two examples. Example 5.1 (Reachability of the Inverted Pendulum). Consider the inverted pendulum example introduced in Example 3.5. The nonlinear equations of motion are given in equation (3.5) dx x2 = sin x1 + u cos x1 dt y = x1 . Linearizing this system about x = 0, the linearized model becomes dx 0 0 1 u x+ = 1 1 0 dt y = 1 0 x. The dynamics matrix and the control matrix are A= The reachability matrix is Wr = 0 1 . 1 0 (5.5) 0 1 , 1 0 B= 0 1 (5.4)
This matrix has full rank and we can conclude that the system is reachable. This implies that we can move the system from any initial state to any nal state and, in particular, that we can always nd an input to bring the system from an initial state to the equilibrium. Example 5.2 (System in Reachable Canonical Form). Next we will consider a system by in reachable canonical form: a1 a2 . . . an1 an 1 1 0 0 0 0 dz 1 0 0 + Bu = 0 z + 0 u = Az . dt . . . . . 0 0 1 0 0
5.2. REACHABILITY
113
To show that Wr is full rank, we show that the inverse of the reachability matrix exists and is given by 1 a 1 a2 . . . an 0 1 a1 . . . an1 1 (5.6) Wr = . . . 0 0 0 ... 1 To show this we consider the product A B B where w0 = B +A B w1 = a 1 B . . . + + A n1 B. wn1 = an1 B + an2 AB The vectors wk satisfy the relation wk = a k + w k1 and iterating this relation we nd that 1 0 0 ... 0 0 1 0 . . . 0 = . . . 0 0 0 ... 1
1 n1 B Wr = w0 w1 A
wn1
w0 w1
wn1
114
S
u
S
Figure 5.1: A non-reachable system. Example 5.3 (Non-reachable System). Assume that the systems in Figure 5.1 are of rst order. The complete system is then described by dx1 = x1 + u dt dx2 = x2 + u dt The reachability matrix is Wr = 1 1 1 1
This matrix is singular and the system is not reachable. One implication of this is that if x1 and x2 start with the same value, it is never possible to nd an input which causes them to have dierent values. Similarly, if they start with dierent values, no input will be able to drive them both to zero.
Coordinate Changes
It is interesting to investigate how the reachability matrix transforms when the coordinates are changed. Consider the system in (5.1). Assume that the coordinates are changed to z = T x. As shown in the last chapter, that the dynamics matrix and the control matrix for the transformed system are = T AT 1 A = TB B The reachability matrix for the transformed system then becomes r = B = A B ... A n1 B W
5.3. STATE FEEDBACK We have B = T AT 1 T B = T AB A 2 B = (T AT 1 )2 T B = T AT 1 T AT 1 T B = T A2 B A . . . n B = T An B. A The reachability matrix for the transformed system is thus r = B A B ... A n1 B = T B AB . . . An1 B = T Wr W
115
(5.7)
This formula is useful for nding the transformation matrix T that converts r from Example 5.2). a system into reachable canonical form (using W
5.3
State Feedback
dx = Ax + Bu dt y = Cx
The output is the variable that we are interested in controlling. To begin with it is assumed that all components of the state vector are measured. Since the state at time t contains all information necessary to predict the future behavior of the system, the most general time invariant control law is function of the state, i.e. u(t) = f (x(t)) If the feedback is restricted to be a linear, it can be written as u = Kx + Kr r (5.9)
where r is the reference value. The negative sign is simply a convention to indicate that negative feedback is the normal situation. The closed loop system obtained when the feedback (5.8) is applied to the system (5.9) is given by dx = (A BK )x + BKr r (5.10) dt
116
It will be attempted to determine the feedback gain K so that the closed loop system has the characteristic polynomial p(s) = sn + p1 sn1 + . . . + pn1 s + pn (5.11)
This control problem is called the eigenvalue assignment problem or the pole placement problem (we will dene poles more formally in a later chapter).
Examples
We will start by considering a few examples that give insight into the nature of the problem. Example 5.4 (The Double Integrator). The double integrator is described by dx 0 1 0 = x+ u 0 0 1 dt y= 1 0 x Introducing the feedback u = k1 x1 k2 x2 + Kr r the closed loop system becomes dx 0 1 0 = x+ r k k K dt 1 2 r y= 1 0 x The closed loop system has the characteristic polynomial det s 1 = s2 + k2 s + k 1 k1 s + k 2 (5.12)
Assume it is desired to have a feedback that gives a closed loop system with the characteristic polynomial
2 p(s) = s2 + 20 s + 0
Comparing this with the characteristic polynomial of the closed loop system we nd nd that the feedback gains should be chosen as
2 k1 = 0 ,
k2 = 20
To have unit steady state gain the parameter Kr must be equal to k1 = 2 . The control law can thus be written as 0
2 u = k1 (r x1 ) k2 x2 = 0 (r x1 ) 20 0 x2
5.3. STATE FEEDBACK In the next example we will encounter some diculties. Example 5.5 (An Unreachable System). Consider the system dx 1 0 1 u x+ = 0 0 0 dt y = Cx = 1 0 x with the control law u = k1 x1 k2 x2 + Kr r The closed loop system is dx k1 1 k2 Kr = x+ r 0 0 0 dt This system has the characteristic polynomial det s + k1 1 + k2 = s2 + k1 s = s(s + k1 ) 0 s
117
This polynomial has zeros at s = 0 and s = k1 . One closed loop eigenvalue is thus always equal to s = 0 and it is not possible to obtain an arbitrary characteristic polynomial. This example shows that the eigenvalue placement problem cannot always be solved. An analysis of the equation describing the system shows that the state x2 is not reachable. It is thus clear that some conditions on the system are required. The reachable canonical form has the property that the parameters of the system are the coecients of the characteristic equation. It is therefore natural to consider systems on this form when solving the eigenvalue placement problem. In the next example we investigate the case when the system is in reachable canonical form. Example 5.6 (System in Reachable reachable canonical form, i.e, a1 a2 1 0 dz 0 1 = Az + Bu = . dt . . 0 0 = b1 b2 y = Cz Canonical Form). Consider a system in 1 . . . an1 an ... 0 0 0 ... 0 0 z + 0 u . . . 0 ... 1 0
(5.13)
bn z.
118
The open loop system has the characteristic polynomial s + a1 a2 . . . an1 an 1 s 0 0 0 1 0 0 Dn (s) = det . . . . 0 0 1 s Expanding the determinant by the last row we nd that the following recursive equation for the determinant: Dn (s) = sDn1 (s) + an . It follows from this equation that Dn (s) = sn + a1 sn1 + . . . + an1 s + an A useful property of the system described by (5.13) is thus that the coefcients of the characteristic polynomial appear in the rst row. Since the all elements of the B -matrix except the rst row are zero it follows that the state feedback only changes the rst row of the A-matrix. It is thus straight forward to see how the closed loop eigenvalues are changed by the feedback. Introduce the control law 1 z1 k 2 z2 . . . k n zn + Kr r + K r r = k u = Kz The closed loop system then becomes 1 a2 k 2 . . . an1 k n1 an k n Kr a1 k 0 1 0 0 0 dz 0 0 1 0 0 = z + r . dt . . . . . 0 0 1 0 0 (5.15) The feedback thus changes the elements of the rst row of the A matrix, which corresponds to the parameters of the characteristic equation. The closed loop system thus has the characteristic polynomial 1 )sn1 + (a2 + k 2 )sn2 + . . . + (an1 + k n1 )s + an + k n sn + (al + k y = b1 b2 bn z (5.14)
119
Requiring this polynomial to be equal to the desired closed loop polynomial (5.11) we nd that the controller gains should be chosen as 1 = p1 a1 k 2 = p2 a2 k . . . kn = p n a n This feedback simply replace the parameters ai in the system (5.15) by pi . The feedback gain for a system in reachable canonical form is thus = p1 a 1 p2 a 2 K n pn an + k = bn bn pn a n (5.16)
To have unit steady state gain the parameter Kr should be chosen as Kr = (5.17)
Notice that it is essential to know the precise values of parameters a n and bn in order to obtain the correct steady state gain. The steady state gain is thus obtained by precise calibration. This is very dierent from obtaining the correct steady state value by integral action, which we shall see in later chapters. We thus nd that it is easy to solve the eigenvalue placement problem when the system has the structure given by (5.13).
120
The transformation matrix is thus given by r W 1 T =W r and the feedback gain can be written as
1 =K W r Wr K = KT
(5.18)
(5.19)
r is given by (5.6). The feedforward gain Kr is Notice that the matrix W given by equation (5.17). The results obtained can be summarized as follows. Theorem 5.1 (Pole-placement by State Feedback). Consider the system given by equation (5.8) dx = Ax + Bu dt y = Cx with one input and one output. If the system is reachable there exits a feedback u = Kx + Kr r that gives a closed loop system with the characteristic polynomial p(s) = sn + p1 sn1 + . . . + pn1 s + pn . The feedback gain is given by
1 = p1 a 1 p2 a 2 . . . p n a n W r Wr K = KT pn Kr = an
where ai are the coecients of the characteristic polynomial of the matrix r are given by A and the matrices Wr and W Wr = B AB . . . An1 1 1 a1 a2 . . . an1 0 1 a1 . . . an2 r = W . . . 0 0 0 ... 1
Remark 5.1 (A mathematical interpretation). Notice that the eigenvalue placement problem can be formulated abstractly as the following algebraic problem. Given an n n matrix A and an n 1 matrix B , nd a 1 n matrix K such that the matrix A BK has prescribed eigenvalues.
5.4. OBSERVABILITY
121
5.4
Observability
In Section 5.3 it was shown that it was possible to nd a feedback that gives desired closed loop eigenvalues provided that the system is reachable and that all states were measured. It is highly unrealistic to assume that all states are measured. In this section we will investigate how the state can be estimated by using the mathematical model and a few measurements. It will be shown that the computation of the states can be done by dynamical systems. Such systems will be called observers. Consider a system described by dx = Ax + Bu dt y = Cx (5.20)
where x is the state, u the input, and y the measured output. The problem of determining the state of the system from its inputs and outputs will be
122
considered. It will be assumed that there is only one measured signal, i.e. that the signal y is a scalar and that C is a (row) vector.
Observability
When discussing reachability we neglected the output and focused on the state. We will now discuss a related problem where we will neglect the input and instead focus on the output. Consider the system dx = Ax dt y = Cx (5.21)
We will now investigate if it is possible to determine the state from observations of the output. This is clearly a problem of signicant practical interest, because it will tell if the sensors are sucient. The output itself gives the projection of the state on vectors that are rows of the matrix C . The problem can clearly be solved if the matrix C is invertible. If the matrix is not invertible we can take derivatives of the output to obtain dy dx =C = CAx. dt dt From the derivative of the output we thus get the projections of the state on vectors which are rows of the matrix CA. Proceeding in this way we get y C dy dt CA d2 y 2 = CA2 x (5.22) dt . . . . . . CAn1 dn1 y
dtn1
has n independent rows. Notice that because of the Cayley-Hamilton equation it is not worth while to continue and take derivatives of order higher
(5.23)
5.4. OBSERVABILITY
123
S S
Figure 5.2: A non-observable system. than n 1. The matrix Wo is called the observability matrix. A system is called observable if the observability matrix has full rank. We illustrate with an example. Example 5.7 (Observability of the Inverted Pendulum). The linearized model of inverted pendulum around the upright position is described by (5.4). The matrices A and C are A= The observability matrix is Wo = 1 0 0 1 0 1 , 1 0 C= 1 0
y
which has full rank. It is thus possible to compute the state from a measurement of the angle. The calculation can easily be extended to systems with inputs. The state is then given by a linear combination of inputs and outputs and their higher derivatives. Dierentiation can give very large errors when there is measurement noise and the method is therefore not very practical particularly when derivatives of high order appear. A method that works with inputs will be given the next section.
A Non-Observable System
It is useful to have an understanding of the mechanisms that make a system unobservable. Such a system is shown in Figure 5.2. Next we will consider
124
y = 1 0 0 . . . 0 z + Du
A straight forward but tedious calculation shows that the inverse of the observability matrix has a simple form. It is given by 1 0 0 ... 0 a1 1 0 . . . 0 1 a1 1 . . . 0 Wo = a2 . . . an1 an2 an3 . . . 1
This matrix is always invertible. The system is composed of two identical systems whose outputs are added. It seems intuitively clear that it is not possible to deduce the states from the output. This can also be seen formally.
Coordinate Changes
It is interesting to investigate how the observability matrix transforms when the coordinates are changed. Consider the system in equation (5.21). Assume that the coordinates are changed to z = T x. It follows from linear algebra that the dynamics matrix and the output matrix are given by = T AT 1 A = CT 1 . C The observability matrix for the transformed system then becomes C A C A 2 o = C W . . . A n1 C
125
and we nd that the observability matrix for the transformed system has the property C A C o = C A2 (5.24) W T 1 = Wo T 1 . . . C An1 This formula is very useful for nding the transformation matrix T .
5.5
Observers
For a system governed by equation (5.20), we can attempt to determine the state simply by simulating the equations with the correct input. An estimate of the state is then given by dx = Ax + Bu dt (5.25)
To nd the properties of this estimate, introduce the estimation error x =xx It follows from (5.20) and (5.25) that dx = Ax dt If matrix A has all its eigenvalues in the left half plane, the error x will thus go to zero. Equation (5.25) is thus a dynamical system whose output converges to the state of the system (5.20). The observer given by (5.25) uses only the process input u; the measured signal does not appear in the equation. It must also be required that the system is stable. We will therefore attempt to modify the observer so that
126
the output is used and that it will work for unstable systems. Consider the following observer dx = Ax + Bu + L(y C x ). (5.26) dt This can be considered as a generalization of (5.25). Feedback from the measured output is provided by adding the term L(y C x ). Notice that Cx =y is the output that is predicted by the observer. To investigate the observer (5.26), form the error x =xx It follows from (5.20) and (5.26) that dx = (A LC ) x dt If the matrix L can be chosen in such a way that the matrix A LC has eigenvalues with negative real parts, the error x will go to zero. The convergence rate is determined by an appropriate selection of the eigenvalues. The problem of determining the matrix L such that A LC has prescribed eigenvalues is very similar to the eigenvalue placement problem that was solved above. In fact, if we observe that the eigenvalues of the matrix and its transpose are the same, we nd that could determine L such that AT C T LT has given eigenvalues. First we notice that the problem can be solved if the matrix CT AT C T . . . A(n1)T C T
is invertible. Notice that this matrix is the transpose of the observability matrix for the system (5.20). C CA Wo = . . . CAn1 of the system. Assume it is desired that the characteristic polynomial of the matrix A LC is p(s) = sn + p1 sn1 + . . . + pn It follows from Remark 5.1 of Theorem 5.1 that the solution is given by T W T L T = p1 a 1 p2 a 2 . . . p n a n W o o
5.5. OBSERVERS where Wo is the observability matrix the system of the system a1 1 0 a2 0 1 dz . = . . dt an1 0 0 an 0 0
y = 1 0 0 ... 0
which is the observable canonical form of the system (5.20). Transposing the formula for L we obtain p1 a 1 p a2 1 2 L = Wo Wo . . . pn a n Theorem 5.2 (Observer design by eigenvalue placement). Consider the system given by dx = Ax + Bu dt y = Cx
where output y is a scalar. Assume that the system is observable. The dynamical system dx = Ax + Bu + L(y C x ) dt with L chosen as p1 a 1 p a2 1 2 L = Wo Wo . (5.27) . . o are given by where the matrices Wo and W 1 0 0 C a1 1 0 CA 1 a2 a 1 1 Wo = . , Wo = . . . . . CAn1 an1 an2 an3 pn a n ... 0 . . . 0 . . . 0 ... 1
Figure 5.3: Block diagram of the observer. Notice that the observer contains a copy of the process. Then the observer error x = xx is governed by a dierential equation having the characteristic polynomial p(s) = sn + p1 sn1 + . . . + pn Remark 5.2. The dynamical system (5.26) is called an observer for (the states of the) system (5.20) because it will generate an approximation of the states of the system from its inputs and outputs. Remark 5.3. The theorem can be derived by transforming the system to observable canonical form and solving the problem for a system in this form. Remark 5.4. Notice that we have given two observers, one based on pure differentiation (5.22) and another described by the dierential equation (5.26). There are also other forms of observers.
5.5. OBSERVERS
129
Duality
Notice the similarity between the problems of nding a state feedback and nding the observer. The key is that both of these problems are equivalent to the same algebraic problem. In eigenvalue placement it is attempted to nd L so that A BL has given eigenvalues. For the observer design it is instead attempted to nd L so that A LC has given eigenvalues. The following equivalence can be established between the problems A AT
T Wr W o
K LT
B CT
The similarity between design of state feedback and observers also means that the same computer code can be used for both problems.
130
i.e. the identity matrix. The system is thus observable and the problem can be solved. We have l1 1 A LC = l2 0 It has the characteristic polynomial det A LC = det s + l1 1 = s2 + l1 s + l 2 l2 s
Assume that it is desired to have an observer with the characteristic polynomial s2 + p1 s + p2 = s2 + 2s + 2 The observer gains should be chosen as l1 = p1 = 2 l2 = p 2 = 2 The observer is then dx 0 1 0 l = x + u + 1 (y x 1 ) 0 0 1 l2 dt
5.6
Output Feedback
In this section we will consider the same system as in the previous sections, i.e. the nth order system described by dx = Ax + Bu dt y = Cx (5.28)
where only the output is measured. As before it will be assumed that u and y are scalars. It is also assumed that the system is reachable and observable. In Section 5.3 we had found a feedback u = Kx + Kr r for the case that all states could be measured and in Section 5.4 we have presented developed an observer that can generate estimates of the state x based on inputs and outputs. In this section we will combine the ideas of these sections to nd an feedback which gives desired closed loop eigenvalues for systems where only outputs are available for feedback.
131
If all states are not measurable, it seems reasonable to try the feedback u = K x + Kr r where x is the output of an observer of the state (5.26), i.e. dx = Ax + Bu + L(y C x ) dt (5.30) (5.29)
Since the system (5.28) and the observer (5.30) both are of order n, the closed loop system is thus of order 2n. The states of the system are x and x . The evolution of the states is described by equations (5.28), (5.29)(5.30). To analyze the closed loop system, the state variable x is replace by x =xx Subtraction of (5.28) from (5.28) gives dx = Ax Ax L(y C x ) = Ax LC x = (A LC ) x dt Introducing u from (5.29) into this equation and using (5.31) to eliminate x gives dx = Ax + Bu = Ax BK x + BKr r = Ax BK (x x ) + BKr r dt = (A BK )x + BK x + BKr r The closed loop system is thus governed by d x A BK BK = 0 A LC dt x BKr x + r x 0 (5.32) (5.31)
Since the matrix on the right-hand side is block diagonal, we nd that the characteristic polynomial of the closed loop system is det (sI A + BK ) det (sI A + LC ) This polynomial is a product of two terms, where the rst is the characteristic polynomial of the closed loop system obtained with state feedback and the other is the characteristic polynomial of the observer error. The feedback (5.29) that was motivated heuristically thus provides a very neat solution to the eigenvalue placement problem. The result is summarized as follows.
132
Theorem 5.3 (Pole placement by output feedback). Consider the system dx = Ax + Bu dt y = Cx The controller described by u = K x + Kr r dx = Ax + Bu + L(y C x ) dt gives a closed loop system with the characteristic polynomial det (sI A + BK ) det (sI A + LC ) This polynomial can be assigned arbitrary roots if the system is observable and reachable. Remark 5.5. Notice that the characteristic polynomial is of order 2n and that it can naturally be separated into two factors, one det (sI A + BK ) associated with the state feedback and the other det (sI A + LC ) with the observer. Remark 5.6. The controller has a strong intuitive appeal. It can be thought of as composed of two parts, one state feedback and one observer. The feedback gain K can be computed as if all state variables can be measured.
133
PSfrag replacements
Kr
Process
y C
A Observer K
Figure 5.4: Block diagram of a controller which combines state feedback with an observer.
5.7
Integral Action
The controller based on state feedback achieves the correct steady state response to reference signals by careful calibration of the gain Lr and it lacks the nice property of integral control. It is then natural to ask why the the beautiful theory of state feedback and observers does not automatically give controllers with integral action. This is a consequence of the assumptions made when deriving the analytical design method which we will now investigate. When using an analytical design method, we postulate criteria and specications, and the controller is then a consequence of the assumptions. In this case the problem is the model (5.8). This model assumes implicitly that the system is perfectly calibrated in the sense that the output is zero when the input is zero. In practice it is very dicult to obtain such a model. Consider, for example, a chemical process control problem where the output is temperature and the control variable is a large rusty valve. The model (5.8) then implies that we know exactly how to position the valve to get a specied outlet temperatureindeed, a highly unrealistic assumption.
134
Having understood the diculty it is not too hard to change the model. By modifying the model to dx = Ax + B (u + v ) dt y = Cx, (5.35)
where v is an unknown constant, we can can capture the idea that the model is no longer perfectly calibrated. This model is called a model with an input disturbance. Another possibility is to use the model dx = Ax + Bu dt y = Cx + v where v is an unknown constant. This is a model with an output disturbance. It will now be shown that a straightforward design of an output feedback for this system does indeed give integral action. Both disturbance models will produce controllers with integral action. We will start by investigating the case of an input disturbance. This is a little more convenient for us because it ts the control goal of nding a controller that drives the state to zero. The model with an input disturbance can conveniently be brought into the framework of state feedback. To do this, we rst observe that v is an unknown constant which can be described by dv =0 dt To bring the system into the standard format we simply introduce the disturbance v as an extra state variable. The state of the system is thus z= x v
This is also called state augmentation. Using the augmented state the model (5.35) can be written as d x A B = 0 0 dt v y= C 0 x B + u v 0 x v
(5.36)
Notice that the disturbance state is not reachable. If the disturbance can be measured, the state feedback is then + Kr r = Kx x Kv v + Kr r u = Kz (5.37)
135
The disturbance state v is not reachable. The the eect of the disturbance on the system can, however, be eliminated by choosing Kv = 1. If the disturbance v is known the control law above can be interpreted as a combination of feedback from the system state and feedforward from a measured disturbance. It is not realistic to assume that the disturbance can be measured and we will instead replace the states by estimates. The feedback law then becomes u = Kx z + Kr r = Kx x v + Kr r This means that feedback is based on estimates of the state and the disturbance. There are many other ways to introduce integral action.
5.8
So far reference signals have been introduced simply by adding it to the state feedback. A more sophisticated way of doing this is shown by the block diagram in Figure 5.5, where the controller consists of three parts: an observer that computes estimates of the states based on a model and measured process inputs and outputs, a state feedback and a trajectory generator that generates the desired behavior of all states xm and a feedforward signal u . The signal u is such that it generates the desired behavior of the states when applied to the system, under ideal conditions of no disturbances and no modeling errors. The controller is said to have two degrees of freedom because the response to command signals and disturbances are decoupled. Disturbance responses are governed by the observer and the state feedback and the response to command signal is governed by the feedforward. To get some insight into the behavior of the system let us discuss what happens when the command signal is changed. To x the ideas let us assume that the system is in equilibrium with the observer state x equal to the process state x. When the command signal is changed a feedforward signal u (t) is generated. This signal has the property that the process output gives the desired output xm (t) when the feedforward signal is applied to the system. The process state changes in response to the feedforward signal. The observer tracks the state perfectly because the initial state was correct. The estimated state x will be equal to the desired state xm and the feedback signal L(xm x ) is zero. If there are some disturbances or some modeling errors the feedback signal will be dierent from zero and attempt to correct the situation. The controller given in Figure 5.5 is a very general structure. There are many ways to generate the feedforward signal and there are also many dif-
PSfrag replacements
136
y r
Figure 5.5: Block diagram of a controller based on a structure with two degrees of freedom. The controller consists of a command signal generator, state feedback and an observer. ferent ways to compute the feedback gains L and the gain L of the observer. The system in Figure 5.5 is an example of the internal model principle which says that a controller should contain a model of the system to be controlled and the disturbances action on the system.
Computer Implementation
The controllers obtained so far have been described by ordinary dierential equations. They can be implemented directly using analog computers. Since most controllers are implemented using digital computers we will briey discuss how this can be done. The computer typically operates periodically, signals from the sensors are sampled and converted to digital form by the A/D converter, the control signal is computed, converted to analog form for the actuators, as shown in Figure 1.3 on page 5. To illustrate the main principles we consider the controller described by equations (5.29) and (5.30), i.e. u = K x + Kr r dx = Ax + Bu + K (y C x ) dt The rst equation which only consists of additions and multiplications can be implemented directly in a computer. The second equation has to be approximated. A simple way is to replace the derivative by a dierence x (tk+1 ) x (tk ) = Ax (tk ) + Bu(tk ) + K (y (tk ) C x (tk )) h
5.9. EXERCISES
137
where tk are the sampling instants and h = tk+1 tk is the sampling period. Rewriting the equation we get x (tk+1 = x (tk ) + h Ax (tk ) + Bu(tk ) + K (y (tk ) C x (tk )) . (5.38)
The calculation of the state only requires addition and multiplication and can easily be done by a computer. A pseudo code for the program that runs in the digital computer is "Control algorithm - main loop r=adin(ch1) "read setpoint from ch1 y=adin(ch2) "read process variable from ch2 u=C*x+Kr*r "compute control variable daout(ch1) "set analog output ch1 x=x+h*(A*x+B*u+L*(y-C*x)) "update state estimate The program runs periodically. Notice that the number of computations between reading the analog input and setting th analog output has been minimized. The state is updated after the analog output has been set. The program has one states x. The choice of sampling period requires some care. For linear systems the dierence approximation can be avoided by observing that the control signal is constant over the sampling period. An exact theory for this can be developed. Doing this we get a control law that is identical to (5.38) but with slightly dierent coecients. There are several practical issues that also must be dealt with. For example it is necessary to lter a signal before it is sampled so that the ltered signal has little frequency content above fs /2 where fs is the sampling frequency. If controllers with integral action are used it is necessary to provide protection so that the integral does not become too large when the actuator saturates. Care must also be taken so that parameter changes do not cause disturbances. Some of these issues are discussed in Chapter 10.
5.9
Exercises
1. Consider a system on reachable canonical form. Show that the inverse of the reachability matrix is given by 1 a 1 a2 . . . an 0 1 a1 . . . an1 1 (5.39) Wr = . . . 0 0 0 ... 1
138