Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ModelPredictiveControl"
uuid = "61f9bdb8-6ae4-484a-811f-bbf86720c31c"
version = "2.14.0"
version = "2.14.1"
authors = ["Francis Gagnon"]

[deps]
Expand Down
5 changes: 4 additions & 1 deletion src/estimator/mhe/construct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,11 @@ function default_covestim_mhe(model::SimModel, i_ym, nint_u, nint_ym, P̂_0, Q̂
elseif model isa NonLinModel
return UnscentedKalmanFilter(model, i_ym, nint_u, nint_ym, P̂_0, Q̂, R̂; direct)
else
# SteadyKalmanFilter with arbitrary LinModel (will be ignored):
nx, nu, ny = model.nx, model.nu, model.ny
A, Bu, C = 0.1*I(nx), ones(nx, nu), ones(ny, nx)
poles = nx > 1 ? range(0.1, 0.9, length=nx) : [0.5]
A = Diagonal(poles) # distinct and stable poles for observability
Bu, C = ones(nx, nu), ones(ny, nx)
dummy_model = LinModel(A, Bu, C, 0, 0, model.Ts)
return SteadyKalmanFilter(dummy_model, i_ym, nint_u, nint_ym, Q̂, R̂; direct)
end
Expand Down
5 changes: 5 additions & 0 deletions test/2_test_state_estim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,11 @@ end
mhe2 = MovingHorizonEstimator(dae; He=3, transcription, direct=false)
@test mhe2.direct == false

mhe_skf = MovingHorizonEstimator(dae; He=3, nint_ym=0, nint_u=0, σP_0 = [0.5])
@test mhe_skf.cov.P̂_0 ≈ [0.5^2]
@test mhe_skf.cov.invP̄ ≈ [1/(0.5^2)]
@test mhe_skf.P̂arr_old ≈ [0.5^2]

@test_throws ArgumentError MovingHorizonEstimator(dae, He=3, transcription=SingleShooting())
@test_throws ArgumentError MovingHorizonEstimator(dae, He=3, transcription=MultipleShooting())
end
Expand Down
Loading