Skip to content

Commit dc329ed

Browse files
committed
InternalModel error if ym keyword argument is absent with moveinput!
1 parent ee24faf commit dc329ed

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

docs/src/manual/linmpc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ for details).
8282

8383
[^1]: We could have use an [`InternalModel`](@ref) structure with
8484
`mpc = LinMPC(InternalModel(model), Hp=15, Hc=2, Mwt=[1, 1], Nwt=[0.1, 0.1])` to avoid
85-
state estimator design . It was tested on the example of this page and it gives similar
85+
state estimator design . It was tested on the example of this page and it gives similar
8686
results.
8787

8888
Before closing the loop, we call [`initstate!`](@ref) with the actual plant inputs and

src/predictive_control.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@ end
389389
Use current measured outputs `ym` for prediction when `estim` is a [`InternalModel`](@ref).
390390
"""
391391
function predictstoch!(mpc, estim::InternalModel, d, ym )
392+
isnothing(ym) && error("Predictive controllers with InternalModel need the measured "*
393+
"outputs ym in keyword argument to compute control actions u")
392394
ŷd = h(estim.model, estim.x̂d, d - estim.model.dop) + estim.model.yop
393395
ŷs = zeros(estim.model.ny)
394396
ŷs[estim.i_ym] = ym - ŷd[estim.i_ym] # ŷs=0 for unmeasured outputs

0 commit comments

Comments
 (0)