Skip to content

Commit 6033e91

Browse files
authored
Fixes to test suite (#174)
1 parent 102c6f0 commit 6033e91

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ julia = "1.6"
1818
[extras]
1919
ControlSystemsBase = "aaaaaaaa-a6ca-5380-bf3e-84a91bcd477e"
2020
DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0"
21+
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
2122
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
2223
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
2324
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2425

2526
[targets]
26-
test = ["OrdinaryDiffEq", "SafeTestsets", "Test", "ControlSystemsBase", "DataInterpolations"]
27+
test = ["LinearAlgebra", "OrdinaryDiffEq", "SafeTestsets", "Test", "ControlSystemsBase", "DataInterpolations"]

test/Blocks/test_analysis_points.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ sys_outer = ODESystem(eqs, t, systems = [F, sys_inner, r], name = :outer)
129129

130130
# test first that the structural_simplify works correctly
131131
ssys = structural_simplify(sys_outer)
132-
prob = ODEProblem(ssys, [P.x => 1], (0, 10))
132+
prob = ODEProblem(ssys, Pair[], (0, 10))
133133
# sol = solve(prob, Rodas5())
134134
# plot(sol)
135135

@@ -148,7 +148,7 @@ lsyso = sminreal(ss(matrices_So...))
148148
## A more complicated test case
149149
using ModelingToolkit, OrdinaryDiffEq, LinearAlgebra
150150
using ModelingToolkitStandardLibrary.Mechanical.Rotational
151-
using ModelingToolkitStandardLibrary.Blocks: t, Sine, PID, SecondOrder, Step, RealOutput
151+
using ModelingToolkitStandardLibrary.Blocks: Sine, PID, SecondOrder, Step, RealOutput
152152
using ModelingToolkit: connect
153153
# Parameters
154154
m1 = 1

test/Electrical/analog.jl

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ end
189189
sol = solve(prob, Tsit5())
190190
y(x, st) = (x .> st) .* abs.(collect(x) .- st)
191191
@test sol.retcode == Success
192-
@test sum(reduce(vcat, sol.u) .- y(sol.t, start_time))0 atol=1e-2
192+
@test sum(reduce(vcat, sol[capacitor.v]) .- y(sol.t, start_time))0 atol=1e-2
193193
end
194194

195195
@testset "Integrator" begin
@@ -201,19 +201,28 @@ end
201201
@named R2 = Resistor(R = 100 * R)
202202
@named C1 = Capacitor(C = 1 / (2 * pi * f * R))
203203
@named opamp = IdealOpAmp()
204-
@named square = Square(amplitude = Vin)
204+
@named square_source = Square(amplitude = Vin)
205205
@named voltage = Voltage()
206206
@named sensor = VoltageSensor()
207207

208-
connections = [connect(square.output, voltage.V)
208+
connections = [connect(square_source.output, voltage.V)
209209
connect(voltage.p, R1.p)
210210
connect(R1.n, C1.n, R2.p, opamp.n1)
211211
connect(opamp.p2, C1.p, R2.n)
212212
connect(opamp.p1, ground.g, opamp.n2, voltage.n)
213213
connect(opamp.p2, sensor.p)
214214
connect(sensor.n, ground.g)]
215215
@named model = ODESystem(connections, t,
216-
systems = [R1, R2, opamp, square, voltage, C1, ground, sensor])
216+
systems = [
217+
R1,
218+
R2,
219+
opamp,
220+
square_source,
221+
voltage,
222+
C1,
223+
ground,
224+
sensor,
225+
])
217226
sys = structural_simplify(model)
218227
u0 = [C1.v => 0.0
219228
R1.v => 0.0]

0 commit comments

Comments
 (0)