added vertical line

This commit is contained in:
2025-11-21 21:35:44 +01:00
parent 8ea258b8c4
commit 989be65c55
+10 -2
View File
@@ -272,7 +272,7 @@ def main() -> None:
speed.append(dv/dt*60*60)
# Convert x-axis
dt_h = (np.array(time_h) - time_h[0]) / 3600 / 24 + settings.sel_days[0]
dt_h = (np.array(time_h) - time_h[0]) / 3600.0 / 24 + settings.sel_days[0]
dt_h -= settings.sel_days[0]
dt_h *= 24
@@ -285,7 +285,7 @@ def main() -> None:
odo_diff_last = 0
# Calc charging energy
for chgpwr, chgstate, odo in zip(v_chgpwr, v_chg_state, v_odo):
energy += chgpwr/3600*dt
energy += float(chgpwr)/3600*dt
if chg_state_last != chgstate:
chg_state_last = chgstate
if ChargingState[chgstate] == ChargingState.charging:
@@ -298,34 +298,42 @@ def main() -> None:
v_consumption.append(consumption)
v_energy.append(energy)
now = datetime_to_int(datetime.now())
curr_time = float((now - datetime_to_int(dt_start)))/3600
# plot data
NUM_PLOTS = 6
plot.subplot(NUM_PLOTS, 1, 1)
plot.plot(dt_h, np.array(v_odo) - v_odo[0])
plot.ylabel("Kilometerstand")
plot.axvline(x=curr_time, color='r')
plot.grid()
plot.subplot(NUM_PLOTS, 1, 2)
plot.plot(dt_h, speed)
plot.ylabel("Speed")
plot.axvline(x=curr_time, color='r')
plot.grid()
plot.subplot(NUM_PLOTS, 1, 3)
plot.plot(dt_h, v_soc, dt_h, v_chgpwr, dt_h, v_temperature)
plot.ylabel("Akkustand")
plot.axvline(x=curr_time, color='r')
plot.grid()
plot.subplot(NUM_PLOTS, 1, 4)
normalized_range = 100*np.array(v_range)/v_soc
normalized_range_mean = np.mean(normalized_range)
plot.plot(dt_h, v_range, dt_h, normalized_range, dt_h, normalized_range_mean*np.ones(normalized_range.shape))
plot.ylabel("Range")
plot.axvline(x=curr_time, color='r')
plot.grid()
plot.subplot(NUM_PLOTS, 1, 5)
plot.plot(dt_h, v_chg_state)
plot.ylabel("Charge state")
plot.axvline(x=curr_time, color='r')
plot.grid()
plot.subplot(NUM_PLOTS, 1, 6)
plot.plot(dt_h, v_energy, dt_h, v_consumption)
plot.ylabel("Charge energy")
plot.axvline(x=curr_time, color='r')
plot.grid()
plot.show()