added vertical line
This commit is contained in:
+10
-2
@@ -272,7 +272,7 @@ def main() -> None:
|
|||||||
speed.append(dv/dt*60*60)
|
speed.append(dv/dt*60*60)
|
||||||
|
|
||||||
# Convert x-axis
|
# 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 -= settings.sel_days[0]
|
||||||
dt_h *= 24
|
dt_h *= 24
|
||||||
@@ -285,7 +285,7 @@ def main() -> None:
|
|||||||
odo_diff_last = 0
|
odo_diff_last = 0
|
||||||
# Calc charging energy
|
# Calc charging energy
|
||||||
for chgpwr, chgstate, odo in zip(v_chgpwr, v_chg_state, v_odo):
|
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:
|
if chg_state_last != chgstate:
|
||||||
chg_state_last = chgstate
|
chg_state_last = chgstate
|
||||||
if ChargingState[chgstate] == ChargingState.charging:
|
if ChargingState[chgstate] == ChargingState.charging:
|
||||||
@@ -298,34 +298,42 @@ def main() -> None:
|
|||||||
|
|
||||||
v_consumption.append(consumption)
|
v_consumption.append(consumption)
|
||||||
v_energy.append(energy)
|
v_energy.append(energy)
|
||||||
|
now = datetime_to_int(datetime.now())
|
||||||
|
curr_time = float((now - datetime_to_int(dt_start)))/3600
|
||||||
|
|
||||||
# plot data
|
# plot data
|
||||||
NUM_PLOTS = 6
|
NUM_PLOTS = 6
|
||||||
plot.subplot(NUM_PLOTS, 1, 1)
|
plot.subplot(NUM_PLOTS, 1, 1)
|
||||||
plot.plot(dt_h, np.array(v_odo) - v_odo[0])
|
plot.plot(dt_h, np.array(v_odo) - v_odo[0])
|
||||||
plot.ylabel("Kilometerstand")
|
plot.ylabel("Kilometerstand")
|
||||||
|
plot.axvline(x=curr_time, color='r')
|
||||||
plot.grid()
|
plot.grid()
|
||||||
plot.subplot(NUM_PLOTS, 1, 2)
|
plot.subplot(NUM_PLOTS, 1, 2)
|
||||||
plot.plot(dt_h, speed)
|
plot.plot(dt_h, speed)
|
||||||
plot.ylabel("Speed")
|
plot.ylabel("Speed")
|
||||||
|
plot.axvline(x=curr_time, color='r')
|
||||||
plot.grid()
|
plot.grid()
|
||||||
plot.subplot(NUM_PLOTS, 1, 3)
|
plot.subplot(NUM_PLOTS, 1, 3)
|
||||||
plot.plot(dt_h, v_soc, dt_h, v_chgpwr, dt_h, v_temperature)
|
plot.plot(dt_h, v_soc, dt_h, v_chgpwr, dt_h, v_temperature)
|
||||||
plot.ylabel("Akkustand")
|
plot.ylabel("Akkustand")
|
||||||
|
plot.axvline(x=curr_time, color='r')
|
||||||
plot.grid()
|
plot.grid()
|
||||||
plot.subplot(NUM_PLOTS, 1, 4)
|
plot.subplot(NUM_PLOTS, 1, 4)
|
||||||
normalized_range = 100*np.array(v_range)/v_soc
|
normalized_range = 100*np.array(v_range)/v_soc
|
||||||
normalized_range_mean = np.mean(normalized_range)
|
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.plot(dt_h, v_range, dt_h, normalized_range, dt_h, normalized_range_mean*np.ones(normalized_range.shape))
|
||||||
plot.ylabel("Range")
|
plot.ylabel("Range")
|
||||||
|
plot.axvline(x=curr_time, color='r')
|
||||||
plot.grid()
|
plot.grid()
|
||||||
plot.subplot(NUM_PLOTS, 1, 5)
|
plot.subplot(NUM_PLOTS, 1, 5)
|
||||||
plot.plot(dt_h, v_chg_state)
|
plot.plot(dt_h, v_chg_state)
|
||||||
plot.ylabel("Charge state")
|
plot.ylabel("Charge state")
|
||||||
|
plot.axvline(x=curr_time, color='r')
|
||||||
plot.grid()
|
plot.grid()
|
||||||
plot.subplot(NUM_PLOTS, 1, 6)
|
plot.subplot(NUM_PLOTS, 1, 6)
|
||||||
plot.plot(dt_h, v_energy, dt_h, v_consumption)
|
plot.plot(dt_h, v_energy, dt_h, v_consumption)
|
||||||
plot.ylabel("Charge energy")
|
plot.ylabel("Charge energy")
|
||||||
|
plot.axvline(x=curr_time, color='r')
|
||||||
plot.grid()
|
plot.grid()
|
||||||
|
|
||||||
plot.show()
|
plot.show()
|
||||||
|
|||||||
Reference in New Issue
Block a user