Skip to content

Commit bb001cb

Browse files
test(Electrical): add test for ChuaDiode
1 parent 5944672 commit bb001cb

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/Electrical/analog.jl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,3 +369,30 @@ end
369369
# savefig(plt, "test_current_$(source.name)")
370370
end
371371
end
372+
373+
@testset "ChuaCircuit" begin
374+
@parameters t
375+
@named ChuaD = ChuaDiode(Ga = -0.757576, Gb = -0.409091, Ve = 1)
376+
@named L = Inductor(L = 18, i = 0.0)
377+
@named Ro = Resistor(R = 12.5e-3)
378+
@named G = Conductor(G = 0.565)
379+
@named C1 = Capacitor(C = 10, v = 4)
380+
@named C2 = Capacitor(C = 100, v = 0.0)
381+
@named Gnd = Ground()
382+
383+
connections = [connect(L.p, G.p)
384+
connect(G.n, ChuaD.p)
385+
connect(ChuaD.n, Gnd.g)
386+
connect(C1.p, G.n)
387+
connect(L.n, Ro.p)
388+
connect(G.p, C2.p)
389+
connect(C1.n, Gnd.g)
390+
connect(C2.n, Gnd.g)
391+
connect(Ro.n, Gnd.g)]
392+
393+
@named model = ODESystem(connections, t, systems = [L, Ro, G, C1, C2, ChuaD, Gnd])
394+
sys = structural_simplify(model)
395+
prob = ODEProblem(sys, Pair[], (0, 5e4), saveat = 0.01)
396+
sol = solve(prob, Rodas4())
397+
@test sol.retcode == Success
398+
end

0 commit comments

Comments
 (0)