File tree Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -278,8 +278,11 @@ function linconstraint!(mpc::PredictiveController, model::LinModel)
278
278
mpc. con. b[(n+ 1 ): (n+ nx̂)] .= @. - mpc. con. x̂min + fx̂
279
279
n += nx̂
280
280
mpc. con. b[(n+ 1 ): (n+ nx̂)] .= @. + mpc. con. x̂max - fx̂
281
- lincon = mpc. optim[:linconstraint ]
282
- set_normalized_rhs (lincon, mpc. con. b[mpc. con. i_b])
281
+ if any (mpc. con. i_b)
282
+ lincon = mpc. optim[:linconstraint ]
283
+ set_normalized_rhs (lincon, mpc. con. b[mpc. con. i_b])
284
+ end
285
+ return nothing
283
286
end
284
287
285
288
" Set `b` excluding predicted output constraints when `model` is not a [`LinModel`](@ref)."
@@ -293,8 +296,11 @@ function linconstraint!(mpc::PredictiveController, ::SimModel)
293
296
mpc. con. b[(n+ 1 ): (n+ nΔŨ)] .= @. - mpc. con. ΔŨmin
294
297
n += nΔŨ
295
298
mpc. con. b[(n+ 1 ): (n+ nΔŨ)] .= @. + mpc. con. ΔŨmax
296
- lincon = mpc. optim[:linconstraint ]
297
- set_normalized_rhs .(lincon, mpc. con. b[mpc. con. i_b])
299
+ if any (mpc. con. i_b)
300
+ lincon = mpc. optim[:linconstraint ]
301
+ set_normalized_rhs (lincon, mpc. con. b[mpc. con. i_b])
302
+ end
303
+ return nothing
298
304
end
299
305
300
306
@doc raw """
Original file line number Diff line number Diff line change @@ -285,8 +285,11 @@ function linconstraint!(estim::MovingHorizonEstimator, model::LinModel)
285
285
estim. con. b[(n+ 1 ): (n+ nV̂)] .= @. - V̂min + estim. F
286
286
n += nV̂
287
287
estim. con. b[(n+ 1 ): (n+ nV̂)] .= @. + V̂max - estim. F
288
- lincon = estim. optim[:linconstraint ]
289
- set_normalized_rhs .(lincon, estim. con. b[estim. con. i_b])
288
+ if any (estim. con. i_b)
289
+ lincon = estim. optim[:linconstraint ]
290
+ set_normalized_rhs (lincon, estim. con. b[estim. con. i_b])
291
+ end
292
+ return nothing
290
293
end
291
294
292
295
" Set `b` excluding state and sensor noise bounds if `model` is not a [`LinModel`](@ref)."
@@ -301,8 +304,11 @@ function linconstraint!(estim::MovingHorizonEstimator, ::SimModel)
301
304
estim. con. b[(n+ 1 ): (n+ nŴ)] .= @. - Ŵmin
302
305
n += nŴ
303
306
estim. con. b[(n+ 1 ): (n+ nŴ)] .= @. + Ŵmax
304
- lincon = estim. optim[:linconstraint ]
305
- set_normalized_rhs .(lincon, estim. con. b[estim. con. i_b])
307
+ if any (estim. con. i_b)
308
+ lincon = estim. optim[:linconstraint ]
309
+ set_normalized_rhs (lincon, estim. con. b[estim. con. i_b])
310
+ end
311
+ return nothing
306
312
end
307
313
308
314
" Truncate the bounds `Bmin` and `Bmax` to the window size `Nk` if `Nk < He`."
You can’t perform that action at this time.
0 commit comments