Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 0 additions & 95 deletions examples/electrical_components.jl

This file was deleted.

17 changes: 0 additions & 17 deletions examples/rc_model.jl

This file was deleted.

33 changes: 0 additions & 33 deletions examples/serial_inductor.jl

This file was deleted.

26 changes: 26 additions & 0 deletions test/common/rc_model.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import ModelingToolkitStandardLibrary.Electrical as El
import ModelingToolkitStandardLibrary.Blocks as Bl

@mtkmodel RCModel begin
@parameters begin
R = 1.0
C = 1.0
V = 1.0
end
@components begin
resistor = El.Resistor(R = R)
capacitor = El.Capacitor(C = C)
shape = Bl.Constant(k = V)
source = El.Voltage()
ground = El.Ground()
end
@equations begin
connect(shape.output, source.V)
connect(source.p, resistor.p)
connect(resistor.n, capacitor.p)
connect(capacitor.n, source.n)
connect(capacitor.n, ground.g)
end
end

@named rc_model = RCModel()
47 changes: 47 additions & 0 deletions test/common/serial_inductor.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import ModelingToolkitStandardLibrary.Electrical as El
import ModelingToolkitStandardLibrary.Blocks as Bl

@mtkmodel LLModel begin
@components begin
shape = Bl.Constant(k = 10.0)
source = El.Voltage()
resistor = El.Resistor(R = 1.0)
inductor1 = El.Inductor(L = 1.0e-2)
inductor2 = El.Inductor(L = 2.0e-2)
ground = El.Ground()
end
@equations begin
connect(shape.output, source.V)
connect(source.p, resistor.p)
connect(resistor.n, inductor1.p)
connect(inductor1.n, inductor2.p)
connect(source.n, inductor2.n)
connect(inductor2.n, ground.g)
end
end

@named ll_model = LLModel()

@mtkmodel LL2Model begin
@components begin
shape = Bl.Constant(k = 10.0)
source = El.Voltage()
resistor1 = El.Resistor(R = 1.0)
resistor2 = El.Resistor(R = 1.0)
inductor1 = El.Inductor(L = 1.0e-2)
inductor2 = El.Inductor(L = 2.0e-2)
ground = El.Ground()
end
@equations begin
connect(shape.output, source.V)
connect(source.p, inductor1.p)
connect(inductor1.n, resistor1.p)
connect(inductor1.n, resistor2.p)
connect(resistor1.n, resistor2.n)
connect(resistor2.n, inductor2.p)
connect(source.n, inductor2.n)
connect(inductor2.n, ground.g)
end
end

@named ll2_model = LL2Model()
Loading
Loading