Skip to content

Commit 4c909e3

Browse files
test: exercise SISO initialization through ODEProblem
The standalone initialization problem represents an intermediate system, so it can lose defaults or observed variables from the original ODE system. Construct the ODE problem and assert the same initialized values through its public indexing API. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
1 parent d698064 commit 4c909e3

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

test/utils.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using ModelingToolkitStandardLibrary.Blocks
22
using SciCompDSL
33
using ModelingToolkit
4-
using OrdinaryDiffEq
4+
using SciMLBase: ODEProblem
55
using ModelingToolkit: t_nounits as t, D_nounits as D
66
using Symbolics
77

@@ -34,11 +34,10 @@ end
3434
@named iosys = System(connect(c.output, so.input), t, systems = [so, c])
3535
sys = mtkcompile(iosys)
3636

37-
initprob = ModelingToolkit.InitializationProblem(sys, 0.0)
38-
initsol = solve(initprob)
37+
prob = ODEProblem(sys, Dict{Any, Any}(), (0.0, 1.0))
3938

40-
@test initsol[sys.so.xd] == 1.0
41-
@test initsol[sys.so.u] == 1.0
39+
@test prob[sys.so.xd] == 1.0
40+
@test prob[sys.so.u] == 1.0
4241
end
4342

4443
@test_deprecated RealInput(; name = :a, u_start = 1.0)

0 commit comments

Comments
 (0)