@@ -191,6 +191,7 @@ They are computed with these equations using in-place operations:
191191function initpred! (mpc:: PredictiveController , model:: LinModel , d, D̂, R̂y, R̂u)
192192 mul! (mpc. T_lastu0, mpc. T, mpc. estim. lastu0)
193193 ŷ, F, q̃, r = mpc. ŷ, mpc. F, mpc. q̃, mpc. r
194+ Cy, Cu = mpc. buffer. Cy, mpc. buffer. Cu
194195 ŷ .= evaloutput (mpc. estim, d)
195196 predictstoch! (mpc, mpc. estim) # init mpc.F with Ŷs for InternalModel
196197 F .+ = mpc. B
@@ -206,18 +207,18 @@ function initpred!(mpc::PredictiveController, model::LinModel, d, D̂, R̂y, R̂
206207 end
207208 # --- output setpoint tracking term ---
208209 mpc. R̂y .= R̂y
209- Cy = F .- (R̂y .- mpc. Yop)
210+ Cy . = F .- (R̂y .- mpc. Yop)
210211 M_Hp_Ẽ = mpc. weights. M_Hp* mpc. Ẽ
211- mul! (q̃, M_Hp_Ẽ' , Cy)
212+ mul! (q̃, M_Hp_Ẽ' , Cy) # q̃ = M_Hp*Ẽ'*Cy
212213 r .= dot (Cy, mpc. weights. M_Hp, Cy)
213214 # --- input setpoint tracking term ---
214215 mpc. R̂u .= R̂u
215- Cu = mpc. T_lastu0 .- (R̂u .- mpc. Uop)
216+ Cu . = mpc. T_lastu0 .- (R̂u .- mpc. Uop)
216217 L_Hp_S̃ = mpc. weights. L_Hp* mpc. S̃
217- mul! (q̃, L_Hp_S̃' , Cu, 1 , 1 )
218+ mul! (q̃, L_Hp_S̃' , Cu, 1 , 1 ) # q̃ = q̃ + L_Hp*S̃'*Cu
218219 r .+ = dot (Cu, mpc. weights. L_Hp, Cu)
219220 # --- finalize ---
220- lmul! (2 , q̃)
221+ lmul! (2 , q̃) # q̃ = 2*q̃
221222 return nothing
222223end
223224
0 commit comments