Skip to content
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
1 change: 0 additions & 1 deletion apps/predbat/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2390,7 +2390,6 @@ def fetch_config_options(self):
self.battery_temperature_discharge_curve = self.validate_curve(self.args.get("battery_temperature_discharge_curve", {}), "battery_temperature_discharge_curve")

self.import_export_scaling = self.get_arg("import_export_scaling", 1.0)
self.best_soc_margin = 0.0
self.best_soc_min = self.get_arg("best_soc_min")
self.best_soc_max = self.get_arg("best_soc_max")
self.best_soc_keep = self.get_arg("best_soc_keep")
Expand Down
141 changes: 110 additions & 31 deletions apps/predbat/plan.py

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion apps/predbat/predbat.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,6 @@ def reset(self):
self.inverter_set_charge_before = True
self.best_soc_min = 0
self.best_soc_max = 0
self.best_soc_margin = 0
self.best_soc_keep = 0
self.best_soc_keep_weight = 0.5
self.rate_min = 0
Expand Down
343 changes: 341 additions & 2 deletions apps/predbat/tests/test_export_commitment.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions apps/predbat/tests/test_optimise_all_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,13 @@ def run_optimise_all_windows_tests(my_predbat, prediction_kernel=False):
return failed

# Optimise charge limit
best_soc, best_metric, best_cost, best_soc_min, best_soc_min_minute, best_keep, best_cycle, best_carbon, best_import = my_predbat.optimise_charge_limit(
best_soc, best_metric, best_cost, best_soc_min, best_soc_min_minute, best_keep, best_cycle, best_carbon, best_import, best_metric_plan = my_predbat.optimise_charge_limit(
0, len(expect_charge_limit), expect_charge_limit, charge_window_best, export_window_best, expect_export_limit, all_n=None, end_record=my_predbat.end_record
)
before_best_metric = best_metric
my_predbat.isCharging = True
my_predbat.isCharging_Target = 100
best_soc, best_metric, best_cost, best_soc_min, best_soc_min_minute, best_keep, best_cycle, best_carbon, best_import = my_predbat.optimise_charge_limit(
best_soc, best_metric, best_cost, best_soc_min, best_soc_min_minute, best_keep, best_cycle, best_carbon, best_import, best_metric_plan = my_predbat.optimise_charge_limit(
0, len(expect_charge_limit), expect_charge_limit, charge_window_best, export_window_best, expect_export_limit, all_n=None, end_record=my_predbat.end_record
)

Expand Down
158 changes: 79 additions & 79 deletions coverage/cases/random_results.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@
"run_info": {
"template_yaml": "cases/predbat_debug_agile1.yaml",
"scenarios_file": "cases/random_scenarios.yaml",
"timestamp": "2026-07-08T06:50:45.684051+00:00"
"timestamp": "2026-07-31T12:40:42.783152+00:00"
},
"results": [
{
"id": 0,
"seed": 0,
"metric": 494.0434,
"cost": 678.5038,
"import_kwh_battery": 15.3003,
"metric": 494.04,
"cost": 678.5004,
"import_kwh_battery": 15.2999,
"import_kwh_house": 0.0298,
"export_kwh": 10.5838,
"soc_min": 0.8066,
"soc_final": 9.5,
"battery_cycles": 19.3241,
"carbon_g": 13404.32,
"runtime_s": 0.454,
"battery_cycles": 19.3237,
"carbon_g": 13404.16,
"runtime_s": 0.797,
"failed": false,
"error": null,
"end_record": 1440
},
{
"id": 1,
"seed": 1,
"metric": 481.4329,
"cost": 564.2996,
"import_kwh_battery": 6.2239,
"metric": 481.4967,
"cost": 564.3012,
"import_kwh_battery": 6.2189,
"import_kwh_house": 0.0521,
"export_kwh": 24.1757,
"soc_min": 1.9214,
"soc_min": 1.9561,
"soc_final": 4.579,
"battery_cycles": 11.2511,
"carbon_g": 5161.75,
"runtime_s": 0.396,
"battery_cycles": 11.1817,
"carbon_g": 5160.03,
"runtime_s": 0.672,
"failed": false,
"error": null,
"end_record": 1440
Expand All @@ -51,7 +51,7 @@
"soc_final": 0.38,
"battery_cycles": 7.0761,
"carbon_g": 9003.06,
"runtime_s": 1.654,
"runtime_s": 2.827,
"failed": false,
"error": null,
"end_record": 1440
Expand All @@ -68,24 +68,24 @@
"soc_final": 4.6647,
"battery_cycles": 10.2125,
"carbon_g": 11635.69,
"runtime_s": 0.658,
"runtime_s": 1.103,
"failed": false,
"error": null,
"end_record": 1440
},
{
"id": 4,
"seed": 4,
"metric": 855.7041,
"metric": 856.1016,
"cost": 927.7127,
"import_kwh_battery": 10.0794,
"import_kwh_house": 0.7822,
"export_kwh": 0.2967,
"soc_min": 0.38,
"soc_final": 4.6215,
"battery_cycles": 12.0919,
"battery_cycles": 12.1086,
"carbon_g": 16198.02,
"runtime_s": 0.574,
"runtime_s": 0.991,
"failed": false,
"error": null,
"end_record": 1440
Expand All @@ -102,24 +102,24 @@
"soc_final": 12.9568,
"battery_cycles": 16.0606,
"carbon_g": 5197.29,
"runtime_s": 0.331,
"runtime_s": 0.59,
"failed": false,
"error": null,
"end_record": 1440
},
{
"id": 6,
"seed": 6,
"metric": 249.4903,
"cost": 415.5059,
"metric": 248.7213,
"cost": 413.7647,
"import_kwh_battery": 23.8391,
"import_kwh_house": 0.3018,
"export_kwh": 21.3354,
"export_kwh": 21.4492,
"soc_min": 0.38,
"soc_final": 13.0816,
"battery_cycles": 44.7705,
"carbon_g": 12472.47,
"runtime_s": 3.963,
"soc_final": 13.0791,
"battery_cycles": 44.7341,
"carbon_g": 12427.01,
"runtime_s": 6.587,
"failed": false,
"error": null,
"end_record": 1440
Expand All @@ -136,7 +136,7 @@
"soc_final": 0.38,
"battery_cycles": 0.9215,
"carbon_g": 17836.83,
"runtime_s": 0.435,
"runtime_s": 0.76,
"failed": false,
"error": null,
"end_record": 1440
Expand All @@ -153,15 +153,15 @@
"soc_final": 0.38,
"battery_cycles": 6.9101,
"carbon_g": 13346.35,
"runtime_s": 0.226,
"runtime_s": 0.39,
"failed": false,
"error": null,
"end_record": 1440
},
{
"id": 9,
"seed": 9,
"metric": 114.7647,
"metric": 115.3287,
"cost": 233.0853,
"import_kwh_battery": 13.0071,
"import_kwh_house": 0.0,
Expand All @@ -170,58 +170,58 @@
"soc_final": 7.3332,
"battery_cycles": 26.1783,
"carbon_g": 3997.87,
"runtime_s": 1.166,
"runtime_s": 1.708,
"failed": false,
"error": null,
"end_record": 1440
},
{
"id": 10,
"seed": 10,
"metric": 314.1815,
"cost": 452.4177,
"import_kwh_battery": 13.8104,
"metric": 311.3112,
"cost": 457.0942,
"import_kwh_battery": 13.5365,
"import_kwh_house": 0.0,
"export_kwh": 20.9941,
"export_kwh": 20.2051,
"soc_min": 0.7599,
"soc_final": 9.1808,
"battery_cycles": 33.9669,
"carbon_g": 9466.33,
"runtime_s": 2.49,
"soc_final": 9.695,
"battery_cycles": 35.4429,
"carbon_g": 9698.96,
"runtime_s": 4.743,
"failed": false,
"error": null,
"end_record": 1440
},
{
"id": 11,
"seed": 11,
"metric": 734.4434,
"cost": 741.8218,
"import_kwh_battery": 11.4806,
"import_kwh_house": 0.1432,
"metric": 732.6263,
"cost": 740.0047,
"import_kwh_battery": 11.4145,
"import_kwh_house": 0.1465,
"export_kwh": 9.4432,
"soc_min": 0.38,
"soc_final": 0.38,
"battery_cycles": 17.0478,
"carbon_g": 13463.25,
"runtime_s": 1.239,
"battery_cycles": 16.167,
"carbon_g": 13437.39,
"runtime_s": 2.086,
"failed": false,
"error": null,
"end_record": 1440
},
{
"id": 12,
"seed": 12,
"metric": 655.459,
"cost": 727.2605,
"import_kwh_battery": 27.0024,
"import_kwh_house": 6.9445,
"export_kwh": 20.5474,
"metric": 659.0014,
"cost": 717.2374,
"import_kwh_battery": 27.1088,
"import_kwh_house": 6.4535,
"export_kwh": 20.6943,
"soc_min": 0.38,
"soc_final": 4.5028,
"battery_cycles": 49.8339,
"carbon_g": 17101.67,
"runtime_s": 2.308,
"soc_final": 3.9057,
"battery_cycles": 50.591,
"carbon_g": 16945.09,
"runtime_s": 4.344,
"failed": false,
"error": null,
"end_record": 1440
Expand All @@ -238,15 +238,15 @@
"soc_final": 0.38,
"battery_cycles": 10.9678,
"carbon_g": 10462.19,
"runtime_s": 1.105,
"runtime_s": 2.819,
"failed": false,
"error": null,
"end_record": 1440
},
{
"id": 14,
"seed": 14,
"metric": 915.2228,
"metric": 915.2244,
"cost": 924.6169,
"import_kwh_battery": 11.0497,
"import_kwh_house": 3.043,
Expand All @@ -255,24 +255,24 @@
"soc_final": 1.0744,
"battery_cycles": 8.7572,
"carbon_g": 16975.54,
"runtime_s": 0.399,
"runtime_s": 0.731,
"failed": false,
"error": null,
"end_record": 1440
},
{
"id": 15,
"seed": 15,
"metric": 762.2191,
"cost": 826.8768,
"import_kwh_battery": 23.9157,
"import_kwh_house": 0.5194,
"export_kwh": 10.7298,
"metric": 763.1013,
"cost": 825.2776,
"import_kwh_battery": 23.9547,
"import_kwh_house": 0.5784,
"export_kwh": 10.8302,
"soc_min": 0.2978,
"soc_final": 4.6978,
"battery_cycles": 32.7641,
"carbon_g": 17402.12,
"runtime_s": 2.279,
"soc_final": 4.6311,
"battery_cycles": 33.208,
"carbon_g": 17398.39,
"runtime_s": 3.97,
"failed": false,
"error": null,
"end_record": 1440
Expand All @@ -289,7 +289,7 @@
"soc_final": 0.38,
"battery_cycles": 4.1652,
"carbon_g": 15925.89,
"runtime_s": 0.478,
"runtime_s": 0.832,
"failed": false,
"error": null,
"end_record": 1440
Expand All @@ -306,7 +306,7 @@
"soc_final": 13.4038,
"battery_cycles": 36.1279,
"carbon_g": 5283.62,
"runtime_s": 1.903,
"runtime_s": 3.235,
"failed": false,
"error": null,
"end_record": 1440
Expand All @@ -323,24 +323,24 @@
"soc_final": 4.5266,
"battery_cycles": 8.7378,
"carbon_g": 11634.51,
"runtime_s": 0.236,
"runtime_s": 0.41,
"failed": false,
"error": null,
"end_record": 1440
},
{
"id": 19,
"seed": 19,
"metric": 598.0599,
"cost": 972.4951,
"import_kwh_battery": 26.988,
"metric": 597.7879,
"cost": 972.3154,
"import_kwh_battery": 27.1372,
"import_kwh_house": 0.0,
"export_kwh": 10.0611,
"soc_min": 0.5055,
"soc_final": 19.9853,
"battery_cycles": 29.7806,
"carbon_g": 17665.55,
"runtime_s": 1.189,
"export_kwh": 10.1922,
"soc_min": 0.38,
"soc_final": 19.9987,
"battery_cycles": 29.5557,
"carbon_g": 17653.56,
"runtime_s": 2.071,
"failed": false,
"error": null,
"end_record": 1440
Expand Down
Loading
Loading