@@ -171,16 +171,6 @@ x = [rand()]
171171u = [rand ()]
172172@test f[1 ](x, u, p, 1 ) == - x + u
173173
174- @testset " Constants substitution" begin
175- @constants c = 2.0
176- @variables x (t)
177- eqs = [D (x) ~ c * x]
178- @named sys = ODESystem (eqs, t, [x], [])
179-
180- f, dvs, ps = ModelingToolkit. generate_control_function (sys, simplify = true )
181- @test f[1 ]([0.5 ], nothing , nothing , 0.0 ) == [1.0 ]
182- end
183-
184174# more complicated system
185175
186176@variables u (t) [input = true ]
@@ -401,3 +391,14 @@ matrices, ssys = linearize(augmented_sys,
401391 io_sys, [x + u * t]; inputs = [u])
402392 @test obsfn ([1.0 ], [2.0 ], nothing , 3.0 ) == [7.0 ]
403393end
394+
395+ # https://github.com/SciML/ModelingToolkit.jl/issues/2896
396+ @testset " Constants substitution" begin
397+ @constants c = 2.0
398+ @variables x (t)
399+ eqs = [D (x) ~ c * x]
400+ @named sys = ODESystem (eqs, t, [x], [])
401+
402+ f, dvs, ps = ModelingToolkit. generate_control_function (sys, simplify = true )
403+ @test f[1 ]([0.5 ], nothing , nothing , 0.0 ) == [1.0 ]
404+ end
0 commit comments