Skip to content

Commit ae6844e

Browse files
committed
More tests
1 parent 8978fc0 commit ae6844e

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

examples/serial_inductor.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,20 @@ eqs = [connect(source.p, resistor.p)
1414

1515
@named ll_model = ODESystem(eqs, t)
1616
ll_model = compose(ll_model, [source, resistor, inductor1, inductor2, ground])
17+
18+
@named source = ConstantVoltage(V = 10.0)
19+
@named resistor1 = Resistor(R = 1.0)
20+
@named resistor2 = Resistor(R = 1.0)
21+
@named inductor1 = Inductor(L = 1.0e-2)
22+
@named inductor2 = Inductor(L = 2.0e-2)
23+
@named ground = Ground()
24+
25+
eqs = [connect(source.p, inductor1.p)
26+
connect(inductor1.n, resistor1.p)
27+
connect(inductor1.n, resistor2.p)
28+
connect(resistor1.n, resistor2.n)
29+
connect(resistor2.n, inductor2.p)
30+
connect(source.n, inductor2.n)
31+
connect(inductor2.n, ground.g)]
32+
@named ll2_model = ODESystem(eqs, t)
33+
ll2_model = compose(ll2_model, [source, resistor1, resistor2, inductor1, inductor2, ground])

test/components.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@ u0 = states(sys) .=> 0
159159
prob = DAEProblem(sys, Differential(t).(states(sys)) .=> 0, u0, (0, 0.5))
160160
@test_nowarn sol = solve(prob, DFBDF())
161161

162+
sys2 = structural_simplify(ll2_model)
163+
@test length(equations(sys2)) == 3
164+
u0 = states(sys) .=> 0
165+
prob = ODEProblem(sys, u0, (0, 10.0))
166+
@test_nowarn sol = solve(prob, FBDF())
167+
162168
@variables t x1(t) x2(t) x3(t) x4(t)
163169
D = Differential(t)
164170
@named sys1_inner = ODESystem([D(x1) ~ x1], t)

0 commit comments

Comments
 (0)