Skip to content

Commit b521932

Browse files
Merge pull request #3592 from AayushSabharwal/as/remove-examples
test: remove reliance on old `examples/` models
2 parents 7e75d00 + a70c525 commit b521932

File tree

11 files changed

+299
-399
lines changed

11 files changed

+299
-399
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Libdl = "1"
123123
LinearAlgebra = "1"
124124
Logging = "1"
125125
MLStyle = "0.4.17"
126-
ModelingToolkitStandardLibrary = "2.19"
126+
ModelingToolkitStandardLibrary = "2.20"
127127
Moshi = "0.3"
128128
NaNMath = "0.3, 1"
129129
NonlinearSolve = "4.3"

examples/electrical_components.jl

Lines changed: 0 additions & 95 deletions
This file was deleted.

examples/rc_model.jl

Lines changed: 0 additions & 17 deletions
This file was deleted.

examples/serial_inductor.jl

Lines changed: 0 additions & 33 deletions
This file was deleted.

test/common/rc_model.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import ModelingToolkitStandardLibrary.Electrical as El
2+
import ModelingToolkitStandardLibrary.Blocks as Bl
3+
4+
@mtkmodel RCModel begin
5+
@parameters begin
6+
R = 1.0
7+
C = 1.0
8+
V = 1.0
9+
end
10+
@components begin
11+
resistor = El.Resistor(R = R)
12+
capacitor = El.Capacitor(C = C)
13+
shape = Bl.Constant(k = V)
14+
source = El.Voltage()
15+
ground = El.Ground()
16+
end
17+
@equations begin
18+
connect(shape.output, source.V)
19+
connect(source.p, resistor.p)
20+
connect(resistor.n, capacitor.p)
21+
connect(capacitor.n, source.n)
22+
connect(capacitor.n, ground.g)
23+
end
24+
end
25+
26+
@named rc_model = RCModel()

test/common/serial_inductor.jl

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import ModelingToolkitStandardLibrary.Electrical as El
2+
import ModelingToolkitStandardLibrary.Blocks as Bl
3+
4+
@mtkmodel LLModel begin
5+
@components begin
6+
shape = Bl.Constant(k = 10.0)
7+
source = El.Voltage()
8+
resistor = El.Resistor(R = 1.0)
9+
inductor1 = El.Inductor(L = 1.0e-2)
10+
inductor2 = El.Inductor(L = 2.0e-2)
11+
ground = El.Ground()
12+
end
13+
@equations begin
14+
connect(shape.output, source.V)
15+
connect(source.p, resistor.p)
16+
connect(resistor.n, inductor1.p)
17+
connect(inductor1.n, inductor2.p)
18+
connect(source.n, inductor2.n)
19+
connect(inductor2.n, ground.g)
20+
end
21+
end
22+
23+
@named ll_model = LLModel()
24+
25+
@mtkmodel LL2Model begin
26+
@components begin
27+
shape = Bl.Constant(k = 10.0)
28+
source = El.Voltage()
29+
resistor1 = El.Resistor(R = 1.0)
30+
resistor2 = El.Resistor(R = 1.0)
31+
inductor1 = El.Inductor(L = 1.0e-2)
32+
inductor2 = El.Inductor(L = 2.0e-2)
33+
ground = El.Ground()
34+
end
35+
@equations begin
36+
connect(shape.output, source.V)
37+
connect(source.p, inductor1.p)
38+
connect(inductor1.n, resistor1.p)
39+
connect(inductor1.n, resistor2.p)
40+
connect(resistor1.n, resistor2.n)
41+
connect(resistor2.n, inductor2.p)
42+
connect(source.n, inductor2.n)
43+
connect(inductor2.n, ground.g)
44+
end
45+
end
46+
47+
@named ll2_model = LL2Model()

0 commit comments

Comments
 (0)