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

Change name of calculate_export_on_low_import to calculate_export_on_high_import #1767

Merged
merged 2 commits into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions apps/predbat/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,11 @@
"oldname": "calculate_secondary_order_slots",
},
{
"name": "calculate_export_low_import",
"friendly_name": "Calculate export slots on low import rate slots first",
"name": "calculate_export_high_import",
"friendly_name": "Calculate export slots on high import rate slots first",
"type": "switch",
"enable": "expert_mode",
"default": False,
"default": True,
},
{
"name": "calculate_inday_adjustment",
Expand Down
2 changes: 1 addition & 1 deletion apps/predbat/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -1828,7 +1828,7 @@ def fetch_config_options(self):
self.calculate_tweak_plan = self.get_arg("calculate_tweak_plan")
self.calculate_regions = True
self.calculate_import_low_export = self.get_arg("calculate_import_low_export")
self.calculate_export_low_import = self.get_arg("calculate_export_low_import")
self.calculate_export_high_import = self.get_arg("calculate_export_high_import")

self.balance_inverters_enable = self.get_arg("balance_inverters_enable")
self.balance_inverters_charge = self.get_arg("balance_inverters_charge")
Expand Down
6 changes: 3 additions & 3 deletions apps/predbat/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ def sort_window_by_time(self, windows):
window_sorted.sort(key=self.window_sort_func_start)
return window_sorted

def sort_window_by_price_combined(self, charge_windows, export_windows, stand_alone=False, calculate_import_low_export=False, calculate_export_low_import=False):
def sort_window_by_price_combined(self, charge_windows, export_windows, stand_alone=False, calculate_import_low_export=False, calculate_export_high_import=False):
"""
Sort windows into price sets
"""
Expand Down Expand Up @@ -1505,7 +1505,7 @@ def sort_window_by_price_combined(self, charge_windows, export_windows, stand_al
if self.carbon_enable:
carbon_intensity = self.carbon_intensity.get(window["start"] - self.minutes_now, 0)
average += carbon_intensity * self.carbon_metric / 1000.0
if calculate_export_low_import:
if calculate_export_high_import:
average_import = dp2((self.rate_import.get(window["start"], 0) + self.rate_import.get(window["end"] - PREDICT_STEP, 0)) / 2)
else:
average_import = 0
Expand Down Expand Up @@ -1993,7 +1993,7 @@ def optimise_all_windows(self, best_metric, metric_keep, debug_mode=False):
record_charge_windows = max(self.max_charge_windows(self.end_record + self.minutes_now, self.charge_window_best), 1)
record_export_windows = max(self.max_charge_windows(self.end_record + self.minutes_now, self.export_window_best), 1)
window_sorted, window_index, price_set, price_links = self.sort_window_by_price_combined(
self.charge_window_best[:record_charge_windows], self.export_window_best[:record_export_windows], calculate_import_low_export=self.calculate_import_low_export, calculate_export_low_import=self.calculate_export_low_import
self.charge_window_best[:record_charge_windows], self.export_window_best[:record_export_windows], calculate_import_low_export=self.calculate_import_low_export, calculate_export_high_import=self.calculate_export_high_import
)

self.rate_best_cost_threshold_charge = best_price
Expand Down
Loading