@@ -139,13 +139,13 @@ Lastly, we plot the closed-loop test with the `Plots` package:
139139``` @example 1
140140using Plots
141141function plot_data(t_data, u_data, y_data, ry_data)
142- p1 = plot(t_data, y_data[1,:], label="meas."); ylabel!( "level")
142+ p1 = plot(t_data, y_data[1,:], label="meas.", ylabel= "level")
143143 plot!(p1, t_data, ry_data[1,:], label="setpoint", linestyle=:dash, linetype=:steppost)
144144 plot!(p1, t_data, fill(45,size(t_data)), label="min", linestyle=:dot, linewidth=1.5)
145- p2 = plot(t_data, y_data[2,:], label="meas.", legend=:topleft); ylabel!( "temp.")
145+ p2 = plot(t_data, y_data[2,:], label="meas.", legend=:topleft, ylabel= "temp.")
146146 plot!(p2, t_data, ry_data[2,:],label="setpoint", linestyle=:dash, linetype=:steppost)
147- p3 = plot(t_data,u_data[1,:],label="cold", linetype=:steppost); ylabel!( "flow rate")
148- plot!(p3, t_data,u_data[2,:],label="hot", linetype=:steppost); xlabel!( "time (s)")
147+ p3 = plot(t_data,u_data[1,:],label="cold", linetype=:steppost, ylabel= "flow rate")
148+ plot!(p3, t_data,u_data[2,:],label="hot", linetype=:steppost, xlabel= "time (s)")
149149 return plot(p1, p2, p3, layout=(3,1))
150150end
151151plot_data(t_data, u_data, y_data, ry_data)
@@ -186,15 +186,16 @@ under a past time window ``H_e``. Bounds on the estimated plant state ``\mathbf{
186186estimated process noise `` \mathbf{ŵ} `` and estimated sensor noise `` \mathbf{v̂} `` can be
187187included in the problem. This can be useful to add physical knowledge in the soft sensor,
188188without adding new physical sensors (e.g. a strictly positive concentration). The
189- closed-loop performance of a state feedback controller, like here, depends on the accuracy
189+ closed-loop performance of any state feedback controller, like here, depends on the accuracy
190190of the plant state estimate.
191191
192192For the CSTR, we will bound the innovation term ``\mathbf{\mathbf{y}(k) - \mathbf{ŷ}(k)} =
193- \mathbf{v̂}`` , and increase `` \mathbf{Q_ {int_u}}`` to accelerate the estimation of the load
194- disturbance. The rejection is slightly faster:
193+ \mathbf{v̂}``, and increase the hot water unmeasured disturbance covariance in
194+ `` \mathbf{Q_{int_u}} `` to accelerate the estimation of the load disturbance. The rejection
195+ is slightly faster:
195196
196197``` @example 1
197- estim = MovingHorizonEstimator(model, He=10, nint_u=[1, 1], σQint_u = [2 , 2])
198+ estim = MovingHorizonEstimator(model, He=10, nint_u=[1, 1], σQint_u = [1 , 2])
198199estim = setconstraint!(estim, v̂min=[-1, -0.5], v̂max=[+1, +0.5])
199200mpc_mhe = LinMPC(estim, Hp=10, Hc=2, Mwt=[1, 1], Nwt=[0.1, 0.1])
200201mpc_mhe = setconstraint!(mpc_mhe, ymin=[45, -Inf])
@@ -211,8 +212,9 @@ savefig(ans, "plot3_LinMPC.svg"); nothing # hide
211212## Adding Feedforward Compensation
212213
213214Suppose that the load disturbance `` u_l `` of the last section is in fact caused by a
214- separate hot water pipe that discharges into the tank. Measuring this flow rate allows us to
215- incorporate feedforward compensation in the controller. The new plant model is:
215+ separate hot water pipe that discharges into the tank. Adding a new sensor to measure this
216+ flow rate allows us to incorporate feedforward compensation in the controller. The new plant
217+ model is:
216218
217219``` math
218220\begin{bmatrix}
0 commit comments