Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test fixes #1726

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions apps/predbat/unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,8 @@ def run_execute_test(
def run_single_debug(my_predbat, debug_file):
print("**** Running debug test {} ****\n".format(debug_file))
re_do_rates = True
reset_load_model = False
reset_load_model = True
load_override = 0.2

reset_inverter(my_predbat)
my_predbat.read_debug_yaml(debug_file)
Expand All @@ -912,6 +913,10 @@ def run_single_debug(my_predbat, debug_file):
my_predbat.metric_min_improvement_export = 5

if re_do_rates:
# Set rate thresholds
if my_predbat.rate_import or my_predbat.rate_export:
my_predbat.set_rate_thresholds()

# Find discharging windows
if my_predbat.rate_export:
my_predbat.high_export_rates, lowest, highest = my_predbat.rate_scan_window(my_predbat.rate_export, 5, my_predbat.rate_export_cost_threshold, True)
Expand All @@ -937,7 +942,7 @@ def run_single_debug(my_predbat, debug_file):
my_predbat.minutes_now,
forward=False,
scale_today=my_predbat.load_inday_adjustment,
scale_fixed=1.0,
scale_fixed=1.0 * load_override,
type_load=True,
load_forecast=my_predbat.load_forecast,
load_scaling_dynamic=my_predbat.load_scaling_dynamic,
Expand All @@ -948,7 +953,7 @@ def run_single_debug(my_predbat, debug_file):
my_predbat.minutes_now,
forward=False,
scale_today=my_predbat.load_inday_adjustment,
scale_fixed=my_predbat.load_scaling10,
scale_fixed=my_predbat.load_scaling10 * load_override,
type_load=True,
load_forecast=my_predbat.load_forecast,
load_scaling_dynamic=my_predbat.load_scaling_dynamic,
Expand Down Expand Up @@ -986,8 +991,10 @@ def run_single_debug(my_predbat, debug_file):

# Calculate best export windows
if my_predbat.high_export_rates and my_predbat.calculate_best_export and my_predbat.set_export_window:
print("High export rates: {}".format(my_predbat.high_export_rates))
my_predbat.export_window_best = copy.deepcopy(my_predbat.high_export_rates)
else:
print("export disabled {} {} {}".format(my_predbat.high_export_rates, my_predbat.calculate_best_export, my_predbat.set_export_window))
my_predbat.export_window_best = copy.deepcopy(my_predbat.export_window)

# Pre-fill best charge limit with the current charge limit
Expand Down
Loading