Skip to content

test: remove reliance on old examples/ models #3592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 3, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Libdl = "1"
LinearAlgebra = "1"
Logging = "1"
MLStyle = "0.4.17"
ModelingToolkitStandardLibrary = "2.19"
ModelingToolkitStandardLibrary = "2.20"
Moshi = "0.3"
NaNMath = "0.3, 1"
NonlinearSolve = "4.3"
Expand Down
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