Skip to content

Commit e36137f

Browse files
committed
doc: removed useless plot number in var name
1 parent 771c585 commit e36137f

3 files changed

Lines changed: 54 additions & 54 deletions

File tree

‎docs/src/manual/mtk.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ using Logging # hide
149149
res_ry = with_logger(ConsoleLogger(stderr, Error)) do # hide
150150
res_ry = sim!(nmpc, N, [180.0], plant=plant, x_0=[0, 0], x̂_0=[0, 0, 0])
151151
end #
152-
p1 = plot(res_ry)
153-
savefig("plot1_MTK.svg") # hide
154-
display(p1) # hide
152+
p = plot(res_ry)
153+
savefig(p, "plot1_MTK.svg") # hide
154+
display(p) # hide
155155
```
156156

157157
![plot1_MTK](plot1_MTK.svg)
@@ -162,9 +162,9 @@ and also the output disturbance rejection:
162162
res_yd = with_logger(ConsoleLogger(stderr, Error)) do # hide
163163
res_yd = sim!(nmpc, N, [180.0], plant=plant, x_0=[0, π], x̂_0=[0, π, 0], y_step=[10])
164164
end # hide
165-
p2 = plot(res_yd)
166-
savefig("plot2_MTK.svg") # hide
167-
display(p2) # hide
165+
p = plot(res_yd)
166+
savefig(p, "plot2_MTK.svg") # hide
167+
display(p) # hide
168168
```
169169

170170
![plot2_MTK](plot2_MTK.svg)

‎docs/src/manual/nonlinmpc1.md‎

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ using Plots
7373
u = [0.5]
7474
N = 35
7575
res = sim!(model, N, u)
76-
p1 = plot(res, plotu=false)
77-
savefig("plot1_NonLinMPC.svg") # hide
78-
display(p1) # hide
76+
p = plot(res, plotu=false)
77+
savefig(p, "plot1_NonLinMPC.svg") # hide
78+
display(p) # hide
7979
```
8080

8181
![plot1_NonLinMPC](plot1_NonLinMPC.svg)
@@ -105,9 +105,9 @@ p_plant = copy(p_model)
105105
p_plant[3] = 1.25*p_model[3]
106106
plant = setname!(NonLinModel(f, h, Ts, nu, nx, ny; p=p_plant); u=vu, x=vx, y=vy)
107107
res = sim!(estim, N, [0.5], plant=plant, y_noise=[0.5])
108-
p2 = plot(res, plotu=false, plotxwithx̂=true)
109-
savefig("plot2_NonLinMPC.svg") # hide
110-
display(p2) # hide
108+
p = plot(res, plotu=false, plotxwithx̂=true)
109+
savefig(p, "plot2_NonLinMPC.svg") # hide
110+
display(p) # hide
111111
```
112112

113113
![plot2_NonLinMPC](plot2_NonLinMPC.svg)
@@ -134,9 +134,9 @@ The option `Cwt=Inf` disables the slack variable `ϵ` for constraint softening.
134134
using JuMP; unset_time_limit_sec(nmpc.optim) # hide
135135
ry = [180.0]
136136
res_ry = sim!(nmpc, N, ry, plant=plant, x_0=[0, 0], x̂_0=[0, 0, 0])
137-
p3 = plot(res_ry)
138-
savefig("plot3_NonLinMPC.svg") # hide
139-
display(p3) # hide
137+
p = plot(res_ry)
138+
savefig(p, "plot3_NonLinMPC.svg") # hide
139+
display(p) # hide
140140
```
141141

142142
![plot3_NonLinMPC](plot3_NonLinMPC.svg)
@@ -147,9 +147,9 @@ satisfactory:
147147

148148
```@example man_nonlin
149149
res_yd = sim!(nmpc, N, ry, plant=plant, x_0=[π, 0], x̂_0=[π, 0, 0], y_step=[10])
150-
p4 = plot(res_yd)
151-
savefig("plot4_NonLinMPC.svg") # hide
152-
display(p4) # hide
150+
p = plot(res_yd)
151+
savefig(p, "plot4_NonLinMPC.svg") # hide
152+
display(p) # hide
153153
```
154154

155155
![plot4_NonLinMPC](plot4_NonLinMPC.svg)
@@ -221,9 +221,9 @@ setpoint is similar:
221221
unset_time_limit_sec(empc.optim) # hide
222222
ry = [180.0, 0]
223223
res2_ry = sim!(empc, N, ry, plant=plant2, x_0=[0, 0], x̂_0=[0, 0, 0])
224-
p5 = plot(res2_ry, ploty=[1])
225-
savefig("plot5_NonLinMPC.svg") # hide
226-
display(p5) # hide
224+
p = plot(res2_ry, ploty=[1])
225+
savefig(p, "plot5_NonLinMPC.svg") # hide
226+
display(p) # hide
227227
```
228228

