diff --git a/docs/src/manual/nonlinmpc.md b/docs/src/manual/nonlinmpc.md index 38b7f01e8..57bc2f28d 100644 --- a/docs/src/manual/nonlinmpc.md +++ b/docs/src/manual/nonlinmpc.md @@ -245,7 +245,7 @@ regenerative circuitry. ## Custom Nonlinear Inequality Constraints -Instead of limits on the torque, suppose that the motor can deliver a maximum of 3 watt: +In addition to the torque limits, suppose that the motor can deliver a maximum of 3 watt: ```math P(t) = τ(t) ω(t) ≤ P_\mathrm{max} @@ -288,6 +288,7 @@ specifying the number of custom inequality constraints `nc`: ```@example man_nonlin Cwt, Pmax, nc = 1e5, 3, Hp+1 nmpc2 = NonLinMPC(estim2; Hp, Hc, Nwt=Nwt, Mwt=[0.5, 0], Cwt, gc!, nc, p=Pmax) +nmpc2 = setconstraint!(nmpc2; umin, umax) using JuMP; unset_time_limit_sec(nmpc2.optim) # hide nmpc2 # hide ``` @@ -319,8 +320,8 @@ savefig("plot7_NonLinMPC.svg"); nothing # hide ![plot7_NonLinMPC](plot7_NonLinMPC.svg) -The slight constraint violation is caused here by the modeling error on the friction -coefficient ``K``. +The controller is able to find a solution that does not violate the torque and power +constraints. ## Model Linearization diff --git a/src/controller/execute.jl b/src/controller/execute.jl index c70058e83..29e6c5a53 100644 --- a/src/controller/execute.jl +++ b/src/controller/execute.jl @@ -385,7 +385,7 @@ special cases in which `Ŷe`, `Ue` and `Ū` are not mutated: - If `mpc.weights.iszero_M_Hp[] && nocustomfcts`, the `Ŷe` vector is not computed to reduce the burden in the optimization problem. -- If `mpc.weights.iszero_L_Hc[] && nocustomfcts`, the `Ue` vector is not computed for the +- If `mpc.weights.iszero_L_Hp[] && nocustomfcts`, the `Ue` vector is not computed for the same reason as above. """ function extended_predictions!(Ŷe, Ue, Ū, mpc, model, Ŷ0, ΔŨ)