mirror of
https://github.com/flobz/psa_car_controller.git
synced 2026-08-24 02:16:14 +00:00
fix units
This commit is contained in:
@@ -143,7 +143,7 @@ class Trips(list):
|
||||
elif distance == 0 and charge > 2:
|
||||
end_trip = True
|
||||
if DEBUG:
|
||||
logger.debug(f"charge detected {charge}")
|
||||
logger.debug(f"charge detected")
|
||||
elif speed_average < 0.2 and duration > 0.05:
|
||||
# (distance == 0 and duration > 0.08) or duration > 2 or
|
||||
# check the speed to handle missing point
|
||||
@@ -183,7 +183,7 @@ class Trips(list):
|
||||
if DEBUG:
|
||||
logger.debug(
|
||||
f"Trip: {tr.start_at} -> {tr.end_at} {tr.distance:.1f}km {tr.duration:.2f}h {tr.speed_average:.0f}km/h "
|
||||
f"{tr.consumption:.2f}kw {tr.consumption_km:.2f}kw/100km {tr.consumption_fuel}L {tr.consumption_fuel_km}L/100km "
|
||||
f"{tr.consumption:.2f}kWh {tr.consumption_km:.2f}kWh/100km {tr.consumption_fuel}L {tr.consumption_fuel_km}L/100km "
|
||||
f"{tr.mileage:.1f}km")
|
||||
# filter bad value
|
||||
if tr.consumption_km < 70 and (
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ def display_value(value):
|
||||
filtered_trips.append(trip)
|
||||
filtered_chargings = MyPSACC.get_chargings(min,max)
|
||||
figures.get_figures(filtered_trips,filtered_chargings)
|
||||
consumption = "Average consumption: {:.1f} kW/100km".format(float(figures.consumption_df.mean(numeric_only=True)))
|
||||
consumption = "Average consumption: {:.1f} kWh/100km".format(float(figures.consumption_df.mean(numeric_only=True)))
|
||||
return figures.trips_map, figures.consumption_fig, figures.consumption_fig_by_speed, consumption, figures.table_fig, figures.battery_info
|
||||
|
||||
|
||||
|
||||
+6
-5
@@ -77,7 +77,7 @@ def get_figures(trips: List[Trip], charging: List[dict]):
|
||||
{'id': 'speed_average', 'name': 'average speed', 'type': 'numeric',
|
||||
'format': deepcopy(nb_format).symbol_suffix(" km/h").precision(0)},
|
||||
{'id': 'consumption_km', 'name': 'average consumption', 'type': 'numeric',
|
||||
'format': deepcopy(nb_format).symbol_suffix(" kw/100km")},
|
||||
'format': deepcopy(nb_format).symbol_suffix(" kWh/100km")},
|
||||
{'id': 'consumption_fuel_km', 'name': 'average consumption fuel', 'type': 'numeric',
|
||||
'format': deepcopy(nb_format).symbol_suffix(" L/100km")},
|
||||
{'id': 'distance', 'name': 'distance', 'type': 'numeric', 'format': nb_format.symbol_suffix(" km").precision(1)},
|
||||
@@ -100,7 +100,7 @@ def get_figures(trips: List[Trip], charging: List[dict]):
|
||||
name="Trips"))
|
||||
consumption_fig_by_speed.update_layout(xaxis_title="average Speed km/h", yaxis_title="Consumption kWh/100Km")
|
||||
kw_per_km = float(consumption_df.mean(numeric_only=True))
|
||||
info = "Average consumption: {:.1f} kW/100km".format(kw_per_km)
|
||||
info = "Average consumption: {:.1f} kWh/100km".format(kw_per_km)
|
||||
|
||||
# charging
|
||||
charging_data = DataFrame.from_records(charging)
|
||||
@@ -118,6 +118,7 @@ def get_figures(trips: List[Trip], charging: List[dict]):
|
||||
charge_speed = 0
|
||||
except KeyError: # when there is no data yet:
|
||||
charge_speed = 0
|
||||
battery_info = html.Div(children=[html.P("Average gC02/kW: {:.1f}".format(co2_per_kw)),
|
||||
html.P("Average gC02/km: {:1f}".format(co2_per_km)),
|
||||
html.P("Average Charge SPEED {:1f} kW/h".format(charge_speed))])
|
||||
battery_info = html.Div(children=[
|
||||
html.P("Average C02 emission: {:.1f} g/kWh".format(co2_per_kw)),
|
||||
html.P("Average CO2 emission: {:.1f} g/km".format(co2_per_km)),
|
||||
html.P("Average charge speed: {:.3f} kW".format(charge_speed))])
|
||||
|
||||
Reference in New Issue
Block a user