Skip to content

Commit 0314e6b

Browse files
committed
added: show progress of sim! in VS Code status bar
1 parent 312551a commit 0314e6b

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1212
OSQP = "ab2f91bb-94b4-55e3-9ba0-7f65df51de79"
1313
PreallocationTools = "d236fae5-4411-538c-8e31-a6e3d9e00b46"
1414
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
15+
ProgressLogging = "33c8b6b6-d38a-422a-b730-caa89a2f386c"
1516
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1617
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
1718

@@ -29,10 +30,10 @@ RecipesBase = "1"
2930
julia = "1.6"
3031

3132
[extras]
33+
DAQP = "c47d62df-3981-49c8-9651-128b1cd08617"
3234
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3335
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
3436
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
35-
DAQP = "c47d62df-3981-49c8-9651-128b1cd08617"
3637

3738
[targets]
3839
test = ["Test", "Documenter", "Plots", "DAQP"]

src/ModelPredictiveControl.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ using LinearAlgebra
55
using Random: randn
66

77
using RecipesBase
8+
using ProgressLogging
89
using ForwardDiff
910

1011
import ControlSystemsBase

src/plot_sim.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function sim!(
126126
D_data = Matrix{NT}(undef, plant.nd, N)
127127
X_data = Matrix{NT}(undef, plant.nx, N)
128128
setstate!(plant, x_0)
129-
for i=1:N
129+
@progress name="$(typeof(plant).name.name) simulation" for i=1:N
130130
y = evaloutput(plant, d)
131131
Y_data[:, i] .= y
132132
U_data[:, i] .= u
@@ -274,7 +274,7 @@ function sim_closedloop!(
274274
lastd, lasty = d, evaloutput(plant, d)
275275
initstate!(est_mpc, lastu, lasty[estim.i_ym], lastd)
276276
isnothing(x̂_0) || setstate!(est_mpc, x̂_0)
277-
for i=1:N
277+
@progress name="$(typeof(est_mpc).name.name) simulation" for i=1:N
278278
d = lastd + d_step + d_noise.*randn(plant.nd)
279279
y = evaloutput(plant, d) + y_step + y_noise.*randn(plant.ny)
280280
ym = y[estim.i_ym]

0 commit comments

Comments
 (0)