Skip to content

Commit

Permalink
Fix battery scaling computation to account for buy rate in export (#1130
Browse files Browse the repository at this point in the history
)

* Fix battery scaling computation to account for buy rate in export

* [pre-commit.ci lite] apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
  • Loading branch information
springfall2008 and pre-commit-ci-lite[bot] authored May 20, 2024
1 parent 9c0d377 commit f5373d5
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions apps/predbat/predbat.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
if not "PRED_GLOBAL" in globals():
PRED_GLOBAL = {}

THIS_VERSION = "v7.19.6"
THIS_VERSION = "v7.19.7"
PREDBAT_FILES = ["predbat.py"]
TIME_FORMAT = "%Y-%m-%dT%H:%M:%S%z"
TIME_FORMAT_SECONDS = "%Y-%m-%dT%H:%M:%S.%f%z"
Expand Down Expand Up @@ -9972,17 +9972,9 @@ def compute_metric(
# Balancing payment to account for battery left over
# ie. how much extra battery is worth to us in future, assume it's the same as low rate
rate_min = self.rate_min_forward.get(end_record, self.rate_min) / self.inverter_loss / self.battery_loss + self.metric_battery_cycle
metric -= (
(soc + final_iboost)
* max(rate_min, 1.0, self.rate_export_min * self.inverter_loss * self.battery_loss_discharge - self.metric_battery_cycle)
* self.metric_battery_value_scaling
)
metric10 -= (
(soc10 + final_iboost10)
* max(rate_min, 1.0, self.rate_export_min * self.inverter_loss * self.battery_loss_discharge - self.metric_battery_cycle)
* self.metric_battery_value_scaling
)

rate_export_min = self.rate_export_min * self.inverter_loss * self.battery_loss_discharge - self.metric_battery_cycle - rate_min
metric -= (soc + final_iboost) * max(rate_min, 1.0, rate_export_min) * self.metric_battery_value_scaling
metric10 -= (soc10 + final_iboost10) * max(rate_min, 1.0, rate_export_min) * self.metric_battery_value_scaling
# Metric adjustment based on 10% outcome weighting
if metric10 > metric:
metric_diff = metric10 - metric
Expand Down

0 comments on commit f5373d5

Please sign in to comment.