1 / 50

The Need for Formulae Manipulation in the Object-oriented Modeling of Physical Systems

François E. Cellier, Ph.D. Institute of Computational Science ETH Zurich Switzerland July 26, 2006. The Need for Formulae Manipulation in the Object-oriented Modeling of Physical Systems.

maxima
Download Presentation

The Need for Formulae Manipulation in the Object-oriented Modeling of Physical Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. François E. Cellier, Ph.D. Institute of Computational Science ETH Zurich Switzerland July 26, 2006 The Need for Formulae Manipulationin the Object-oriented Modelingof Physical Systems

  2. Today’s modeling needs extend to physical systems that are described by many thousands of mathematical equations. Such models are being created and maintained by employing the principles of object-oriented graphical modeling. Each object contains a number of different layers (aspects, realities) that are to be described shortly. Symbolic formula manipulation plays a central role in converting these object-oriented descriptions to a form that can be simulated effectively and efficiently. Object-oriented Modeling

  3. Objects may contain an iconic representation that is being used to embed the object at the next higher hierarchical level. Objects may contain a geometric representation that is being used for animation. Objects may contain a topological description that shows its decomposition structure. Objects may contain a mathematical description that shows the equations that the model is formed of. Objects may contain a parametric description that shows parameters and their default values. Objects may contain a documentation layer that describes the object verbally. Object Descriptions

  4. Heterogeneous Modeling Formalisms

  5. Heterogeneous Modeling Formalisms II

  6. A First Example

  7. A First Example II Component equations: U0= f(t) U0= v1 – v0 uR1 = R1· iR1uR1= v1 – v2 uR2 = R2· iR2 uR2= v2 – v0 iC = C1· duC/dt uC= v2 – v0 uL = L1· diL/dt uL= v1 – v0 v0 = 0 Node equations: i0 = iR1 + iL iR1 = iR2 + iC The circuit contains 5 components and 3 nodes.  We require 13 equations in 13 unknowns.

  8. 1: U0 = f(t) 2: i0 = iL + iR1 3: uL = U0 4:diL/dt = uL / L1 5: v1 = U0 6: uR1 = v1 – v2 7: iR1 = uR1 / R1 8: v2 = uC 9: iC = iR1 – iR2 10: duC/dt = iC / C1 11: uR2 = uC 12: iR2 = uR2 / R2 diL duC uL v1 uR1 v2 U0 i0 iR1 iC uR2 iR2 dt dt 01 02 03 04 05 06 07 08 09 10 11 12 1 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 1 S = The Structure Incidence Matrix 

  9. Equations Unknowns U0 03 09 05 07 01 02 04 06 08 10 11 12 1: U0 = f(t) 2: i0 = iL + iR1 3: uL = U0 4:diL/dt = uL / L1 5: v1 = U0 6: uR1 = v1 – v2 7: iR1 = uR1 / R1 8: v2 = uC 9: iC = iR1 – iR2 10: duC/dt = iC / C1 11: uR2 = uC 12: iR2 = uR2 / R2 i0 uL diL/dt v1 uR1 iR1 v2 iC duC/dt uR2 iR2 The Structure Digraph 

  10. The TarjanAlgorithm is based on the structure digraph. It is a graph coloring algorithm. The Tarjan Algorithm equations with only a single black line leading to them, color that line in red and color all black lines that emanate from the indicated unknown in blue. Renumber the equations anew starting with 1. unknowns with only a single black line leading to them, color that line in red and color all black lines that emanate from the indicated equation in blue. Renumber the equations anew starting with n, where n denotes the number of equations.

  11. Equations Unknowns U0 01 03 09 07 05 11 02 12 01 04 08 10 06 1: U0 = f(t) 2: i0 = iL + iR1 3: uL = U0 4:diL/dt = uL / L1 5: v1 = U0 6: uR1 = v1 – v2 7: iR1 = uR1 / R1 8: v2 = uC 9: iC = iR1 – iR2 10: duC/dt = iC / C1 11: uR2 = uC 12: iR2 = uR2 / R2 i0 10 uL i di /dt i 0 du /dt L R1 u u i diL/dt C 11 U U C R2 L u 0 0 R2 v1 uR1 iR1 v2 02 iC U 0 duC/dt 12 v uR2 v 03 2 2 iR2 The Tarjan Algorithm: An Example 

  12. Equations Unknowns U0 01 03 05 07 09 12 11 10 08 02 04 01 06 1: U0 = f(t) 2: i0 = iL + iR1 3: uL = U0 4:diL/dt = uL / L1 5: v1 = U0 6: uR1 = v1 – v2 7: iR1 = uR1 / R1 8: v2 = uC 9: iC = iR1 – iR2 10: duC/dt = iC / C1 11: uR2 = uC 12: iR2 = uR2 / R2 i0 10 uL 04 i i i di /dt i 0 i v v du /dt L C R2 R1 R1 i u u diL/dt 1 C R2 1 11 U U C L R2 u 0 0 R2 v1 05 i u L uR1 iR1 v2 02 iC U 09 0 duC/dt 12 v uR2 v 03 2 2 iR2 06 The Tarjan Algorithm: An Example II 

  13. Equations Unknowns U0 01 03 05 07 09 08 01 02 04 11 10 12 06 1: U0 = f(t) 2: i0 = iL + iR1 3: uL = U0 4:diL/dt = uL / L1 5: v1 = U0 6: uR1 = v1 – v2 7: iR1 = uR1 / R1 8: v2 = uC 9: iC = iR1 – iR2 10: duC/dt = iC / C1 11: uR2 = uC 12: iR2 = uR2 / R2 i0 10 u uL i 04 R1 u i R1 i i di /dt i R1 0 i v v du /dt L C R2 R1 R1 i u u diL/dt 1 C R2 1 11 U U C R2 L u 0 0 R2 v1 05 i u L uR1 07 iR1 08 v2 02 iC U 09 0 duC/dt 12 v uR2 v 03 2 2 iR2 06 The Tarjan Algorithm: An Example III 

  14. 01 02 03 04 05 06 07 Equations Unknowns U0 03 09 07 05 06 02 01 04 11 10 12 08 1:U0 = f(t) 2:v2 = uC 3:uR2 = uC 4:uL = U0 5:v1 = U0 6:iR2 = uR2 / R2 7:uR1 = v1 – v2 8:iR1 = uR1 / R1 9:iC = iR1 – iR2 10:i0 = iL + iR1 11:diL/dt = uL / L1 12:duC/dt = iC / C1 i0 uL diL/dt v1 uR1 iR1 v2 iC duC/dt 12 11 10 09 08 uR2 iR2 The Tarjan Algorithm: An Example IV 

  15. 1:U0 = f(t) 2:v2 = uC 3:uR2 = uC 4:uL = U0 5:v1 = U0 6:iR2 = uR2 / R2 7:uR1 = v1 – v2 8:iR1 = uR1 / R1 9:iC = iR1 – iR2 10:i0 = iL + iR1 11:diL/dt = uL / L1 12:duC/dt = iC / C1 v2 uR2 uL v1 U0 iR2 uR1 iR1 iC i0 diL 01 02 03 04 05 06 07 08 09 10 11 12 1 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 dt  The structure incidence matrix of the completely sorted equation system is brought into lower triangular form. S = duC dt The Structure Incidence Matrix II 

  16. Algebraic Loops Component equations: U0 = f(t) u3 = R3· i3 u1 = R1· i1 uL = L· diL/dt u2 = R2· i2 Node equations: i0 = i1 + iL i1 = i2 + i3 Mesh equations: U0 = u1 + u3 uL = u1 + u2 u3 = u2 The circuit contains 5 components  We require 10 equations in 10 unknowns

  17. Equations Unknowns U0 03 09 07 05 01 02 06 10 08 04 1: U0= f(t) 2: u1 = R1· i1 3: u2 = R2· i2 4: u3 = R3· i3 5: uL = L· diL/dt 6: i0 = i1 + iL 7: i1 = i2 + i3 8: U0 = u1 + u3 9: u3 = u2 10: uL = u1 + u2 i0 uL diL/dt u1 i1 u2 i2 u3 i3 Algebraic Loops: An Example 

  18. 01 Equations Unknowns 03 07 05 09 02 06 01 08 04 10 U0 1: U0= f(t) 2: u1 = R1· i1 3: u2 = R2· i2 4: u3 = R3· i3 5: uL = L· diL/dt 6: i0 = i1 + iL 7: i1 = i2 + i3 8: U0 = u1 + u3 9: u3 = u2 10: uL = u1 + u2 i0 uL diL/dt u1 i1 u2 i2 u3 i3 09 10 Algebraic Loops: An Example II 

  19. 01 Equations Unknowns 03 05 07 09 01 02 04 06 08 10 U0 1: U0= f(t) 2: u1 = R1· i1 3: u2 = R2· i2 4: u3 = R3· i3 5: uL = L· diL/dt 6: i0 = i1 + iL 7: i1 = i2 + i3 8: U0 = u1 + u3 9: u3 = u2 10: uL = u1 + u2 i0 uL diL/dt u1 i1 u2 i2 u3  i3 10 08 09 The algorithm fails as there are no longer single black lines to either equations or unknowns. Algebraic Loops: An Example III 

  20. The following heuristic may be used to find suitable tearing variables: The Tearing of Algebraic Loops Determine those equations in the digraph that contain the largest number of black lines. For each of these equations, find the unknown with the largest number of black lines emanating from it. Determine for each of these variables, how many additional equations can be causalized, when this variable is assumed known. Choose that variable as the next tearing variable that causalizes the largest number of additional equations.

  21. 01 Equations Unknowns 03 09 07 05 08 06 10 02 01 04 U0 1: U0= f(t) 2: u1 = R1· i1 3: u2 = R2· i2 4: u3 = R3· i3 5: uL = L· diL/dt 6: i0 = i1 + iL 7: i1 = i2 + i3 8: U0 = u1 + u3 9: u3 = u2 10: uL = u1 + u2 i0 uL diL/dt u1 i1 u2 02 i2 u3 i3 09 08 10 Choice Algebraic Loops: An Example IV 

  22. 01 Equations Unknowns 03 09 07 05 10 08 06 04 02 01 U0 1: U0= f(t) 2: u1 = R1· i1 3: u2 = R2· i2 4: u3 = R3· i3 5: uL = L· diL/dt 6: i0 = i1 + iL 7: i1 = i2 + i3 8: U0 = u1 + u3 9: u3 = u2 10: uL = u1 + u2 i0 uL diL/dt u1 i1 u2 03 02 i2 u3 i3 08 09 10 Choice Algebraic Loops: An Example V 

  23. 01 Equations Unknowns 03 09 07 05 06 04 08 01 02 10 U0 1: U0= f(t) 2: u1 = R1· i1 3: u2 = R2· i2 4: u3 = R3· i3 5: uL = L· diL/dt 6: i0 = i1 + iL 7: i1 = i2 + i3 8: U0 = u1 + u3 9: u3 = u2 10: uL = u1 + u2 i0 uL diL/dt u1 i1 u2 03 02 i2 u3 i3 08 09 10 Choice Algebraic Loops: An Example VI  06 07

  24. 01 Equations Unknowns 03 09 07 05 02 01 08 06 10 04 U0 1: U0= f(t) 2: u1 = R1· i1 3: u2 = R2· i2 4: u3 = R3· i3 5: uL = L· diL/dt 6: i0 = i1 + iL 7: i1 = i2 + i3 8: U0 = u1 + u3 9: u3 = u2 10: uL = u1 + u2 i0 uL diL/dt u1 i1 u2 02 03 i2 u3 i3 08 10 09 Choice Algebraic Loops: An Example VII  06 04 07

  25. 01 Equations Unknowns 03 09 07 05 01 02 04 08 10 06 U0 1: U0= f(t) 2: u1 = R1· i1 3: u2 = R2· i2 4: u3 = R3· i3 5: uL = L· diL/dt 6: i0 = i1 + iL 7: i1 = i2 + i3 8: U0 = u1 + u3 9: u3 = u2 10: uL = u1 + u2 i0 uL diL/dt u1 i1 u2 05 02 03 i2 06 04 u3 i3 07 08 09 10 Choice Algebraic Loops: An Example VIII 

  26. 01 Equations Unknowns 03 09 07 05 01 02 04 08 10 06 U0 1: U0= f(t) 2:i1 = i2 + i3 3:u1 = R1· i1 4:u3= U0 - u1 5:u2= u3 6:i2= u2 / R2 7:i3= u3 / R3 8:uL = u1 + u2 9:i0 = i1 + iL 10:diL/dt= uL / L i0 uL diL/dt u1 i1 u2 05 02 03 i2 06 04 u3 i3 07 08 09 10 Choice Algebraic Loops: An Example IX 

  27. 1: U0= f(t) 2:i1 = i2 + i3 3:u1 = R1· i1 4:u3= U0 - u1 5:u2= u3 6:i2= u2 / R2 7:i3= u3 / R3 8:uL = u1 + u2 9:i0 = i1 + iL 10:diL/dt= uL / L diL U0 i1 u1 u3 i2 i2 i3 uL i0 dt 01 02 03 04 05 06 07 08 09 10 1 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 1 1 0 0 0 1 0 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 1 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 S =  The structure incidence matrix now assumes a block lower triangular (BLT) form. u2 Choice The Structure Incidence Matrix III 

  28. The Tarjan algorithm identifies and isolates algebraic loops. It transforms the structure incidence matrix to BLT form, whereby the diagonal blocks are made as small as possible. The selection of the tearing variables is not done in a truly optimal fashion. This is not meaningful, because the optimal selection of tearing variables has been shown to be an np-complete problem. Instead, a set of heuristics is being used, which usually comes up with a small number of tearing variables, although the number may not be truly minimal. The Tarjan algorithm does not concern itself with how the resulting algebraic loops are being solved. The Solving of Algebraic Loops I

  29. 4.i1 = i2 + i3 5. U0 = u1 + u3 6.u3 = u2 1.u1 = R1· i1 2.u2 = R2· i2 3.u3 = R3· i3 1. 4. i2 i3 i1 u1 u3 u2 5. 2. 4. U0 3. Algebraic Loops 6. The Solving of Algebraic Loops II Structure diagram

  30. 4.i1 = i2 + i3 5. U0 = u1 + u3 6.u3 = u2 4.i1 = i2 + i3 5.u3= U0 - u1 6.u2 = u3 1.u1 = R1· i1 2.u2 = R2· i2 3.u3 = R3· i3 1.u1 = R1· i1 2.i2 = u2 / R2 3.i3 = u3 / R3 Equation 4.is replaced by the new equation. i1 = · U0 R2 + R3 R1 R2 + R1 R3 + R2 R3 Solution of Algebraic Loops III  i1 = i2 + i3 = u2 / R2 + u3 / R3 = u3 / R2 + u3 / R3 = ((R2 + R3 ) / (R2 · R3 )) · u3 = ((R2 + R3 ) / (R2 · R3 )) · (U0 - u1 ) = ((R2 + R3 ) / (R2 · R3 )) · (U0 - R1· i1) 

  31. The algebraic loops can be solved either analytically or numerically. If the loop equations are non-linear, a Newton iteration on the tearing variables may be optimal. If the loop equations are linear and if the set is fairly large, Newton iteration may still be the method of choice. If the loop equations are linear and if the set is of modest size, the equations can either be solved by matrix techniques or by means of explicit formulae manipulation. The Solving of Algebraic Loops IV

  32. I I I 1 2 3 i i C R i i L1 L2 v v v v 3 1 2 0 Structural Singularities: An Example I We compose a model using the currents, the Voltages and the potentials. Consequently, the mesh equations are being ignored. We have 7 circuit components plus the ground, therefore 27 + 1 = 15 equations. In addition, there are 4 nodes giving rise to another 3 equations. Therefore, we expect 18 equations in 18 unknowns. For passive components, it is customary to normalize the Voltages in the same direction as the currents. For active components (sources), the reverse is true.

  33. 1: I1 = f1(t) 2: I2 = f2(t) 3: I3 = f3(t) 4: uR = R · iR 5: uL1 = L1 · diL1 /dt 6: uL2 = L2 · diL2 /dt 7: iC = C · duC /dt 8: v0 = 0 9:u1 = v0 – v1 10:u2 = v3 – v2 11:u3 = v0 – v1 12:uR = v3 – v0 13:uL1 = v2 – v0 14:uL2 = v1 – v3 15:uC = v1 – v2 01 02 03 04 05 u2 07 06 09 10 11 12 13 14 08 15 u3 17 diL1 /dt I1 I2 I3 uR iR uL1 18 16 uL2 iC duC /dt v0 v1 v2 v3 u1 diL2 /dt 16: iC = iL1 + I2 17: iR = iL2 + I2 18: I1 + iC + iL2 + I3 = 0 Structural Singularities: An Example II 

  34. 04 03 02 01 1:I1 = f1(t) 2:I2 = f2(t) 3:I3 = f3(t) 4: uR = R · iR 5: uL1 = L1 · diL1 /dt 6:uL2 = L2 · diL2 /dt 7:iC = C · duC /dt 8:v0 = 0 9:u1 = v0 – v1 10:u2 = v3 – v2 11:u3 = v0 – v1 12:uR = v3 – v0 13:uL1 = v2 – v0 14:uL2 = v1 – v3 15:uC = v1 – v2 03 04 05 06 07 I1 08 12 11 02 13 14 15 16 09 10 17 01 I3 uR iR uL1 diL1 /dt 18 diL2 /dt iC v1 uL2 I2 v2 v3 u1 u2 u3 duC /dt v0 16: iC = iL1 + I2 17: iR = iL2 + I2 18:I1 + iC + iL2 + I3 = 0 16 15 17 13 14 18 Structural Singularities: An Example III 

  35. 04 03 02 01 1:I1 = f1(t) 2:I2 = f2(t) 3:I3 = f3(t) 4: uR = R · iR 5: uL1 = L1 · diL1 /dt 6:uL2 = L2 · diL2 /dt 7:iC = C · duC /dt 8:v0 = 0 9:u1 = v0 – v1 10:u2 = v3 – v2 11:u3 = v0 – v1 12:uR = v3 – v0 13:uL1 = v2 – v0 14:uL2 = v1 – v3 15:uC = v1 – v2 03 04 05 18 07 08 09 12 11 01 13 14 15 16 10 06 17 02 I1 uR iR uL1 I3 uL2 diL2 /dt iC duC /dt diL1 /dt v1 I2 v3 u1 u2 u3 v2 v0 16:iC = iL1 + I2 17: iR = iL2 + I2 18:I1 + iC + iL2 + I3 = 0 05 14 18 17 16 15 13 Constraint Equation All connections are blue Structural Singularities: An Example IV 

  36. As soon as a constraint equation has been found, this equation must be differentiated. In the algorithm of Pantelides, the differentiated constraint equation is added to the set of equations. Consequently, the set of equations has now one equation too many. In order to re-equalize the number of equations and unknowns, one of the integrators that is associated with the constraint equation is being eliminated. The Algorithm by Pantelides

  37. x x dx dx    dt dt unknown unknown unknown known, since this is a state variable  dx x unknown unknown The Algorithm by Pantelides II An additional unknown was created by the elimination of the integrator. x and dx are now algebraic variables, for which there must be found equations.

  38. When differentiating constraint equations, it can happen that additional new variables are being created, e.g. vdv, where v is an algebraic variable. Since v was already blue (otherwise, this would not have been a constraint equation), there already exists another equation to compute v. This equation must also be differentiated. The differentiation of additional equations continues until no additional variables are being created. The Algorithm by Pantelides III

  39. eliminated integrator dI1 + diC + diL2 + dI3 = 0 newly introduced variables The Algorithm by Pantelides : An Example 1:I1 = f1(t) 2:I2 = f2(t) 3:I3 = f3(t) 4: uR = R · iR 5: uL1 = L1 · diL1 /dt 6:uL2 = L2 · diL2 /dt 7:iC = C · duC /dt 8:v0 = 0 9:u1 = v0 – v1 10:u2 = v3 – v2 11:u3 = v0 – v1 12:uR = v3 – v0 13:uL1 = v2 – v0 14:uL2 = v1 – v3 15:uC = v1 – v2 16:iC = iL1 + I2 17: iR = iL2 + I2 18:I1 + iC + iL2 + I3 = 0

  40. 1:I1 = f1(t) 2:I2 = f2(t) 3:I3 = f3(t) 4: uR = R · iR 5: uL1 = L1 · diL1 /dt 6:uL2 = L2 · diL2 /dt 7:iC = C · duC /dt 8:v0 = 0 9:u1 = v0 – v1 10:u2 = v3 – v2 11:u3 = v0 – v1 12:uR = v3 – v0 13:uL1 = v2 – v0 14:uL2 = v1 – v3 15:uC = v1 – v2 16:iC = iL1 + I2 17: iR = iL2 + I2 18:I1 + iC + iL2 + I3 = 0 19: dI1 + diC + diL2 + dI3 = 0 The Algorithm by Pantelides : An Example II 1:I1 = f1(t) 2:I2 = f2(t) 3:I3 = f3(t) 4: uR = R · iR 5: uL1 = L1 · diL1 /dt 6: uL2 = L2 · diL2 7:iC = C · duC /dt 8:v0 = 0 9:u1 = v0 – v1 10:u2 = v3 – v2 11:u3 = v0 – v1 12:uR = v3 – v0 13:uL1 = v2 – v0 14:uL2 = v1 – v3 15:uC = v1 – v2  16:iC = iL1 + I2 17: iR = iL2 + I2 18:I1 + iC + iL2 + I3 = 0 19: dI1 + diC + diL2 + dI3 = 0

  41. 20: dI1 = df1(t)/dt 21: dI3 = df3(t)/dt 22: diC = diL1 /dt + dI2 uL1 = L1 · diL1 /dt 23: dI2 = df2(t)/dt newly introduced variable The Algorithm by Pantelides : An Example III 1:I1 = f1(t) 2:I2 = f2(t) 3:I3 = f3(t) 4: uR = R · iR 5: uL1 = L1 · diL1 /dt 6: uL2 = L2 · diL2 7:iC = C · duC /dt 8:v0 = 0 9:u1 = v0 – v1 10:u2 = v3 – v2 11:u3 = v0 – v1 12:uR = v3 – v0 13:uL1 = v2 – v0 14:uL2 = v1 – v3 15:uC = v1 – v2 16:iC = iL1 + I2 17: iR = iL2 + I2 18:I1 + iC + iL2 + I3 = 0 19: dI1 + diC + diL2 + dI3 = 0

  42. 1:I1 = f1(t) 2:I2 = f2(t) 3:I3 = f3(t) 4: uR = R · iR 5: uL1 = L1 · diL1 /dt 6: uL2 = L2 · diL2 7:iC = C · duC /dt 8:v0 = 0 9:u1 = v0 – v1 10:u2 = v3 – v2 11:u3 = v0 – v1 12:uR = v3 – v0 13:uL1 = v2 – v0 14:uL2 = v1 – v3 15:uC = v1 – v2 16:iC = iL1 + I2 17: iR = iL2 + I2 18:I1 + iC + iL2 + I3 = 0 19: dI1 + diC + diL2 + dI3 = 0 20: dI1 = df1(t)/dt 21: dI3 = df3(t)/dt 22: diC = diL1 /dt + dI2 23: dI2 = df2(t)/dt The Algorithm by Pantelides : An Example IV

  43. Higher-order models are almost invariably stiff. Stiff models require an implicit ODE solver for their simulation. Implicit ODE solvers call for an additional iteration during each integration step. Inline integration may be able to reduce the number of iteration variables by merging the solver equations with the model equations. Inline Integration

  44. Equations Unknowns U0 03 07 05 09 02 06 01 08 10 04 1: U0= f(t) 2: u1 = R1· i1 3: u2 = R2· i2 4: u3 = R3· i3 5: uL = L· diL/dt 6: i0 = i1 + iL 7: i1 = i2 + i3 8: U0 = u1 + u3 9: u3 = u2 10: uL = u1 + u2 11: iL = pre(iL) + h ·diL/dt i0 uL diL/dt u1 i1 u2 i2 u3 i3 Inline Integration: An Example  iL 11

  45. Equations Unknowns U0 03 09 05 07 01 02 04 06 08 10 1: U0= f(t) 2: u1 = R1· i1 3: u2 = R2· i2 4: u3 = R3· i3 5: uL = L· diL/dt 6: i0 = i1 + iL 7: i1 = i2 + i3 8: U0 = u1 + u3 9: u3 = u2 10: uL = u1 + u2 11: iL = pre(iL) + h ·diL/dt i0 uL diL/dt u1 i1 u2 i2 u3 i3 Inline Integration: An Example II 01 11 08 09  iL 10 11

  46. Equations Unknowns U0 03 09 05 07 01 02 04 06 08 10 1: U0= f(t) 2: u1 = R1· i1 3: u2 = R2· i2 4: u3 = R3· i3 5: uL = L· diL/dt 6: i0 = i1 + iL 7: i1 = i2 + i3 8: U0 = u1 + u3 9: u3 = u2 10: uL = u1 + u2 11: iL = pre(iL) + h ·diL/dt i0 uL diL/dt u1 i1 u2 i2 u3 i3 Inline Integration: An Example III 01 11 08 09  02 iL 10 11 Choice

  47. Equations Unknowns U0 03 09 05 07 01 02 04 06 08 10 1: U0= f(t) 2: u1 = R1· i1 3: u2 = R2· i2 4: u3 = R3· i3 5: uL = L· diL/dt 6: i0 = i1 + iL 7: i1 = i2 + i3 8: U0 = u1 + u3 9: u3 = u2 10: uL = u1 + u2 11: iL = pre(iL) + h ·diL/dt i0 uL diL/dt u1 i1 u2 i2 u3 i3 Inline Integration: An Example IV 01 11 03 08 09  05 02 04 06 07 iL 10 11 Choice

  48. DASSL would have required to use all state variables (1) plus all tearing variables (1) as iteration variables. With inline integration, we got away with a single iteration variable in this example. Determining a good (small) set of tearing variables is thus essential, as it ultimately determines the efficiency of the simulation. Dymola offers a highly sophisticated selection of heuristics to determine small sets of tearing variables. These heuristics have not been published, as the company views them as their technological edge. Inline Integration II

  49. Discontinuity handling requires special considerations during the (symbolic) translation. (Switching equations change their computational causality as a function of the switch position.) Discontinuity handling also requires special considerations during the (numerical) simulation. (Extrapolation polynomials don’t exhibit discontinuities.) Discontinuity Handling

  50. Mixed Symbolic and Numerical Processing

More Related