File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -302,3 +302,25 @@ ss = alias_elimination(sys)
302
302
@test length (equations (ss)) == length (states (ss)) == 1
303
303
ss = structural_simplify (sys)
304
304
@test length (equations (ss)) == length (states (ss)) == 2
305
+
306
+ @variables t
307
+ vars = @variables x (t) y (t) k (t) z (t) zₜ (t) ddx (t)
308
+ D = Differential (t)
309
+ eqs = [D (D (x)) ~ ddx
310
+ ddx ~ y
311
+ D (x) ~ z
312
+ D (z) ~ zₜ
313
+ D (zₜ) ~ sin (t)
314
+ D (x) ~ D (k)
315
+ D (D (D (x))) ~ sin (t)]
316
+ @named sys = ODESystem (eqs, t, vars, [])
317
+ state = TearingState (sys);
318
+ ag, mm, complete_ag, complete_mm = ModelingToolkit. alias_eliminate_graph! (state)
319
+ fullvars = state. fullvars
320
+ aliases = []
321
+ for (v, (c, a)) in complete_ag
322
+ push! (aliases, fullvars[v] => c == 0 ? 0 : c * fullvars[a])
323
+ end
324
+ ref_aliases = [D (k) => D (x); z => D (x); D (z) => D (D (x)); zₜ => D (D (x)); ddx => D (D (x));
325
+ y => D (D (x)); D (zₜ) => D (D (D (x)))]
326
+ @test Set (aliases) == Set (ref_aliases)
You can’t perform that action at this time.
0 commit comments