ELEC34 Control Systems Linear Systems - Moelling - Some Issues Session 2, 2007 Introuction Linear systems may be represente in a number of ifferent ways. Figure shows the relationship between various representations. Continuous Transfer Function Differential Equation Block Diagram Difference Equation Continuous State Space Discrete Transfer Function Discrete State Space Block Diagram Figure : Relationships between ifferent linear system representations We will explore the relationships by following the evelopment of ifferent moels for a representative linear system. 2 Differential Equations an Transfer Functions Consier the linear system represente by the ifferential equation: 3 y t 3 + y 0.32 t 2 + 0.4y + 0.5y = 2u t t + u In the time omain, the relationship between y an u is etermine by convolution, but this operation is complex for higher orer ifferential equations. By taking Laplace Transforms we can prouce a frequency omain representation of the system: s 3 Y + 0.3s 2 Y + 0.4sY + 0.5Y = 2sU + U
Note that in taking Laplace Transforms we have set all the initial conitions to zero. This is appropriate if we are intent on forming a transfer function representation, but woul not be correct if we nee to calculate responses which might be epenent on initial conitions. In the frequency omain, convolution operations are replace by algebraic ones, an the transfer function is: Y (s) U(s) = 2s + s 3 + 0.3s 2 + 0.4s + 0.5 3 Block Diagrams In forming a block iagram, we nee to separate the transfer function into polynomials. There are an infinite number of ways in which this can be one. A simple example woul be to write: (s 3 + 0.3s 2 + 0.4s + 0.5)Y = ( 2s + )U However, it is much more useful to introuce another variable an write: Rearranging the secon equation yiels: Y = ( 2s + )e U e = s 3 + 0.3s 2 + 0.4s + 0.5 s 3 e = U 0.3s 2 e 0.4se 0.5e This helps us efine a chain of integrators whose output is e, an we are in a position to raw a block iagram representing the process (Figure 2). This is a canonical representation of the process, because the coefficient blocks correspon exactly to the coefficients in the original ifferential equation. A little block iagram algebra reveals that this is not necessarily always the case. This particular form is known as a Controller Canonical Form. 4 Continuous State Space Moels The outputs of the integrators have been labelle x, x 2 an x 3. These are the state variables. State variables represent storage or memory of some sort, an integrators are typical storage evices. We can write a first orer ifferential equation for each state variable, simply by looking at the block iagram. t x = x 2 2
2 U 3 2 s e s e s x3 s se x2 s e x Y 0.3 0.4 0.5 Figure 2: Block Diagram for our process t x 2 = x 3 t x 3 = u 0.5x 0.4x 2 0.3x 3 Together with the equation for Y (the output equation), these equations give the state-space representation for the system. In matrix form, this gives: y = x 2x 2 t x x 2 x 3 = y = [ 0 0 0 0 0.5 0.4 0.3 2 0 ] x x 2 x 3 x x 2 x 3 + 0 0 u This is in the familiar form (with suitable efinition of x, A, B, C): ẋ = Ax + Bu y = Cx 4. Linearization A system is sai to be linear if it obeys the principle of superposition. 3
Is ẋ = Ax + Bu linear? In accorance with assumptions, we must have: an ẋ I = Ax I + Bu I Aing these two equations we obtain ẋ II = Ax II + Bu II This last equation can be written ẋ I + ẋ II = Ax I + Ax II + Bu I + Bu II t (x I + x II ) = A(x I + x II ) + B(u I + u II ) an as this equation tells us that the sum x I + x II satisfies the given state space equation, we conclue that superposition applies. Assume that the ifferential equations for the system uner stuy may be written in the form ẋ = f(x,u) an the function f() is nonlinear. The nominal state vector will be calle x 0 an the corresponing actuation u 0. x 0 an u 0 are functions of time. x 0 satisfies the vector equation ẋ 0 = f(x 0,u 0 ) Now assume that we are slightly off the reference trajectory ue to the fact that the actuation is not exactly u 0. Define x an u as x = x 0 + δx u = u 0 + δu x an u must also satisfy the given nonlinear system equation, i.e. t (x0 + δx) = ẋ 0 + δẋ = f(x 0 + δx,u 0 + δu) Consier the ith component of this vector equation, an expan f i in a Taylor series aroun the reference trajectory ẋ 0 i + δẋ0 i f i (x 0,u 0 ) + f i x δx +... + f i x n δx n + f i u δu +... + f i u m δu m 4
The existence of the partial erivatives is assume, an all will be compute along the reference trajectory. In view of the original nonlinear ifferential equation δẋ i ( ) 0 ( ) 0 fi fi δx +... + δx n x x n ( ) 0 ( ) 0 fi fi + δu +... + δu m u u m where () 0 implies computation of the partials along the reference trajectory. Introucing Jacobian Matrices A = B = f f x... x n......... f n f x... n x n f f u... u m......... f n u... f n u m the perturbation for of the moel may be written δẋ Aδx + Bδu Although the system ifferential equations are nonlinear, the ifferential equations escribing perturbations aroun the nominal trajectory are linear to first orer accuracy. 5 Discrete State Space Moels Discrete moels represent solutions to continuous moels. They can be erive from the stanar convolution solution to a first orer fferential equation (i.e. the state-space moel): t x(t) = e At x(0) + e At τ x(τ)τ 0 In general, it becomes very ifficult to evaluate the convolution integral, but the problem can be alleviate by making an assumption about how the actuation is applie to the process. A D/A converter will normally hol its value until that is change at the next sample instant. For this very practical reason, it is usual (an also very convenient from the ease of evaluating the integral) to assume that the actuation is applie through a zero-orer hol. Between sample instants, this is equivalent to u = 0, so that the state-space equations can be written: [ x t u ] = [ A B 0 0 ] [ x u ] 5
If we consier this to be χ = Aχ it has a solution χ(t) = e At where t is the sampling interval. For our sample process, we woul have: χ = 0 0 0 0 0 0 0.5 0.4 0.3 0 0 0 0 We can use a numerical analysis package such as MATLAB or SCILAB to compute the matrix exponential, yieling (for t = ): χ(t) = e A χ(0) = χ 0.924 0.920 0.435 0.5 0.28 0.750 0.790 0.435 0.395 0.533 0.53 0.790 0 0 0 χ(0) This is then written in recursive form as a iscrete state space equation: x(k + ) = y(k) = [ 0.924 0.920 0.435 0.28 0.750 0.790 0.395 0.533 0.53 2 0 ] x(k) x(k) + 0.5 0.435 0.790 u(k) Note that the 4th row of the matrix exponential is equivalent to saying u(k + ) = u(k), i.e. the zero orer hol is invariant across the continuous-to-iscrete transformation. 6 Difference Equations The link between state space an trasnfer function representations may again be trace through a block iagram. The important thing to realise is that the operator is now the elay operator q rather than the Laplace operator s. The elay operator efines the following relationship: q x(k) = x(k ) However, it quickly becomes necessary to use a numerical package to perform transformations between state space an transfer function moels. The transfer function for our system is: y(k) u(k) = 0.79q + 0.623q 2 + 0.93q 3 2.88q + 2.347q 2 0.74q 3 6
Computationally, this requires the evaluation of a ifference equation which requires storage of a short history of values of the measurement an actuation. The ifference equation is: y(k) = 0.79u(k )+0.623u(k 2)+0.93u(k 2)+2.88y(k ) 2.347y(k 2)+0.74y(k 3) Note that a fference equation may be regare as a recursive solution to the ifferential equation. 7 SCILAB/SCICOS Operations SCILAB unerstans about polynomials, transfer functions, state space an all the rest. The operations inherent in the above sections may be carrie out using the folloiwng SCILAB commans. An on-line help facility provies clear ocumentation for each comman. First, efine a polynomial operator, s: s = poly(0, s ) We can efine a continuous linear system, either by entering the state space matrices or by entering the transfer function, for example: ctf = (-2*s + )/(s^3 + 0.3*s^2 + 0.4*s + 0.5) cg = syslin( c, ctf) We can obtain the state space system by: css = tf2ss(cg) This may give state space matrices which are not in canonical form. The alternative is to enter the state space matrices erive from the block iagram, where the matrices a, b an c have been previously entere: css = syslin( c,a,b,c) The calculation of the matrix exponential to get the iscrete state space system is invoke (for a step interval of ) by: ss = scr(css,) The iscrete transfer function may then be obtaine: g = ss2tf(ss) SCICOS is a block iagram simulator, which may be use to obtain responses for simulations base on any of the system representations (transfer function or state space, continuous or iscrete) or a suitable mixture of blocks using ifferent representations. 7
8 Class Exercises. Verify the various moel representations appearing in this paper using SCILAB. 2. Obtain step responses for various system representations, ensuring that all the representations are equivalent. 9 Assignment Using manual tuning, obtain a representation of a iscrete 3-term controller for controlling this process. Use a ifference form for the 3-term controller. Check the operation of the controller with. a continuous transfer function simulation of the process 2. a iscrete state-space simulation of the process 8