4 Acta Electrotechnica et Informatica, Vol., No., 0, 4 9, DOI: 0.478/v098-0-000- MODELING OF A SYSTEM WITH HYBRID DYNAMICS Vratilav HLADKÝ, Ľuboš POPOVIČ, Ján SARNOVSKÝ Department of Cybernetic and Artificial Intelligence, Faculty of Electrical Engineering and Informatic, Technical Univerity of Košice, Letná 9, 04 00 Košice, Slovak Republic, tel.: +4 55 60 46, e-mail: vratilav.hladky@tuke.k, lubo.popovic@tuke.k, jan.arnovky@tuke.k ABSTRACT The article deal with modeling of a ytem with hybrid dynamic and with two tool for modeling of uch ytem. For purpoe of modeling we choe the ytem of coupled tank. The tank are ituated in different height and dynamic of the ytem change in the moment when the liquid level in the econd tank run over the height of bottom of the firt tank. That repreent hybrid nature of thi ytem. We choe two tool for imulation of hybrid ytem MPT toolbox and HYSDEL and we pecifically aim on modeling of the ytem of coupled tank by both thee tool and on comparion of thee tool. The tool are free however they do not work independently but a a part of the imulation language Matlab. Keyword: hybrid ytem, imulation, Matlab, MPT toolbox, HYSDEL. INTRODUCTION The ytem which have been traditionally tudied by automatic control theory involve mainly familiar dynamical ytem that are governed by ordinary differential or difference equation. On the other hand there are many ituation in which uch model are not appropriate. For example conider hybrid dynamic ytem in which the tate of ytem include both continuou and dicrete variable (robotic ytem, rulebaed controller, fault-tolerant ytem, ytem with many failure mode, etc.. The control of thee ytem involve dicrete et of alternative interpretation of oberved data, model for each of thee alternative and optimal deciion. Thi higher level dicrete deciion i then incorporated into a feedback control policy. Such a high-level controller hould be able to deal with ituation which may involve deciion procee. In control practice it i quite common to ue everal different controller and to witch among them with ome type of logical device. Some example are ytem with elector, which have been ued for contraint control for a long time, ytem with gain cheduling, etc. Thee ytem are commonly ued for control of chemical procee, power tation and in flight control. Other example of ytem with mode witching are found in robotic or in the expert controller with a hierarchical tructure where a collection of controller are juggled by an expert ytem. All thee ytem are hybrid control ytem [,4]. One definition of the hybrid control ytem i: the hybrid control ytem i a control ytem where the plant or the controller contain dicrete mode that together with continuou equation govern the behavior of the ytem [5]. Thi general definition cover baically every exiting control ytem. Lately there ha been a coniderable effort in trying to unify ome of the approache and get a more general theory for hybrid ytem. The fundamental problem with hybrid ytem i their complex mixture of dicrete and continuou variable. Such ytem are very general and they have appeared in many different domain. They have, for example, attracted much interet in control a well a in computer cience. In automatic control the focu ha been on the continuou behavior, while computer cience ha emphaized the dicrete apect. It i generally difficult to get analytical olution to mixed difference/differential equation. For ome problem it i poible to do qualitative analyi for aggregated model. Becaue of the lack of good analyi method, many invetigation of hybrid ytem have relied on imulation [,5]. Therefore we decided to chooe two concrete modeling tool for hybrid ytem MPT toolbox and HYSDEL and to model a choen hybrid ytem by thee tool.. SYSTEMS WITH HYBRID DYNAMICS Today complex ytem have hybrid character thu in general we can ay that thee ytem involve continuou and dicrete variable. Epecially exitence of both type of variable give the hybrid nature to uch ytem. Evolution of the hybrid ytem we can o decribe by equation that include logical, dicrete and continuou variable. Continuou dynamic of thee ytem i motly decribed by equation with continuou or dicrete time. Dicrete dynamic i motly decribed by digital automaton or input output tranition ytem with a finite number of tate []. Further we will mainly deal with the hybrid ytem by which the continuou dynamic i generally decribed by linear differential equation and the dicrete dynamic by o called tate automaton and both are ynchronized by the ame clock pule. Such ytem are often called a dicrete hybrid automaton. The pecific example of the dicrete hybrid automaton i repreented by piecewie affinne ytem (PWA ytem that were mentioned firt time in [9]. Actual mode of thee ytem depend on actual poition of the tate vector in pecific area only. Both mentioned hybrid dynamic ytem are eentially equivalent and therefore the ytem decribed a dicrete hybrid automaton can be tranformed into piecewie affinne ytem []. From point of view of our imulation the mot important part of the dicrete hybrid automaton i ISSN 335-843 (print 0 FEI TUKE www.aei.tuke.k Unauthenticated 94.38.39.60 Download Date /5/4 3:3 AM ISSN 338-3957 (online www.verita.com/aei
Acta Electrotechnica et Informatica, Vol., No., 0 5 witched affine ytem. Switched affine ytem i a et of linear affine ytem []: x ( k + = A x ( k + B u ( k + f ( r i( k r i( k r i( k y ( k = C x ( k + D u ( k + g ( r i( k r i( k r i( k where k Z + n i the time indicator, xr Xr R i the m continuou tate vector, ur Ur R i the continuou p input vector, yr Yr R i the continuou output vector, { Ai, Bi, fi, Ci, Di, gi} i i a et of matrice of I uitable dimenion, and the mode ik ( I (I i the et of integer i an input ignal that chooe one of the linear dynamic of the ytem. A witched affine ytem given by equation ( preerve the value of the tate when a witch occur. A witched affine ytem can be rewritten a the combination of linear term and if then ele rule. The equation ( i then equivalent to the form []: ( Ax r( k + Bu r( k + f; if i( k = z ( k = 0; otherwie ( Axr( k + Bur( k + f; if i( k = z ( k = 0; otherwie x ( k + = z ( k (5 r i i= n where zi ( k R, i =,,. Similarly we can alo tranform the equation (. Other part of dicrete hybrid automaton are: event generator i a mathematical object that generate a logic ignal according to the atifaction of a linear affine contraint of the ytem, finite tate machine (or automaton i a dicrete dynamic proce that evolve according to a logic tate function and in principle it control mode elector, mode elector it define the actual mode of the ytem []. 3. MODELING OF THE SYSTEM OF COUPLED TANKS A an example of the hybrid ytem we choe the ytem of coupled tank which i hown in Fig. []. But for our purpoe we have modified thi ytem the firt tank i pherical. The dynamic behaviour of the ytem change in time and it i decribed by everal et of differential equation. At pecified time period it witche among thee et of differential equation and thi feature repreent hybrid character of the ytem. The parameter of the tank are: R =, m, F = 3,7 m, k = 4 lit,5 -, k = 3,56 lit,5 -, h =,35 m. The tank are ituated in different height (ee Fig. and dynamic of the ytem change in the moment when the liquid level in the econd tank run over the height of bottom of the firt tank. Mathematical decription change (3 (4 Fig. The ytem of coupled tank from the decription of the ytem without interaction to the decription of the ytem with interaction at thi moment. Therefore it i ueful to obtain two eparate mathematical decription for the ytem without interaction and for the ytem with interaction. Thee mathematical model are produced by equation of material balance for ma of the liquid which i in the form (verbal decription: um of ma flow on input = um of ma flow on output + peed of accumulation of ma in the ytem [,8]. At firt we formulate the dynamic model of the ytem without interaction. In thi cae the level of liquid in the econd tank doe not run over the height of the bottom of the firt tank. For the firt tank we have: ( ρq0 = ρq + ρf dh t (6 where: q 0 (t volume flow on the input, q (t volume flow on the output, F (t variable ectional area of the firt tank, h (t liquid level in the firt tank, ρ conitency of liquid. We aume that conitency of liquid ρ i contant, o equation (6 i in the form: ( q0 = q + F dh t (7 The ectional area of the firt tank i variable and it can be formulated by equation: ( F = π Rh h (8 where: R radiu of the firt tank. Following Bernoulli equation the flow q (t i the function of the liquid level in the firt tank by the form: q = f gh (9 where: f ectional area of efflux nozzle of the firt tank, g acceleration of gravity. By mergence of contant we have: q = k h (0 ISSN 335-843 (print 0 FEI TUKE www.aei.tuke.k Unauthenticated 94.38.39.60 Download Date /5/4 3:3 AM ISSN 338-3957 (online www.verita.com/aei
6 Modeling of a Sytem with Hybrid Dynamic Subtituting q (t from equation (0 and F (t from equation (8 to equation (7 we have: ( q0 = k h + π ( Rh h dh t ( The liquid level h repreent the firt tate variable. Similarly for the econd tank we can obtain: dh k h t k h t F ( = ( + ( k = f g (3 where: h (t liquid level in the econd tank, F ectional area of the econd tank, f ectional area of efflux nozzle of the econd tank. We aume that ectional area of the econd tank F i contant. Equation ( and ( repreent the dynamic model of the ytem of coupled tank without interaction. For imulation of the ytem it i important to determine the liquid level in teady tate. If the input flow i contant then the liquid level in the tank are fixed and their derivation are equal to zero: dh dh = 0; = 0 (4 where: h liquid level in the firt tank in teady tate, h liquid level in the econd tank in teady tate. Then the model of the firt tank in teady tate i in the form: q = q or q = k h (5 0 0 From thi equation we can imply calculate the liquid level in the teady tate. Similarly we can calculate the teady tate of the liquid level for the econd tank. Further imilarly a for the ytem without interaction we can obtain mathematical model of the dynamic ytem of coupled tank with interaction. The equation for the firt tank i in the form [7]: q = 0 ( ( ( ( ( ( ( = ign h t h t h k h t h t h + dh + π ( Rh ( t h( t and for the econd tank: ( ( ( ( ( ( ( ign h t h t h k h t h t h = dh = F + k h( t (6 (7 Enumeration of the liquid level in the teady tate i identical a for the firt tank. For the purpoe of modeling of thi hybrid ytem in HYSDEL we have to linearize both mathematical model of the ytem of coupled tank without interaction and with interaction. We will realize the linearization for the firt tank. The equation ( i nonlinear with regard to h. At firt we ubtract equation decribing the ytem in the teady tate from equation decribing the ame dynamic ytem: ( ( q0 q0 = k h( t k d h t h h + F (8 where: ( ( F = π Rh h (9 Becaue we perform lizearization in mall area of operating point (teady tate we can conider the ectional area of the firt tank F a contant (9. It i ueful to define deviation value: Δ h = h h ; Δ q = q q (0 0 0 0 We expand nonlinear item h ( t into the Taylor erie and we neglect higher term of the erie: ( h h = h + h h = ( ( ( h h = h + h t h h Subtituting to the equation (8 we obtain: q q = k h + k h h ( ( h ( 0 0 h k h + F d h t ( ( For the ake of implicity we define the following contant: k k = (3 h Then the linearized model of the firt tank i in the form: dδh Δ q0 = kδ h( t + F (4 The linearized mathematical model for the econd tank and for the ytem with interaction we can obtain by identical way a decribed above. 3.. Modeling of the ytem of coupled tank by MPT toolbox It i very ueful to model and imulate the hybrid ytem hown in Fig. by utilization of MPT toolbox. ISSN 335-843 (print 0 FEI TUKE www.aei.tuke.k Unauthenticated 94.38.39.60 Download Date /5/4 3:3 AM ISSN 338-3957 (online www.verita.com/aei
Acta Electrotechnica et Informatica, Vol., No., 0 7 Thi toolbox i free oftware and it i poible to download it from the web page: http://control.ee.ethz.ch/ ~mpt/download/. The toolbox doe not work independently but a a part of the imulation language Matlab. By MPT toolbox we are able to model directly equation decribing a dynamic ytem, in our cae equation (, (, (6 and (7. In addition the MPT toolbox enable to rewrite piecewie affine ytem to Matlab. It i only required differential equation that repreent the hybrid dynamic of the ytem and condition / condition by which the dynamic of the ytem change. At creating the model in Matlab we produce S-function that it i poible to ue in Simulink too. The differential equation that repreent particular dynamic are for purpoe of writing to S-function of the MPT toolbox in following form.. The ytem without interaction: dh q0 k h = π Rh t h t Rh t h t ( ( ( π ( ( ( dh k h k h F F (5 = (6. The ytem with interaction: dh q Rh t h t 0 = π ( ( ( ( ( ( ( ( ( ( π ( Rh ( t h( t ign h t h t h k h t h t h dh = ign h t h t h k h t h t h ( ( ( ( ( ( ( = F k h F (7 (8 The condition of change of the dynamic i in the form: h > h (9 The trajectory of the liquid level h (t and proce of change of the ytem dynamic that we obtained by imulation of the ytem by MPT toolbox are hown in Fig.. 3.. Modeling of the ytem of coupled tank by HYSDEL Simulation of the ame hybrid ytem (the ytem of coupled tank by utilization of the tool HYSDEL will be decribed in thi part. HYSDEL i abbreviation from Englih term HYbrid Sytem DEcription Language. Thi toolbox i alo free oftware and it i poible to download h (t [m].4.38.36.34.3.3.8 Liquid level in the econd tank.6 0 5 0 5 0 5 30 t [] Actual mode [ - ].8.6.4. Change of mode in the ytem of coupled tank 0 5 0 5 0 5 30 t [] Fig. The time repone of the liquid level h (t and the proce of mode change imulation by MPT toolbox it from the web page: http://control.ee.ethz.ch/~hybrid/ hydel/hydel.php. It doe not work independently but a a part of the imulation language Matlab. HYSDEL ha been developed in Italian Swi cooperation and it i alo commercially ued by ABB company in Switzerland []. Preffered application of the HYSDEL i in the area of modeling of dicrete hybrid automata []. Source code of HYSDEL conit of two main part that are INTERFACE and IMPLEMENTATION, and yntax of thi language i baed on the principle of C language. The part INTERFACE contain declaration and it i ditributed to another part called STATE, INPUT, OUTPUT and PARAMETER, where equence of particular part i not fundamental []. For declaration of a real variable we ue the key word REAL, for example REAL variable_name [min, max] where min and max are limit of given variable. For declaration of a Boolean variable it i ued the key word BOOL. The part IMPLEMENTATION conit of another pecial part which decribed relation within defined variable. The pecial part will be decribed in following []: OUTPUT allow pecifying tatic linear and logic relation for the output vector of the ytem. AD allow to define Boolean variable from continuou one, and i baed exactly on the ame emantic of the event generator, which i detailly decribed in []. LOGIC allow to pecify arbitrary function of Boolean variable: In particular the mode elector i a Boolean function and therefore it can be modeled in thi ection. DA define continuou variable according to if then ele condition on Boolean variable. Thi ection model part of the witched affine ytem. ISSN 335-843 (print 0 FEI TUKE www.aei.tuke.k Unauthenticated 94.38.39.60 Download Date /5/4 3:3 AM ISSN 338-3957 (online www.verita.com/aei
8 Modeling of a Sytem with Hybrid Dynamic CONTINUOUS decribe the linear dynamic, expreed a difference equation. Thi ection model the remaining third equation of the witched affine ytem. LINEAR allow alo to define a continuou variable a an affine function of continuou variable. AUTOMATA pecifie the tate tranition equation of the finite tate machine a Boolean function. MUST pecifie contraint on continuou and Boolean variable, i.e., linear contraint and Boolean formula. Need for linearization of dynamic model of ytem with equential dicretization of obtained differential equation i a certain diadvantage of thi language for decription of the hybrid ytem. After thi manner proceed equation will be in the form:. Sytem without interaction: k Δq Δ h ( t+ T = Δ h ( t + 0 F F T k k Δ h( t+ T = Δ h( t + Δh( t F F T T. Sytem with interaction: k k Δq0 Δ h( t+ T = Δ h( t + Δ h( t + F F F T T T k k k Δ h( t+ T = Δh( t h( t + Δ F F F T T T T (30 (3 (3 (33 Condition of change of the dynamic from the ytem without interaction to the ytem with interaction or reverely i again defined by form (9. The trajectory of the liquid level h (t and proce of change of the ytem dynamic that we obtained by imulation of the ytem by HYSDEL are hown in Fig. 3. 4. CONCLUSIONS We have uccefully imulated the ytem with hybrid dynamic by two pecial tool for imulation of uch ytem. The hybrid nature of the ytem conit in interaction between tank, epecially in fact that the connecting pipe i not at the bottom of the econd tank but in height h. We have alo modeled directly equation (5, (6, (7 and (8 by block in Simulink for purpoe of h (t [m].4.38.36.34.3.3.8 Liquid level in the econd tank.6 0 5 0 5 0 5 30 t [] Actual mode [ - ].8.6.4. Change of mode in the ytem of coupled tank 0 5 0 5 0 5 30 t [] Fig. 3 The time repone of the liquid level h (t and the proce of mode change imulation by HYSDEL comparion of trajectorie of liquid level modeled by MPT toolbox and HYSDEL. Following experience from modeling of the hybrid ytem we can ay that the reult of imulation by MPT toolbox and by HYSDEL are equivalent but imulation of a hybrid ytem by MPT toolbox i more imple and comfortable than by HYSDEL. By MPT toolbox we are able to imulate directly equation decribing a ytem without additional modification of the equation. For modeling in HYSDEL we have to linearize the mathematical model of the ytem. In thi cae it can be quite difficult to determine operating point and alo to determine witch condition. For that reaon HYSDEL appear to be more uitable for modeling uch ytem where tate of the ytem are witched by a witch device. In our cae there i no real witching device, it mean that we do not ue any logical variable. The dynamic of the ytem of coupled tank i continuou and at the moment when the liquid level in the econd tank h (t reache the height h it change only mathematical model of the ytem from the ytem without interaction to the ytem with interaction, and it repreent the actual mode of the ytem. ACKNOWLEDGMENTS Thi work i the reult of the project implementation: Center of Information and Communication Technologie for Knowledge Sytem (ITMS project code: 60000 upported by the Reearch & Development Operational Program funded by the ERDF. REFERENCES [] BRANICKY, M.: Studie in Hybrid Sytem: Modeling, Analyi, and Control. Ph.D. di., Maachuett Intitute of Technology, 995. ISSN 335-843 (print 0 FEI TUKE www.aei.tuke.k Unauthenticated 94.38.39.60 Download Date /5/4 3:3 AM ISSN 338-3957 (online www.verita.com/aei
Acta Electrotechnica et Informatica, Vol., No., 0 9 [] HIRMAJER, T. FIKAR, M.: Optimal Control of Sytem with Hybrid Dynamic, AT&P Journal, vol. 8, no., pp. 8 84, 005. [3] HIRMAJER, T. FIKAR, M.: Dynamic Optimization of a Hybrid Coupled Tank Sytem, Journal of Electrical Engineering, vol. 57, no. 3, pp. 67 7, 006. [4] HLADKÝ, V. SARNOVSKÝ, J.: Hybrid Control of Large Scale Sytem, Proceeding of the 3 th International Conference on Proce Control, High Tatra, Slovak Republic, CD ROM, June 4, 00. [5] MALMBORG, J.: Analyi and Deign of Hybrid Control Sytem. Ph.D. di., Lund Intitute of Technology, 998. [6] POPOVIČ, Ľ. HLADKÝ, V. SARNOVSKÝ, J.: Modeling and Control of Laboratory Model Ball&Plate by MPT Toolbox, Proceeding of International Conference Cybernetic and Informatic, Vyšná Boca, Slovak Republic, CD ROM, February 0 3, 00. [7] NOSKIEVIČ, P.: Modeling and Identification of Sytem, Otrava, Montanex, 999, pp. 56 70. [8] SARNOVSKÝ, J. HLADKÝ, V. JADLOVSKÁ, A: Control of Large-cale Sytem, Košice, Elfa, 005. [9] SONTAG, E. D.: Nonlinear regulation: The piecewie linear approach, IEEE Tranaction Automatic Control, vol. 6, no., pp. 346 358, 98. [0] TORISI, F. D. BEMPORAD, A.: Dicrete-time Hybrid Modeling and Verification, Proceeding of 40 th IEEE Conference on Deciion and Control, Orlando, Florida, pp. 899 904, 00. [] TORISI, F. D. BEMPORAD, A.: HYSDEL A Tool for Generating Computational Hybrid Model, IEEE Tranaction Control Sytem Technology, vol., no., pp. 35 49, 004. [] TORISI, F. D. BEMPORAD, A. BERTINI, G. HERTACH, P. JOST, D. MIGNONE, D.: HYSDEL.0.5 uer manual, pp. 35, 00. Received November 0, 00, accepted March, 0 BIOGRAPHIES Vratilav Hladký wa born on.5.968. In 99 he graduated (MSc at the Department of Cybernetic and Artificial Intelligence of the Faculty of Electrical Engineering and Informatic at Technical Univerity in Košice. He defended hi PhD in the field of Control engineering and automation in 996. Hi cientific reearch i focuing on dynamic and control of complex and hybrid ytem. Ľuboš Popovič wa born on 5.6.984. In 007 he graduated (MSc at the Department of Cybernetic and Artificial Intelligence of the Faculty of Electrical Engineering and Informatic at Technical Univerity in Košice. Since 007 he i a PhD tudent at the Department of Cybernetic and Artificial Intelligence. Hi PhD thei in the field of Cybernetic; i Principle of requiite variety in control ytem. Hi cientific reearch i focuing on dynamic and control of complex and hybrid ytem. Ján Sarnovký wa born on 3.3.945. He received hi MSc. in the field of Automation at Electrotechnical faculty of Slovak Technical Univerity in Bratilava in 968. In. 980 he defended hi doctoral candidate thei and obtained cientific degree CSc. He obtained Profeor of Technical Cybernetic in 993. From 989 he i a head of Department of Cybernetic and Artificial Intelligence of the Faculty of Electrical Engineering and Informatic at Technical Univerity in Košice. He i coordinator of ome national cientific grant. Hi cientific reearch i focuing on control of dynamic ytem and multi-agent ytem. ISSN 335-843 (print 0 FEI TUKE www.aei.tuke.k Unauthenticated 94.38.39.60 Download Date /5/4 3:3 AM ISSN 338-3957 (online www.verita.com/aei