229229
![plot5_NonLinMPC](plot5_NonLinMPC.svg)
@@ -242,9 +242,9 @@ Also, for a 10° step disturbance:
242242

243243
```@example man_nonlin
244244
res2_yd = sim!(empc, N, ry; plant=plant2, x_0=[π, 0], x̂_0=[π, 0, 0], y_step=[10, 0])
245-
p6 = plot(res2_yd, ploty=[1])
246-
savefig("plot6_NonLinMPC.svg") # hide
247-
display(p6) # hide
245+
p = plot(res2_yd, ploty=[1])
246+
savefig(p, "plot6_NonLinMPC.svg") # hide
247+
display(p) # hide
248248
```
249249

250250
![plot6_NonLinMPC](plot6_NonLinMPC.svg)
@@ -330,9 +330,9 @@ function plotWithPower(res, Pmax)
330330
plot!(plt2, t, Pmax, label=raw"$P_\mathrm{max}$", linestyle=:dot, linewidth=1.5)
331331
return plot(plt1, plt2, layout=(2,1))
332332
end
333-
p7 = plotWithPower(res3_ry, Pmax)
334-
savefig("plot7_NonLinMPC.svg") # hide
335-
display(p7) # hide
333+
p = plotWithPower(res3_ry, Pmax)
334+
savefig(p, "plot7_NonLinMPC.svg") # hide
335+
display(p) # hide
336336
```
337337

338338
![plot7_NonLinMPC](plot7_NonLinMPC.svg)
@@ -366,9 +366,9 @@ The linear controller satisfactorily rejects the 10° step disturbance:
366366
```@example man_nonlin
367367
ry = [180.0]
368368
res_lin = sim!(mpc, N, ry; plant, x_0=[π, 0], y_step=[10])
369-
p9 = plot(res_lin)
370-
savefig("plot9_NonLinMPC.svg") # hide
371-
display(p9) # hide
369+
p = plot(res_lin)
370+
savefig(p, "plot9_NonLinMPC.svg") # hide
371+
display(p) # hide
372372
```
373373

374374
![plot9_NonLinMPC](plot9_NonLinMPC.svg)
@@ -406,9 +406,9 @@ does slightly improve the rejection of the step disturbance:
406406

407407
```@example man_nonlin
408408
res_lin2 = sim!(mpc2, N, ry; plant, x_0=[π, 0], y_step=[10])
409-
p10 = plot(res_lin2)
410-
savefig("plot10_NonLinMPC.svg") # hide
411-
display(p10) # hide
409+
p = plot(res_lin2)
410+
savefig(p, "plot10_NonLinMPC.svg") # hide
411+
display(p) # hide
412412
```
413413

414414
![plot10_NonLinMPC](plot10_NonLinMPC.svg)
@@ -427,9 +427,9 @@ results:
427427

428428
```@example man_nonlin
429429
res_ms = sim!(mpc_ms, N, ry; plant, x_0=[π, 0], y_step=[10])
430-
plot!(p10, res_ms)
431-
savefig("plot10b_NonLinMPC.svg") # hide
432-
display(p10) # hide
430+
plot!(p, res_ms)
431+
savefig(p, "plot10b_NonLinMPC.svg") # hide
432+
display(p) # hide
433433
```
434434

435435
![plot10b_NonLinMPC](plot10b_NonLinMPC.svg)
@@ -500,9 +500,9 @@ operating point. The [`SimResult`](@ref) object is for plotting purposes only. T
500500
```@example man_nonlin
501501
x_0 = [0, 0]; x̂_0 = [0, 0, 0];
502502
res_slin = sim_adapt!(mpc3, model, N, ry, plant, x_0, x̂_0)
503-
p12 = plot(res_slin)
504-
savefig("plot12_NonLinMPC.svg") # hide
505-
display(p12) # hide
503+
p = plot(res_slin)
504+
savefig(p, "plot12_NonLinMPC.svg") # hide
505+
display(p) # hide
506506
```
507507

508508
![plot12_NonLinMPC](plot12_NonLinMPC.svg)
@@ -512,9 +512,9 @@ and the 10° step disturbance:
512512
```@example man_nonlin
513513
x_0 = [π, 0]; x̂_0 = [π, 0, 0]; y_step = [10]
514514
res_slin = sim_adapt!(mpc3, model, N, ry, plant, x_0, x̂_0, y_step)
515-
p13 = plot(res_slin)
516-
savefig("plot13_NonLinMPC.svg") # hide
517-
display(p13) # hide
515+
p = plot(res_slin)
516+
savefig(p, "plot13_NonLinMPC.svg") # hide
517+
display(p) # hide
518518
```
519519

520520
![plot13_NonLinMPC](plot13_NonLinMPC.svg)

‎docs/src/manual/nonlinmpc2.md‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ We can now plot the result:
240240

241241
```@example 1
242242
using Plots
243-
p1 = plot(res, plotu=true, plotd=true)
244-
savefig(p1, "plot1_DAEpH.svg") # hide
245-
display(p1) # hide
243+
p = plot(res, plotu=true, plotd=true)
244+
savefig(p, "plot1_DAEpH.svg") # hide
245+
display(p) # hide
246246
```
247247

248248
![plot1_DAEpH](plot1_DAEpH.svg)
@@ -349,9 +349,9 @@ function simMHE(mhe, plant, N; x_0, x̂_0)
349349
end
350350
x̂_0 = [0.025, 0.025, c_Ain]
351351
res = simMHE(mhe, plant, N; x_0, x̂_0)
352-
p2 = plot(res, plotd=false, plotu=false, plotxwithx̂=true, plotx̂min=false)
353-
savefig(p2, "plot2_DAEpH.svg") # hide
354-
display(p2) # hide
352+
p = plot(res, plotd=false, plotu=false, plotxwithx̂=true, plotx̂min=false)
353+
savefig(p, "plot2_DAEpH.svg") # hide
354+
display(p) # hide
355355
```
356356

