Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/src/manual/nonlinmpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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
```
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/controller/execute.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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, ΔŨ)
Expand Down
Loading