Skip to content

Commit 7b3fbac

Browse files
committed
debug: ExplicitMPC method predict!
1 parent 0c1c064 commit 7b3fbac

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/controller/execute.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ function extended_vectors!(Ue, Ŷe, mpc::PredictiveController, U0, Ŷ0)
352352
if !(mpc.weights.iszero_L_Hp[] && nocustomfcts)
353353
Ue[1:end-nu] .= U0 .+ mpc.Uop
354354
# u(k + Hp) = u(k + Hp - 1) since Δu(k+Hp) = 0 (because Hc ≤ Hp):
355-
Ue[end-nu+1:end] .= @views U[end-nu+1:end]
355+
Ue[end-nu+1:end] .= @views Ue[end-2*nu+1:end-nu]
356356
end
357357
# --- extended output predictions Ŷe = [ŷ(k); Ŷ] ---
358358
if !(mpc.weights.iszero_M_Hp[] && nocustomfcts)

src/controller/explicitmpc.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,10 @@ optim_objective!(mpc::ExplicitMPC) = lmul!(-1, ldiv!(mpc.Z̃, mpc.H̃_chol, mpc.
195195

196196
"Compute the predictions but not the terminal states if `mpc` is an [`ExplicitMPC`](@ref)."
197197
function predict!(
198-
Ŷ0, x̂0next, _ , _ , _ , mpc::ExplicitMPC, ::LinModel, ::TranscriptionMethod, Z̃
198+
Ŷ0, x̂0end, _ , _ , mpc::ExplicitMPC, ::LinModel, ::TranscriptionMethod, _ , Z̃
199199
)
200200
# in-place operations to reduce allocations :
201201
Ŷ0 .= mul!(Ŷ0, mpc.Ẽ, Z̃) .+ mpc.F
202-
x̂0end = x̂0next
203202
x̂0end .= NaN
204203
return Ŷ0, x̂0end
205204
end

0 commit comments

Comments
 (0)