Refactor BatteryModel and market handling for improved time tracking, logging, and market rate calculations

Something is slow, I suspect its the logging, but time is tight, so I'm going to wrap up to make it at least useable
This commit is contained in:
2026-09-22 18:04:25 +01:00
parent 3000b461ec
commit 99dd7feba6
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -110,7 +110,8 @@ class BatteryModel:
self._current_charge_value)
def log_state_change(self, fn, original_state, new_state):
self._decision_log_handle.write(f"{self.current_time},{self._runtime},{fn},{original_state},{new_state}\n")
# self._decision_log_handle.write(f"{self.current_time},{self._runtime},{fn},{original_state},{new_state}\n")
pass
def handle_storage_capacity_check(self, previous_state: "BatteryModel"):
if self._charge_discharge_cycles > previous_state._charge_discharge_cycles and self._charge_discharge_cycles / int(self._charge_discharge_cycles) == 1:
+1 -1
View File
@@ -42,7 +42,7 @@ class MarketState:
elif last_timestamp is not None and last_timestamp < key and key_delta > delta:
return last_timestamp, self._market_data[last_timestamp]
else:
last_timestamp = key
last_timestamp = key
return None