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:
@@ -110,7 +110,8 @@ class BatteryModel:
|
|||||||
self._current_charge_value)
|
self._current_charge_value)
|
||||||
|
|
||||||
def log_state_change(self, fn, original_state, new_state):
|
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"):
|
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:
|
if self._charge_discharge_cycles > previous_state._charge_discharge_cycles and self._charge_discharge_cycles / int(self._charge_discharge_cycles) == 1:
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class MarketState:
|
|||||||
elif last_timestamp is not None and last_timestamp < key and key_delta > delta:
|
elif last_timestamp is not None and last_timestamp < key and key_delta > delta:
|
||||||
return last_timestamp, self._market_data[last_timestamp]
|
return last_timestamp, self._market_data[last_timestamp]
|
||||||
else:
|
else:
|
||||||
last_timestamp = key
|
last_timestamp = key
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user