@@ -42,6 +42,7 @@ julia> res = SimResult(plant, U_data, Y_data)
42
42
Simulation results of LinModel with 5 time steps.
43
43
44
44
julia> using Plots; plot(res)
45
+
45
46
```
46
47
"""
47
48
function SimResult (
@@ -83,7 +84,7 @@ get_nx̂(mpc::PredictiveController) = mpc.estim.nx̂
83
84
84
85
function Base. show (io:: IO , res:: SimResult )
85
86
N = length (res. T_data)
86
- print (io, " Simulation results of $(typeof (res. obj)) with $N time steps." )
87
+ print (io, " Simulation results of $(typeof (res. obj). name . name ) with $N time steps." )
87
88
end
88
89
89
90
@@ -102,7 +103,8 @@ on them (see Examples below). Note that the method mutates `plant` internal stat
102
103
```julia-repl
103
104
julia> plant = NonLinModel((x,u,d)->0.1x+u+d, (x,_)->2x, 10.0, 1, 1, 1, 1);
104
105
105
- julia> res = sim!(plant, 15, [0], [0], x0=[1]);
106
+ julia> res = sim!(plant, 15, [0], [0], x0=[1])
107
+ Simulation results of NonLinModel with 15 time steps.
106
108
107
109
julia> using Plots; plot(res, plotu=false, plotd=false, plotx=true)
108
110
@@ -169,9 +171,10 @@ vectors. The simulated sensor and process noises of `plant` are specified by `y_
169
171
```julia-repl
170
172
julia> model = LinModel(tf(3, [30, 1]), 0.5);
171
173
172
- julia> estim = KalmanFilter(model, σR=[0.5], σQ=[0.25], σQ_int =[0.01], σP0_int =[0.1]);
174
+ julia> estim = KalmanFilter(model, σR=[0.5], σQ=[0.25], σQint_ym =[0.01], σP0int_ym =[0.1]);
173
175
174
- julia> res = sim!(estim, 50, [0], y_noise=[0.5], x_noise=[0.25], x0=[-10], x̂0=[0, 0]);
176
+ julia> res = sim!(estim, 50, [0], y_noise=[0.5], x_noise=[0.25], x0=[-10], x̂0=[0, 0])
177
+ Simulation results of KalmanFilter with 50 time steps.
175
178
176
179
julia> using Plots; plot(res, plotŷ=true, plotu=false, plotxwithx̂=true)
177
180
@@ -208,7 +211,8 @@ julia> model = LinModel([tf(3, [30, 1]); tf(2, [5, 1])], 4);
208
211
209
212
julia> mpc = setconstraint!(LinMPC(model, Mwt=[0, 1], Nwt=[0.01], Hp=30), ymin=[0, -Inf]);
210
213
211
- julia> res = sim!(mpc, 25, [0, 0], y_noise=[0.1], y_step=[-10, 0]);
214
+ julia> res = sim!(mpc, 25, [0, 0], y_noise=[0.1], y_step=[-10, 0])
215
+ Simulation results of LinMPC with 25 time steps.
212
216
213
217
julia> using Plots; plot(res, plotry=true, plotŷ=true, plotymin=true, plotu=true)
214
218
0 commit comments