Skip to content

Commit eb51290

Browse files
committed
fix more tests
1 parent 4690d5b commit eb51290

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

src/structural_transformation/utils.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ function check_consistency(state::TransformationState, orig_inputs; nothrow = fa
9696
fullvars = get_fullvars(state)
9797
neqs = n_concrete_eqs(state)
9898
@unpack graph, var_to_diff = state.structure
99-
@show equations(state.sys)
10099
highest_vars = computed_highest_diff_variables(complete!(state.structure))
101100
n_highest_vars = 0
102101
for (v, h) in enumerate(highest_vars)

test/downstream/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0"
44
DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d"
55
InfiniteOpt = "20393b10-9daf-11e9-18c9-8db751c92c57"
66
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
7+
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
78
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
89
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
910
ModelingToolkitStandardLibrary = "16a59e39-deab-5bd0-87e4-056b12336739"

test/downstream/jump_control.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using SimpleDiffEq
55
using OrdinaryDiffEqSDIRK, OrdinaryDiffEqVerner, OrdinaryDiffEqTsit5, OrdinaryDiffEqFIRK
66
using Ipopt
77
using DataInterpolations
8-
#const M = ModelingToolkit
8+
const M = ModelingToolkit
99

1010
@testset "ODE Solution, no cost" begin
1111
# Test solving without anything attached.
@@ -108,7 +108,7 @@ end
108108
# Linear systems have bang-bang controls
109109
@test is_bangbang(jsol.input_sol, [-1.0], [1.0])
110110
# Test reached final position.
111-
@test (jsol.sol.u[end][1], 0.25, rtol = 1e-5)
111+
@test (jsol.sol.u[end][2], 0.25, rtol = 1e-5)
112112
# Test dynamics
113113
@parameters (u_interp::ConstantInterpolation)(..)
114114
@mtkbuild block_ode = ODESystem([D(x(t)) ~ v(t), D(v(t)) ~ u_interp(t)], t)
@@ -120,7 +120,7 @@ end
120120
iprob = InfiniteOptDynamicOptProblem(block, u0map, tspan, parammap; dt = 0.01)
121121
isol = solve(iprob, Ipopt.Optimizer; silent = true)
122122
@test is_bangbang(isol.input_sol, [-1.0], [1.0])
123-
@test (isol.sol.u[end][1], 0.25, rtol = 1e-5)
123+
@test (isol.sol.u[end][2], 0.25, rtol = 1e-5)
124124
osol = solve(oprob, ImplicitEuler(); dt = 0.01, adaptive = false)
125125
@test (isol.sol.u, osol.u, rtol = 0.05)
126126

@@ -233,6 +233,8 @@ end
233233
end
234234

235235
@testset "Cart-pole problem" begin
236+
t = M.t_nounits
237+
D = M.D_nounits
236238
# gravity, length, moment of Inertia, drag coeff
237239
@parameters g l mₚ mₖ
238240
@variables x(..) θ(..) u(t) [input = true, bounds = (-10, 10)]

test/runtests.jl

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ function activate_downstream_env()
2222
Pkg.instantiate()
2323
end
2424

25-
function activate_dynamic_optimization_env()
26-
Pkg.activate("dynamic_optimization")
27-
Pkg.develop(PackageSpec(path = dirname(@__DIR__)))
28-
Pkg.instantiate()
29-
end
30-
3125
@time begin
3226
#if GROUP == "All" || GROUP == "InterfaceI"
3327
# @testset "InterfaceI" begin
@@ -128,6 +122,7 @@ end
128122

129123
if GROUP == "All" || GROUP == "Downstream"
130124
activate_downstream_env()
125+
@safetestset "JuMP Collocation Solvers" include("downstream/jump_control.jl")
131126
@safetestset "Linearization Tests" include("downstream/linearize.jl")
132127
@safetestset "Linearization Dummy Derivative Tests" include("downstream/linearization_dd.jl")
133128
@safetestset "Inverse Models Test" include("downstream/inversemodel.jl")
@@ -149,9 +144,4 @@ end
149144
@safetestset "InfiniteOpt Extension Test" include("extensions/test_infiniteopt.jl")
150145
@safetestset "JuMPControl Extension Test" include("extensions/jump_control.jl")
151146
end
152-
153-
if GROUP == "All" || GROUP == "Dynamic Optimization"
154-
activate_dynamic_optimization_env()
155-
@safetestset "JuMP Collocation Solvers" include("dynamic_optimization/jump_control")
156-
end
157147
end

0 commit comments

Comments
 (0)