@@ -33,4 +33,31 @@ pendulum = ODESystem(eqs, t, [x, y, w, z, T], [L, g], name=:pendulum)
3333edges, vars, vars_asso = sys2bigraph (pendulum)
3434@test ModelingToolkit. matching (edges, length (vars), vars_asso .== 0 ) == [0 , 0 , 0 , 0 , 1 , 2 , 3 , 4 , 0 ]
3535
36- @test ModelingToolkit. pantelides (pendulum) == ([0 , 0 , 0 , 0 , 1 , 2 , 3 , 8 , 4 , 7 , 9 ], [5 , 6 , 7 , 8 , 10 , 11 , 0 , 0 , 0 , 0 , 0 ], [7 , 8 , 0 , 0 , 6 , 9 , 0 , 0 , 0 ])
36+ edges, assign, vars_asso, eqs_asso = ModelingToolkit. pantelides (pendulum)
37+
38+ @test edges == [
39+ [5 , 3 ], # 1
40+ [6 , 4 ], # 2
41+ [7 , 9 , 1 ], # 3
42+ [8 , 9 , 2 ], # 4
43+ [2 , 1 ], # 5
44+ [2 , 1 , 6 , 5 ], # 6
45+ [5 , 3 , 10 , 7 ], # 7
46+ [6 , 4 , 11 , 8 ], # 8
47+ [2 , 1 , 6 , 5 , 11 , 10 ], # 9
48+ ]
49+ # [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
50+ # [x, y, w, z, x', y', w', z', T, x'', y'']
51+ @test vars_asso == [5 , 6 , 7 , 8 , 10 , 11 , 0 , 0 , 0 , 0 , 0 ]
52+ # 1: D(x) ~ w
53+ # 2: D(y) ~ z
54+ # 3: D(w) ~ T*x
55+ # 4: D(z) ~ T*y - g
56+ # 5: 0 ~ x^2 + y^2 - L^2
57+ # ----
58+ # 6: D(5) -> 0 ~ 2xx'+ 2yy'
59+ # 7: D(1) -> D(D(x)) ~ D(w)
60+ # 8: D(2) -> D(D(y)) ~ D(z)
61+ # 9: D(6) -> 0 ~ 2xx'' + 2x'x' + 2yy'' + 2y'y'
62+ # [1, 2, 3, 4, 5, 6, 7, 8, 9]
63+ @test eqs_asso == [7 , 8 , 0 , 0 , 6 , 9 , 0 , 0 , 0 ]
0 commit comments