From 06adbf85c5d0ebdcdfd73a15c48a3e4d8fde6205 Mon Sep 17 00:00:00 2001 From: Zolan Date: Tue, 16 Dec 2025 08:26:40 -0700 Subject: [PATCH 1/6] cap stroage power and energy contribution to bigM on energy, demand tiers --- src/constraints/electric_utility_constraints.jl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/constraints/electric_utility_constraints.jl b/src/constraints/electric_utility_constraints.jl index 07dbbab76..7297c3df1 100644 --- a/src/constraints/electric_utility_constraints.jl +++ b/src/constraints/electric_utility_constraints.jl @@ -478,12 +478,14 @@ end """ function get_electric_demand_tiers_bigM(p::REoptInputs, tou::Bool) added_power = !isempty(p.s.storage.types.elec) ? sum(p.s.storage.attr[b].max_kw for b in p.s.storage.types.elec) : 1.0e-3 - bigM = 2 * maximum(100*p.s.electric_load.loads_kw .+ #2 multiplier for heating/cooling loads in case of a low COP tech, like ASHP in cold temps + bigM_load = 2 * maximum(100*p.s.electric_load.loads_kw .+ #2 multiplier for heating/cooling loads in case of a low COP tech, like ASHP in cold temps p.s.space_heating_load.loads_kw .+ #100 multiplier for electric load in case it is used for charging an inefficient, seasonal storage (e.g., H2) p.s.process_heat_load.loads_kw .+ p.s.dhw_load.loads_kw .+ p.s.cooling_load.loads_kw_thermal - ) + added_power + ) + added_power = min(added_power,bigM) + bigM = bigM_load + added_power if tou periods = 1:length(p.s.electric_tariff.tou_demand_ratchet_time_steps) num_tiers = p.s.electric_tariff.n_tou_demand_tiers @@ -525,6 +527,7 @@ function get_electric_energy_tiers_bigM(p::REoptInputs) p.s.dhw_load.loads_kw .+ p.s.cooling_load.loads_kw_thermal ) + added_energy = min(added_energy,sum(bigM_hourly_load)) bigM_energy_tier_limits = zeros(12,p.s.electric_tariff.n_energy_tiers) for mth in p.months monthly_bigM = added_energy + sum(bigM_hourly_load[ts] for ts in p.s.electric_tariff.time_steps_monthly[mth]) From dd19ce1e958f54e13eb1f43b12f1f91dc7c44e88 Mon Sep 17 00:00:00 2001 From: Zolan Date: Tue, 16 Dec 2025 10:56:16 -0700 Subject: [PATCH 2/6] update test case with large storage system --- src/constraints/electric_utility_constraints.jl | 2 +- test/scenarios/tiered_energy_demand.json | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/constraints/electric_utility_constraints.jl b/src/constraints/electric_utility_constraints.jl index 7297c3df1..59c20acd5 100644 --- a/src/constraints/electric_utility_constraints.jl +++ b/src/constraints/electric_utility_constraints.jl @@ -484,7 +484,7 @@ function get_electric_demand_tiers_bigM(p::REoptInputs, tou::Bool) p.s.dhw_load.loads_kw .+ p.s.cooling_load.loads_kw_thermal ) - added_power = min(added_power,bigM) + added_power = min(added_power,bigM_load) bigM = bigM_load + added_power if tou periods = 1:length(p.s.electric_tariff.tou_demand_ratchet_time_steps) diff --git a/test/scenarios/tiered_energy_demand.json b/test/scenarios/tiered_energy_demand.json index d4fd86a26..e704d6eb6 100644 --- a/test/scenarios/tiered_energy_demand.json +++ b/test/scenarios/tiered_energy_demand.json @@ -1297,6 +1297,10 @@ }, "ElectricUtility" : { "co2_from_avert" : true + }, + "ElectricStorage": { + "max_kw": 10000000000, + "max_kwh": 10000000000 } } \ No newline at end of file From d2ead511681a2b1169440bcd9da9f7daa9a4addd Mon Sep 17 00:00:00 2001 From: Alex Zolan Date: Tue, 16 Dec 2025 11:00:17 -0700 Subject: [PATCH 3/6] Update CHANGELOG for storage contribution fix Fixed a bug in demand and energy charge calculations for large max storage system sizes. --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e7cfffe3..11b6b8b62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,10 @@ Classify the change according to the following categories: ### Deprecated ### Removed +## fix-storage-contribution-to-bigm +###Fixed +- Fixed a bug in which demand and energy charges are inaccurately calculated when large max storage system sizes are present. + ## v0.56.3 ### Fixed - Correctly escape the \$ symbol in docstring for `REopt.add_electric_tariff_results` in `results/electric_tariff.jl` From 5f673f290dc46fd9ca2ea24976f6ee9cbdb66dcb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 16 Dec 2025 18:00:58 +0000 Subject: [PATCH 4/6] Initial plan From 6eaa75c20be4a0679fe9eb44565f938dfa98ec9c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 16 Dec 2025 18:05:10 +0000 Subject: [PATCH 5/6] Fix spacing in min() function call for Julia style consistency Co-authored-by: zolanaj <12503579+zolanaj@users.noreply.github.com> --- src/constraints/electric_utility_constraints.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constraints/electric_utility_constraints.jl b/src/constraints/electric_utility_constraints.jl index 59c20acd5..a9139377c 100644 --- a/src/constraints/electric_utility_constraints.jl +++ b/src/constraints/electric_utility_constraints.jl @@ -484,7 +484,7 @@ function get_electric_demand_tiers_bigM(p::REoptInputs, tou::Bool) p.s.dhw_load.loads_kw .+ p.s.cooling_load.loads_kw_thermal ) - added_power = min(added_power,bigM_load) + added_power = min(added_power, bigM_load) bigM = bigM_load + added_power if tou periods = 1:length(p.s.electric_tariff.tou_demand_ratchet_time_steps) From 25d36f3f010bbe3a0bb9c9eed8a3fd1f0ce3f547 Mon Sep 17 00:00:00 2001 From: Zolan Date: Tue, 16 Dec 2025 11:14:16 -0700 Subject: [PATCH 6/6] additional spacing update --- src/constraints/electric_utility_constraints.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constraints/electric_utility_constraints.jl b/src/constraints/electric_utility_constraints.jl index a9139377c..b7080d66c 100644 --- a/src/constraints/electric_utility_constraints.jl +++ b/src/constraints/electric_utility_constraints.jl @@ -527,7 +527,7 @@ function get_electric_energy_tiers_bigM(p::REoptInputs) p.s.dhw_load.loads_kw .+ p.s.cooling_load.loads_kw_thermal ) - added_energy = min(added_energy,sum(bigM_hourly_load)) + added_energy = min(added_energy, sum(bigM_hourly_load)) bigM_energy_tier_limits = zeros(12,p.s.electric_tariff.n_energy_tiers) for mth in p.months monthly_bigM = added_energy + sum(bigM_hourly_load[ts] for ts in p.s.electric_tariff.time_steps_monthly[mth])