@@ -130,8 +130,6 @@ satisfactory:
130130
131131``` @example 1
132132res_yd = sim!(nmpc, N, [180.0], plant=plant, x0=[π, 0], x̂0=[π, 0, 0], y_step=[10])
133- using BenchmarkTools
134- @btime sim!(nmpc, N, [180.0], plant=plant, x0=[π, 0], x̂0=[π, 0, 0], y_step=[10])
135133plot(res_yd)
136134savefig(ans, "plot4_NonLinMPC.svg"); nothing # hide
137135```
@@ -142,7 +140,7 @@ savefig(ans, "plot4_NonLinMPC.svg"); nothing # hide
142140
143141Nonlinear MPC are more computationally expensive than [ ` LinMPC ` ] ( @ref ) . Solving the problem
144142should always be faster than the sampling time `` T_s = 0.1 `` s for real-time operation. For
145- electronic and mechanical systems like here, this requirement is sometimes harder to achieve
143+ electronic or mechanical systems like here, this requirement is sometimes harder to achieve
146144because of their fast dynamics. To ease the design and comparison with [ ` LinMPC ` ] ( @ref ) , the
147145[ ` linearize ` ] ( @ref ) function allows automatic linearization of [ ` NonLinModel ` ] ( @ref ) based
148146on [ ` ForwardDiff.jl ` ] ( https://juliadiff.org/ForwardDiff.jl/stable/ ) . We first linearize
@@ -155,7 +153,7 @@ linmodel = linearize(model, x=[π, 0], u=[0])
155153
156154It is worth mentionning that the Euler method in ` model ` object is not the best choice for
157155linearization since its accuracy is low (i.e. approximation of a bad approximation). A
158- [ ` SteadyKalmanFilter ` ] ( @ref ) and a [ ` LinMPC ` ] ( @ref ) is designed from ` linmodel ` :
156+ [ ` SteadyKalmanFilter ` ] ( @ref ) and a [ ` LinMPC ` ] ( @ref ) are designed from ` linmodel ` :
159157
160158``` @example 1
161159kf = SteadyKalmanFilter(linmodel; σQ, σR, nint_u, σQint_u)
@@ -201,8 +199,6 @@ does improve the rejection of the step disturbance:
201199
202200``` @example 1
203201res_lin2 = sim!(mpc2, N, [180.0]; plant, x0=[π, 0], y_step=[10])
204- using BenchmarkTools
205- @btime sim!(mpc2, N, [180.0]; plant, x0=[π, 0], y_step=[10])
206202plot(res_lin2)
207203savefig(ans, "plot6_NonLinMPC.svg"); nothing # hide
208204```
@@ -211,7 +207,7 @@ savefig(ans, "plot6_NonLinMPC.svg"); nothing # hide
211207
212208The performance is still lower than the nonlinear controller, as expected, but computations
213209are about 2000 times faster (0.00002 s versus 0.04 s per time steps on average). Note that
214- ` linmodel ` is only valid for angular position near 180°. Multiple linearized models and
210+ ` linmodel ` is only valid for angular positions near 180°. Multiple linearized models and
215211controllers are required for large deviations from this operating point. This is known as
216212gain scheduling.
217213
0 commit comments