Skip to content

Commit 52b1262

Browse files
committed
added : sim! function for SimModel type and doc
1 parent 9fddfef commit 52b1262

File tree

5 files changed

+334
-166
lines changed

5 files changed

+334
-166
lines changed

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1111
OSQP = "ab2f91bb-94b4-55e3-9ba0-7f65df51de79"
1212
PreallocationTools = "d236fae5-4411-538c-8e31-a6e3d9e00b46"
1313
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
14+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1415
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
1516

1617
[compat]

docs/src/public/generic_func.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ setstate!
3131
## Quick Simulation
3232

3333
```@docs
34-
sim
34+
sim!
3535
```

example/juMPC.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,15 @@ default(fontfamily="Computer Modern"); scalefontsizes(1.1)
154154
test_mpc(linModel4 , mpc)
155155
@time u_data, y_data, r_data, d_data = test_mpc(linModel4, mpc)
156156

157+
resM = sim!(nonLinModel2, mpc.Hp+10, [1,-1])
158+
psM = plot(resM)
159+
display(psM)
157160

158-
res = sim(mpc, mpc.Hp+10, x0=zeros(mpc.estim.model.nx))
161+
res = sim!(mpc, mpc.Hp+10)
159162
ps = plot(res)
160163
display(ps)
161164

162-
res2 = sim(uscKalmanFilter1, mpc.Hp+10)
165+
res2 = sim!(uscKalmanFilter1, mpc.Hp+10)
163166
ps2 = plot(res2)
164167
display(ps2)
165168

src/ModelPredictiveControl.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module ModelPredictiveControl
22

33
using PrecompileTools
44

5-
using LinearAlgebra
5+
using LinearAlgebra, Random
66
using RecipesBase
77
using ControlSystemsBase
88
using JuMP
@@ -14,7 +14,7 @@ export SimModel, LinModel, NonLinModel, setop!, setstate!, updatestate!, evalout
1414
export StateEstimator, InternalModel
1515
export SteadyKalmanFilter, KalmanFilter, UnscentedKalmanFilter
1616
export initstate!
17-
export PredictiveController, LinMPC, NonLinMPC, setconstraint!, moveinput!, getinfo, sim
17+
export PredictiveController, LinMPC, NonLinMPC, setconstraint!, moveinput!, getinfo, sim!
1818

1919
include("sim_model.jl")
2020
include("state_estim.jl")

0 commit comments

Comments
 (0)