Skip to content

Commit ad00fc7

Browse files
committed
Add tests
1 parent 647c0cf commit ad00fc7

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/reduction.jl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,33 @@ eqs = [
247247
]
248248
@named sys = ODESystem(eqs, t, sts, params)
249249
@test_throws ModelingToolkit.InvalidSystemException structural_simplify(sys)
250+
251+
# issue #963
252+
@parameters t
253+
D = Differential(t)
254+
@variables v47(t) v57(t) v66(t) v25(t) i74(t) i75(t) i64(t) i71(t) v1(t) v2(t)
255+
256+
eq = [
257+
v47 ~ v1
258+
v47 ~ sin(10t)
259+
v57 ~ v1 - v2
260+
v57 ~ 10.0i64
261+
v66 ~ v2
262+
v66 ~ 5.0i74
263+
v25 ~ v2
264+
i75 ~ 0.005 * D(v25)
265+
0 ~ i74 + i75 - i64
266+
0 ~ i64 + i71]
267+
268+
269+
sys0 = ODESystem(eq, t)
270+
sys = structural_simplify(sys0)
271+
@test length(equations(sys)) == 1
272+
eq = equations(sys)[1]
273+
@test isequal(eq.lhs, 0)
274+
dv25 = ModelingToolkit.value(ModelingToolkit.derivative(eq.rhs, v25))
275+
ddv25 = ModelingToolkit.value(ModelingToolkit.derivative(eq.rhs, D(v25)))
276+
dt = ModelingToolkit.value(ModelingToolkit.derivative(eq.rhs, sin(10t)))
277+
@test dv25 0.3
278+
@test ddv25 == 0.005
279+
@test dt == -0.1

0 commit comments

Comments
 (0)