Skip to content

Commit

Permalink
Add plot Energy
Browse files Browse the repository at this point in the history
  • Loading branch information
ufechner7 committed Mar 26, 2024
1 parent 7131016 commit 23b6034
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions examples/autopilot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,14 @@ end
function plot_power()
log = load_log(PARTICLES, basename(KiteViewers.plot_file[]))
sl = log.syslog
display(plotx(log.syslog.time, sl.force, sl.v_reelout, sl.force.*sl.v_reelout;
ylabels=["force [N]", L"v_\mathrm{ro}~[m/s]", L"P_\mathrm{m}~[W]"],
energy = similar(sl.v_reelout)
en=0.0
for i in eachindex(energy)
en += sl.force[i]*sl.v_reelout[i]
energy[i] = en
end
display(plotx(log.syslog.time, sl.force, sl.v_reelout, sl.force.*sl.v_reelout, energy./3600;
ylabels=["force [N]", L"v_\mathrm{ro}~[m/s]", L"P_\mathrm{m}~[W]", "Energy [Wh]"],
fig="power"))
plt.pause(0.01)
plt.show(block=false)
Expand Down

0 comments on commit 23b6034

Please sign in to comment.