Merge remote-tracking branch 'origin/main'

This commit is contained in:
Noe 2024-08-05 16:32:20 +02:00
commit 707441d753
2 changed files with 8 additions and 2 deletions

View File

@ -221,7 +221,10 @@ class Aggregator:
except ValueError: except ValueError:
pass pass
if len(node_data) == 1: if len(node_data) == 0:
# No data collected, return default AggregatedData with zeros
return AggregatedData(0.0, 0.0, 0.0, 0.0, 0.0)
elif len(node_data) == 1:
# Directly use the values for a single node # Directly use the values for a single node
for node_number, data in node_data.items(): for node_number, data in node_data.items():
min_soc = data['soc'][0] if data['soc'] else 0.0 min_soc = data['soc'][0] if data['soc'] else 0.0

View File

@ -226,7 +226,10 @@ class Aggregator:
except ValueError: except ValueError:
pass pass
if len(node_data) == 1: if len(node_data) == 0:
# No data collected, return default AggregatedData with zeros
return AggregatedData(0.0, 0.0, 0.0, 0.0, 0.0)
elif len(node_data) == 1:
# Directly use the values for a single node # Directly use the values for a single node
for node_number, data in node_data.items(): for node_number, data in node_data.items():
min_soc = data['soc'][0] if data['soc'] else 0.0 min_soc = data['soc'][0] if data['soc'] else 0.0