Skip to content

Commit 59360bc

Browse files
committed
solve warnings generated by Documenter.jl
1 parent 303ebec commit 59360bc

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

docs/src/manual/linmpc.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,14 @@ function plot_data(t_data, u_data, y_data, ry_data)
146146
plot!(t_data, ry_data[2,:],label="setpoint", linestyle=:dash, linetype=:steppost)
147147
p3 = plot(t_data,u_data[1,:],label="cold", linetype=:steppost); ylabel!("flow rate")
148148
plot!(t_data,u_data[2,:],label="hot", linetype=:steppost); xlabel!("time (s)")
149-
return plot(p1, p2, p3, layout=(3,1), fmt=:svg)
149+
return plot(p1, p2, p3, layout=(3,1))
150150
end
151151
plot_data(t_data, u_data, y_data, ry_data)
152+
savefig(ans, "plot1_LinMPC.svg"); nothing # hide
152153
```
153154

155+
![plot1_LinMPC](plot1_LinMPC.svg)
156+
154157
For some situations, when [`LinMPC`](@ref) matrices are small/medium and dense, [`DAQP`](https://darnstrom.github.io/daqp/)
155158
optimizer may be more efficient. To install it, run:
156159

@@ -178,8 +181,11 @@ u, y = model.uop, model()
178181
initstate!(mpc2, u, y)
179182
u_data, y_data, ry_data = test_mpc(mpc2, model)
180183
plot_data(t_data, u_data, y_data, ry_data)
184+
savefig(ans, "plot2_LinMPC.svg"); nothing # hide
181185
```
182186

187+
![plot2_LinMPC](plot2_LinMPC.svg)
188+
183189
## Adding Feedforward Compensation
184190

185191
Suppose that the load disturbance ``u_l`` of the last section is in fact caused by a
@@ -251,4 +257,7 @@ u, y, d = model.uop, model(), mpc_ff.estim.model.dop
251257
initstate!(mpc_ff, u, y, d)
252258
u_data, y_data, ry_data = test_mpc_ff(mpc_ff, model)
253259
plot_data(t_data, u_data, y_data, ry_data)
260+
savefig(ans, "plot3_LinMPC.svg"); nothing # hide
254261
```
262+
263+
![plot3_LinMPC](plot3_LinMPC.svg)

docs/src/manual/nonlinmpc.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,11 @@ to first simulate `model` using [`sim!`](@ref) as a quick sanity check:
5656
using Plots
5757
u = [0.5]
5858
plot(sim!(model, 60, u), plotu=false)
59+
savefig(ans, "plot1_NonLinMPC.svg"); nothing # hide
5960
```
6061

62+
![plot1_NonLinMPC](plot1_NonLinMPC.svg)
63+
6164
## Nonlinear Model Predictive Controller
6265

6366
An [`UnscentedKalmanFilter`](@ref) estimates the plant state :
@@ -76,8 +79,11 @@ f_plant(x, u, _) = x + Ts*pendulum(par_plant, x, u)
7679
plant = NonLinModel(f_plant, h, Ts, nu, nx, ny)
7780
res = sim!(estim, 60, [0.5], plant=plant, y_noise=[0.5])
7881
plot(res, plotu=false, plotxwithx̂=true)
82+
savefig(ans, "plot2_NonLinMPC.svg"); nothing # hide
7983
```
8084

85+
![plot2_NonLinMPC](plot2_NonLinMPC.svg)
86+
8187
The estimate ``x̂_3`` is the integrator state that compensates for static errors (`nint_ym`
8288
and `σQint_ym` parameters of [`UnscentedKalmanFilter`](@ref)). The Kalman filter performance
8389
seems sufficient for control. As the motor torque is limited to -1.5 to 1.5 N m, we
@@ -94,13 +100,19 @@ position):
94100
```@example 1
95101
res = sim!(mpc, 60, [180.0], plant=plant, x0=zeros(plant.nx), x̂0=zeros(mpc.estim.nx̂))
96102
plot(res)
103+
savefig(ans, "plot3_NonLinMPC.svg"); nothing # hide
97104
```
98105

106+
![plot3_NonLinMPC](plot3_NonLinMPC.svg)
107+
99108
The controller seems robust enough to variations on ``K`` coefficient. Starting from this
100109
inverted position, the closed-loop response to a step disturbances of 10° is also
101110
satisfactory:
102111

103112
```@example 1
104113
res = sim!(mpc, 60, [180.0], plant=plant, x0=[π, 0], x̂0=[π, 0, 0], y_step=[10])
105114
plot(res)
115+
savefig(ans, "plot4_NonLinMPC.svg"); nothing # hide
106116
```
117+
118+
![plot4_NonLinMPC](plot4_NonLinMPC.svg)

0 commit comments

Comments
 (0)