Skip to content

Commit

Permalink
[pre-commit.ci lite] apply automatic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci-lite[bot] authored Dec 13, 2024
1 parent a9f71dc commit 0da3c62
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
2 changes: 2 additions & 0 deletions apps/predbat/predbat.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
try:
import adbase as ad
import appdaemon.plugins.hass.hassapi as hass

IS_APPDAEMON = True
except:
import hass as hass

IS_APPDAEMON = False

import pytz
Expand Down
50 changes: 24 additions & 26 deletions apps/predbat/unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,8 +907,8 @@ def run_single_debug(my_predbat, debug_file):

# Force off combine export XXX:
print("Combined export slots {}".format(my_predbat.combine_export_slots))
#my_predbat.combine_export_slots = False
#my_predbat.best_soc_keep = 1.0
# my_predbat.combine_export_slots = False
# my_predbat.best_soc_keep = 1.0
my_predbat.metric_min_improvement_export = 5

if re_do_rates:
Expand Down Expand Up @@ -953,13 +953,13 @@ def run_single_debug(my_predbat, debug_file):
load_forecast=my_predbat.load_forecast,
load_scaling_dynamic=my_predbat.load_scaling_dynamic,
cloud_factor=min(my_predbat.metric_load_divergence + 0.5, 1.0) if my_predbat.metric_load_divergence else None,
)
)

pv_step = my_predbat.pv_forecast_minute_step
pv10_step = my_predbat.pv_forecast_minute10_step
load_step = my_predbat.load_minutes_step
load10_step = my_predbat.load_minutes_step10

my_predbat.prediction = Prediction(my_predbat, pv_step, pv_step, load_step, load_step)
my_predbat.debug_enable = True

Expand Down Expand Up @@ -1048,7 +1048,6 @@ def run_single_debug(my_predbat, debug_file):
print("Wrote plan to plan_final.html")



def run_execute_tests(my_predbat):
print("**** Running execute tests ****\n")
reset_inverter(my_predbat)
Expand Down Expand Up @@ -1299,22 +1298,22 @@ def run_execute_tests(my_predbat):
return failed

my_predbat.battery_charge_power_curve = {
100 : 0.50,
99 : 0.50,
98 : 0.50,
97 : 0.50,
96 : 0.50,
95 : 0.50,
94 : 1.00,
93 : 1.00,
92 : 1.00,
91 : 1.00,
90 : 1.00,
89 : 1.00,
88 : 1.00,
87 : 1.00,
86 : 1.00,
85 : 1.00,
100: 0.50,
99: 0.50,
98: 0.50,
97: 0.50,
96: 0.50,
95: 0.50,
94: 1.00,
93: 1.00,
92: 1.00,
91: 1.00,
90: 1.00,
89: 1.00,
88: 1.00,
87: 1.00,
86: 1.00,
85: 1.00,
}

# 60 minutes - 10 minute margin = 50 minutes to add 0.75kWh to each battery (x2 inverters)
Expand Down Expand Up @@ -2941,10 +2940,10 @@ def run_model_tests(my_predbat):
failed |= simple_scenario("load_only", my_predbat, 1, 0, assert_final_metric=import_rate * 24, assert_final_soc=0, with_battery=False)
failed |= simple_scenario("load_bat_ac", my_predbat, 4, 0, assert_final_metric=import_rate * 24 * 3.2, assert_final_soc=100 - 24, with_battery=True, battery_soc=100.0, inverter_loss=0.8)
failed |= simple_scenario("load_bat_dc", my_predbat, 4, 0, assert_final_metric=import_rate * 24 * 3.2, assert_final_soc=100 - 24, with_battery=True, battery_soc=100.0, inverter_loss=0.8, hybrid=True)
failed |= simple_scenario("load_bat_ac2", my_predbat, 0.5, 0, assert_final_metric=0, assert_final_soc=100 - 12/0.8, with_battery=True, battery_soc=100.0, inverter_loss=0.8)
failed |= simple_scenario("load_bat_dc2", my_predbat, 0.5, 0, assert_final_metric=0, assert_final_soc=100 - 12/0.8, with_battery=True, battery_soc=100.0, inverter_loss=0.8, hybrid=True)
failed |= simple_scenario("load_bat_ac3", my_predbat, 1.0, 0, assert_final_metric=import_rate * 0.2*24, assert_final_soc=100 - 24, with_battery=True, battery_soc=100.0, inverter_loss=0.8)
failed |= simple_scenario("load_bat_dc3", my_predbat, 1.0, 0, assert_final_metric=import_rate * 0.2*24, assert_final_soc=100 - 24, with_battery=True, battery_soc=100.0, inverter_loss=0.8, hybrid=True)
failed |= simple_scenario("load_bat_ac2", my_predbat, 0.5, 0, assert_final_metric=0, assert_final_soc=100 - 12 / 0.8, with_battery=True, battery_soc=100.0, inverter_loss=0.8)
failed |= simple_scenario("load_bat_dc2", my_predbat, 0.5, 0, assert_final_metric=0, assert_final_soc=100 - 12 / 0.8, with_battery=True, battery_soc=100.0, inverter_loss=0.8, hybrid=True)
failed |= simple_scenario("load_bat_ac3", my_predbat, 1.0, 0, assert_final_metric=import_rate * 0.2 * 24, assert_final_soc=100 - 24, with_battery=True, battery_soc=100.0, inverter_loss=0.8)
failed |= simple_scenario("load_bat_dc3", my_predbat, 1.0, 0, assert_final_metric=import_rate * 0.2 * 24, assert_final_soc=100 - 24, with_battery=True, battery_soc=100.0, inverter_loss=0.8, hybrid=True)

failed |= simple_scenario(
"load_bat_dc_pv",
Expand Down Expand Up @@ -4140,7 +4139,6 @@ def main():
parser = argparse.ArgumentParser(description="Predbat unit tests")
parser.add_argument("--debug_file", action="store", help="Enable debug output")
args = parser.parse_args()


print("**** Starting Predbat tests ****")
my_predbat = PredBat()
Expand Down

0 comments on commit 0da3c62

Please sign in to comment.