Skip to content

Commit

Permalink
move test
Browse files Browse the repository at this point in the history
  • Loading branch information
aml5600 committed Jul 29, 2024
1 parent aa1df08 commit 7a93c8d
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions test/input_output_handling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,6 @@ x = [rand()]
u = [rand()]
@test f[1](x, u, p, 1) == -x + u

@testset "Constants substitution" begin
@constants c = 2.0
@variables x(t)
eqs = [D(x) ~ c * x]
@named sys = ODESystem(eqs, t, [x], [])

f, dvs, ps = ModelingToolkit.generate_control_function(sys, simplify = true)
@test f[1]([0.5], nothing, nothing, 0.0) == [1.0]
end

# more complicated system

@variables u(t) [input = true]
Expand Down Expand Up @@ -401,3 +391,14 @@ matrices, ssys = linearize(augmented_sys,
io_sys, [x + u * t]; inputs = [u])
@test obsfn([1.0], [2.0], nothing, 3.0) == [7.0]
end

# https://github.com/SciML/ModelingToolkit.jl/issues/2896
@testset "Constants substitution" begin
@constants c = 2.0
@variables x(t)
eqs = [D(x) ~ c * x]
@named sys = ODESystem(eqs, t, [x], [])

f, dvs, ps = ModelingToolkit.generate_control_function(sys, simplify = true)
@test f[1]([0.5], nothing, nothing, 0.0) == [1.0]
end

0 comments on commit 7a93c8d

Please sign in to comment.