Skip to content

Commit 9f95d97

Browse files
committed
added : sim function for StateEstimator
1 parent e572849 commit 9f95d97

File tree

6 files changed

+393
-266
lines changed

6 files changed

+393
-266
lines changed

docs/src/public/sim_model.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ Pages = ["sim_model.md"]
77
The [`SimModel`](@ref) types represents discrete state-space models that can be used to
88
construct [`StateEstimator`](@ref)s and [`PredictiveController`](@ref)s, or as plant
99
simulators by calling [`evaloutput`](@ref) and [`updatestate!`](@ref) methods on
10-
[`SimModel`](@ref) objects (to test estimator/controller designs). For time simulations, the
11-
states `x` are stored inside [`SimModel`](@ref) objects. Use [`setstate!`](@ref) method
12-
to manually modify them.
10+
[`SimModel`](@ref) instances (to test estimator/controller designs). For time simulations,
11+
the states `x` are stored inside [`SimModel`](@ref) instances. Use [`setstate!`](@ref)
12+
method to manually modify them.
1313

1414
## SimModel
1515

example/juMPC.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,18 @@ using PlotThemes, Plots
151151
theme(:dark)
152152
default(fontfamily="Computer Modern"); scalefontsizes(1.1)
153153

154-
test_mpc(linModel4, mpc)
154+
test_mpc(linModel4 , mpc)
155155
@time u_data, y_data, r_data, d_data = test_mpc(linModel4, mpc)
156156

157157

158158
res = sim(mpc, mpc.Hp+10, x0=zeros(mpc.estim.model.nx))
159159
ps = plot(res, plotD=false, plotŶminŶmax=false, plotUminUmax=false)
160160
display(ps)
161161

162+
res2 = sim(uscKalmanFilter1, mpc.Hp+10)
163+
ps2 = plot(res2)
164+
display(ps2)
165+
162166
#=
163167
test_mpc(linModel4, nmpc)
164168
@time u_data, y_data, r_data, d_data = test_mpc(linModel4, nmpc)

src/ModelPredictiveControl.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export PredictiveController, LinMPC, NonLinMPC, setconstraint!, moveinput!, geti
1919
include("sim_model.jl")
2020
include("state_estim.jl")
2121
include("predictive_control.jl")
22-
include("plots.jl")
22+
include("plot_sim.jl")
2323

2424
@setup_workload begin
2525
# Putting some things in `@setup_workload` instead of `@compile_workload` can reduce the size of the

0 commit comments

Comments
 (0)