357357
![plot2_DAEpH](plot2_DAEpH.svg)
@@ -428,9 +428,9 @@ using Logging # hide
428428
res = with_logger(ConsoleLogger(stderr, Error)) do # hide
429429
res = simNMPC(nmpc, plant, N2, ry; x_0=[0.07, 0.04], x̂_0)
430430
end # hide
431-
p3 = plot(res, plotd=false, plotxwithx̂=true, plotx̂min=false, plotŷ=true)
432-
savefig(p3, "plot3_DAEpH.svg") # hide
433-
display(p3) # hide
431+
p = plot(res, plotd=false, plotxwithx̂=true, plotx̂min=false, plotŷ=true)
432+
savefig(p, "plot3_DAEpH.svg") # hide
433+
display(p) # hide
434434
```
435435

436436
![plot3_DAEpH](plot3_DAEpH.svg)
@@ -444,9 +444,9 @@ law responds quickly and returns the effluent pH to the specified range:
444444
res = with_logger(ConsoleLogger(stderr, Error)) do # hide
445445
res = simNMPC(nmpc, plant, N2, ry; x_0=[0.07, 0.04], x̂_0, noise=true)
446446
end # hide
447-
p4 = plot(res, plotd=false, plotxwithx̂=true, plotx̂min=false, plotŷ=true)
448-
savefig(p4, "plot4_DAEpH.svg") # hide
449-
display(p4) # hide
447+
p = plot(res, plotd=false, plotxwithx̂=true, plotx̂min=false, plotŷ=true)
448+
savefig(p, "plot4_DAEpH.svg") # hide
449+
display(p) # hide
450450
```
451451

452452
![plot4_DAEpH](plot4_DAEpH.svg)

0 commit comments

Comments
 (0)