Skip to content

Commit 3ed42e4

Browse files
authored
Merge pull request #150 from JuliaControl/doc_torque_correction
doc: torques constraints AND power constraint in the example (manual)
2 parents 6613a1e + ea8c657 commit 3ed42e4

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

docs/src/manual/nonlinmpc.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ regenerative circuitry.
245245

246246
## Custom Nonlinear Inequality Constraints
247247

248-
Instead of limits on the torque, suppose that the motor can deliver a maximum of 3 watt:
248+
In addition to the torque limits, suppose that the motor can deliver a maximum of 3 watt:
249249

250250
```math
251251
P(t) = τ(t) ω(t) ≤ P_\mathrm{max}
@@ -288,6 +288,7 @@ specifying the number of custom inequality constraints `nc`:
288288
```@example man_nonlin
289289
Cwt, Pmax, nc = 1e5, 3, Hp+1
290290
nmpc2 = NonLinMPC(estim2; Hp, Hc, Nwt=Nwt, Mwt=[0.5, 0], Cwt, gc!, nc, p=Pmax)
291+
nmpc2 = setconstraint!(nmpc2; umin, umax)
291292
using JuMP; unset_time_limit_sec(nmpc2.optim) # hide
292293
nmpc2 # hide
293294
```
@@ -319,8 +320,8 @@ savefig("plot7_NonLinMPC.svg"); nothing # hide
319320

320321
![plot7_NonLinMPC](plot7_NonLinMPC.svg)
321322

322-
The slight constraint violation is caused here by the modeling error on the friction
323-
coefficient ``K``.
323+
The controller is able to find a solution that does not violate the torque and power
324+
constraints.
324325

325326
## Model Linearization
326327

src/controller/execute.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ special cases in which `Ŷe`, `Ue` and `Ū` are not mutated:
385385
386386
- If `mpc.weights.iszero_M_Hp[] && nocustomfcts`, the `Ŷe` vector is not computed to reduce
387387
the burden in the optimization problem.
388-
- If `mpc.weights.iszero_L_Hc[] && nocustomfcts`, the `Ue` vector is not computed for the
388+
- If `mpc.weights.iszero_L_Hp[] && nocustomfcts`, the `Ue` vector is not computed for the
389389
same reason as above.
390390
"""
391391
function extended_predictions!(Ŷe, Ue, Ū, mpc, model, Ŷ0, ΔŨ)

0 commit comments

Comments
 (0)