evaluate temperature
This commit is contained in:
+18
-18
@@ -128,7 +128,6 @@ def check_sel(root_path, sel: list):
|
||||
|
||||
return res
|
||||
|
||||
|
||||
def process(end_points: list[Endpoint], base_path: str, user: str, vin: str, sel_years=None, sel_months=None, sel_days=None, sel_hours=None):
|
||||
_path = os.path.join(base_path, user)
|
||||
root_path = os.path.join(_path, vin)
|
||||
@@ -148,16 +147,18 @@ def process(end_points: list[Endpoint], base_path: str, user: str, vin: str, sel
|
||||
|
||||
# Sort out files with unknown nickname
|
||||
file_list_sorted = sorted(os.listdir(day_path), key=lambda f: convert(f))
|
||||
vehicle_diff = {}
|
||||
last = {}
|
||||
for filename in file_list_sorted:
|
||||
file_path = os.path.join(day_path, filename)
|
||||
with open(file_path, "r") as fp:
|
||||
records = json.load(fp)
|
||||
print(f"In file \"{filename}\": found {len(records):4d} records")
|
||||
for record in records:
|
||||
try:
|
||||
vehicle_diff = record['data']
|
||||
combined_content = {}
|
||||
for section in ["data", "other_data"]:
|
||||
vehicle_diff = {}
|
||||
last = {}
|
||||
content = {}
|
||||
for record in records:
|
||||
vehicle_diff = record[section]
|
||||
is_header = True
|
||||
if 'is_delta' in record['info']:
|
||||
if record['info']['is_delta']:
|
||||
@@ -166,19 +167,16 @@ def process(end_points: list[Endpoint], base_path: str, user: str, vin: str, sel
|
||||
if is_header:
|
||||
last = {}
|
||||
|
||||
except KeyError as e:
|
||||
print(f"KeyError: {e}")
|
||||
if not has_diff_entries(vehicle_diff):
|
||||
vehicle_diff = {'update_add': vehicle_diff}
|
||||
|
||||
if not has_diff_entries(vehicle_diff):
|
||||
vehicle_diff = {'update_add': vehicle_diff}
|
||||
|
||||
vehicle_data = jay_merge_full(last, vehicle_diff)
|
||||
last = vehicle_data
|
||||
try:
|
||||
vehicle_data = jay_merge_full(last, vehicle_diff)
|
||||
last = vehicle_data
|
||||
for ep in end_points:
|
||||
ep.assign({'info': record['info'], 'data': vehicle_data})
|
||||
except KeyError:
|
||||
pass
|
||||
try:
|
||||
ep.assign({'info': record['info'], section: vehicle_data})
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
for ep in end_points:
|
||||
ep.remove_dups()
|
||||
@@ -254,6 +252,7 @@ def main() -> None:
|
||||
ep_range = find_ep_by_name(end_points, name="range")
|
||||
ep_chgpwr = find_ep_by_name(end_points, name="chgpwr")
|
||||
ep_chg_state = find_ep_by_name(end_points, name="chg_state")
|
||||
ep_temperature = find_ep_by_name(end_points, name="temperature")
|
||||
|
||||
time_h = make_time(dt_start, dt_stop, td_step)
|
||||
|
||||
@@ -263,6 +262,7 @@ def main() -> None:
|
||||
v_range = make_values(time_h, ep_range)
|
||||
v_chgpwr = make_values(time_h, ep_chgpwr)
|
||||
v_chg_state = make_values(time_h, ep_chg_state)
|
||||
v_temperature = make_values(time_h, ep_temperature)
|
||||
|
||||
# calc speed
|
||||
speed = [0]
|
||||
@@ -310,7 +310,7 @@ def main() -> None:
|
||||
plot.ylabel("Speed")
|
||||
plot.grid()
|
||||
plot.subplot(NUM_PLOTS, 1, 3)
|
||||
plot.plot(dt_h, v_soc, dt_h, v_chgpwr)
|
||||
plot.plot(dt_h, v_soc, dt_h, v_chgpwr, dt_h, v_temperature)
|
||||
plot.ylabel("Akkustand")
|
||||
plot.grid()
|
||||
plot.subplot(NUM_PLOTS, 1, 4)
|
||||
|
||||
Reference in New Issue
Block a user