diff --git a/Project.toml b/Project.toml index 53203217d..8d4726f48 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ModelPredictiveControl" uuid = "61f9bdb8-6ae4-484a-811f-bbf86720c31c" -version = "2.1.2" +version = "2.2.0" authors = ["Francis Gagnon"] [deps] diff --git a/src/controller/execute.jl b/src/controller/execute.jl index 7a2ed1fb8..ed3212eb3 100644 --- a/src/controller/execute.jl +++ b/src/controller/execute.jl @@ -93,16 +93,18 @@ The function should be called after calling [`moveinput!`](@ref). It returns the - `:ΔU` or *`:DeltaU`* : optimal manipulated input increments over ``H_c``, ``\mathbf{ΔU}`` - `:ϵ` or *`:epsilon`* : optimal slack variable, ``ϵ`` - `:D̂` or *`:Dhat`* : predicted measured disturbances over ``H_p``, ``\mathbf{D̂}`` +- `:x̂` or *`:xhat`* : current estimated state, ``\mathbf{x̂}_i(k)`` - `:ŷ` or *`:yhat`* : current estimated output, ``\mathbf{ŷ}(k)`` - `:Ŷ` or *`:Yhat`* : optimal predicted outputs over ``H_p``, ``\mathbf{Ŷ}`` - `:Ŷs` or *`:Yhats`* : predicted stochastic output over ``H_p`` of [`InternalModel`](@ref), ``\mathbf{Ŷ_s}`` - `:R̂y` or *`:Rhaty`* : predicted output setpoint over ``H_p``, ``\mathbf{R̂_y}`` - `:R̂u` or *`:Rhatu`* : predicted manipulated input setpoint over ``H_p``, ``\mathbf{R̂_u}`` - `:x̂end` or *`:xhatend`* : optimal terminal states, ``\mathbf{x̂}_i(k+H_p)`` -- `:J` : objective value optimum, ``J`` -- `:U` : optimal manipulated inputs over ``H_p``, ``\mathbf{U}`` -- `:u` : current optimal manipulated input, ``\mathbf{u}(k)`` -- `:d` : current measured disturbance, ``\mathbf{d}(k)`` +- `:J` : objective value optimum, ``J`` +- `:U` : optimal manipulated inputs over ``H_p``, ``\mathbf{U}`` +- `:u` : current optimal manipulated input, ``\mathbf{u}(k)`` +- `:d` : current measured disturbance, ``\mathbf{d}(k)`` +- `:lastu` : last manipulated input, ``\mathbf{u}(k-1)`` For [`LinMPC`](@ref) and [`NonLinMPC`](@ref), the following fields are also available: @@ -160,23 +162,26 @@ function getinfo(mpc::PredictiveController{NT}) where NT<:Real J = obj_nonlinprog!(Ŷ0, U0, mpc, Ue, Ŷe, ΔŨ) Ŷs = similar(mpc.Yop) predictstoch!(Ŷs, mpc, mpc.estim) - info[:ΔU] = Z̃[1:mpc.Hc*model.nu] - info[:ϵ] = getϵ(mpc, Z̃) - info[:J] = J - info[:U] = U - info[:u] = info[:U][1:model.nu] - info[:d] = mpc.d0 + model.dop - info[:D̂] = D̂ - info[:ŷ] = mpc.ŷ - info[:Ŷ] = Ŷ - info[:x̂end] = x̂0end + mpc.estim.x̂op - info[:Ŷs] = Ŷs - info[:R̂y] = mpc.R̂y - info[:R̂u] = mpc.R̂u + info[:ΔU] = Z̃[1:mpc.Hc*model.nu] + info[:ϵ] = getϵ(mpc, Z̃) + info[:J] = J + info[:U] = U + info[:u] = info[:U][1:model.nu] + info[:lastu] = mpc.lastu0 .+ model.uop + info[:d] = mpc.d0 + model.dop + info[:D̂] = D̂ + info[:x̂] = mpc.estim.x̂0 .+ mpc.estim.x̂op + info[:ŷ] = mpc.ŷ + info[:Ŷ] = Ŷ + info[:x̂end] = x̂0end + mpc.estim.x̂op + info[:Ŷs] = Ŷs + info[:R̂y] = mpc.R̂y + info[:R̂u] = mpc.R̂u # --- non-Unicode fields --- info[:DeltaU] = info[:ΔU] info[:epsilon] = info[:ϵ] info[:Dhat] = info[:D̂] + info[:xhat] = info[:x̂] info[:yhat] = info[:ŷ] info[:Yhat] = info[:Ŷ] info[:xhatend] = info[:x̂end] diff --git a/src/general.jl b/src/general.jl index 13a6c3580..41216be6e 100644 --- a/src/general.jl +++ b/src/general.jl @@ -22,7 +22,7 @@ const HIDDEN_GETINFO_KEYS_MHE = ( ) const HIDDEN_GETINFO_KEYS_MPC = ( - :DeltaU, :epsilon, :Dhat, :yhat, :Yhat, :xhatend, :Yhats, :Rhaty, :Rhatu, + :DeltaU, :epsilon, :Dhat, :xhat, :yhat, :Yhat, :xhatend, :Yhats, :Rhaty, :Rhatu, :nablaJ, :nabla2J, :nablag, :nabla2lg, :nablageq, :nabla2lgeq )