Skip to content

Commit d42e165

Browse files
committed
debug MHE tests
1 parent 1681caf commit d42e165

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/estimator/mhe/construct.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -890,8 +890,7 @@ function init_optimization!(
890890
)
891891
nZ̃ = length(estim.Z̃)
892892
set_silent(optim)
893-
#TODO: RE-ENABLE THIS
894-
#limit_solve_time(estim.optim, estim.model.Ts)
893+
limit_solve_time(estim.optim, estim.model.Ts)
895894
@variable(optim, Z̃var[1:nZ̃])
896895
A = estim.con.A[estim.con.i_b, :]
897896
b = estim.con.b[estim.con.i_b]
@@ -913,8 +912,7 @@ function init_optimization!(
913912
# --- variables and linear constraints ---
914913
nZ̃ = length(estim.Z̃)
915914
set_silent(optim)
916-
#TODO: RE-ENABLE THIS
917-
#limit_solve_time(estim.optim, estim.model.Ts)
915+
limit_solve_time(estim.optim, estim.model.Ts)
918916
@variable(optim, Z̃var[1:nZ̃])
919917
A = estim.con.A[con.i_b, :]
920918
b = estim.con.b[con.i_b]

test/test_state_estim.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Ts = 4.0
22
sys = [ tf(1.90,[18.0,1]) tf(1.90,[18.0,1]) tf(1.90,[18.0,1]);
33
tf(-0.74,[8.0,1]) tf(0.74,[8.0,1]) tf(-0.74,[8.0,1]) ]
4-
4+
#=
55
@testset "SteadyKalmanFilter construction" begin
66
linmodel1 = LinModel(sys,Ts,i_u=[1,2])
77
skalmanfilter1 = SteadyKalmanFilter(linmodel1)
@@ -549,7 +549,7 @@ end
549549
@test x̂ ≈ [0, 0]
550550
@test isa(x̂, Vector{Float32})
551551
end
552-
552+
=#
553553
@testset "MovingHorizonEstimator construction" begin
554554
linmodel1 = LinModel(sys,Ts,i_d=[3])
555555
f(x,u,d) = linmodel1.A*x + linmodel1.Bu*u + linmodel1.Bd*d
@@ -680,7 +680,7 @@ end
680680
mhe1 = MovingHorizonEstimator(linmodel1, He=1, nint_ym=0)
681681
setconstraint!(mhe1, x̂min=[-51,-52], x̂max=[53,54])
682682
@test all((mhe1.con.X̂min, mhe1.con.X̂max) .≈ ([-51,-52], [53,54]))
683-
@test all((mhe1.con.x̂min, mhe1.con.x̂max) .≈ ([-51,-52], [53,54]))
683+
@test all((mhe1.con.x̃min, mhe1.con.x̃max) .≈ ([-51,-52], [53,54]))
684684
setconstraint!(mhe1, ŵmin=[-55,-56], ŵmax=[57,58])
685685
@test all((mhe1.con.Ŵmin, mhe1.con.Ŵmax) .≈ ([-55,-56], [57,58]))
686686
setconstraint!(mhe1, v̂min=[-59,-60], v̂max=[61,62])
@@ -689,7 +689,7 @@ end
689689
mhe2 = MovingHorizonEstimator(linmodel1, He=4, nint_ym=0)
690690
setconstraint!(mhe2, X̂min=-1(1:10), X̂max=1(1:10))
691691
@test all((mhe2.con.X̂min, mhe2.con.X̂max) .≈ (-1(3:10), 1(3:10)))
692-
@test all((mhe2.con.x̂min, mhe2.con.x̂max) .≈ (-1(1:2), 1(1:2)))
692+
@test all((mhe2.con.x̃min, mhe2.con.x̃max) .≈ (-1(1:2), 1(1:2)))
693693
setconstraint!(mhe2, Ŵmin=-1(11:18), Ŵmax=1(11:18))
694694
@test all((mhe2.con.Ŵmin, mhe2.con.Ŵmax) .≈ (-1(11:18), 1(11:18)))
695695
setconstraint!(mhe2, V̂min=-1(31:38), V̂max=1(31:38))

0 commit comments

Comments
 (0)