Skip to content

Commit 695f2d9

Browse files
committed
Improve the timing plot.
1 parent f2baef4 commit 695f2d9

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

examples/plots.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ function plot_timing()
3434

3535
sl = log.syslog
3636
time_limit = app.dt/app.set.time_lapse
37-
display(ControlPlots.plotx(sl.time, sl.t_sim, 100*sl.steering, 100*sl.depower;
37+
t_sim = collect(sl.t_sim)
38+
tl = fill(time_limit * 1000, length(t_sim))
39+
display(ControlPlots.plotx(sl.time, [t_sim, tl], 100*sl.steering, 100*sl.depower;
3840
ylabels=["t_sim [ms]", "steering [%]","depower [%]"],
41+
labels=[["t_sim", "time_limit"], "", ""],
3942
fig="timing"))
4043
println("Time limit: $(time_limit*1000) ms")
4144
println("Mean time per timestep: $(mean(sl.t_sim)) ms")
@@ -51,8 +54,9 @@ function plot_timing2()
5154

5255
sl = log.syslog
5356
time_limit = app.dt/app.set.time_lapse
54-
tl = time_limit * ones(length(sl.time)) * 1000
55-
display(ControlPlots.plot(sl.time, [sl.t_sim, tl], ylabel="t_sim [ms]", labels=["t_sim","time_limit"], fig="timing2"))
57+
t_sim = collect(sl.t_sim)
58+
tl = fill(time_limit * 1000, length(t_sim))
59+
display(ControlPlots.plot(sl.time, [t_sim, tl], ylabel="t_sim [ms]", labels=["t_sim","time_limit"], fig="timing2"))
5660
nothing
5761
end
5862

0 commit comments

Comments
 (0)