Skip to content

Commit 96b14f8

Browse files
committed
deprecate output constraint arguments with hat (not really necessary)
1 parent fc0006d commit 96b14f8

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/predictive_control.jl

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,35 @@ function setconstraint!(
110110
ymin = nothing, ymax = nothing,
111111
c_umin = nothing, c_umax = nothing,
112112
c_Δumin = nothing, c_Δumax = nothing,
113-
c_ymin = nothing, c_ymax = nothing
113+
c_ymin = nothing, c_ymax = nothing,
114+
# will be deleted in the future:
115+
ŷmin = nothing, ŷmax = nothing,
116+
c_ŷmin = nothing, c_ŷmax = nothing,
114117
)
115118
model = mpc.estim.model
116119
con = mpc.con
117120
nu, ny = model.nu, model.ny
118121
Hp, Hc = mpc.Hp, mpc.Hc
119122
C, E = mpc.C, mpc.Ẽ[:, 1:nu*Hc]
123+
124+
# these 4 if will be deleted in the future:
125+
if !isnothing(ŷmin)
126+
Base.depwarn("keyword arg ŷmin is deprecated, use ymin instead", :setconstraint!)
127+
ymin = ŷmin
128+
end
129+
if !isnothing(ŷmax)
130+
Base.depwarn("keyword arg ŷmax is deprecated, use ymax instead", :setconstraint!)
131+
ymax = ŷmax
132+
end
133+
if !isnothing(c_ŷmin)
134+
Base.depwarn("keyword arg ŷmin is deprecated, use ymin instead", :setconstraint!)
135+
c_ymin = c_ŷmin
136+
end
137+
if !isnothing(c_ŷmax)
138+
Base.depwarn("keyword arg ŷmax is deprecated, use ymax instead", :setconstraint!)
139+
c_ymax = c_ŷmax
140+
end
141+
120142
if !isnothing(umin)
121143
size(umin) == (nu,) || error("umin size must be $((nu,))")
122144
Umin = repeat(umin, Hc)
@@ -210,6 +232,8 @@ function setconstraint!(
210232
return mpc
211233
end
212234

235+
236+
213237
"By default, there is no nonlinear constraint, thus do nothing."
214238
setnonlincon!(::PredictiveController, ::SimModel) = nothing
215239

0 commit comments

Comments
 (0)