B. Lennox and N.F. Thornhill, 9, Sae Space Modelling, IChemE Process Managemen and Conrol Subjec Group Newsleer STE-SPACE MODELLING Inroducion: Over he pas decade or so here has been an ever increasing use of sae-space modelling in conrol books and applicaions. Alhough sae-space is ofen considered o be a complex represenaion, i is in he end simply a mehod for describing he behaviour of dynamic sysems. The growing populariy of sae-space modelling can be aribued o he fac ha i has a very general form and is able o represen linear, nonlinear, ime-invarian and ime-varying dynamics in a relaively compac form. Furhermore, in many applicaion areas he sae-space approach is very inuiive, allowing rapid developmen of dynamic models from firs principles. This aricle will illusrae he ideas ha underpin sae-space analysis and illusrae hem wih a sraighforward example. The Basics, and an Example: In he process indusries, conrol heory has ypically been based on dynamic models ha are represened as Ordinary Differenial Equaions (ODEs) and/or ransfer funcions. As an example, consider he sysem illusraed in Figure. This sysem is used in many ex-books and concerns he relaionship beween he flow of liquid ino he ank, qin () and he level of liquid, h. From his model a feedback conrol sysem can be designed o mainain he level of liquid in he ank. q in h cross secional area = q = kh( ) ou Figure : Liquid Level Sysem The flow of liquid ou of he ank is proporional o level of liquid h if he flow is laminar: qou () = kh() where k is a consan parameer. A mass balance across he ank gives: dv() qin() qou () = i.e. he rae of change of liquid volume, V, is equal o he volumeric flow rae of liquid in minus he flow rae of liquid ou. The mass balance can be re-arranged o give: d h() qin() qou () = and since A T is consan: Adh T () qin() qou () =. Replacing qou () by kh() gives: Adh T () qin() kh() = and more re-arrangemen gives: dh() k + h () = q in() () Equaion () describes a linear, firs order relaionship beween he flow ino he ank and he liquid level. If zero iniial condiions are assumed, hen his equaion can be ransformed ino he Laplace domain as follows: k sh( s) + H( s) = Qin( s) where H( s ) and Qin ( s ) are he Laplace ransforms of he ime rends h () and qin ( ). For insance, if qin () is a sep change of magniude q, hen Qin ( s) = q s. Afer some algebra, he ransfer funcion for he ank is: Hs ( ) k = = () Qin( s) s+ k ( k) s+ The generic form of a firs order ransfer funcion K p is where K p is he sysem gain and τ is sτ + he ime consan, hence by comparison, he gain of he ank sysem is k and is ime consan is k. So far, he analysis has involved an ODE wih one dependen variable h(), and one independen variable qin (). Applicaion of he Laplace ransform o he ODE gave a singleinpu-single-oupu ransfer funcion showing he gain and ime consan. Nex, in anicipaion of more complicaed sysems wih more han one dependen variable, le s examine a more general formulaion of he same equaion. Equaion () is re-considered and a new
B. Lennox and N.F. Thornhill, 9, Sae Space Modelling, IChemE Process Managemen and Conrol Subjec Group Newsleer variable, x () is now defined, such ha x () = h (). Equaion () can be re-wrien as: () k = x () + q in() which in a more general form can be expressed a dynamic sae equaion: = x() = Ax() + Bu () (3) where: k x () = x(), u () = qin(), A = and B = A T Equaion (3) is he general, linear sae equaion, where he vecor x represens he sae variables of he process. I anicipaes more complex sysems by use of vecors and marices. In he ank example, however, here is a single sae variable h() and a single inpu variable qin ( ) so he A and B marices are scalars. Sae variables are he smalles subse of sysem variables ha describe he enire dynamic characerisics of he sysem. They can be hough of as inernal elemens of he sysem ha are relaed o, or in some case are acually equal o, he oupu variables. Alhough i can someimes be beneficial, i is no necessary for he sae variables o be measured or even have physical meaning. In he even more general non-linear case he sae equaion is defined as: () = f ( xu,, ) where f is a non-linear funcion. q in h h ( ) q = k h h Figure : A Two Tank Sysem q = k h 3 3 A Two Sae Sysem: The coupled wo-ank sysem shown in Figure is an example of a sysem wih more han one sae. The coupled wo ank sysem has wo physical saes, h and h and, if he anks each have uni cross secional area (i.e. A T = ), he sae equaion is: dh k k h () = + qin dh k ( k k + 3) h () Expanding ou he marices and rearranging shows ha he sae equaion is nohing more han a volumeric balance for each ank. dh = k( h h) + qin dh = k( h h) k3h Thus, here is no new physics in a sae equaion. The reason why conrol engineers use i is ha is a convenien way of sudying he mahemaical properies of he physical equaions. Using sae-space leads o some very powerful conroller designs ha would be oo cumbersome o consider wihou he compac marix formulaion. Referring back o he general sae equaion: = x() = Ax() + Bu () In he wo-ank example, he sae vecor x () is h, he inpu u () is q h in and he consancoefficien A and B marices are: k k A = and B = k ( k + k 3) Observer Equaion: The sae equaion (3) describes how he saes vary wih ime. In he case of he examples above, he oupu variables were he liquid levels, which were also defined as he sae variables. However, in many examples, he sae variables will be differen from he oupu variables. I is herefore necessary o have anoher equaion which describes he relaionship beween he process oupus and sae variables. For general sysems, his equaion is defined as follows: y( ) = g( x, u, ) where g is a non-linear funcion. For a linear, ime-invarian sysem his equaion always akes he form: y( ) = Cx( ) + Du ( ) (4) where y() is a vecor of oupu variables. In he wo-ank example: C = and D =
B. Lennox and N.F. Thornhill, 9, Sae Space Modelling, IChemE Process Managemen and Conrol Subjec Group Newsleer The fac C is a uni marix shows he oupu variables are equal o he sae variables in he wo ank example. The above equaion for y () is referred o as he observer equaion. The combinaion of he sae equaion (3) and observer equaion (4) is called a sae-space model. Anoher sae-space form: For any dynamic sysem, here is no unique sae-space model. In fac here is an infinie number of sae-space equaions ha can be developed, depending on how he saes are defined. As an example, he physical balance equaions for he wo ank sysem naurally yielded wo simulaneous firs order differenial equaions. Bu anoher way o rearrange he equaions is o eliminae eiher h or h o give a single second order differenial equaion. For insance, h may be eliminaed o give an equaion for h as follows: Adding he wo mass balances: dh = k( h h) + qin dh = k( h h) k3h gives dh dh + = qin k3h and, by rearrangemen: dh dh = qin k3h The second mass balance can be differeniaed o give: and now = k k3 d h dh dh dh dh can be replaced o give: = k qin k3h k3 d h dh dh dh and finally: dh ( k3 k) kkh 3 kq in d h + + + = (5) Again, here is no new physics, bu now he focus is on h which obeys a second order differenial equaion. Now, he saes can be represened no as h and h, bu as h and dh. Therefore he sae vecor would be: h () x () = = () () x dh x Clearly (by definiion) one of he sae equaions is = x () and he second comes from he rearrangemen of equaion (5): dh ( k3 k) k k3h kqin d h = + + (6) dh Using h( ) = x( ) and = x () gives: = ( k3 + k) x() kk3x() + kqin Hence he sae equaions are: = x () = kkx 3 () ( k3 + k) x() + kq in and hey can be expressed in marix form as: x () k = + q kk 3 ( k3 k + ) x () This way of describing a sae-space is referred o as he conrollable canonical form. There are however many oher ways in which he A, B, C and D marices can be re-arranged o produce, for example, he observable canonical form. Relaionship Beween Sae-Space, ODEs and Transfer Funcions: Process conrol engineers end o be familiar wih ODEs and he ransfer funcion derived from he Laplace ransform of he ODE. As shown in he previous examples sae-space does no describe anyhing new, i is simply a re-arrangemen of he dynamic equaions ino a form ha is more compac and convenien for conrol sysem developmen and analysis. Therefore i is useful o see how he coefficiens in he ODE relae o he parameers of he ransfer funcion and he elemens in he sae-space A, B, C and D marices. The ODE in he general case is a single inpu, single oupu, high order dynamic sysem described by he following differenial equaion: n n () () d y d y + a n n + n m d u() + ay () = bm + m m d u b () m m () + + b u in
B. Lennox and N.F. Thornhill, 9, Sae Space Modelling, IChemE Process Managemen and Conrol Subjec Group Newsleer h h qin The ransfer funcion for his sysem, derived by applying Laplace ransforms wih zero iniial condiion is: m m Y( s) s + bm s +... + bs + b Gs ( ) = = U n n ( s ) s + an s +... + as + a and he equivalen sae-space equaion in conrollable canonical form is as follows: A =, B = a a a a n C = [ b b bm ] and D = As can be seen, he same coefficiens appear in all hree forms indicaing ha hey are hree differen ways of looking a he same equaions. Relaionship wih sep-response models: The dynamics for elecrical and mechanical sysems are ofen reasonably well defined and can be derived from a physical undersanding of he sysem. In conras, process sysems may no be undersood wih sufficien accuracy o develop a model from firs principles and i is ypical for sep or oher ess o be performed o beer undersand he dynamics. This secion will demonsrae ha he resuls of sep response ess can be used o provide boh ransfer funcion models and a sae-space model. 35 3 5 5 3 4 5 6 7 8 9 43 4 4 4 39 3 4 5 6 7 8 9 3 3 4 5 6 7 8 9 Time (secs) Figure 3. Sep responses of he wo-ank sysem. Figure 3 shows sep ess for a wo-ank sysem in which he inle flow rae was doubled a ime sec. The levels h and h boh changed. Level h shows a response wih a seep iniial gradien ha is characerisic of a firs order sysem. Figure 3 indicaes ha he gain is because he uni sep in q in produces a change in level of on he h scale. The ime consan is approximaely seconds, and hence: H ( s ) in ( ) Q s s+ This ransfer funcion is approximae, because alhough he sep response looks firs order here is in pracice is a back-pressure on he firs ank from he second ank. The dynamics are acually of a higher order, however he effec is small and was no deeced by he sep es. The level in he second ank, h, has he S- shaped response ha is characerisic of a second order sysem. I requires a numerical mehod o fi a ransfer funcion model o such sep response daa, for insance by using he ARX command in Malab. The resuls from sysem idenificaion (o one s.f.) were: H( s). in ( ) = Q s s +.7s+.5 If boh levels are now considered, he complee ransfer funcion model for his sysem is: H( s) H( s). Qin( s) s + s +.7s+.5 An equivalen sae-space equaion is as follows: x() = Ax() + Bu() y Cx Du () = () + () where: h() h() x() = h (), y() =, () = qin() h () u dh () and / A = B =.5.7. C =, = D The ransfer funcions and sae-space models have he same inpu-oupu behaviour, again illusraing ha he sae-space form does no include any new physical informaion. However, as is beginning o become apparen from his example, wih more inpu and oupu variables he ransfer funcion model quickly becomes unwieldy. In conras, he complexiy of he saespace represenaion does no really change. The sae-space model always consiss of wo compac equaions, one is he dynamic sae equaion and he oher is he algebraic observer
B. Lennox and N.F. Thornhill, 9, Sae Space Modelling, IChemE Process Managemen and Conrol Subjec Group Newsleer equaion. The only change as he sysem becomes more complex is ha he dimensions of he marices increase. There are hree saes in he above model, which effecively combine he saes h () and h () from he model based on volumeric balancing wih he saes h () and dh ha were presen in he conrollable canonical form. I can ake some judgemen o selec he bes saes for a given purpose, however he abiliy o make good choices grows wih experience. There are also some useful algorihms such as sub-space idenificaion which can help.. Commens and Conclusions: The aricle has shown how o explore and invesigae he physical equaions of a sysem by means of is inernal saes. The saes may have a direc physical meaning, or hey may be absrac ones such as when he conrollable canonical form is used. There are many reasons for making he saes of a sysem explici in he mahemaical formulaion. For insance, if he saes can be esimaed from process measuremens, hen here is an opporuniy o use sae feedback. Rae feedback, where he rae of change of he conrolled variable is used as a feedback signal, is an example of sae feedback. Here is a shor lis of some of he oher hings ha working wih sae-space makes possible:. Provides a model srucure from which feedback conrol sysems can be designed wih relaive ease.. Enables closed-loop characerisics, such as robusness and sabiliy, o be analysed and considered during conrol design. The complexiy of he mahemaics involved for his is such ha i would no be pracical o apply i o oher modelling formas. 3. In siuaions where he oupu variables are no direcly measured, he observer equaion can be used o esimae hese measuremens from he sae variables. Despie heir advanages, here is a very serious weakness o sae-space models. When using ransfer models, paricularly firs and second order, i is sraigh forward o visualize he sepresponse of he sysem. Unforunaely, his is no he case wih sae-space models which are more complicaed o inerpre and ypically require he use of a compuer o simulae sep responses and evaluae he sysem ime consans. On he oher hand, i is quie easy o obain a sae-space model from a sep-response, as shown in his aricle. The example considered was sraighforward, however more realisic cases require care and judgemen in selecion of he saes, and opimal sae-space models may no resul. Mehods for obaining good saespace models for complex sysems using pseudo random binary inpu sequences or sepresponse daa will be considered in a fuure aricle on sub-space idenificaion. Furher reading. Those who are ineresed o dig deeper migh like o visi he URL below: hp://en.wikipedia.org/wiki/sae_space_(conrols)