people.inf.ethz.ch · numerical simulation of dynamic systems: hw9 - solution homework 9 - solution...
TRANSCRIPT
![Page 1: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/1.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Numerical Simulation of Dynamic Systems: Hw9- Solution
Prof. Dr. Francois E. CellierDepartment of Computer Science
ETH Zurich
May 7, 2013
![Page 2: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/2.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting
Given the electrical circuit:
![Page 3: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/3.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting
Given the electrical circuit:
R=100
R1
C=1
e-6
C
R=100
R2
R=2
0
R3
L=0.01
L
u0=10
i4 = 4�u3
u1
i1 i2
u2
u3
i3iC u4
i4
iL
uL
u0
i0
i4
![Page 4: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/4.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting
Given the electrical circuit:
R=100
R1
C=1
e-6
C
R=100
R2
R=2
0
R3
L=0.01
L
u0=10
i4 = 4�u3
u1
i1 i2
u2
u3
i3iC u4
i4
iL
uL
u0
i0
i4
� The circuit contains aconstant voltage source, u0,and a dependent currentsource, i4, that depends onthe voltage across thecapacitor, C , and theresistor, R3.
![Page 5: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/5.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting
Given the electrical circuit:
R=100
R1
C=1
e-6
C
R=100
R2
R=2
0
R3
L=0.01
L
u0=10
i4 = 4�u3
u1
i1 i2
u2
u3
i3iC u4
i4
iL
uL
u0
i0
i4
� The circuit contains aconstant voltage source, u0,and a dependent currentsource, i4, that depends onthe voltage across thecapacitor, C , and theresistor, R3.
� Write down the elementequations for the sevencircuit elements. Since thevoltage u3 is common totwo circuit elements, theseequations contain 13 ratherthan 14 unknowns. Add thevoltage equations for thethree meshes and thecurrent equations for threeof the four nodes.
![Page 6: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/6.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting II
� Draw the structure digraph of the DAE system, and apply the Tarjan algorithmto sort the equations both horizontally and vertically. Write down the causalequations, i.e., the resulting ODE system.
![Page 7: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/7.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting II
� Draw the structure digraph of the DAE system, and apply the Tarjan algorithmto sort the equations both horizontally and vertically. Write down the causalequations, i.e., the resulting ODE system.
� Simulate the ODE system across 50 µsec using RKF4/5 with Gustaffssonstep-size control and with zero initial conditions on both the capacitor and theinductor.
![Page 8: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/8.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting II
� Draw the structure digraph of the DAE system, and apply the Tarjan algorithmto sort the equations both horizontally and vertically. Write down the causalequations, i.e., the resulting ODE system.
� Simulate the ODE system across 50 µsec using RKF4/5 with Gustaffssonstep-size control and with zero initial conditions on both the capacitor and theinductor.
� Plot the voltage u3 and the current iC , and the step size h on three separatesubplots as functions of time.
![Page 9: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/9.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting III
R=100
R1C
=1e-
6
C
R=100
R2
R=2
0
R3
L=0.01
L
u0=10
i4 = 4�u3
u1
i1 i2
u2
u3
i3iC u4
i4
iL
uL
u0
i0
i4
![Page 10: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/10.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting III
R=100
R1C
=1e-
6
C
R=100
R2
R=2
0
R3
L=0.01
L
u0=10
i4 = 4�u3
u1
i1 i2
u2
u3
i3iC u4
i4
iL
uL
u0
i0
i4
1: u0 = 102: u1 = R1 · i13: u2 = R2 · i24: u3 = R3 · i35: iC = C · du3
dt
6: uL = L · diLdt
7: i4 = 4 · u3
8: u0 = u1 + u3
9: uL = u1 + u2
10: u2 = u3 + u4
11: i0 = i1 + iL12: i1 = i2 + iC + i313: i4 = i2 + iL
![Page 11: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/11.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting IV
1: u0 = 102: u1 = R1 · i13: u2 = R2 · i24: u3 = R3 · i35: iC = C · du3
dt
6: uL = L · diLdt
7: i4 = 4 · u3
8: u0 = u1 + u3
9: uL = u1 + u2
10: u2 = u3 + u4
11: i0 = i1 + iL12: i1 = i2 + iC + i313: i4 = i2 + iL
![Page 12: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/12.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting IV
1: u0 = 102: u1 = R1 · i13: u2 = R2 · i24: u3 = R3 · i35: iC = C · du3
dt
6: uL = L · diLdt
7: i4 = 4 · u3
8: u0 = u1 + u3
9: uL = u1 + u2
10: u2 = u3 + u4
11: i0 = i1 + iL12: i1 = i2 + iC + i313: i4 = i2 + iL
Eq.(1)
Eq.(2)
Eq.(3)
Eq.(4)
Eq.(5)
Eq.(6)
Eq.(7)
Eq.(8)
Eq.(9)
Eq.(10)
Eq.(11)
Eq.(12)
Eq.(13)
u0
i0
i1
u2
i3
iC
uL
diL/dt
du3/dt
i4
i2
u4
u1
![Page 13: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/13.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting V
Eq.(1)
Eq.(2)
Eq.(3)
Eq.(4)
Eq.(5)
Eq.(6)
Eq.(7)
Eq.(8)
Eq.(9)
Eq.(10)
Eq.(11)
Eq.(12)
Eq.(13)
u0
i0
i1
u2
i3
iC
uL
diL/dt
du3/dt
i4
i2
u4
u1
![Page 14: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/14.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting V
Eq.(1)
Eq.(2)
Eq.(3)
Eq.(4)
Eq.(5)
Eq.(6)
Eq.(7)
Eq.(8)
Eq.(9)
Eq.(10)
Eq.(11)
Eq.(12)
Eq.(13)
u0
i0
i1
u2
i3
iC
uL
diL/dt
du3/dt
i4
i2
u4
u1
Eq.(1)
Eq.( )
Eq.( )
Eq.(2)
Eq.( )
Eq.( )
Eq.(3)
Eq.( )
Eq.( )
Eq.( )
Eq.( )
Eq.( )
Eq.( )
u0
i0
i1
u2
i3
iC
uL
diL/dt
du3/dt
i4
i2
u4
u1
![Page 15: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/15.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting VI
Eq.(1)
Eq.( )
Eq.( )
Eq.(2)
Eq.( )
Eq.( )
Eq.(3)
Eq.( )
Eq.( )
Eq.( )
Eq.( )
Eq.( )
Eq.( )
u0
i0
i1
u2
i3
iC
uL
diL/dt
du3/dt
i4
i2
u4
u1
![Page 16: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/16.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting VI
Eq.(1)
Eq.( )
Eq.( )
Eq.(2)
Eq.( )
Eq.( )
Eq.(3)
Eq.( )
Eq.( )
Eq.( )
Eq.( )
Eq.( )
Eq.( )
u0
i0
i1
u2
i3
iC
uL
diL/dt
du3/dt
i4
i2
u4
u1
Eq.(1)
Eq.( )
Eq.( )
Eq.(2)
Eq.(10)
Eq.(11)
Eq.(3)
Eq.( )
Eq.( )
Eq.(12)
Eq.(13)
Eq.( )
Eq.( )
u0
i0
i1
u2
i3
iC
uL
diL/dt
du3/dt
i4
i2
u4
u1
![Page 17: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/17.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical SortingVII
Eq.(1)
Eq.( )
Eq.( )
Eq.(2)
Eq.(10)
Eq.(11)
Eq.(3)
Eq.( )
Eq.( )
Eq.(12)
Eq.(13)
Eq.( )
Eq.( )
u0
i0
i1
u2
i3
iC
uL
diL/dt
du3/dt
i4
i2
u4
u1
![Page 18: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/18.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical SortingVII
Eq.(1)
Eq.( )
Eq.( )
Eq.(2)
Eq.(10)
Eq.(11)
Eq.(3)
Eq.( )
Eq.( )
Eq.(12)
Eq.(13)
Eq.( )
Eq.( )
u0
i0
i1
u2
i3
iC
uL
diL/dt
du3/dt
i4
i2
u4
u1
Eq.(1)
Eq.( )
Eq.( )
Eq.(2)
Eq.(10)
Eq.(11)
Eq.(3)
Eq.(4)
Eq.( )
Eq.(12)
Eq.(13)
Eq.( )
Eq.(5)
u0
i0
i1
u2
i3
iC
uL
diL/dt
du3/dt
i4
i2
u4
u1
![Page 19: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/19.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical SortingVIII
Eq.(1)
Eq.( )
Eq.( )
Eq.(2)
Eq.(10)
Eq.(11)
Eq.(3)
Eq.(4)
Eq.( )
Eq.(12)
Eq.(13)
Eq.( )
Eq.(5)
u0
i0
i1
u2
i3
iC
uL
diL/dt
du3/dt
i4
i2
u4
u1
![Page 20: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/20.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical SortingVIII
Eq.(1)
Eq.( )
Eq.( )
Eq.(2)
Eq.(10)
Eq.(11)
Eq.(3)
Eq.(4)
Eq.( )
Eq.(12)
Eq.(13)
Eq.( )
Eq.(5)
u0
i0
i1
u2
i3
iC
uL
diL/dt
du3/dt
i4
i2
u4
u1
Eq.(1)
Eq.( )
Eq.( )
Eq.(2)
Eq.(10)
Eq.(11)
Eq.(3)
Eq.(4)
Eq.(8)
Eq.(12)
Eq.(13)
Eq.(9)
Eq.(5)
u0
i0
i1
u2
i3
iC
uL
diL/dt
du3/dt
i4
i2
u4
u1
![Page 21: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/21.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting IX
Eq.(1)
Eq.( )
Eq.( )
Eq.(2)
Eq.(10)
Eq.(11)
Eq.(3)
Eq.(4)
Eq.(8)
Eq.(12)
Eq.(13)
Eq.(9)
Eq.(5)
u0
i0
i1
u2
i3
iC
uL
diL/dt
du3/dt
i4
i2
u4
u1
![Page 22: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/22.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting IX
Eq.(1)
Eq.( )
Eq.( )
Eq.(2)
Eq.(10)
Eq.(11)
Eq.(3)
Eq.(4)
Eq.(8)
Eq.(12)
Eq.(13)
Eq.(9)
Eq.(5)
u0
i0
i1
u2
i3
iC
uL
diL/dt
du3/dt
i4
i2
u4
u1
Eq.(1)
Eq.(6)
Eq.(7)
Eq.(2)
Eq.(10)
Eq.(11)
Eq.(3)
Eq.(4)
Eq.(8)
Eq.(12)
Eq.(13)
Eq.(9)
Eq.(5)
u0
i0
i1
u2
i3
iC
uL
diL/dt
du3/dt
i4
i2
u4
u1
![Page 23: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/23.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting X
Eq.(1)
Eq.(6)
Eq.(7)
Eq.(2)
Eq.(10)
Eq.(11)
Eq.(3)
Eq.(4)
Eq.(8)
Eq.(12)
Eq.(13)
Eq.(9)
Eq.(5)
u0
i0
i1
u2
i3
iC
uL
diL/dt
du3/dt
i4
i2
u4
u1
![Page 24: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/24.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting X
Eq.(1)
Eq.(6)
Eq.(7)
Eq.(2)
Eq.(10)
Eq.(11)
Eq.(3)
Eq.(4)
Eq.(8)
Eq.(12)
Eq.(13)
Eq.(9)
Eq.(5)
u0
i0
i1
u2
i3
iC
uL
diL/dt
du3/dt
i4
i2
u4
u1
1: u0 = 106: u1 = R1 · i17: u2 = R2 · i22: u3 = R3 · i310: iC = C · du3
dt
11: uL = L · diLdt
3: i4 = 4 · u3
4: u0 = u1 + u3
8: uL = u1 + u2
12: u2 = u3 + u4
13: i0 = i1 + iL9: i1 = i2 + iC + i35: i4 = i2 + iL
![Page 25: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/25.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting XI
1: u0 = 106: u1 = R1 · i17: u2 = R2 · i22: u3 = R3 · i310: iC = C · du3
dt
11: uL = L · diLdt
3: i4 = 4 · u3
4: u0 = u1 + u3
8: uL = u1 + u2
12: u2 = u3 + u4
13: i0 = i1 + iL9: i1 = i2 + iC + i35: i4 = i2 + iL
![Page 26: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/26.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical Sorting XI
1: u0 = 106: u1 = R1 · i17: u2 = R2 · i22: u3 = R3 · i310: iC = C · du3
dt
11: uL = L · diLdt
3: i4 = 4 · u3
4: u0 = u1 + u3
8: uL = u1 + u2
12: u2 = u3 + u4
13: i0 = i1 + iL9: i1 = i2 + iC + i35: i4 = i2 + iL
1: u0 = 102: i3 = 1
R3· u3
3: i4 = 4 · u3
4: u1 = u0 − u3
5: i2 = i4 − iL6: i1 = 1
R1· u1
7: u2 = R2 · i28: uL = u1 + u2
9: iC = i1 − i2 − i310: du3
dt= 1
C· iC
11: diLdt
= 1L· uL
12: u4 = u2 − u3
13: i0 = i1 + iL
![Page 27: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/27.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical SortingXII
The model and output equations can be coded as follows:
function [xdot] = st eq2(x, t)R1 = 100; R2 = 100; R3 = 30;C = 1e − 6; L = 0.01;%u3 = x(1); iL = x(2);%u0 = 10;i3 = u3/R3;i4 = 4 ∗ u3;u1 = u0 − u3;i2 = i4 − iL;i1 = u1/R1;u2 = R2 ∗ i2;uL = u1 + u2;iC = i1 − i2 − i3;du3 = iC/C ;diL = uL/L;u4 = u2 − u3;i0 = i1 + iL;%xdot = zeros(2, 1);xdot(1) = du3; xdot(2) = diL;%return
![Page 28: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/28.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical SortingXII
The model and output equations can be coded as follows:
function [xdot] = st eq2(x, t)R1 = 100; R2 = 100; R3 = 30;C = 1e − 6; L = 0.01;%u3 = x(1); iL = x(2);%u0 = 10;i3 = u3/R3;i4 = 4 ∗ u3;u1 = u0 − u3;i2 = i4 − iL;i1 = u1/R1;u2 = R2 ∗ i2;uL = u1 + u2;iC = i1 − i2 − i3;du3 = iC/C ;diL = uL/L;u4 = u2 − u3;i0 = i1 + iL;%xdot = zeros(2, 1);xdot(1) = du3; xdot(2) = diL;%return
function [y] = out eq2(x, t)R1 = 100; R2 = 100; R3 = 30;C = 1e − 6; L = 0.01;%u3 = x(1); iL = x(2);%u0 = 10;i3 = u3/R3;i4 = 4 ∗ u3;u1 = u0 − u3;i2 = i4 − iL;i1 = u1/R1;u2 = R2 ∗ i2;uL = u1 + u2;iC = i1 − i2 − i3;du3 = iC/C ;diL = uL/L;u4 = u2 − u3;i0 = i1 + iL;%y = zeros(2, 1);y(1) = u3; y(2) = iC ;%return
![Page 29: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/29.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical SortingXIII
The simulation loop (with Gustafsson step-size control) can be coded as follows:
while t < tf ,[x4, x5] = rkf45 step2(x, t, h);err = norm(x4 − x5,’inf’)/max([norm(x4),norm(x5), 1.0e − 10]);if err > tol,
h = (0.8 ∗ tol/err) ∧ (0.2) ∗ h;errl = 0;
elset = t + h;x = x5;y = out eq2(x, t);tvec = [tvec, t];yvec = [yvec, y];if errl > 0,
h = (0.8 ∗ tol/err) ∧ (0.06) ∗ (errl/err) ∧ (0.08) ∗ h;else
h = (0.8 ∗ tol/err) ∧ (0.2) ∗ h;endhvec = [hvec, h];errl = err ;
endend
![Page 30: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/30.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Tarjan Algorithm
[H7.1] Electrical Circuit, Horizontal and Vertical SortingXIV
0 1 2 3 4 5 6
x 10−5
0
0.02
0.04
0.06Homework [H7.1]
Time
u3
0 1 2 3 4 5 6
x 10−5
0
0.05
0.1
Time
iC
0 1 2 3 4 5 6
x 10−5
0
0.5
1
1.5x 10
−6
Time
h
![Page 31: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/31.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity
Given the circuit shown below containing three sinusoidal current sources:
![Page 32: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/32.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity
Given the circuit shown below containing three sinusoidal current sources:
u3
I3
C
R
iL2
I1
I2
u2
I2
I3
iR
uR
uC
iCu1
I1
iL1
L2 uL2
L1 uL1
![Page 33: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/33.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity
Given the circuit shown below containing three sinusoidal current sources:
u3
I3
C
R
iL2
I1
I2
u2
I2
I3
iR
uR
uC
iCu1
I1
iL1
L2 uL2
L1 uL1
� Write down the completeset of equations describingthis circuit. Draw thestructure digraph and begincausalizing the equations.Determine a constraintequation.
![Page 34: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/34.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity
Given the circuit shown below containing three sinusoidal current sources:
u3
I3
C
R
iL2
I1
I2
u2
I2
I3
iR
uR
uC
iCu1
I1
iL1
L2 uL2
L1 uL1
� Write down the completeset of equations describingthis circuit. Draw thestructure digraph and begincausalizing the equations.Determine a constraintequation.
� Apply the Pantelidesalgorithm to reduce theperturbation index to 1.Then apply the tearingalgorithm with substitutionto bring the perturbationindex down to 0.
![Page 35: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/35.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity
Given the circuit shown below containing three sinusoidal current sources:
u3
I3
C
R
iL2
I1
I2
u2
I2
I3
iR
uR
uC
iCu1
I1
iL1
L2 uL2
L1 uL1
� Write down the completeset of equations describingthis circuit. Draw thestructure digraph and begincausalizing the equations.Determine a constraintequation.
� Apply the Pantelidesalgorithm to reduce theperturbation index to 1.Then apply the tearingalgorithm with substitutionto bring the perturbationindex down to 0.
� Write down the structure incidence matrices of the index-1 DAE and the index-0ODE systems, and show that they are in BLT form, and in LT form, respectively.
![Page 36: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/36.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity II
u3
I3
C
RiL2
I1
I2
u2
I2
I3
iR
uR
uC
iCu1
I1
iL1
L2 uL2
L1 uL1
![Page 37: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/37.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity II
u3
I3
C
RiL2
I1
I2
u2
I2
I3
iR
uR
uC
iCu1
I1
iL1
L2 uL2
L1 uL1
1: I1 = f1(t)2: I2 = f2(t)3: I3 = f3(t)4: uR = R · iR5: iC = C · duC
dt
6: uL1 = L1 · diL1dt
7: uL2 = L2 · diL2dt
8: u1 = uL1 + uC
9: uL1 = uR + u2
10: uL2 = u2 + uC
11: u3 = uR + uL2
12: I1 + I3 = iL1 + iR13: iL1 = I2 + iC14: iL2 = I2 + iR
![Page 38: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/38.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity III
1: I1 = f1(t)2: I2 = f2(t)3: I3 = f3(t)4: uR = R · iR5: iC = C · duC
dt
6: uL1 = L1 · diL1dt
7: uL2 = L2 · diL2dt
8: u1 = uL1 + uC
9: uL1 = uR + u2
10: uL2 = u2 + uC
11: u3 = uR + uL2
12: I1 + I3 = iL1 + iR13: iL1 = I2 + iC14: iL2 = I2 + iR
![Page 39: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/39.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity III
1: I1 = f1(t)2: I2 = f2(t)3: I3 = f3(t)4: uR = R · iR5: iC = C · duC
dt
6: uL1 = L1 · diL1dt
7: uL2 = L2 · diL2dt
8: u1 = uL1 + uC
9: uL1 = uR + u2
10: uL2 = u2 + uC
11: u3 = uR + uL2
12: I1 + I3 = iL1 + iR13: iL1 = I2 + iC14: iL2 = I2 + iR
Eq.(1)
Eq.(2)
Eq.(3)
Eq.(4)
Eq.(5)
Eq.(6)
Eq.(7)
Eq.(8)
Eq.(9)
Eq.(10)
Eq.(11)
Eq.(12)
Eq.(13)
Eq.(14)
u1
I1
I2
u3
uR
iR
uL1
diL1/dt
duC/dt
I3
iC
u2
uL2
diL2/dt
![Page 40: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/40.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity IV
I causalized as much as I could without getting into trouble:
Eq.(1)
Eq.(2)
Eq.(3)
Eq.(8)
Eq.(12)
Eq.(11)
Eq.(10)
Eq.(14)
Eq.(9)
Eq.( )
Eq.(13)
Eq.( )
Eq.(4)
Eq.( )
u1
I1
I2
u3
uR
iR
uL1
diL1/dt
duC/dt
I3
iC
u2
uL2
diL2/dt
![Page 41: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/41.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity IV
I causalized as much as I could without getting into trouble:
Eq.(1)
Eq.(2)
Eq.(3)
Eq.(8)
Eq.(12)
Eq.(11)
Eq.(10)
Eq.(14)
Eq.(9)
Eq.( )
Eq.(13)
Eq.( )
Eq.(4)
Eq.( )
u1
I1
I2
u3
uR
iR
uL1
diL1/dt
duC/dt
I3
iC
u2
uL2
diL2/dt
1: I1 = f1(t)2: I2 = f2(t)3: I3 = f3(t)8: uR = R · iR12: iC = C · duC
dt
11: uL1 = L1 · diL1dt
10: uL2 = L2 · diL2dt
14: u1 = uL1 + uC
9: uL1 = uR + u2
?: uL2 = u2 + uC
13: u3 = uR + uL2
?: I1 + I3 = iL1 + iR4: iL1 = I2 + iC?: iL2 = I2 + iR
![Page 42: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/42.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity V
Any additional causalization leads invariably to a constraint:
Eq.(1)
Eq.(2)
Eq.(3)
Eq.(8)
Eq.(12)
Eq.(11)
Eq.(10)
Eq.(14)
Eq.(9)
Eq.( )
Eq.(13)
Eq.(5)
Eq.(4)
Const.Eq.
u1
I1
I2
u3
uR
iR
uL1
diL1/dt
duC/dt
I3
iC
u2
uL2
diL2/dt
![Page 43: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/43.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity V
Any additional causalization leads invariably to a constraint:
Eq.(1)
Eq.(2)
Eq.(3)
Eq.(8)
Eq.(12)
Eq.(11)
Eq.(10)
Eq.(14)
Eq.(9)
Eq.( )
Eq.(13)
Eq.(5)
Eq.(4)
Const.Eq.
u1
I1
I2
u3
uR
iR
uL1
diL1/dt
duC/dt
I3
iC
u2
uL2
diL2/dt
1: I1 = f1(t)2: I2 = f2(t)3: I3 = f3(t)8: uR = R · iR12: iC = C · duC
dt
11: uL1 = L1 · diL1dt
10: uL2 = L2 · diL2dt
14: u1 = uL1 + uC
9: uL1 = uR + u2
?: uL2 = u2 + uC
13: u3 = uR + uL2
5: I1 + I3 = iL1 + iR4: iL1 = I2 + iCconst.eq.: iL2 = I2 + iR
![Page 44: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/44.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity VI
We differentiate the constraint equation and let go of the integrator for iL1:
1: I1 = f1(t)2: I2 = f2(t)3: I3 = f3(t)8: uR = R · iR12: iC = C · duC
dt
11: uL1 = L1 · diL1dt
10: uL2 = L2 · diL2dt
14: u1 = uL1 + uC
9: uL1 = uR + u2
?: uL2 = u2 + uC
13: u3 = uR + uL2
5: I1 + I3 = iL1 + iR4: iL1 = I2 + iCconst.eq.: iL2 = I2 + iR
![Page 45: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/45.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity VI
We differentiate the constraint equation and let go of the integrator for iL1:
1: I1 = f1(t)2: I2 = f2(t)3: I3 = f3(t)8: uR = R · iR12: iC = C · duC
dt
11: uL1 = L1 · diL1dt
10: uL2 = L2 · diL2dt
14: u1 = uL1 + uC
9: uL1 = uR + u2
?: uL2 = u2 + uC
13: u3 = uR + uL2
5: I1 + I3 = iL1 + iR4: iL1 = I2 + iCconst.eq.: iL2 = I2 + iR
1: I1 = f1(t)2: I2 = f2(t)3: I3 = f3(t)10: uR = R · iR13: iC = C · duC
dt
12: uL1 = L1 · diL1dt
?: uL2 = L2 · diL2
15: u1 = uL1 + uC
11: uL1 = uR + u2
?: uL2 = u2 + uC
14: u3 = uR + uL2
5: I1 + I3 = iL1 + iR4: iL1 = I2 + iC6: iL2 = I2 + iR?: diL2 = dI2 + diR
![Page 46: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/46.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity VII
We introduced two new pseudo-derivatives, dI2 and diR :
1: I1 = f1(t)2: I2 = f2(t)3: I3 = f3(t)10: uR = R · iR13: iC = C · duC
dt
12: uL1 = L1 · diL1dt
?: uL2 = L2 · diL2
15: u1 = uL1 + uC
11: uL1 = uR + u2
?: uL2 = u2 + uC
14: u3 = uR + uL2
5: I1 + I3 = iL1 + iR4: iL1 = I2 + iC6: iL2 = I2 + iR?: diL2 = dI2 + diR
![Page 47: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/47.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity VII
We introduced two new pseudo-derivatives, dI2 and diR :
1: I1 = f1(t)2: I2 = f2(t)3: I3 = f3(t)10: uR = R · iR13: iC = C · duC
dt
12: uL1 = L1 · diL1dt
?: uL2 = L2 · diL2
15: u1 = uL1 + uC
11: uL1 = uR + u2
?: uL2 = u2 + uC
14: u3 = uR + uL2
5: I1 + I3 = iL1 + iR4: iL1 = I2 + iC6: iL2 = I2 + iR?: diL2 = dI2 + diR
1: I1 = f1(t)2: I2 = f2(t)
7: dI2 =df2(t)
dt3: I3 = f3(t)8: uR = R · iR15: iC = C · duC
dt
?: uL1 = L1 · diL1dt
?: uL2 = L2 · diL2
17: u1 = uL1 + uC
?: uL1 = uR + u2
?: uL2 = u2 + uC
16: u3 = uR + uL2
5: I1 + I3 = iL1 + iR?: dI1 + dI3 = diL1
dt+ diR
4: iL1 = I2 + iC6: iL2 = I2 + iR?: diL2 = dI2 + diR
![Page 48: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/48.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity VIII
Two more pseudo-derivatives, dI1 and dI3:
1: I1 = f1(t)2: I2 = f2(t)
7: dI2 =df2(t)
dt3: I3 = f3(t)8: uR = R · iR15: iC = C · duC
dt
?: uL1 = L1 · diL1dt
?: uL2 = L2 · diL2
17: u1 = uL1 + uC
?: uL1 = uR + u2
?: uL2 = u2 + uC
16: u3 = uR + uL2
5: I1 + I3 = iL1 + iR?: dI1 + dI3 = diL1
dt+ diR
4: iL1 = I2 + iC6: iL2 = I2 + iR?: diL2 = dI2 + diR
![Page 49: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/49.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity VIII
Two more pseudo-derivatives, dI1 and dI3:
1: I1 = f1(t)2: I2 = f2(t)
7: dI2 =df2(t)
dt3: I3 = f3(t)8: uR = R · iR15: iC = C · duC
dt
?: uL1 = L1 · diL1dt
?: uL2 = L2 · diL2
17: u1 = uL1 + uC
?: uL1 = uR + u2
?: uL2 = u2 + uC
16: u3 = uR + uL2
5: I1 + I3 = iL1 + iR?: dI1 + dI3 = diL1
dt+ diR
4: iL1 = I2 + iC6: iL2 = I2 + iR?: diL2 = dI2 + diR
1: I1 = f1(t)
9: dI1 = df1(t)dt
2: I2 = f2(t)
7: dI2 =df2(t)
dt3: I3 = f3(t)
10: dI3 =df3(t)
dt8: uR = R · iR17: iC = C · duC
dt
?: uL1 = L1 · diL1dt
?: uL2 = L2 · diL2
19: u1 = uL1 + uC
?: uL1 = uR + u2
?: uL2 = u2 + uC
18: u3 = uR + uL2
5: I1 + I3 = iL1 + iR?: dI1 + dI3 = diL1
dt+ diR
4: iL1 = I2 + iC6: iL2 = I2 + iR?: diL2 = dI2 + diR
![Page 50: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/50.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity IX
S =
⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣
I1 I2 I3 iC iR iL2 dI2 uR dI1 dI3 uL1diL1dt
uL2 diL2 u2 diRduCdt
u3 u1
1: 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 02: 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 03: 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 04: 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 05: 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 06: 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 07: 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 08: 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 09: 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 010: 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 011: 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 012: 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 013: 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 014: 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 015: 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 1 0 0 016: 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 017: 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 018: 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 019: 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1
⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦
![Page 51: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/51.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity X
We have an algebraic loop in six equations and six unknowns:
?: uL1 = L1 · diL1dt
?: uL2 = L2 · diL2
?: uL1 = uR + u2
?: uL2 = u2 + uC
?: dI1 + dI3 = diL1dt
+ diR?: diL2 = dI2 + diR
![Page 52: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/52.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity X
We have an algebraic loop in six equations and six unknowns:
?: uL1 = L1 · diL1dt
?: uL2 = L2 · diL2
?: uL1 = uR + u2
?: uL2 = u2 + uC
?: dI1 + dI3 = diL1dt
+ diR?: diL2 = dI2 + diR
Eq.(1)
Eq.(2)
Eq.(3)
Eq.(4)
Eq.(5)
Eq.(6) diR
uL1
diL1/dt
u2
uL2
diL2
![Page 53: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/53.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity X
We have an algebraic loop in six equations and six unknowns:
?: uL1 = L1 · diL1dt
?: uL2 = L2 · diL2
?: uL1 = uR + u2
?: uL2 = u2 + uC
?: dI1 + dI3 = diL1dt
+ diR?: diL2 = dI2 + diR
Eq.(1)
Eq.(2)
Eq.(3)
Eq.(4)
Eq.(5)
Eq.(6) diR
uL1
diL1/dt
u2
uL2
diL2
Eq.(2)
Eq.(5)
Eq.(3)
Eq.(4)
Eq.(1)
Res.Eq. diR
uL1
diL1/dt
u2
uL2
diL2
![Page 54: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/54.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity X
We have an algebraic loop in six equations and six unknowns:
?: uL1 = L1 · diL1dt
?: uL2 = L2 · diL2
?: uL1 = uR + u2
?: uL2 = u2 + uC
?: dI1 + dI3 = diL1dt
+ diR?: diL2 = dI2 + diR
Eq.(1)
Eq.(2)
Eq.(3)
Eq.(4)
Eq.(5)
Eq.(6) diR
uL1
diL1/dt
u2
uL2
diL2
Eq.(2)
Eq.(5)
Eq.(3)
Eq.(4)
Eq.(1)
Res.Eq. diR
uL1
diL1/dt
u2
uL2
diL2
2: uL1 = L1 · diL1dt
5: uL2 = L2 · diL2
3: uL1 = uR + u2
4: uL2 = u2 + uC
1: dI1 + dI3 = diL1dt
+ diRres.eq.: diL2 = dI2 + diR
![Page 55: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/55.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity XI
We have an algebraic loop in six equations and six unknowns:
2: uL1 = L1 · diL1dt
5: uL2 = L2 · diL2
3: uL1 = uR + u2
4: uL2 = u2 + uC
1: dI1 + dI3 = diL1dt
+ diRres.eq.: diL2 = dI2 + diR
![Page 56: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/56.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity XI
We have an algebraic loop in six equations and six unknowns:
2: uL1 = L1 · diL1dt
5: uL2 = L2 · diL2
3: uL1 = uR + u2
4: uL2 = u2 + uC
1: dI1 + dI3 = diL1dt
+ diRres.eq.: diL2 = dI2 + diR
res.eq.: diR = diL2 − dI21: diL1
dt= dI1 + dI3 − diR
2: uL1 = L1 · diL1dt
3: u2 = uL1 − uR
4: uL2 = u2 + uC
5: diL2 = 1L2
· uL2
![Page 57: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/57.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity XI
We have an algebraic loop in six equations and six unknowns:
2: uL1 = L1 · diL1dt
5: uL2 = L2 · diL2
3: uL1 = uR + u2
4: uL2 = u2 + uC
1: dI1 + dI3 = diL1dt
+ diRres.eq.: diL2 = dI2 + diR
res.eq.: diR = diL2 − dI21: diL1
dt= dI1 + dI3 − diR
2: uL1 = L1 · diL1dt
3: u2 = uL1 − uR
4: uL2 = u2 + uC
5: diL2 = 1L2
· uL2
diR = diL2 − dI2
=1
L2
· uL2 − dI2
=1
L2
· u2 +1
L2
· uC − dI2
=1
L2
· uL1 − 1
L2
· uR +1
L2
· uC − dI2
=L1
L2
· diL1
dt− 1
L2
· uR +1
L2
· uC − dI2
=L1
L2
· dI1 +L1
L2
· dI3 − L1
L2
· diR − 1
L2
· uR +1
L2
· uC − dI2
![Page 58: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/58.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity XI
We have an algebraic loop in six equations and six unknowns:
2: uL1 = L1 · diL1dt
5: uL2 = L2 · diL2
3: uL1 = uR + u2
4: uL2 = u2 + uC
1: dI1 + dI3 = diL1dt
+ diRres.eq.: diL2 = dI2 + diR
res.eq.: diR = diL2 − dI21: diL1
dt= dI1 + dI3 − diR
2: uL1 = L1 · diL1dt
3: u2 = uL1 − uR
4: uL2 = u2 + uC
5: diL2 = 1L2
· uL2
diR = diL2 − dI2
=1
L2
· uL2 − dI2
=1
L2
· u2 +1
L2
· uC − dI2
=1
L2
· uL1 − 1
L2
· uR +1
L2
· uC − dI2
=L1
L2
· diL1
dt− 1
L2
· uR +1
L2
· uC − dI2
=L1
L2
· dI1 +L1
L2
· dI3 − L1
L2
· diR − 1
L2
· uR +1
L2
· uC − dI2
diR =L1 · (dI1 + dI3) − uR + uC − L2 · dI2
L1 + L2
![Page 59: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/59.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity XII
1: I1 = f1(t)2: I2 = f2(t)3: I3 = f3(t)4: iC = iL1 − I25: iR = I1 + I3 − iL1
6: iL2 = I2 + iR7: dI2 = df2(t)
dt8: uR = R · iR9: dI1 = df1(t)
dt
10: dI3 = df3(t)dt
11: diR = L1·(dI1+dI3)−uR+uC−L2·dI2L1+L2
12: diL1dt
= dI1 + dI3 − diR13: uL1 = L1 · diL1
dt14: u2 = uL1 − uR
15: uL2 = u2 + uC
16: diL2 = 1L2
· uL2
17: duCdt
= 1C· iC
18: u3 = uR + uL2
19: u1 = uL1 + uC
![Page 60: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/60.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.7] Electrical Circuit, Structural Singularity XIII
S =
⎡⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣
I1 I2 I3 iC iR iL2 dI2 uR dI1 dI3 diRdiL1dt
uL1 u2 uL2 diL2duCdt
u3 u1
1: 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 02: 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 03: 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 04: 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 05: 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 06: 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 07: 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 08: 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 09: 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 010: 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 011: 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 012: 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 013: 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 014: 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 015: 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 016: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 017: 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 018: 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 019: 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1
⎤⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦
![Page 61: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/61.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm
The following set of DAEs:
dC
dt= K1(C0 − C) − R
dT
dt= K1(T0 − T ) + K2R − K3(T − TC )
0 = R − K3 exp
(−K4
T
)C
0 = C − u
describes a chemical isomerization reaction.
![Page 62: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/62.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm
The following set of DAEs:
dC
dt= K1(C0 − C) − R
dT
dt= K1(T0 − T ) + K2R − K3(T − TC )
0 = R − K3 exp
(−K4
T
)C
0 = C − u
describes a chemical isomerization reaction.
C is the reactant concentration, T is the reactant temperature, and R is the reactantrate per unit volume. C0 is the feed reactant concentration, and T0 is the feedreactant temperature. u is the desired concentration, and TC is the controltemperature that we need to produce u.
![Page 63: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/63.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm II
� We want to turn the problem around (inverse model control) and determine thenecessary control temperature TC as a function of the desired concentration u.Thus, u will be an input to our model, and TC is the output.
![Page 64: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/64.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm II
� We want to turn the problem around (inverse model control) and determine thenecessary control temperature TC as a function of the desired concentration u.Thus, u will be an input to our model, and TC is the output.
� Draw the structure digraph. You shall notice at once that one of the equationshas no connections to it. Thus, it is a constraint equation that needs to bedifferentiated, while an integrator associated with the constraint equation needsto be thrown out.
![Page 65: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/65.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm II
� We want to turn the problem around (inverse model control) and determine thenecessary control temperature TC as a function of the desired concentration u.Thus, u will be an input to our model, and TC is the output.
� Draw the structure digraph. You shall notice at once that one of the equationshas no connections to it. Thus, it is a constraint equation that needs to bedifferentiated, while an integrator associated with the constraint equation needsto be thrown out.
� We now have five equations in five unknowns. Draw the enhanced structuredigraph, and start causalizing the equations. You shall notice that a secondconstraint equation appears. Hence the original DAE system had been anindex-3 DAE system. Differentiate that constraint equation as well, and throwout the second integrator. In the process, new pseudo-derivatives are introducedthat call for additional differentiations.
![Page 66: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/66.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm III
� This time around, you end up with eight equations in eight unknowns. Draw theonce more enhanced structure digraph, and causalize the equations. This is anexample, in which (by accident) the Pantelides algorithm reduces theperturbation index in one step from 2 to 0, i.e., the final set of equations doesnot contain an algebraic loop.
![Page 67: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/67.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm III
� This time around, you end up with eight equations in eight unknowns. Draw theonce more enhanced structure digraph, and causalize the equations. This is anexample, in which (by accident) the Pantelides algorithm reduces theperturbation index in one step from 2 to 0, i.e., the final set of equations doesnot contain an algebraic loop.
� Draw a block diagram that shows how the output TC can be computed from
the three inputs u, dudt
, and d2udt2 .
![Page 68: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/68.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm IV
The original equations are:
?: dCdt
= K1 · (C0 − C) − R
?: dTdt
= K1 · (T0 − T ) + K2 · R − K3 · (T − TC )
?: 0 = R − K3 · exp( −K4
T
)· C
const.eq.: 0 = C − u
![Page 69: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/69.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm IV
The original equations are:
?: dCdt
= K1 · (C0 − C) − R
?: dTdt
= K1 · (T0 − T ) + K2 · R − K3 · (T − TC )
?: 0 = R − K3 · exp( −K4
T
)· C
const.eq.: 0 = C − u
With the structure digraph:
Eq.( )
Eq.( )
Eq.( )
Const.Eq.
dC/dt
R
TC
dT/dt
![Page 70: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/70.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm IV
The original equations are:
?: dCdt
= K1 · (C0 − C) − R
?: dTdt
= K1 · (T0 − T ) + K2 · R − K3 · (T − TC )
?: 0 = R − K3 · exp( −K4
T
)· C
const.eq.: 0 = C − u
With the structure digraph:
Eq.( )
Eq.( )
Eq.( )
Const.Eq.
dC/dt
R
TC
dT/dt
We recognize immediately a constraint equation.
![Page 71: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/71.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm V
The enhanced equations are:
?: dC = K1 · (C0 − C) − R
?: dTdt
= K1 · (T0 − T ) + K2 · R − K3 · (T − TC )
?: 0 = R − K3 · exp( −K4
T
)· C
?: 0 = C − u
?: 0 = dC − dudt
![Page 72: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/72.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm V
The enhanced equations are:
?: dC = K1 · (C0 − C) − R
?: dTdt
= K1 · (T0 − T ) + K2 · R − K3 · (T − TC )
?: 0 = R − K3 · exp( −K4
T
)· C
?: 0 = C − u
?: 0 = dC − dudt
With the structure digraph:
Eq.( )
Eq.( )
Eq.( )
Eq.( )
dC
R
TC
dT/dt
CEq.( )
![Page 73: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/73.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm VI
We start coloring the structure digraph and recognize soon a second constraintequation:
Const.Eq.
Eq.( )
Eq.(3)
Eq.(1)
dC
R
TC
dT/dt
CEq.(2)
![Page 74: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/74.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm VI
We start coloring the structure digraph and recognize soon a second constraintequation:
Const.Eq.
Eq.( )
Eq.(3)
Eq.(1)
dC
R
TC
dT/dt
CEq.(2)
?: dC = K1 · (C0 − C) − R
?: dTdt
= K1 · (T0 − T ) + K2 · R − K3 · (T − TC )
?: 0 = R − K3 · exp( −K4
T
)· C
?: 0 = C − u
?: 0 = dC − dudt
![Page 75: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/75.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm VII
The once more enhanced equations are:
?: dC = K1 · (C0 − C) − R?: dT = K1 · (T0 − T ) + K2 · R − K3 · (T − TC )
?: 0 = R − K3 · exp( −K4
T
)· C
?: 0 = C − u
?: 0 = dC − dudt
?: d2C = K1 · ( dC0dt
− dC) − dR
?: 0 = dR − K3 · exp( −K4
T
)·[dC + K4·C ·dT
T 2
]?: 0 = d2C − d2u
dt2
![Page 76: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/76.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm VIII
Let us color the structure digraph:
Eq.( )
Eq.( )
Eq.( )
Eq.( )
Eq.( )
dC
R
TC
C
dT
T
Eq.( )
Eq.( )
Eq.( )
dR
d2C
![Page 77: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/77.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm VIII
Let us color the structure digraph:
Eq.( )
Eq.( )
Eq.( )
Eq.( )
Eq.( )
dC
R
TC
C
dT
T
Eq.( )
Eq.( )
Eq.( )
dR
d2C
Eq.(4)
Eq.(8)
Eq.(6)
Eq.(1)
Eq.(2)
dC
R
TC
C
dT
T
Eq.(5)
Eq.(7)
Eq.(3)
dR
d2C
![Page 78: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/78.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm VIII
Let us color the structure digraph:
Eq.( )
Eq.( )
Eq.( )
Eq.( )
Eq.( )
dC
R
TC
C
dT
T
Eq.( )
Eq.( )
Eq.( )
dR
d2C
Eq.(4)
Eq.(8)
Eq.(6)
Eq.(1)
Eq.(2)
dC
R
TC
C
dT
T
Eq.(5)
Eq.(7)
Eq.(3)
dR
d2C
We went from index-2 directly down to index-0. This sometimes happens.
![Page 79: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/79.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm IX
4: dC = K1 · (C0 − C) − R8: dT = K1 · (T0 − T ) + K2 · R − K3 · (T − TC )
6: 0 = R − K3 · exp( −K4
T
)· C
1: 0 = C − u
2: 0 = dC − dudt
5: d2C = K1 · ( dC0dt
− dC) − dR
7: 0 = dR − K3 · exp( −K4
T
)·[dC + K4·C·dT
T2
]3: 0 = d2C − d2u
dt2
![Page 80: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/80.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm X
1: C = u
2: dC = dudt
3: d2C = d2udt2
4: R = K1 · (C0 − C) − dC
5: dR = K1 · ( dC0dt
− dC) − d2C
6: T = −K4
log(
RK3·C
)
7: dT = T 2
K3·K4·C ·[dR · exp
(K4T
)− K3 · dC
]8: TC = dT−K1·(T0−T )−K2·R+K3·T
K3
![Page 81: people.inf.ethz.ch · Numerical Simulation of Dynamic Systems: Hw9 - Solution Homework 9 - Solution Tarjan Algorithm [H7.1] Electrical Circuit, Horizontal and Vertical Sorting Given](https://reader034.vdocuments.site/reader034/viewer/2022050523/5fa6767bff9f6b604679de42/html5/thumbnails/81.jpg)
Numerical Simulation of Dynamic Systems: Hw9 - Solution
Homework 9 - Solution
Pantelides Algorithm
[H7.8] Chemical Reactions, Pantelides Algorithm XI
ddt
ddt
ddt
u
u.
u..
.C0
C
dC
C0
T0
d2C
TR
dR
Eq.(1)
Eq.(2)
Eq.(3)
Eq.(4)
Eq.(5)
Eq.(8)Eq.(6) Eq.(7) TCdT