Skip to content
Merged
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
21 changes: 20 additions & 1 deletion docs/src/manual/nonlinmpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,26 @@ savefig("plot10_NonLinMPC.svg"); nothing # hide

![plot10_NonLinMPC](plot10_NonLinMPC.svg)

The closed-loop performance is still lower than the nonlinear controller, as expected, but
Additionally, similar results are obtained by using a sparse [`MultipleShooting`](@ref)
transcription, which is known to be more robust for unstable systems, with a solver that can
explicilty handle sparsity like the default `OSQP`:

```@example man_nonlin
mpc_ms = LinMPC(skf; Hp, Hc, Mwt, Nwt, Cwt=Inf, transcription=MultipleShooting())
mpc_ms = setconstraint!(mpc_ms, umin=[-1.5], umax=[+1.5])
```

Superimposing the previous disturbance rejection plot shows almost identical results:

```@example man_nonlin
res_ms = sim!(mpc_ms, N, [180.0]; plant, x_0=[π, 0], y_step=[10])
plot!(res_ms)
savefig("plot10b_NonLinMPC.svg"); nothing # hide
```

![plot10b_NonLinMPC](plot10b_NonLinMPC.svg)

The closed-loop performances are still lower than the nonlinear controller, as expected, but
computations are about 210 times faster (0.000071 s versus 0.015 s per time steps, on
average). However, remember that `linmodel` is only valid for angular positions near 180°.
For example, the 180° setpoint response from 0° is unsatisfactory since the predictions are
Expand Down
Loading