Skip to content

Commit

Permalink
improve t_sim logging and plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
ufechner7 committed Apr 3, 2024
1 parent df8a35b commit 1221689
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion examples/autopilot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function simulate(integrator, stopped=true)
e_mech += (sys_state.force * sys_state.v_reelout)/3600*dt
sys_state.e_mech = e_mech
sys_state.sys_state = Int16(ssc.fpp._state)
sys_state.t_sim = t_sim
sys_state.t_sim = t_sim*1000
log!(logger, sys_state)
if TIME_LAPSE_RATIO >= 2
ratio = 2
Expand Down Expand Up @@ -322,3 +322,9 @@ nothing
# Mean time per timestep: 3.5648891855434783 ms
# Maximum time per timestep: 14.024168999999999 ms
# Maximum for t>12s : 14.024168999999999 ms

# GC disabled, Ryzen 7950X, 4x realtime, DFBDF solver
# Missed the deadline for 0.0 %. Max time: 25.0 ms
# Mean time per timestep: 0.0007918275678260871 ms
# Maximum time per timestep: 0.008085809 ms
# Maximum for t>12s : 0.008085809 ms
2 changes: 1 addition & 1 deletion examples/plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function plot_timing()
ylabels=["t_sim [ms]", "steering [%]","depower [%]"],
fig="timing"))
println("Mean time per timestep: $(mean(sl.t_sim)) ms")
println("Maximum time per timestep: $(maximum(sl.t_sim)) ms")
println("Maximum time per timestep: $(maximum(sl.t_sim[10:end])) ms")
index = Int64(round(12/dt))
println("Maximum for t>12s : $(maximum(sl.t_sim[index:end])) ms")
plt.pause(0.01)
Expand Down

0 comments on commit 1221689

Please sign in to comment.