Get 20M+ Full-Text Papers For Less Than $1.50/day. Start a 14-Day Trial for You or Your Team.

Learn More →

Index Reduction and Discontinuity Handling Using Substitute Equations

Index Reduction and Discontinuity Handling Using Substitute Equations Mathematical and Computer Modelling of Dynamical Systems 1387-3954/01/0702-173$16.00 2001, Vol. 7, No. 2, pp. 173±187 Swets & Zeitlinger Index Reduction and Discontinuity Handling Using Substitute Equations 1 2 2   G. FABIAN , D.A. VAN BEEK and J.E. ROODA ABSTRACT Several techniques exist for index reduction and consistent initialization of higher index DAEs. Many such techniques change the original set of equations by differentiation, substitution, and / or introduction of new variables. This paper introduces substitute equations as a new language element. By means of a substitute equation, the value of a continuous variable or its time derivative is speci®ed by an expression. This expression is evaluated each time that the variable or its time derivative, respectively, is referenced in the model. The advantage of substitute equations is that they enable index reduction and consistent initialization of higher index DAEs without changing the original equations; no existing variables are removed and no new variables are introduced. Substitute equations can also be used to enable the use of general purpose numerical solvers for equations where one or more of the unknowns are discontinuous, and they can be used to prevent functions to be called outside of their domain. Keywords: differential algebraic equations, index reduction, simulation languages, hybrid systems. 1 INTRODUCTION The majority of continuous-time and hybrid simulation languages are limited to simulation of ODEs, or DAEs with differential index 1. ODEs are relatively easy to solve numerically, and many ODE solvers are available. For ODEs, the initial values of all differential variables can be speci®ed freely, and the calculation of initial conditions is straightforward. For index 1 DAEs, general KPN Research, P.O. Box 421, 2260 AK Leidschendam, Netherlands, E-mail: g.fabian@ kpn.com Eindhoven University of Technology, Dept. of Mechanical Engineering, P.O. Box 513, 5600 MB Eindhoven, Netherlands, E-mail: d.a.v.beek@tue.nl   174 G. FABIAN ET AL. purpose solvers are also available, but the numerical solution and calculation of initial conditions for these systems is, in general, more dif®cult than for ODEs. Mathematical modelling of physical systems, however, may result in higher index DAEs, for which no general purpose solvers are available. Also, speci®cation and calculation of consistent initial conditions for these systems can be rather dif®cult. Therefore, these DAEs are usually solved by means of index reduction techniques. Many such techniques change the original set of equations by differentiation, substitution, and / or introduction of new variables. This paper discusses some of the modeling problems that are a result of these index reduction techniques, and it introduces a new way to deal with higher index systems in simulation languages. The paper is organized as follows. First, some of the currently known techniques are introduced. Second, substitute equations are introduced as a new language element for index reduction. The syntax, semantics, application, and implementation of this new language element are discussed, and several examples of its application are given. Finally, the use of substitute equations for discontinuity handling in simulators is discussed, and conclusions are presented. 2 THE HIGHER INDEX PROBLEM DAEs are differential equations with additional algebraic constraints in the general form f…x _; x; y; t†ˆ 0; …1† n m where x 2 R is the vector of differential variables, y 2 R is the vector of 2n‡m‡1 algebraic variables, t 2 R is the independent variable and f 2 R ! n‡m R is the set of DAEs. The initial conditions x _…t †; x…t †; y…t †, denoted by x _ ; x ; y , cannot be 0 0 0 0 0 speci®ed independently, since they must satisfy (1) at an initial time t f…x _ ; x ; y ; t †ˆ 0: …2† 0 0 0 DAEs are characterized by their (differential) index [7]. The index of (1) is m, if m is the smallest number such that the system of equations f…x _; x; y; t†ˆ 0; INDEX REDUCTION USING SUBSTITUTE EQUATIONS 175 d f…x _; x; y; t† ˆ 0; dt . …3† …m† d f…x; x; y; t† ˆ 0; …m† d t can be transformed into an explicit ODE (‰x _; y _Š ˆ g…x; y; t†) by algebraic manipulations. In general, the higher the index, the greater the numerical dif®culty one encounters when trying to solve the system numerically. The number of degrees of freedom of a set of DAEs is the number of initial conditions from the total set of 2n‡ m initial conditions fx ; x ; y g that can 0 0 be speci®ed independently; or, in other words, it is the number of variables from the set fx; x; yg that can be given independent initial values. For ODEs (x ˆ g…x; t†), which have index 0, the number of degrees of freedom equals the number of differential variables n (x 2 R ). For DAEs (1) of index 1, apart from a small number of exceptions (see Section 7), the number of degrees of freedom also equals the number of differential variables n (x 2 R ); under the assumption that the set of n‡ m DAEs (1) is regular with respect to the remaining n‡ m variables. In many cases, the n differential variables of index 1 DAEs are given independent initial values x , and values of x _ and y are 0 0 calculated from (2). Another possibility is steady state initialization, which corresponds to providing initial values 0 for x _ , and calculating x and y from (2). A common feature of higher index DAEs is that there are hidden constraints in the DAEs. Hidden constraints are equations that further restrict the initial conditions given by (2). They can be obtained after differentiation and algebraic manipulations [7, 12]. The presence of hidden constraints means that the number of degrees of freedom of (1) is smaller than n. In such a case, not all differential variables x may be independently initialized; there are dependencies among them. This can be seen, if equations in the form g…x; t†ˆ 0 …4† are present in (1), or if they can be obtained after algebraic manipulations. The differential variables in (4) are dependent differential variables. The dependencies among the derivatives become visible after differentiation of (4). In fact, hidden constraints may be present in index 1 systems of DAEs too (see Section 7).   176 G. FABIAN ET AL. 3 INDEX REDUCTION It is well known, that mathematical models of physical systems may have a higher (differential) index. The usual technique to solve such higher index DAEs is by index reduction; through differentiation and algebraic manipula- tions, the index is lowered to 0 or 1. In literature, several algorithms can be found for index reduction. From these, the algorithm of Gear and Petzold [8], the constraint stabilization technique of Gear [7], and the algorithm of Bachmann et al. [1] all differentiate (parts of) the system of equations and use substitution. Two well known general purpose index reduction algorithms that are used in simulation languages are the Pantelides algorithm [12], and the dummy derivatives algorithm [11]. The Pantelides algorithm is used in the hybrid simulation language Modelica [10], whereas the dummy derivatives algorithm is used in the hybrid simulation language ABACUSS [6]. However, since integrating these algorithms in a simulation environment is not a trivial matter, few other simulation languages provide the functionality of numerical solution and consistent initialization of higher index DAE systems. A problem with many index reduction techniques is that the additional equations obtained by differentiation lead to an overdetermined system, that cannot be solved by widely used general purpose solvers, such as DASSL, or DASRT [13]. Removing some of the additional equations can make the set of equations solvable by general purpose solvers. However, by doing so, the solution will slowly drift away from the intended, original solution. Another problem of index reduction methods is that these methods change the original set of equations by subsequent steps of differentiations and algebraic manipulations (substitution). This may lead to a modelling problem. Since not all differential variables may be freely chosen in such a system (assuming that, by default, the modeller speci®es initial values for the differential variables), it must be clear for the modeller which differential variables may be initialized, and which ones are calculated from the equations. Even more, the modeller may want to choose the variables that he or she wants to initialize. In fact, [9] states that many approaches for the consistent initiali- zation problem analyze the set of equations and ask the user for the initial conditions for a particular set of variables, which the user might not have. For simulators that have not implemented index reduction techniques, only lower index systems (index 0 or 1) of equations may be entered. In some cases, higher index systems can be avoided by careful modeling. For chemical systems this is illustrated in [14]. In other cases, the modeller has to perform INDEX REDUCTION USING SUBSTITUTE EQUATIONS 177 index reduction, and has to re-formulate the system of equations. In such a case, a new equation set is obtained that is usually less expressive than the original one. Also, variables may be eliminated from the equations due to index reduction. Therefore, each time the values of these variables are needed in the model, they must be re-calculated. This also reduces the readability of models. 4 SUBSTITUTE EQUATIONS To overcome the problems mentioned above, in the  language [5, 16] substitute equations are used. By means of a substitute equation, the value of a continuous variable or its time derivative is speci®ed by an expression. This expression is evaluated each time that the variable or its time derivative, respectively, is referenced in the model. The advantage of substitute equations is that they enable index reduction and consistent initialization of higher index DAEs without changing the original equations; no existing variables are removed and no new variables are introduced. The modeller has full control over which variables he wants to initialize, and the implementation of substitute equations is straightforward. As an additional advantage, widely used general purpose solvers, such as DASSL, or DASRT [13], can be used to solve the resulting set of equations. Substitute equations are, however, not a general purpose index reduction mechanism. They are applicable to those higher index systems where one (or more) of the differential variables can be expressed as an explicit function of the remaining differential variables. Consider the general implicit form of (1). If the vector of differential variables x 2 R can be partitioned into nÿ1 z 2 R and v 2 R such that (1) can be expressed in the form f…z _; z; v _; v; y; t†ˆ 0 …5a† v ˆ …z; t†; …5b† i.e., v is expressed as an explicit function of the remaining differential variables and the time, then substitute equations can be used to calculate v _ . In order to remove the dependency between the differential variables ‰z;vŠ in (5), this equation is differentiated, leading to the hidden constraint v _ ˆ  ‡  z _: …6† t z   178 G. FABIAN ET AL. By specifying (6) as a substitute equation, the following model is obtained f…z _; z; v _; v; y; t†ˆ 0 …7a† v ˆ …z; t†…7b† v _  ‡  z: …7c† t z The left arrow indicates a substitute equation. This model is equivalent to the model given by equation (5), where every occurrence of v in equation (5) is replaced by  ‡  z _. In this way, differential variable v is in fact changed to t z an algebraic variable. This is analogous to the dummy derivatives method [11]; substitution of v _ by a dummy variable d in equations (5, 6) leads to f…z _; z; d; v; y; t†ˆ 0 …8a† v ˆ …z; t†…8b† d ˆ  ‡  z; …8c† t z It is clear from these equations, that variable v has become algebraic instead of differential, so that (8b) no longer speci®es a direct dependency between the differential variables z. A difference between the dummy derivatives algo- rithm and the substitute equations technique, is that the latter technique leaves the original equations unchanged, retaining the expressivity of the original model. A further difference is that the substitute equation technique does not provide an algorithm for automatic index reduction, such as the dummy derivatives algorithm, or the Pantelides algorithm. Rather, it provides the modeller with substitute equations as a new language element; but the modeller should perform the necessary algebraic manipulations and differentiations to obtain equations of the form (7). Higher index systems that are candidate for index reduction by means of substitute equations, generally contain equations of the form g…x; t†ˆ 0; …9† or g…x; u; t†ˆ 0 …10a† u ˆ h…t†; …10 b† where x are differential variables, and u are algebraic variables. The conditions on the form of f in (5a), that guarantee that the index of equation (7) is 1 lower than the index of equation (5) have not yet been determined. INDEX REDUCTION USING SUBSTITUTE EQUATIONS 179 5 SUBSTITUTE EQUATIONS IN THE  LANGUAGE In the  language, substitution can be speci®ed explicitly by means of substitute equations in two forms. The simple form, expressed in Backus-Naur Form (BNF), is S ::ˆ v E j v E E ::ˆ e where S and E are nonterminals, v is a continuous variable, v is the time derivative of a continuous variable and e is an expression of type real. The variable that is de®ned on the left hand side of a substitute equation (in this case, v and v ) is termed a substituted variable. There may only be one substitute equation for each substituted variable. The meaning of a substitute 0 0 equation v e (or v e) is that all occurrences of v (or v ) in the model are replaced by e. The guarded form of E is E ::ˆ‰ b ! e ‰Š .. . ‰Š b ! e Š 1 1 n n where b is a boolean guard and e is an expression of type real (i ˆ 1 .. . n). In i i this case, variable v (or v ) is substituted dynamically, depending on the values of the guards. If b is true, variable v (or v ) is substituted by e . If more i i guards are true at the same time, one alternative is chosen nondeterminis- tically and all occurrences of v (or v ) in the model are calculated from this alternative. All variables occurring in the right-hand-side of substitute equations (in expressions e; e and b ; i ˆ 1 .. . n) must be well-de®ned; they can either be i i de®ned as a constant, as a discrete variable, or as a continuous variable that is either de®ned by another substitute equation or by normal, non-substitute, equations. Substitute equations are evaluated recursively; if a substituted variable occurs on the right-hand-side of a substitute equation, ®rst, its value is calculated by substitution. Therefore, substitute equations can be speci®ed in arbitrary order; the only requirement is that they may not contain circular dependencies. The implementation of substitute equations is straightforward. Whenever the value of a substituted variable is required, the simulator evaluates the right hand side of the substitute equation that de®nes the value of the substituted variable. In the next sections, some examples of the use of substitute equations are given.   180 G. FABIAN ET AL. 6 EXAMPLES 6.1 PID Control Example As an example of a higher index system, take the following (PID) proportional integral differential controller. A horizontal force F is applied to a body of mass 1 on a ¯at surface, without friction. The position of the body is denoted by x. The control objective is to keep the body at a given position x . The set unknowns are x; v ; i; e; u. Variable F is an input variable (depending only on time), x ; k ; k and k are constants. set P D I x _ ˆ v …11a† v_ ˆ F ÿ u …11b† i ˆ e …11c† e ˆ xÿ x …11d† set u ˆ k e‡ k e _ ‡ k i …11e† P D I This is an index 2 system of DAEs. Differentiation of (11d) yields e _ ˆ x _: …12† After differentiating (11a), (11e), and differentiating (12) a second time, the ODE form can be obtained by performing the following substitutions in the differentiated version of (11e): v for e _, F ÿ u for  e ( e ˆ  x ˆ v_ ˆ F ÿ v ), and e for i. Typically to higher index systems, (11d) contains a hidden constraint that appears after differentiation: (12) must also hold when initial conditions are calculated. For automatic calculation of the initial conditions, in general, the differential variables (x, v , i, and e) are considered as known (their initial values are supplied by the modeller), and the derivatives and the algebraic variables are calculated from the equations. This approach generally works well for index 1 systems, but it clearly fails in this case. Although, the number of unknowns (5: x _ , v_ , i, e _ , v ) is equal to the number of equations, the unknowns occur in only 4 out of the 5 equations, making it impossible to calculate them in this way. A substitute equation can be used to reduce the index to 1, and to allow automatic calculation of the initial conditions. Equation (11d) is already in the INDEX REDUCTION USING SUBSTITUTE EQUATIONS 181 form of (5b). After differentiating this equation and selecting e _ for substitution, the system is speci®ed in  as follows x ˆ v; v ˆ F ÿ u; e ˆ xÿ x ; set i ˆ e; u ˆ k e‡ k e ‡ k ; P D I 0 0 e x ; 0 0 Whenever the value of expression e is required, the value of x is evaluated instead. In this model, x can be freely initialized, but the value of e depends on x. The actual set of equations solved by numerical solvers is x _ ˆ v …13a† v_ ˆ F ÿ u …13b† e ˆ xÿ x …13c† set i ˆ e …13d† u ˆ k e‡ k x _ ‡ k i: …13e† P D I Note that for the solvers, e _ is not present in the equations, e has thus become an algebraic variable. After initialization of the differential variables (x, v , i), the _ _ derivatives and algebraic variables (x, v , i, e, u) can now be automatically calculated from equation (13). By means of the substitute equation, the index of the systems has been reduced from 2 to 1. If the modeller would like to specify the initial value of e, instead of x, the substitute equation would become 0 0 x e : …14† If x is not a constant, but a prescribed function of time, say sin(!t†, instead set of one equation e ˆ xÿ x , we get two equations set e ˆ xÿ x …15a† set x ˆ sin…!t†: …15b† set The substitute equation for e then becomes 0 0 e x ÿ cos…!t†: …16†   182 G. FABIAN ET AL. The advantage of using substitute equations is that the process of substitution is transparent; the original form of the equations is preserved 0 0 and the additional information used (e ˆ x ) is made explicit. Also, references to the substituted variable in the discrete-event part of the model need not be altered; in the example, e can be referenced in any discrete statement. 6.2 Composition of Subsystems Example Higher index systems can be a result of connecting two index 1 or index 0 systems. Consider two capacitors with capacitance C and C , respectively, 1 2 that are described by the ODEs v_ ˆ …17a† v_ ˆ : …17b† If the two systems are interconnected, so that the capacitors are in parallel, the equations become v_ ˆ …18a† v_ ˆ …18b† i ‡ i ˆ 0 …18c† 1 2 v ˆ v : …18d† 1 2 This is an index 2 system, because in order to derive an expression for i and i , the ®rst three equations need to be differentiated. This results in equations for v  and v  . By differentiating (18d) twice, v  and v  can be eliminated, so 1 2 1 2 _ _ that i and i can be solved. Together with the already available equations for 1 2 v_ and v_ , the ODE is then obtained. In the parallel system, the two voltages 1 2 v and v can no longer be initialized independently; even if the two voltages 1 2 are initialized to the same value, automatic calculation of the initial conditions by taking v and v as known, and v_ , v_ , i , and i as unknown fails, because 1 2 1 2 1 2 the four equations are singular with respect to these four variables. A corresponding index 1 model with substitute equations would be v_ ˆ …19a† 1 INDEX REDUCTION USING SUBSTITUTE EQUATIONS 183 v_ ˆ …19b† i ‡ i ˆ 0 …19c† 1 2 v ˆ v …19d† 1 2 v_ v_ : …19e† 2 1 The meaning of the additional substitute equation is that all occurrences of v_ are substituted by v_ . Therefore, for the solvers, v_ is no longer present in the 1 2 model, so that variable v becomes algebraic. The initial value of v may be 2 1 speci®ed by the modeller. Automatic calculation of initial conditions is now possible, because v is taken as known, and v_ , v , i , and i are taken as 1 1 2 1 2 unknown. Mathematically, equation (19) are equivalent to v_ ˆ …20a† i i 1 2 ˆ …20b† C C 1 2 i ‡ i ˆ 0 …20c† 1 2 v ˆ v …20d† 1 2 7 CONSISTENT INITIALIZATION OF INDEX 1 SYSTEMS In general, higher index DAEs coincide with hidden constraints in the equations. Hidden constraints can, however, also be present in index 1 DAEs. This is the case when there are dependent differential variables in the index 1 DAE system. Again, the solution is the use of a substitute equation. The PID control system is used as an example. The index of the PID control example can also be reduced by replacing variable u by the derivative of a dummy variable z. The set of equations then becomes x _ ˆ v …21a† F ÿ z _ v_ ˆ …21b† e ˆ xÿ x …21c† set i ˆ e …21d† z _ ˆ k e‡ k e _ ‡ k i: …21e† P D I   184 G. FABIAN ET AL. This is an index 1 problem, because after differentiating (21c), the equations can be re-arranged into an ODE. Yet, e and x remain dependent differential variables, so that they cannot be initialized independently. As a consequence, there is a hidden constraint in (21c), which appears after differentiation of the equation. The initialization problem can easily be solved, as before, by adding a substitute equation for e _. 8 MODELLING AND SIMULATION OF DISCONTINUITIES 8.1 Handling of Discontinuous Variables by Means of Substitute Equations Another application area for substitute equations is the modelling of discontinuous functions. General purpose DAE and ODE solvers cannot usually integrate discontinuous functions [3]. The usual approach is that discontinuities are speci®ed by so called switching functions. When the sign of the switching function changes, a discontinuity occurs. Integration stops, and is re-started again after the discontinuity. For more on numerical methods with respect to discontinuities we refer to [4]. A discontinuity in a variable that is used by the solver can be avoided in cases where the discontinuous variable can be expressed in a closed form. This variable can then be calculated by substitution, and thereby, it is removed from the equation set that is actually solved by numerical solvers. As an example, consider a tank described in [15], where over¯ow occurs if the level h of its contents reaches a maximum height h . The incoming and outgoing ¯ows max are denoted by Q and Q , respectively; the area of the tank by A, and the i o over¯ow by Q . The system described by a conditional equation is ‰ h < h _ Q < Q ! Ah ˆ Q ÿ Q ; Q ˆ 0 max i o i o x ‰Š h  h ^ Q  Q ! Ah ˆ 0; Q ˆ Q ÿ Q max i o x i o The general form of a conditional equation is: ‰ b ! DAEs ‰Š 1 1 .. . ‰Š b ! DAEs Š, where DAEs (1  i  n) represents one or more n n i equations separated by commas. Boolean expression b denotes a guard. At any time, (at least) one of these guards must be open (true), so that the DAE(s) INDEX REDUCTION USING SUBSTITUTE EQUATIONS 185 associated with the open guard (after the arrow of the open guard) is (are) activated. The discontinuous variable Q can be removed from the equations by substitution Ah ˆ Q ÿ Q ÿ Q ; i o x Q ‰ h < h _ Q < Q ! 0 x max i o ‰Šh  h ^ Q  Q ! Q ÿ Q max i o i o In this case, only the ®rst equation, Ah ˆ Q ÿ Q ÿ Q is solved by i o x integration. The fact that variable h has a discontinuous ®rst derivative is usually not a problem for numerical integrators. 8.2 Substitute Equations and Root Finding A well ± known mechanism to handle discontinuities in simulators is based on the root-®nding algorithm present in certain general purpose solvers, such as DASRT 2. Using such a mechanism, relations in the guards of conditional equations, such as h < h , and Q ; Q are converted into so called root max i o functions hÿ h , and Q ÿ Q , respectively. During integration, no max i o discontinuities take place, and the equation set is not changed. In the example of the over¯owing tank from the previous section, the equation set would be 0 0 eitherfAh ˆ Q ÿ Q ; Q ˆ 0g,orfAh ˆ 0; Q ˆ Q ÿ Q g, depending on i o x x i o the values of the guards (e.g., h < h _ Q < Q )at the startofthe integration max i o interval. Integration continues until a root function changes its sign (has crossed zero), and causes the value of a guard to change. The exact location of the zero crossing is then determined (root ®nding), and integration stops. Integration is restarted after the `discontinuity', using a new set of equations, and after ®rst calculating the new initial conditions. Please note that the new initial conditions do not necessarily imply any variables to be discontinuous. It is also possible that there is only a discontinuous derivative, or even that there is no discontinuity at all. This approach, based on root ®nding, is not always possible. Consider, for example, the conditional equation that calculates the square root of an argument, and returns zero for negative arguments: p ‰x  0 ! y ˆ x ‰Šx < 0 ! y ˆ 0 Š Â Â 186 G. FABIAN ET AL. Here, the root ®nding mechanism may not be used, because it may cause the square root function to be called outside of its domain. This happens when p x crosses zero coming from above zero, so that equation y ˆ x is active. In such as case, a root of a negative number would be taken. In order to prevent this from happening, a substitute equation can be used: p y ‰x  0 ! x ‰Šx < 0 ! 0 In substitute equations, no root ®nding takes place. The advantage of using a substitute equation for this purpose, is that the language is kept small, because no additional language elements are required. In the Modelica [10] the noevent directive is used to indicate that the root ®nding mechanism may not be used. 9 CONCLUSIONS Substitute equations make the mechanism of index reduction transparent to users. The original equation set is unchanged, so that substituted variables do not disappear from the model; they can still be used in discrete-event statements. In this way, expressiveness of the models is preserved. Furthermore, the use of substitute equations makes it clear which variables can be initialized independently of one another by the modeller, and which ones are calculated. Substitute equations can also be used to reveal hidden constraints in index 1 DAEs. Finally, substitute equations enable the use of general purpose numerical solvers for equations where an unknown variable is discontinuous, and they can be used to prevent functions to be called outside of their domain. REFERENCES 1. Bachmann, R., Bru È ll, L., Mrziglod, T. and Pallaske, U.: On Methods for Reducing the Index of Differential Algebraic Equations. Computers and Chemical Engineering 14 (1990), 1271±1273. 2. Brenan, K.E., Campbell, S.L. and Petzold, L.R.: Numerical Solution of Initial-Value Problems in Differential-Algebraic Equations. SIAM's Classics in Applied Mathematics. Siam, Philadelphia, 1996. INDEX REDUCTION USING SUBSTITUTE EQUATIONS 187 3. Cellier, F.E., Elmqvist, H., Otter, M. and Taylor, J.H.: Guidelines for Modeling and Simulation of Hybrid Systems. In: IFAC 12th Triennial World Congress, Sydney, 1993, pp. 1219±1225. 4. Eich-Soellner, E. and Fuehrer, C.: Numerical Methods in Multibody Dynamics. Teubner, Stuttgart, 1998. 5. Fa Âbia Ân, G.: A Language and Simulator for Hybrid Systems. Ph.D. thesis, Eindhoven University of Technology, 1999. 6. Feehery, W.F. and Barton, P.I.: A Differentiation-Based Approach to Dynamic Simulation and Optimization with High-Index Differential-Algebraic Equations. In: Proceedings of 2nd International Workshop on Computational Differentiation. Santa Fe, 1996, pp. 239±52. 7. Gear, C.W.: Differential-Algebraic Equation Index Transformations. SIAM. J. Sci. Stat. Comp. 9 (1988), pp. 39±47. 8. Gear, C.W. and Petzold, L.R.: ODE Methods for the Solution of Differential / Algebraic Systems. SIAM Journal on Numerical Analysis 21 (1984), pp. 716±728. 9. Gopal, V. and Biegler, L.: A Successive Linear Programming Approach for Initialization and Reinitialization after Discontinuities of Differential-Algebraic Equations. SIAM J. Sci. Comput. 20 (1998), pp. 447±467. 10. Mattsson, S.E., Elmqvist, H., and Otter, M.: Physical System Modeling with Modelica. Control Engineering Practice 6 (1998), pp. 501±510. 11. Mattsson, S.E. and Soderlind, G.: Index Reduction in Differential-Algebraic Equations Using Dummy Derivatives. SIAM J. Sci. Comput. 14 (1993), pp. 677±692. 12. Pantelides, C.C.: The Consistent Initialization of Differential-Algebraic Systems. SIAM J. Sci. Stat. Comput. 9 (1998), pp. 213±231. 13. Petzold, L.R.: A description of DASSL: A Differential / Algebraic System Solver. Scienti®c Computing (1983), pp. 65±68. 14. Ponton, J.W. and Gawthrop, P.J.: Systematic Construction of Dynamic Models for Phase Equilibrium Processes. Computers & Chemical Engineering 15 (1991), 803±808. 15. Van Beek, D.A. and Rooda, J.E.: Speci®cation of Discontinuities in Hybrid Models. In: J. Zaytoon (ed.): Hybrid Dynamical Systems ± Proc. of 3rd International Conference on Automation of Mixed Processes. Reims, 1998, pp. 415±420. 16. Van Beek, D.A. and Rooda, J.E.: Languages and Applications in Hybrid Modelling and Simulation: Positioning of Chi. Control Engineering Practice 8 (2000), pp. 81±91. http://www.deepdyve.com/assets/images/DeepDyve-Logo-lg.png Mathematical and Computer Modelling of Dynamical Systems Taylor & Francis

Index Reduction and Discontinuity Handling Using Substitute Equations

Loading next page...
 
/lp/taylor-francis/index-reduction-and-discontinuity-handling-using-substitute-equations-VRJMfypR7x

References (18)

Publisher
Taylor & Francis
Copyright
Copyright Taylor & Francis Group, LLC
ISSN
1744-5051
eISSN
1387-3954
DOI
10.1076/mcmd.7.2.173.3646
Publisher site
See Article on Publisher Site

Abstract

Mathematical and Computer Modelling of Dynamical Systems 1387-3954/01/0702-173$16.00 2001, Vol. 7, No. 2, pp. 173±187 Swets & Zeitlinger Index Reduction and Discontinuity Handling Using Substitute Equations 1 2 2   G. FABIAN , D.A. VAN BEEK and J.E. ROODA ABSTRACT Several techniques exist for index reduction and consistent initialization of higher index DAEs. Many such techniques change the original set of equations by differentiation, substitution, and / or introduction of new variables. This paper introduces substitute equations as a new language element. By means of a substitute equation, the value of a continuous variable or its time derivative is speci®ed by an expression. This expression is evaluated each time that the variable or its time derivative, respectively, is referenced in the model. The advantage of substitute equations is that they enable index reduction and consistent initialization of higher index DAEs without changing the original equations; no existing variables are removed and no new variables are introduced. Substitute equations can also be used to enable the use of general purpose numerical solvers for equations where one or more of the unknowns are discontinuous, and they can be used to prevent functions to be called outside of their domain. Keywords: differential algebraic equations, index reduction, simulation languages, hybrid systems. 1 INTRODUCTION The majority of continuous-time and hybrid simulation languages are limited to simulation of ODEs, or DAEs with differential index 1. ODEs are relatively easy to solve numerically, and many ODE solvers are available. For ODEs, the initial values of all differential variables can be speci®ed freely, and the calculation of initial conditions is straightforward. For index 1 DAEs, general KPN Research, P.O. Box 421, 2260 AK Leidschendam, Netherlands, E-mail: g.fabian@ kpn.com Eindhoven University of Technology, Dept. of Mechanical Engineering, P.O. Box 513, 5600 MB Eindhoven, Netherlands, E-mail: d.a.v.beek@tue.nl   174 G. FABIAN ET AL. purpose solvers are also available, but the numerical solution and calculation of initial conditions for these systems is, in general, more dif®cult than for ODEs. Mathematical modelling of physical systems, however, may result in higher index DAEs, for which no general purpose solvers are available. Also, speci®cation and calculation of consistent initial conditions for these systems can be rather dif®cult. Therefore, these DAEs are usually solved by means of index reduction techniques. Many such techniques change the original set of equations by differentiation, substitution, and / or introduction of new variables. This paper discusses some of the modeling problems that are a result of these index reduction techniques, and it introduces a new way to deal with higher index systems in simulation languages. The paper is organized as follows. First, some of the currently known techniques are introduced. Second, substitute equations are introduced as a new language element for index reduction. The syntax, semantics, application, and implementation of this new language element are discussed, and several examples of its application are given. Finally, the use of substitute equations for discontinuity handling in simulators is discussed, and conclusions are presented. 2 THE HIGHER INDEX PROBLEM DAEs are differential equations with additional algebraic constraints in the general form f…x _; x; y; t†ˆ 0; …1† n m where x 2 R is the vector of differential variables, y 2 R is the vector of 2n‡m‡1 algebraic variables, t 2 R is the independent variable and f 2 R ! n‡m R is the set of DAEs. The initial conditions x _…t †; x…t †; y…t †, denoted by x _ ; x ; y , cannot be 0 0 0 0 0 speci®ed independently, since they must satisfy (1) at an initial time t f…x _ ; x ; y ; t †ˆ 0: …2† 0 0 0 DAEs are characterized by their (differential) index [7]. The index of (1) is m, if m is the smallest number such that the system of equations f…x _; x; y; t†ˆ 0; INDEX REDUCTION USING SUBSTITUTE EQUATIONS 175 d f…x _; x; y; t† ˆ 0; dt . …3† …m† d f…x; x; y; t† ˆ 0; …m† d t can be transformed into an explicit ODE (‰x _; y _Š ˆ g…x; y; t†) by algebraic manipulations. In general, the higher the index, the greater the numerical dif®culty one encounters when trying to solve the system numerically. The number of degrees of freedom of a set of DAEs is the number of initial conditions from the total set of 2n‡ m initial conditions fx ; x ; y g that can 0 0 be speci®ed independently; or, in other words, it is the number of variables from the set fx; x; yg that can be given independent initial values. For ODEs (x ˆ g…x; t†), which have index 0, the number of degrees of freedom equals the number of differential variables n (x 2 R ). For DAEs (1) of index 1, apart from a small number of exceptions (see Section 7), the number of degrees of freedom also equals the number of differential variables n (x 2 R ); under the assumption that the set of n‡ m DAEs (1) is regular with respect to the remaining n‡ m variables. In many cases, the n differential variables of index 1 DAEs are given independent initial values x , and values of x _ and y are 0 0 calculated from (2). Another possibility is steady state initialization, which corresponds to providing initial values 0 for x _ , and calculating x and y from (2). A common feature of higher index DAEs is that there are hidden constraints in the DAEs. Hidden constraints are equations that further restrict the initial conditions given by (2). They can be obtained after differentiation and algebraic manipulations [7, 12]. The presence of hidden constraints means that the number of degrees of freedom of (1) is smaller than n. In such a case, not all differential variables x may be independently initialized; there are dependencies among them. This can be seen, if equations in the form g…x; t†ˆ 0 …4† are present in (1), or if they can be obtained after algebraic manipulations. The differential variables in (4) are dependent differential variables. The dependencies among the derivatives become visible after differentiation of (4). In fact, hidden constraints may be present in index 1 systems of DAEs too (see Section 7).   176 G. FABIAN ET AL. 3 INDEX REDUCTION It is well known, that mathematical models of physical systems may have a higher (differential) index. The usual technique to solve such higher index DAEs is by index reduction; through differentiation and algebraic manipula- tions, the index is lowered to 0 or 1. In literature, several algorithms can be found for index reduction. From these, the algorithm of Gear and Petzold [8], the constraint stabilization technique of Gear [7], and the algorithm of Bachmann et al. [1] all differentiate (parts of) the system of equations and use substitution. Two well known general purpose index reduction algorithms that are used in simulation languages are the Pantelides algorithm [12], and the dummy derivatives algorithm [11]. The Pantelides algorithm is used in the hybrid simulation language Modelica [10], whereas the dummy derivatives algorithm is used in the hybrid simulation language ABACUSS [6]. However, since integrating these algorithms in a simulation environment is not a trivial matter, few other simulation languages provide the functionality of numerical solution and consistent initialization of higher index DAE systems. A problem with many index reduction techniques is that the additional equations obtained by differentiation lead to an overdetermined system, that cannot be solved by widely used general purpose solvers, such as DASSL, or DASRT [13]. Removing some of the additional equations can make the set of equations solvable by general purpose solvers. However, by doing so, the solution will slowly drift away from the intended, original solution. Another problem of index reduction methods is that these methods change the original set of equations by subsequent steps of differentiations and algebraic manipulations (substitution). This may lead to a modelling problem. Since not all differential variables may be freely chosen in such a system (assuming that, by default, the modeller speci®es initial values for the differential variables), it must be clear for the modeller which differential variables may be initialized, and which ones are calculated from the equations. Even more, the modeller may want to choose the variables that he or she wants to initialize. In fact, [9] states that many approaches for the consistent initiali- zation problem analyze the set of equations and ask the user for the initial conditions for a particular set of variables, which the user might not have. For simulators that have not implemented index reduction techniques, only lower index systems (index 0 or 1) of equations may be entered. In some cases, higher index systems can be avoided by careful modeling. For chemical systems this is illustrated in [14]. In other cases, the modeller has to perform INDEX REDUCTION USING SUBSTITUTE EQUATIONS 177 index reduction, and has to re-formulate the system of equations. In such a case, a new equation set is obtained that is usually less expressive than the original one. Also, variables may be eliminated from the equations due to index reduction. Therefore, each time the values of these variables are needed in the model, they must be re-calculated. This also reduces the readability of models. 4 SUBSTITUTE EQUATIONS To overcome the problems mentioned above, in the  language [5, 16] substitute equations are used. By means of a substitute equation, the value of a continuous variable or its time derivative is speci®ed by an expression. This expression is evaluated each time that the variable or its time derivative, respectively, is referenced in the model. The advantage of substitute equations is that they enable index reduction and consistent initialization of higher index DAEs without changing the original equations; no existing variables are removed and no new variables are introduced. The modeller has full control over which variables he wants to initialize, and the implementation of substitute equations is straightforward. As an additional advantage, widely used general purpose solvers, such as DASSL, or DASRT [13], can be used to solve the resulting set of equations. Substitute equations are, however, not a general purpose index reduction mechanism. They are applicable to those higher index systems where one (or more) of the differential variables can be expressed as an explicit function of the remaining differential variables. Consider the general implicit form of (1). If the vector of differential variables x 2 R can be partitioned into nÿ1 z 2 R and v 2 R such that (1) can be expressed in the form f…z _; z; v _; v; y; t†ˆ 0 …5a† v ˆ …z; t†; …5b† i.e., v is expressed as an explicit function of the remaining differential variables and the time, then substitute equations can be used to calculate v _ . In order to remove the dependency between the differential variables ‰z;vŠ in (5), this equation is differentiated, leading to the hidden constraint v _ ˆ  ‡  z _: …6† t z   178 G. FABIAN ET AL. By specifying (6) as a substitute equation, the following model is obtained f…z _; z; v _; v; y; t†ˆ 0 …7a† v ˆ …z; t†…7b† v _  ‡  z: …7c† t z The left arrow indicates a substitute equation. This model is equivalent to the model given by equation (5), where every occurrence of v in equation (5) is replaced by  ‡  z _. In this way, differential variable v is in fact changed to t z an algebraic variable. This is analogous to the dummy derivatives method [11]; substitution of v _ by a dummy variable d in equations (5, 6) leads to f…z _; z; d; v; y; t†ˆ 0 …8a† v ˆ …z; t†…8b† d ˆ  ‡  z; …8c† t z It is clear from these equations, that variable v has become algebraic instead of differential, so that (8b) no longer speci®es a direct dependency between the differential variables z. A difference between the dummy derivatives algo- rithm and the substitute equations technique, is that the latter technique leaves the original equations unchanged, retaining the expressivity of the original model. A further difference is that the substitute equation technique does not provide an algorithm for automatic index reduction, such as the dummy derivatives algorithm, or the Pantelides algorithm. Rather, it provides the modeller with substitute equations as a new language element; but the modeller should perform the necessary algebraic manipulations and differentiations to obtain equations of the form (7). Higher index systems that are candidate for index reduction by means of substitute equations, generally contain equations of the form g…x; t†ˆ 0; …9† or g…x; u; t†ˆ 0 …10a† u ˆ h…t†; …10 b† where x are differential variables, and u are algebraic variables. The conditions on the form of f in (5a), that guarantee that the index of equation (7) is 1 lower than the index of equation (5) have not yet been determined. INDEX REDUCTION USING SUBSTITUTE EQUATIONS 179 5 SUBSTITUTE EQUATIONS IN THE  LANGUAGE In the  language, substitution can be speci®ed explicitly by means of substitute equations in two forms. The simple form, expressed in Backus-Naur Form (BNF), is S ::ˆ v E j v E E ::ˆ e where S and E are nonterminals, v is a continuous variable, v is the time derivative of a continuous variable and e is an expression of type real. The variable that is de®ned on the left hand side of a substitute equation (in this case, v and v ) is termed a substituted variable. There may only be one substitute equation for each substituted variable. The meaning of a substitute 0 0 equation v e (or v e) is that all occurrences of v (or v ) in the model are replaced by e. The guarded form of E is E ::ˆ‰ b ! e ‰Š .. . ‰Š b ! e Š 1 1 n n where b is a boolean guard and e is an expression of type real (i ˆ 1 .. . n). In i i this case, variable v (or v ) is substituted dynamically, depending on the values of the guards. If b is true, variable v (or v ) is substituted by e . If more i i guards are true at the same time, one alternative is chosen nondeterminis- tically and all occurrences of v (or v ) in the model are calculated from this alternative. All variables occurring in the right-hand-side of substitute equations (in expressions e; e and b ; i ˆ 1 .. . n) must be well-de®ned; they can either be i i de®ned as a constant, as a discrete variable, or as a continuous variable that is either de®ned by another substitute equation or by normal, non-substitute, equations. Substitute equations are evaluated recursively; if a substituted variable occurs on the right-hand-side of a substitute equation, ®rst, its value is calculated by substitution. Therefore, substitute equations can be speci®ed in arbitrary order; the only requirement is that they may not contain circular dependencies. The implementation of substitute equations is straightforward. Whenever the value of a substituted variable is required, the simulator evaluates the right hand side of the substitute equation that de®nes the value of the substituted variable. In the next sections, some examples of the use of substitute equations are given.   180 G. FABIAN ET AL. 6 EXAMPLES 6.1 PID Control Example As an example of a higher index system, take the following (PID) proportional integral differential controller. A horizontal force F is applied to a body of mass 1 on a ¯at surface, without friction. The position of the body is denoted by x. The control objective is to keep the body at a given position x . The set unknowns are x; v ; i; e; u. Variable F is an input variable (depending only on time), x ; k ; k and k are constants. set P D I x _ ˆ v …11a† v_ ˆ F ÿ u …11b† i ˆ e …11c† e ˆ xÿ x …11d† set u ˆ k e‡ k e _ ‡ k i …11e† P D I This is an index 2 system of DAEs. Differentiation of (11d) yields e _ ˆ x _: …12† After differentiating (11a), (11e), and differentiating (12) a second time, the ODE form can be obtained by performing the following substitutions in the differentiated version of (11e): v for e _, F ÿ u for  e ( e ˆ  x ˆ v_ ˆ F ÿ v ), and e for i. Typically to higher index systems, (11d) contains a hidden constraint that appears after differentiation: (12) must also hold when initial conditions are calculated. For automatic calculation of the initial conditions, in general, the differential variables (x, v , i, and e) are considered as known (their initial values are supplied by the modeller), and the derivatives and the algebraic variables are calculated from the equations. This approach generally works well for index 1 systems, but it clearly fails in this case. Although, the number of unknowns (5: x _ , v_ , i, e _ , v ) is equal to the number of equations, the unknowns occur in only 4 out of the 5 equations, making it impossible to calculate them in this way. A substitute equation can be used to reduce the index to 1, and to allow automatic calculation of the initial conditions. Equation (11d) is already in the INDEX REDUCTION USING SUBSTITUTE EQUATIONS 181 form of (5b). After differentiating this equation and selecting e _ for substitution, the system is speci®ed in  as follows x ˆ v; v ˆ F ÿ u; e ˆ xÿ x ; set i ˆ e; u ˆ k e‡ k e ‡ k ; P D I 0 0 e x ; 0 0 Whenever the value of expression e is required, the value of x is evaluated instead. In this model, x can be freely initialized, but the value of e depends on x. The actual set of equations solved by numerical solvers is x _ ˆ v …13a† v_ ˆ F ÿ u …13b† e ˆ xÿ x …13c† set i ˆ e …13d† u ˆ k e‡ k x _ ‡ k i: …13e† P D I Note that for the solvers, e _ is not present in the equations, e has thus become an algebraic variable. After initialization of the differential variables (x, v , i), the _ _ derivatives and algebraic variables (x, v , i, e, u) can now be automatically calculated from equation (13). By means of the substitute equation, the index of the systems has been reduced from 2 to 1. If the modeller would like to specify the initial value of e, instead of x, the substitute equation would become 0 0 x e : …14† If x is not a constant, but a prescribed function of time, say sin(!t†, instead set of one equation e ˆ xÿ x , we get two equations set e ˆ xÿ x …15a† set x ˆ sin…!t†: …15b† set The substitute equation for e then becomes 0 0 e x ÿ cos…!t†: …16†   182 G. FABIAN ET AL. The advantage of using substitute equations is that the process of substitution is transparent; the original form of the equations is preserved 0 0 and the additional information used (e ˆ x ) is made explicit. Also, references to the substituted variable in the discrete-event part of the model need not be altered; in the example, e can be referenced in any discrete statement. 6.2 Composition of Subsystems Example Higher index systems can be a result of connecting two index 1 or index 0 systems. Consider two capacitors with capacitance C and C , respectively, 1 2 that are described by the ODEs v_ ˆ …17a† v_ ˆ : …17b† If the two systems are interconnected, so that the capacitors are in parallel, the equations become v_ ˆ …18a† v_ ˆ …18b† i ‡ i ˆ 0 …18c† 1 2 v ˆ v : …18d† 1 2 This is an index 2 system, because in order to derive an expression for i and i , the ®rst three equations need to be differentiated. This results in equations for v  and v  . By differentiating (18d) twice, v  and v  can be eliminated, so 1 2 1 2 _ _ that i and i can be solved. Together with the already available equations for 1 2 v_ and v_ , the ODE is then obtained. In the parallel system, the two voltages 1 2 v and v can no longer be initialized independently; even if the two voltages 1 2 are initialized to the same value, automatic calculation of the initial conditions by taking v and v as known, and v_ , v_ , i , and i as unknown fails, because 1 2 1 2 1 2 the four equations are singular with respect to these four variables. A corresponding index 1 model with substitute equations would be v_ ˆ …19a† 1 INDEX REDUCTION USING SUBSTITUTE EQUATIONS 183 v_ ˆ …19b† i ‡ i ˆ 0 …19c† 1 2 v ˆ v …19d† 1 2 v_ v_ : …19e† 2 1 The meaning of the additional substitute equation is that all occurrences of v_ are substituted by v_ . Therefore, for the solvers, v_ is no longer present in the 1 2 model, so that variable v becomes algebraic. The initial value of v may be 2 1 speci®ed by the modeller. Automatic calculation of initial conditions is now possible, because v is taken as known, and v_ , v , i , and i are taken as 1 1 2 1 2 unknown. Mathematically, equation (19) are equivalent to v_ ˆ …20a† i i 1 2 ˆ …20b† C C 1 2 i ‡ i ˆ 0 …20c† 1 2 v ˆ v …20d† 1 2 7 CONSISTENT INITIALIZATION OF INDEX 1 SYSTEMS In general, higher index DAEs coincide with hidden constraints in the equations. Hidden constraints can, however, also be present in index 1 DAEs. This is the case when there are dependent differential variables in the index 1 DAE system. Again, the solution is the use of a substitute equation. The PID control system is used as an example. The index of the PID control example can also be reduced by replacing variable u by the derivative of a dummy variable z. The set of equations then becomes x _ ˆ v …21a† F ÿ z _ v_ ˆ …21b† e ˆ xÿ x …21c† set i ˆ e …21d† z _ ˆ k e‡ k e _ ‡ k i: …21e† P D I   184 G. FABIAN ET AL. This is an index 1 problem, because after differentiating (21c), the equations can be re-arranged into an ODE. Yet, e and x remain dependent differential variables, so that they cannot be initialized independently. As a consequence, there is a hidden constraint in (21c), which appears after differentiation of the equation. The initialization problem can easily be solved, as before, by adding a substitute equation for e _. 8 MODELLING AND SIMULATION OF DISCONTINUITIES 8.1 Handling of Discontinuous Variables by Means of Substitute Equations Another application area for substitute equations is the modelling of discontinuous functions. General purpose DAE and ODE solvers cannot usually integrate discontinuous functions [3]. The usual approach is that discontinuities are speci®ed by so called switching functions. When the sign of the switching function changes, a discontinuity occurs. Integration stops, and is re-started again after the discontinuity. For more on numerical methods with respect to discontinuities we refer to [4]. A discontinuity in a variable that is used by the solver can be avoided in cases where the discontinuous variable can be expressed in a closed form. This variable can then be calculated by substitution, and thereby, it is removed from the equation set that is actually solved by numerical solvers. As an example, consider a tank described in [15], where over¯ow occurs if the level h of its contents reaches a maximum height h . The incoming and outgoing ¯ows max are denoted by Q and Q , respectively; the area of the tank by A, and the i o over¯ow by Q . The system described by a conditional equation is ‰ h < h _ Q < Q ! Ah ˆ Q ÿ Q ; Q ˆ 0 max i o i o x ‰Š h  h ^ Q  Q ! Ah ˆ 0; Q ˆ Q ÿ Q max i o x i o The general form of a conditional equation is: ‰ b ! DAEs ‰Š 1 1 .. . ‰Š b ! DAEs Š, where DAEs (1  i  n) represents one or more n n i equations separated by commas. Boolean expression b denotes a guard. At any time, (at least) one of these guards must be open (true), so that the DAE(s) INDEX REDUCTION USING SUBSTITUTE EQUATIONS 185 associated with the open guard (after the arrow of the open guard) is (are) activated. The discontinuous variable Q can be removed from the equations by substitution Ah ˆ Q ÿ Q ÿ Q ; i o x Q ‰ h < h _ Q < Q ! 0 x max i o ‰Šh  h ^ Q  Q ! Q ÿ Q max i o i o In this case, only the ®rst equation, Ah ˆ Q ÿ Q ÿ Q is solved by i o x integration. The fact that variable h has a discontinuous ®rst derivative is usually not a problem for numerical integrators. 8.2 Substitute Equations and Root Finding A well ± known mechanism to handle discontinuities in simulators is based on the root-®nding algorithm present in certain general purpose solvers, such as DASRT 2. Using such a mechanism, relations in the guards of conditional equations, such as h < h , and Q ; Q are converted into so called root max i o functions hÿ h , and Q ÿ Q , respectively. During integration, no max i o discontinuities take place, and the equation set is not changed. In the example of the over¯owing tank from the previous section, the equation set would be 0 0 eitherfAh ˆ Q ÿ Q ; Q ˆ 0g,orfAh ˆ 0; Q ˆ Q ÿ Q g, depending on i o x x i o the values of the guards (e.g., h < h _ Q < Q )at the startofthe integration max i o interval. Integration continues until a root function changes its sign (has crossed zero), and causes the value of a guard to change. The exact location of the zero crossing is then determined (root ®nding), and integration stops. Integration is restarted after the `discontinuity', using a new set of equations, and after ®rst calculating the new initial conditions. Please note that the new initial conditions do not necessarily imply any variables to be discontinuous. It is also possible that there is only a discontinuous derivative, or even that there is no discontinuity at all. This approach, based on root ®nding, is not always possible. Consider, for example, the conditional equation that calculates the square root of an argument, and returns zero for negative arguments: p ‰x  0 ! y ˆ x ‰Šx < 0 ! y ˆ 0 Š Â Â 186 G. FABIAN ET AL. Here, the root ®nding mechanism may not be used, because it may cause the square root function to be called outside of its domain. This happens when p x crosses zero coming from above zero, so that equation y ˆ x is active. In such as case, a root of a negative number would be taken. In order to prevent this from happening, a substitute equation can be used: p y ‰x  0 ! x ‰Šx < 0 ! 0 In substitute equations, no root ®nding takes place. The advantage of using a substitute equation for this purpose, is that the language is kept small, because no additional language elements are required. In the Modelica [10] the noevent directive is used to indicate that the root ®nding mechanism may not be used. 9 CONCLUSIONS Substitute equations make the mechanism of index reduction transparent to users. The original equation set is unchanged, so that substituted variables do not disappear from the model; they can still be used in discrete-event statements. In this way, expressiveness of the models is preserved. Furthermore, the use of substitute equations makes it clear which variables can be initialized independently of one another by the modeller, and which ones are calculated. Substitute equations can also be used to reveal hidden constraints in index 1 DAEs. Finally, substitute equations enable the use of general purpose numerical solvers for equations where an unknown variable is discontinuous, and they can be used to prevent functions to be called outside of their domain. REFERENCES 1. Bachmann, R., Bru È ll, L., Mrziglod, T. and Pallaske, U.: On Methods for Reducing the Index of Differential Algebraic Equations. Computers and Chemical Engineering 14 (1990), 1271±1273. 2. Brenan, K.E., Campbell, S.L. and Petzold, L.R.: Numerical Solution of Initial-Value Problems in Differential-Algebraic Equations. SIAM's Classics in Applied Mathematics. Siam, Philadelphia, 1996. INDEX REDUCTION USING SUBSTITUTE EQUATIONS 187 3. Cellier, F.E., Elmqvist, H., Otter, M. and Taylor, J.H.: Guidelines for Modeling and Simulation of Hybrid Systems. In: IFAC 12th Triennial World Congress, Sydney, 1993, pp. 1219±1225. 4. Eich-Soellner, E. and Fuehrer, C.: Numerical Methods in Multibody Dynamics. Teubner, Stuttgart, 1998. 5. Fa Âbia Ân, G.: A Language and Simulator for Hybrid Systems. Ph.D. thesis, Eindhoven University of Technology, 1999. 6. Feehery, W.F. and Barton, P.I.: A Differentiation-Based Approach to Dynamic Simulation and Optimization with High-Index Differential-Algebraic Equations. In: Proceedings of 2nd International Workshop on Computational Differentiation. Santa Fe, 1996, pp. 239±52. 7. Gear, C.W.: Differential-Algebraic Equation Index Transformations. SIAM. J. Sci. Stat. Comp. 9 (1988), pp. 39±47. 8. Gear, C.W. and Petzold, L.R.: ODE Methods for the Solution of Differential / Algebraic Systems. SIAM Journal on Numerical Analysis 21 (1984), pp. 716±728. 9. Gopal, V. and Biegler, L.: A Successive Linear Programming Approach for Initialization and Reinitialization after Discontinuities of Differential-Algebraic Equations. SIAM J. Sci. Comput. 20 (1998), pp. 447±467. 10. Mattsson, S.E., Elmqvist, H., and Otter, M.: Physical System Modeling with Modelica. Control Engineering Practice 6 (1998), pp. 501±510. 11. Mattsson, S.E. and Soderlind, G.: Index Reduction in Differential-Algebraic Equations Using Dummy Derivatives. SIAM J. Sci. Comput. 14 (1993), pp. 677±692. 12. Pantelides, C.C.: The Consistent Initialization of Differential-Algebraic Systems. SIAM J. Sci. Stat. Comput. 9 (1998), pp. 213±231. 13. Petzold, L.R.: A description of DASSL: A Differential / Algebraic System Solver. Scienti®c Computing (1983), pp. 65±68. 14. Ponton, J.W. and Gawthrop, P.J.: Systematic Construction of Dynamic Models for Phase Equilibrium Processes. Computers & Chemical Engineering 15 (1991), 803±808. 15. Van Beek, D.A. and Rooda, J.E.: Speci®cation of Discontinuities in Hybrid Models. In: J. Zaytoon (ed.): Hybrid Dynamical Systems ± Proc. of 3rd International Conference on Automation of Mixed Processes. Reims, 1998, pp. 415±420. 16. Van Beek, D.A. and Rooda, J.E.: Languages and Applications in Hybrid Modelling and Simulation: Positioning of Chi. Control Engineering Practice 8 (2000), pp. 81±91.

Journal

Mathematical and Computer Modelling of Dynamical SystemsTaylor & Francis

Published: Jun 1, 2001

There are no references for this article.