Skip to content

Commit 2d2003b

Browse files
committed
added: online modification of mpc weights and estimator covariances
1 parent 5f6a15a commit 2d2003b

File tree

12 files changed

+153
-95
lines changed

12 files changed

+153
-95
lines changed

src/controller/construct.jl

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,8 @@ function setconstraint!(
144144
C_Δumin = C_Deltaumin, C_Δumax = C_Deltaumax,
145145
)
146146
model, con, optim = mpc.estim.model, mpc.con, mpc.optim
147-
nu, ny, nx̂, Hp, Hc = model.nu, model.ny, mpc.estim.nx̂, mpc.Hp, mpc.Hc
147+
nu, ny, nx̂, Hp, Hc, nϵ = model.nu, model.ny, mpc.estim.nx̂, mpc.Hp, mpc.Hc, mpc.
148148
notSolvedYet = (JuMP.termination_status(optim) == JuMP.OPTIMIZE_NOT_CALLED)
149-
C = mpc.C
150149
isnothing(Umin) && !isnothing(umin) && (Umin = repeat(umin, Hp))
151150
isnothing(Umax) && !isnothing(umax) && (Umax = repeat(umax, Hp))
152151
isnothing(ΔUmin) && !isnothing(Δumin) && (ΔUmin = repeat(Δumin, Hc))
@@ -160,7 +159,7 @@ function setconstraint!(
160159
isnothing(C_ymin) && !isnothing(c_ymin) && (C_ymin = repeat(c_ymin, Hp))
161160
isnothing(C_ymax) && !isnothing(c_ymax) && (C_ymax = repeat(c_ymax, Hp))
162161
if !all(isnothing.((C_umin, C_umax, C_Δumin, C_Δumax, C_ymin, C_ymax, c_x̂min, c_x̂max)))
163-
!isinf(C) || throw(ArgumentError("Slack variable weight Cwt must be finite to set softness parameters"))
162+
== 1 || throw(ArgumentError("Slack variable weight Cwt must be finite to set softness parameters"))
164163
notSolvedYet || error("Cannot set softness parameters after calling moveinput!")
165164
end
166165
if !isnothing(Umin)
@@ -605,6 +604,7 @@ function init_defaultcon_mpc(
605604
) where {NT<:Real}
606605
model = estim.model
607606
nu, ny, nx̂ = model.nu, model.ny, estim.nx̂
607+
= isinf(C) ? 0 : 1
608608
u0min, u0max = fill(convert(NT,-Inf), nu), fill(convert(NT,+Inf), nu)
609609
Δumin, Δumax = fill(convert(NT,-Inf), nu), fill(convert(NT,+Inf), nu)
610610
y0min, y0max = fill(convert(NT,-Inf), ny), fill(convert(NT,+Inf), ny)
@@ -617,12 +617,12 @@ function init_defaultcon_mpc(
617617
repeat_constraints(Hp, Hc, u0min, u0max, Δumin, Δumax, y0min, y0max)
618618
C_umin, C_umax, C_Δumin, C_Δumax, C_ymin, C_ymax =
619619
repeat_constraints(Hp, Hc, c_umin, c_umax, c_Δumin, c_Δumax, c_ymin, c_ymax)
620-
A_Umin, A_Umax, S̃ = relaxU(model, C, C_umin, C_umax, S)
620+
A_Umin, A_Umax, S̃ = relaxU(model, , C_umin, C_umax, S)
621621
A_ΔŨmin, A_ΔŨmax, ΔŨmin, ΔŨmax, Ñ_Hc = relaxΔU(
622-
model, C, C_Δumin, C_Δumax, ΔUmin, ΔUmax, N_Hc
622+
model, nϵ, C, C_Δumin, C_Δumax, ΔUmin, ΔUmax, N_Hc
623623
)
624-
A_Ymin, A_Ymax, Ẽ = relaxŶ(model, C, C_ymin, C_ymax, E)
625-
A_x̂min, A_x̂max, ẽx̂ = relaxterminal(model, C, c_x̂min, c_x̂max, ex̂)
624+
A_Ymin, A_Ymax, Ẽ = relaxŶ(model, , C_ymin, C_ymax, E)
625+
A_x̂min, A_x̂max, ẽx̂ = relaxterminal(model, , c_x̂min, c_x̂max, ex̂)
626626
i_Umin, i_Umax = .!isinf.(U0min), .!isinf.(U0max)
627627
i_ΔŨmin, i_ΔŨmax = .!isinf.(ΔŨmin), .!isinf.(ΔŨmax)
628628
i_Ymin, i_Ymax = .!isinf.(Y0min), .!isinf.(Y0max)
@@ -639,7 +639,7 @@ function init_defaultcon_mpc(
639639
A_Umin , A_Umax, A_ΔŨmin, A_ΔŨmax , A_Ymin , A_Ymax , A_x̂min , A_x̂max,
640640
A , b , i_b , C_ymin , C_ymax , c_x̂min , c_x̂max , i_g
641641
)
642-
return con, S̃, Ñ_Hc, Ẽ
642+
return con, nϵ, S̃, Ñ_Hc, Ẽ
643643
end
644644

645645
"Repeat predictive controller constraints over prediction `Hp` and control `Hc` horizons."
@@ -656,7 +656,7 @@ end
656656

657657

658658
@doc raw"""
659-
relaxU(model, C, C_umin, C_umax, S) -> A_Umin, A_Umax, S̃
659+
relaxU(model, , C_umin, C_umax, S) -> A_Umin, A_Umax, S̃
660660
661661
Augment manipulated inputs constraints with slack variable ϵ for softening.
662662
@@ -678,8 +678,8 @@ constraints:
678678
in which ``\mathbf{U_{min}, U_{max}}`` and ``\mathbf{U_{op}}`` vectors respectively contains
679679
``\mathbf{u_{min}, u_{max}}`` and ``\mathbf{u_{op}}`` repeated ``H_p`` times.
680680
"""
681-
function relaxU(::SimModel{NT}, C, C_umin, C_umax, S) where {NT<:Real}
682-
if !isinf(C) # ΔŨ = [ΔU; ϵ]
681+
function relaxU(::SimModel{NT}, , C_umin, C_umax, S) where NT<:Real
682+
if == 1 # ΔŨ = [ΔU; ϵ]
683683
# ϵ impacts ΔU → U conversion for constraint calculations:
684684
A_Umin, A_Umax = -[S C_umin], [S -C_umax]
685685
# ϵ has no impact on ΔU → U conversion for prediction calculations:
@@ -693,7 +693,7 @@ end
693693

694694
@doc raw"""
695695
relaxΔU(
696-
model, C, C_Δumin, C_Δumax, ΔUmin, ΔUmax, N_Hc
696+
model, nϵ, C, C_Δumin, C_Δumax, ΔUmin, ΔUmax, N_Hc
697697
) -> A_ΔŨmin, A_ΔŨmax, ΔŨmin, ΔŨmax, Ñ_Hc
698698
699699
Augment input increments constraints with slack variable ϵ for softening.
@@ -714,9 +714,9 @@ returns the augmented constraints ``\mathbf{ΔŨ_{min}}`` and ``\mathbf{ΔŨ_{
714714
\end{bmatrix}
715715
```
716716
"""
717-
function relaxΔU(::SimModel{NT}, C, C_Δumin, C_Δumax, ΔUmin, ΔUmax, N_Hc) where {NT<:Real}
717+
function relaxΔU(::SimModel{NT}, nϵ, C, C_Δumin, C_Δumax, ΔUmin, ΔUmax, N_Hc) where NT<:Real
718718
nΔU = size(N_Hc, 1)
719-
if !isinf(C) # ΔŨ = [ΔU; ϵ]
719+
if == 1 # ΔŨ = [ΔU; ϵ]
720720
# 0 ≤ ϵ ≤ ∞
721721
ΔŨmin, ΔŨmax = [ΔUmin; NT[0.0]], [ΔUmax; NT[Inf]]
722722
A_ϵ = [zeros(NT, 1, length(ΔUmin)) NT[1.0]]
@@ -732,7 +732,7 @@ function relaxΔU(::SimModel{NT}, C, C_Δumin, C_Δumax, ΔUmin, ΔUmax, N_Hc) w
732732
end
733733

734734
@doc raw"""
735-
relaxŶ(::LinModel, C, C_ymin, C_ymax, E) -> A_Ymin, A_Ymax, Ẽ
735+
relaxŶ(::LinModel, , C_ymin, C_ymax, E) -> A_Ymin, A_Ymax, Ẽ
736736
737737
Augment linear output prediction constraints with slack variable ϵ for softening.
738738
@@ -753,8 +753,8 @@ Denoting the input increments augmented with the slack variable
753753
in which ``\mathbf{Y_{min}, Y_{max}}`` and ``\mathbf{Y_{op}}`` vectors respectively contains
754754
``\mathbf{y_{min}, y_{max}}`` and ``\mathbf{y_{op}}`` repeated ``H_p`` times.
755755
"""
756-
function relaxŶ(::LinModel{NT}, C, C_ymin, C_ymax, E) where {NT<:Real}
757-
if !isinf(C) # ΔŨ = [ΔU; ϵ]
756+
function relaxŶ(::LinModel{NT}, , C_ymin, C_ymax, E) where NT<:Real
757+
if == 1 # ΔŨ = [ΔU; ϵ]
758758
# ϵ impacts predicted output constraint calculations:
759759
A_Ymin, A_Ymax = -[E C_ymin], [E -C_ymax]
760760
# ϵ has no impact on output predictions:
@@ -767,14 +767,14 @@ function relaxŶ(::LinModel{NT}, C, C_ymin, C_ymax, E) where {NT<:Real}
767767
end
768768

769769
"Return empty matrices if model is not a [`LinModel`](@ref)"
770-
function relaxŶ(::SimModel{NT}, C, C_ymin, C_ymax, E) where {NT<:Real}
771-
= !isinf(C) ? [E zeros(NT, 0, 1)] : E
770+
function relaxŶ(::SimModel{NT}, , C_ymin, C_ymax, E) where NT<:Real
771+
= [E zeros(NT, 0, nϵ)]
772772
A_Ymin, A_Ymax = -Ẽ, Ẽ
773773
return A_Ymin, A_Ymax, Ẽ
774774
end
775775

776776
@doc raw"""
777-
relaxterminal(::LinModel, C, c_x̂min, c_x̂max, ex̂) -> A_x̂min, A_x̂max, ẽx̂
777+
relaxterminal(::LinModel, , c_x̂min, c_x̂max, ex̂) -> A_x̂min, A_x̂max, ẽx̂
778778
779779
Augment terminal state constraints with slack variable ϵ for softening.
780780
@@ -794,8 +794,8 @@ the inequality constraints:
794794
\end{bmatrix}
795795
```
796796
"""
797-
function relaxterminal(::LinModel{NT}, C, c_x̂min, c_x̂max, ex̂) where {NT<:Real}
798-
if !isinf(C) # ΔŨ = [ΔU; ϵ]
797+
function relaxterminal(::LinModel{NT}, , c_x̂min, c_x̂max, ex̂) where {NT<:Real}
798+
if == 1 # ΔŨ = [ΔU; ϵ]
799799
# ϵ impacts terminal state constraint calculations:
800800
A_x̂min, A_x̂max = -[ex̂ c_x̂min], [ex̂ -c_x̂max]
801801
# ϵ has no impact on terminal state predictions:
@@ -808,8 +808,8 @@ function relaxterminal(::LinModel{NT}, C, c_x̂min, c_x̂max, ex̂) where {NT<:R
808808
end
809809

810810
"Return empty matrices if model is not a [`LinModel`](@ref)"
811-
function relaxterminal(::SimModel{NT}, C, c_x̂min, c_x̂max, ex̂) where {NT<:Real}
812-
ẽx̂ = !isinf(C) ? [ex̂ zeros(NT, 0, 1)] : ex̂
811+
function relaxterminal(::SimModel{NT}, , c_x̂min, c_x̂max, ex̂) where {NT<:Real}
812+
ẽx̂ = [ex̂ zeros(NT, 0, nϵ)]
813813
A_x̂min, A_x̂max = -ẽx̂, ẽx̂
814814
return A_x̂min, A_x̂max, ẽx̂
815815
end
@@ -853,7 +853,7 @@ function init_stochpred(estim::StateEstimator{NT}, _ ) where NT<:Real
853853
end
854854

855855
"Validate predictive controller weight and horizon specified values."
856-
function validate_weights(model, Hp, Hc, M_Hp, N_Hc, L_Hp, C, E=nothing)
856+
function validate_weights(model, Hp, Hc, M_Hp, N_Hc, L_Hp, C=Inf, E=nothing)
857857
nu, ny = model.nu, model.ny
858858
nM, nN, nL = ny*Hp, nu*Hc, nu*Hp
859859
Hp < 1 && throw(ArgumentError("Prediction horizon Hp should be ≥ 1"))

src/controller/execute.jl

Lines changed: 48 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ function getinfo(mpc::PredictiveController{NT}) where NT<:Real
127127
Ŷs .= mpc.F # predictstoch! init mpc.F with Ŷs value if estim is an InternalModel
128128
mpc.F .= oldF # restore old F value
129129
info[:ΔU] = mpc.ΔŨ[1:mpc.Hc*model.nu]
130-
info[] = isinf(mpc.C) ? NaN : mpc.ΔŨ[end]
130+
info[] = mpc.== 1 ? mpc.ΔŨ[end] : NaN
131131
info[:J] = J
132132
info[:U] = U0 + mpc.Uop
133133
info[:u] = info[:U][1:model.nu]
@@ -468,7 +468,7 @@ function optim_objective!(mpc::PredictiveController{NT}) where {NT<:Real}
468468
model = mpc.estim.model
469469
ΔŨvar::Vector{JuMP.VariableRef} = optim[:ΔŨvar]
470470
# initial ΔŨ (warm-start): [Δu_{k-1}(k); Δu_{k-1}(k+1); ... ; 0_{nu × 1}; ϵ_{k-1}]
471-
ϵ0 = !isinf(mpc.C) ? mpc.ΔŨ[end] : empty(mpc.ΔŨ)
471+
ϵ0 = (mpc.== 1) ? mpc.ΔŨ[end] : empty(mpc.ΔŨ)
472472
ΔŨ0 = [mpc.ΔŨ[(model.nu+1):(mpc.Hc*model.nu)]; zeros(NT, model.nu); ϵ0]
473473
JuMP.set_start_value.(ΔŨvar, ΔŨ0)
474474
set_objective_linear_coef!(mpc, ΔŨvar)
@@ -523,46 +523,69 @@ Set `mpc.estim.x̂0` to `x̂ - estim.x̂op` from the argument `x̂`.
523523
setstate!(mpc::PredictiveController, x̂) = (setstate!(mpc.estim, x̂); return mpc)
524524

525525

526-
"""
527-
setmodel!(mpc::PredictiveController, model::LinModel) -> mpc
526+
@doc raw"""
527+
setmodel!(mpc::PredictiveController, model=mpc.estim.model, <keyword arguments>) -> mpc
528+
529+
Set `model` and objective function weights of `mpc` [`PredictiveController`](@ref).
528530
529-
Set model and operating points of `mpc` [`PredictiveController`](@ref) to `model` values.
531+
Allows model adaptation of controllers based on [`LinModel`](@ref) at runtime. Modification
532+
of [`NonLinModel`](@ref) is not supported. New weight matrices in the objective function can
533+
be specified with the keyword arguments (see [`LinMPC`](@ref) for the nomenclature). If
534+
`Cwt ≠ Inf`, the augmented move suppression weight is ``\mathbf{Ñ}_{H_c} = \mathrm{diag}(
535+
\mathbf{N}_{H_c}, C)``, else ``\mathbf{Ñ}_{H_c} = \mathbf{N}_{H_c}``. The [`StateEstimator`](@ref)
536+
`mpc.estim` cannot be a [`Luenberger`](@ref) observer or a [`SteadyKalmanFilter`](@ref) (the
537+
default estimator). Construct the `mpc` object with a time-varying [`KalmanFilter`](@ref)
538+
instead. Note that the model is constant over the prediction horizon ``H_p``.
530539
531-
Allows model adaptation of controllers based on [`LinModel`](@ref) at runtime ([`NonLinModel`](@ref)
532-
is not supported). The [`StateEstimator`](@ref) `mpc.estim` cannot be a [`Luenberger`](@ref)
533-
observer or a [`SteadyKalmanFilter`](@ref) (the default estimator). Construct the `mpc`
534-
object with a time-varying [`KalmanFilter`](@ref) instead. Note that the model is constant
535-
over the prediction horizon ``H_p``.
540+
# Arguments
541+
542+
- `mpc::PredictiveController` : controller to set model and weights.
543+
- `model=mpc.estim.model` : new plant model ([`NonLinModel`](@ref) not supported).
544+
- `M_Hp=mpc.M_Hp` : new ``\mathbf{M_{H_p}}`` weight matrix.
545+
- `Ñ_Hc=mpc.Ñ_Hc` : new ``\mathbf{Ñ_{H_c}}`` weight matrix (see definition above).
546+
- `L_Hp=mpc.L_Hp` : new ``\mathbf{L_{H_p}}`` weight matrix.
547+
- additional keyword arguments are passed to `setmodel!(::StateEstimator)`.
536548
537549
# Examples
538550
```jldoctest
539-
julia> kf = KalmanFilter(LinModel(ss(0.1, 0.5, 1, 0, 4.0)));
551+
julia> mpc = LinMPC(KalmanFilter(LinModel(ss(0.1, 0.5, 1, 0, 4.0)), σR=[√25]), Hp=1, Hc=1);
552+
553+
julia> mpc.estim.model.A[], mpc.estim.R̂[], mpc.M_Hp[]
554+
(0.1, 25.0)
540555
541-
julia> mpc = LinMPC(kf); mpc.estim.model.A
542-
1×1 Matrix{Float64}:
543-
0.1
556+
julia> setmodel!(mpc, LinModel(ss(0.42, 0.5, 1, 0, 4.0)); R̂=[9], M_Hp=[0]);
544557
545-
julia> setmodel!(mpc, LinModel(ss(0.42, 0.5, 1, 0, 4.0))); mpc.estim.model.A
546-
1×1 Matrix{Float64}:
547-
0.42
558+
julia> mpc.estim.model.A[], mpc.estim.R̂[], mpc.M_Hp[]
559+
(0.42, 9.0)
548560
```
549561
"""
550-
function setmodel!(mpc::PredictiveController, model::LinModel)
562+
function setmodel!(
563+
mpc::PredictiveController,
564+
model = mpc.estim.model;
565+
M_Hp = mpc.M_Hp,
566+
Ñ_Hc = mpc.Ñ_Hc,
567+
L_Hp = mpc.L_Hp,
568+
kwargs...
569+
)
551570
x̂op_old = copy(mpc.estim.x̂op)
552-
setmodel!(mpc.estim, model)
553-
setmodel_controller!(mpc, model, x̂op_old)
571+
nu, ny, Hp, Hc, nϵ = model.nu, model.ny, mpc.Hp, mpc.Hc, mpc.
572+
setmodel!(mpc.estim, model; kwargs...)
573+
mpc.M_Hp .= to_hermitian(M_Hp)
574+
mpc.Ñ_Hc .= to_hermitian(Ñ_Hc)
575+
mpc.L_Hp .= to_hermitian(L_Hp)
576+
setmodel_controller!(mpc, x̂op_old, M_Hp, Ñ_Hc, L_Hp)
554577
return mpc
555578
end
556579

557580
"Update the prediction matrices, linear constraints and JuMP optimization."
558-
function setmodel_controller!(mpc::PredictiveController, model::LinModel, x̂op_old)
559-
estim = mpc.estim
581+
function setmodel_controller!(mpc::PredictiveController, x̂op_old, M_Hp, Ñ_Hc, L_Hp)
582+
estim, model = mpc.estim, mpc.estim.model
560583
nu, ny, nd, Hp, Hc = model.nu, model.ny, model.nd, mpc.Hp, mpc.Hc
561584
optim, con = mpc.optim, mpc.con
562585
# --- predictions matrices ---
563586
E, G, J, K, V, B, ex̂, gx̂, jx̂, kx̂, vx̂, bx̂ = init_predmat(estim, model, Hp, Hc)
564-
A_Ymin, A_Ymax, Ẽ = relaxŶ(model, mpc.C, con.C_ymin, con.C_ymax, E)
565-
A_x̂min, A_x̂max, ẽx̂ = relaxterminal(model, mpc.C, con.c_x̂min, con.c_x̂max, ex̂)
587+
A_Ymin, A_Ymax, Ẽ = relaxŶ(model, mpc., con.C_ymin, con.C_ymax, E)
588+
A_x̂min, A_x̂max, ẽx̂ = relaxterminal(model, mpc., con.c_x̂min, con.c_x̂max, ex̂)
566589
mpc.Ẽ .=
567590
mpc.G .= G
568591
mpc.J .= J
@@ -603,6 +626,7 @@ function setmodel_controller!(mpc::PredictiveController, model::LinModel, x̂op_
603626
A = con.A[con.i_b, :]
604627
b = con.b[con.i_b]
605628
ΔŨvar::Vector{JuMP.VariableRef} = optim[:ΔŨvar]
629+
# deletion is required for sparse solvers like OSQP, when the sparsity pattern changes
606630
JuMP.delete(optim, optim[:linconstraint])
607631
JuMP.unregister(optim, :linconstraint)
608632
@constraint(optim, linconstraint, A*ΔŨvar .≤ b)

src/controller/explicitmpc.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ struct ExplicitMPC{NT<:Real, SE<:StateEstimator} <: PredictiveController{NT}
44
::Vector{NT}
55
Hp::Int
66
Hc::Int
7+
::Int
78
M_Hp::Hermitian{NT, Matrix{NT}}
89
Ñ_Hc::Hermitian{NT, Matrix{NT}}
910
L_Hp::Hermitian{NT, Matrix{NT}}
10-
C::NT
1111
E::NT
1212
R̂u0::Vector{NT}
1313
R̂y0::Vector{NT}
@@ -40,9 +40,9 @@ struct ExplicitMPC{NT<:Real, SE<:StateEstimator} <: PredictiveController{NT}
4040
model = estim.model
4141
nu, ny, nd, nx̂ = model.nu, model.ny, model.nd, estim.nx̂
4242
= copy(model.yop) # dummy vals (updated just before optimization)
43-
Cwt = Inf # no slack variable ϵ for ExplicitMPC
43+
= 0 # no slack variable ϵ for ExplicitMPC
4444
Ewt = 0 # economic costs not supported for ExplicitMPC
45-
validate_weights(model, Hp, Hc, M_Hp, N_Hc, L_Hp, Cwt)
45+
validate_weights(model, Hp, Hc, M_Hp, N_Hc, L_Hp)
4646
# convert `Diagonal` to normal `Matrix` if required:
4747
M_Hp = Hermitian(convert(Matrix{NT}, M_Hp), :L)
4848
N_Hc = Hermitian(convert(Matrix{NT}, N_Hc), :L)
@@ -68,8 +68,8 @@ struct ExplicitMPC{NT<:Real, SE<:StateEstimator} <: PredictiveController{NT}
6868
mpc = new{NT, SE}(
6969
estim,
7070
ΔŨ, ŷ,
71-
Hp, Hc,
72-
M_Hp, Ñ_Hc, L_Hp, Cwt, Ewt,
71+
Hp, Hc, nϵ,
72+
M_Hp, Ñ_Hc, L_Hp, Ewt,
7373
R̂u0, R̂y0, noR̂u,
7474
S̃, T, T_lastu0,
7575
Ẽ, F, G, J, K, V, B,
@@ -208,8 +208,8 @@ addinfo!(info, mpc::ExplicitMPC) = info
208208

209209

210210
"Update the prediction matrices and Cholesky factorization."
211-
function setmodel_controller!(mpc::ExplicitMPC, model::LinModel, _ )
212-
estim = mpc.estim
211+
function setmodel_controller!(mpc::ExplicitMPC, _ , M_Hp, Ñ_Hc, L_Hp)
212+
estim, model = mpc.estim, mpc.estim.model
213213
nu, ny, nd, Hp, Hc = model.nu, model.ny, model.nd, mpc.Hp, mpc.Hc
214214
# --- predictions matrices ---
215215
E, G, J, K, V, B = init_predmat(estim, model, Hp, Hc)

src/controller/linmpc.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ struct LinMPC{
1414
::Vector{NT}
1515
Hp::Int
1616
Hc::Int
17+
::Int
1718
M_Hp::Hermitian{NT, Matrix{NT}}
1819
Ñ_Hc::Hermitian{NT, Matrix{NT}}
1920
L_Hp::Hermitian{NT, Matrix{NT}}
20-
C::NT
2121
E::NT
2222
R̂u0::Vector{NT}
2323
R̂y0::Vector{NT}
@@ -62,7 +62,7 @@ struct LinMPC{
6262
E, G, J, K, V, B, ex̂, gx̂, jx̂, kx̂, vx̂, bx̂ = init_predmat(estim, model, Hp, Hc)
6363
# dummy vals (updated just before optimization):
6464
F, fx̂ = zeros(NT, ny*Hp), zeros(NT, nx̂)
65-
con, S̃, Ñ_Hc, Ẽ = init_defaultcon_mpc(
65+
con, nϵ, S̃, Ñ_Hc, Ẽ = init_defaultcon_mpc(
6666
estim, Hp, Hc, Cwt, S, N_Hc, E, ex̂, fx̂, gx̂, jx̂, kx̂, vx̂, bx̂
6767
)
6868
= init_quadprog(model, Ẽ, S̃, M_Hp, Ñ_Hc, L_Hp)
@@ -77,8 +77,8 @@ struct LinMPC{
7777
mpc = new{NT, SE, JM}(
7878
estim, optim, con,
7979
ΔŨ, ŷ,
80-
Hp, Hc,
81-
M_Hp, Ñ_Hc, L_Hp, Cwt, Ewt,
80+
Hp, Hc, nϵ,
81+
M_Hp, Ñ_Hc, L_Hp, Ewt,
8282
R̂u0, R̂y0, noR̂u,
8383
S̃, T, T_lastu0,
8484
Ẽ, F, G, J, K, V, B,

0 commit comments

Comments
 (0)