File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed
Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ The manipulated inputs ``\mathbf{u}`` and measured disturbances ``\mathbf{d}`` a
2121constant at `u` and `d` values, respectively. The plant initial state ``\m athbf{x}(0)`` is
2222specified by `x0` keyword arguments. The function returns `SimResult` instances that can be
2323visualized by calling `plot` from [`Plots.jl`](https://github.com/JuliaPlots/Plots.jl) on
24- them (see Examples below).
24+ them (see Examples below). Note that the method mutates `plant` internal states.
2525
2626# Examples
2727```julia-repl
@@ -182,12 +182,8 @@ function sim_closedloop!(
182182 X̂_data = Matrix {Float64} (undef, estim. nx̂, N)
183183 setstate! (plant, x0)
184184 lastd, lasty = d, evaloutput (plant, d)
185- if isnothing (x̂0)
186- initstate! (est_mpc, lastu, lasty[estim. i_ym], lastd)
187-
188- else
189- setstate! (est_mpc, x̂0)
190- end
185+ initstate! (est_mpc, lastu, lasty[estim. i_ym], lastd)
186+ isnothing (x̂0) || setstate! (est_mpc, x̂0)
191187 for i= 1 : N
192188 d = lastd + d_step + d_noise.* randn (plant. nd)
193189 y = evaloutput (plant, d) + y_step + y_noise.* randn (plant. ny)
You can’t perform that action at this time.
0 commit comments