@@ -5,7 +5,7 @@ using SimpleDiffEq
55using OrdinaryDiffEqSDIRK, OrdinaryDiffEqVerner, OrdinaryDiffEqTsit5, OrdinaryDiffEqFIRK
66using Ipopt
77using DataInterpolations
8- # const M = ModelingToolkit
8+ const M = ModelingToolkit
99
1010@testset " ODE Solution, no cost" begin
1111 # Test solving without anything attached.
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)
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
233233end
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 )]
0 commit comments