Skip to content

Commit 95208ad

Browse files
committed
changed: rename to upper case (for consistency)
1 parent cde05a7 commit 95208ad

File tree

3 files changed

+31
-23
lines changed

3 files changed

+31
-23
lines changed

src/controller/construct.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ struct ControllerConstraint{NT<:Real, GCfunc<:Union{Nothing, Function}}
176176
# indices of finite numbers in the b vector (linear inequality constraints):
177177
i_b ::BitVector
178178
# A matrices for the linear equality constraints:
179-
A_ŝ ::Matrix{NT}
179+
A_Ŝ ::Matrix{NT}
180180
Aeq ::Matrix{NT}
181181
# b vector for the linear equality constraints:
182182
beq ::Vector{NT}
@@ -518,7 +518,7 @@ function setconstraint!(
518518
con.A_Umin, con.A_Umax, con.A_ΔŨmin, con.A_ΔŨmax,
519519
con.A_Ymin, con.A_Ymax, con.A_Wmin, con.A_Wmax,
520520
con.A_x̂min, con.A_x̂max,
521-
con.A_ŝ
521+
con.A_Ŝ
522522
)
523523
A = con.A[con.i_b, :]
524524
b = con.b[con.i_b]
@@ -910,7 +910,7 @@ function init_defaultcon_mpc(
910910
A_Ymin, A_Ymax, Ẽ = relaxŶ(E, C_ymin, C_ymax, nϵ)
911911
A_Wmin, A_Wmax, Ẽw = relaxW(E, Pu, Hp, W̄y, W̄u, C_wmin, C_wmax, nϵ)
912912
A_x̂min, A_x̂max, ẽx̂ = relaxterminal(ex̂, c_x̂min, c_x̂max, nϵ)
913-
A_ŝ, Ẽŝ = augmentdefect(Eŝ, nϵ)
913+
A_Ŝ, Ẽŝ = augmentdefect(Eŝ, nϵ)
914914
i_Umin, i_Umax = .!isinf.(U0min), .!isinf.(U0max)
915915
i_ΔŨmin, i_ΔŨmax = .!isinf.(ΔŨmin), .!isinf.(ΔŨmax)
916916
i_Ymin, i_Ymax = .!isinf.(Y0min), .!isinf.(Y0max)
@@ -920,7 +920,7 @@ function init_defaultcon_mpc(
920920
model, transcription, nc,
921921
i_Umin, i_Umax, i_ΔŨmin, i_ΔŨmax, i_Ymin, i_Ymax, i_Wmin, i_Wmax, i_x̂min, i_x̂max,
922922
A_Umin, A_Umax, A_ΔŨmin, A_ΔŨmax, A_Ymin, A_Ymax, A_Wmin, A_Wmax, A_x̂max, A_x̂min,
923-
A_ŝ
923+
A_Ŝ
924924
)
925925
# dummy fx̂, Fw and Fŝ vectors (updated just before optimization)
926926
fx̂, Fw, Fŝ = zeros(NT, nx̂), zeros(NT, nW), zeros(NT, nx̂*Hp)
@@ -935,7 +935,7 @@ function init_defaultcon_mpc(
935935
A_Umin , A_Umax , A_ΔŨmin , A_ΔŨmax ,
936936
A_Ymin , A_Ymax , A_Wmin , A_Wmax , A_x̂min , A_x̂max ,
937937
A , b , i_b ,
938-
A_ŝ ,
938+
A_Ŝ ,
939939
Aeq , beq ,
940940
neq ,
941941
C_ymin , C_ymax , C_wmin , C_wmax , c_x̂min , c_x̂max ,
@@ -1194,14 +1194,14 @@ function relaxterminal(ex̂::AbstractMatrix{NT}, c_x̂min, c_x̂max, nϵ) where
11941194
end
11951195

11961196
@doc raw"""
1197-
augmentdefect(Eŝ, nϵ) -> A_ŝ, Ẽŝ
1197+
augmentdefect(Eŝ, nϵ) -> A_Ŝ, Ẽŝ
11981198
11991199
Augment defect equality constraints with slack variable ϵ if `nϵ == 1`.
12001200
12011201
It returns the ``\mathbf{Ẽ_ŝ}`` matrix that appears in the defect equation
12021202
``\mathbf{Ŝ = Ẽ_ŝ Z̃ + F_ŝ}`` and the ``\mathbf{A}`` matrix for the equality constraints:
12031203
```math
1204-
\mathbf{A_ŝ Z̃} = - \mathbf{F_ŝ}
1204+
\mathbf{A_Ŝ Z̃} = - \mathbf{F_ŝ}
12051205
```
12061206
"""
12071207
function augmentdefect(Eŝ::AbstractMatrix{NT}, nϵ) where NT<:Real
@@ -1210,8 +1210,8 @@ function augmentdefect(Eŝ::AbstractMatrix{NT}, nϵ) where NT<:Real
12101210
else # Z̃ = Z (only hard constraints)
12111211
Ẽŝ = Eŝ
12121212
end
1213-
A_ŝ = Ẽŝ
1214-
return A_ŝ, Ẽŝ
1213+
A_Ŝ = Ẽŝ
1214+
return A_Ŝ, Ẽŝ
12151215
end
12161216

12171217
@doc raw"""

src/controller/execute.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ function setmodel_controller!(mpc::PredictiveController, uop_old, x̂op_old)
691691
con.bx̂ .= bx̂
692692
# --- defect matrices ---
693693
Eŝ, Gŝ, Jŝ, Kŝ, Vŝ, Bŝ = init_defectmat(model, estim, transcription, Hp, Hc, nb)
694-
A_ŝ, Ẽŝ = augmentdefect(Eŝ, mpc.nϵ)
694+
A_Ŝ, Ẽŝ = augmentdefect(Eŝ, mpc.nϵ)
695695
con.Ẽŝ .= Ẽŝ
696696
con.Gŝ .= Gŝ
697697
con.Jŝ .= Jŝ
@@ -718,8 +718,8 @@ function setmodel_controller!(mpc::PredictiveController, uop_old, x̂op_old)
718718
con.A_x̂max
719719
]
720720
# --- linear equality constraints ---
721-
con.A_ŝ .= A_ŝ
722-
con.Aeq .= A_ŝ
721+
con.A_Ŝ .= A_Ŝ
722+
con.Aeq .= A_Ŝ
723723
# --- operating points ---
724724
con.U0min .+= mpc.Uop # convert U0 to U with the old operating point
725725
con.U0max .+= mpc.Uop # convert U0 to U with the old operating point

src/controller/transcription.jl

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -709,19 +709,27 @@ end
709709

710710
function init_defectmat(
711711
model::NonLinModel, estim::StateEstimator{NT}, transcription::CollocationMethod, Hp, Hc, _
712-
)
713-
712+
) where {NT<:Real}
713+
nx̂, nu, nd = estim.nx̂, model.nu, model.nd
714+
nZ = get_nZ(estim, transcription, Hp, Hc)
715+
Eŝ = zeros(NT, 0, nZ)
716+
Gŝ = zeros(NT, 0, nd)
717+
Jŝ = zeros(NT, 0, nd*Hp)
718+
Kŝ = zeros(NT, 0, nx̂)
719+
Vŝ = zeros(NT, 0, nu)
720+
Bŝ = zeros(NT, 0)
721+
return Eŝ, Gŝ, Jŝ, Kŝ, Vŝ, Bŝ
714722
end
715723

716724
"""
717725
init_defectmat(
718-
model::NonLinModel, estim::IntenalModel{NT}, transcription::CollocationMethod, Hp, Hc, _
726+
model::NonLinModel, estim::InternalModel{NT}, transcription::CollocationMethod, Hp, Hc, _
719727
) -> Eŝ, Gŝ, Jŝ, Kŝ, Vŝ, Bŝ
720728
721729
Return empty matrices for [`InternalModel`](@ref) (state vector is not augmented).
722730
"""
723731
function init_defectmat(
724-
model::NonLinModel, estim::IntenalModel{NT}, transcription::CollocationMethod, Hp, Hc, _
732+
model::NonLinModel, estim::InternalModel{NT}, transcription::CollocationMethod, Hp, Hc, _
725733
) where {NT<:Real}
726734
nx̂, nu, nd = estim.nx̂, model.nu, model.nd
727735
nZ = get_nZ(estim, transcription, Hp, Hc)
@@ -778,7 +786,7 @@ The argument `nc` is the number of custom nonlinear inequality constraints in
778786
finite numbers. `i_g` is a similar vector but for the indices of ``\mathbf{g}``. The method
779787
also returns the ``\mathbf{A, A_{eq}}`` matrices and `neq` if `args` is provided. In such a
780788
case, `args` needs to contain all the inequality and equality constraint matrices:
781-
`A_Umin, A_Umax, A_ΔŨmin, A_ΔŨmax, A_Ymin, A_Ymax, A_Wmin, A_Wmax, A_x̂min, A_x̂max, A_ŝ`.
789+
`A_Umin, A_Umax, A_ΔŨmin, A_ΔŨmax, A_Ymin, A_Ymax, A_Wmin, A_Wmax, A_x̂min, A_x̂max, A_Ŝ`.
782790
The integer `neq` is the number of nonlinear equality constraints in ``\mathbf{g_{eq}}``.
783791
"""
784792
function init_matconstraint_mpc(
@@ -795,7 +803,7 @@ function init_matconstraint_mpc(
795803
A_Ymin, A_Ymax,
796804
A_Wmin, A_Wmax,
797805
A_x̂min, A_x̂max,
798-
A_ŝ
806+
A_Ŝ
799807
) = args
800808
A = [
801809
A_Umin; A_Umax;
@@ -804,7 +812,7 @@ function init_matconstraint_mpc(
804812
A_Wmin; A_Wmax
805813
A_x̂min; A_x̂max;
806814
]
807-
Aeq = A_ŝ
815+
Aeq = A_Ŝ
808816
neq = 0
809817
end
810818
i_b = [i_Umin; i_Umax; i_ΔŨmin; i_ΔŨmax; i_Ymin; i_Ymax; i_Wmin; i_Wmax; i_x̂min; i_x̂max]
@@ -821,9 +829,9 @@ function init_matconstraint_mpc(
821829
if isempty(args)
822830
A, Aeq, neq = nothing, nothing, nothing
823831
else
824-
A_Umin, A_Umax, A_ΔŨmin, A_ΔŨmax, _ , _ , A_Wmin, A_Wmax, _ , _ , A_ŝ = args
832+
A_Umin, A_Umax, A_ΔŨmin, A_ΔŨmax, _ , _ , A_Wmin, A_Wmax, _ , _ , A_Ŝ = args
825833
A = [A_Umin; A_Umax; A_ΔŨmin; A_ΔŨmax; A_Wmin; A_Wmax]
826-
Aeq = A_ŝ
834+
Aeq = A_Ŝ
827835
neq = 0
828836
end
829837
i_b = [i_Umin; i_Umax; i_ΔŨmin; i_ΔŨmax; i_Wmin; i_Wmax]
@@ -840,9 +848,9 @@ function init_matconstraint_mpc(
840848
if isempty(args)
841849
A, Aeq, neq = nothing, nothing, nothing
842850
else
843-
A_Umin, A_Umax, A_ΔŨmin, A_ΔŨmax, _ , _ , A_Wmin, A_Wmax, A_x̂min, A_x̂max, A_ŝ = args
851+
A_Umin, A_Umax, A_ΔŨmin, A_ΔŨmax, _ , _ , A_Wmin, A_Wmax, A_x̂min, A_x̂max, A_Ŝ = args
844852
A = [A_Umin; A_Umax; A_ΔŨmin; A_ΔŨmax; A_Wmin; A_Wmax; A_x̂min; A_x̂max]
845-
Aeq = A_ŝ
853+
Aeq = A_Ŝ
846854
nΔŨ, nZ̃ = size(A_ΔŨmin)
847855
neq = nZ̃ - nΔŨ
848856
end

0 commit comments

Comments
 (0)