From b5dcb825928f4ba6074bf76984c29c0dff3a4c77 Mon Sep 17 00:00:00 2001 From: Desmond Zhong Date: Sat, 26 Dec 2020 11:00:12 -0500 Subject: [PATCH 1/2] fix typo in planning_reserves --- switch_model/balancing/planning_reserves.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/switch_model/balancing/planning_reserves.py b/switch_model/balancing/planning_reserves.py index 41a28a06d..dde8f7b02 100644 --- a/switch_model/balancing/planning_reserves.py +++ b/switch_model/balancing/planning_reserves.py @@ -235,7 +235,7 @@ def AvailableReserveCapacity_rule(m, prr, t): # Note: this code appears to have no users, since it references # DispatchGen, which doesn't exist (should be m.DispatchGen). if g in getattr(m, "STORAGE_GENS", set()): - reserve_cap += DispatchGen[g, t] - m.ChargeStorage[g, t] + reserve_cap += m.DispatchGen[g, t] - m.ChargeStorage[g, t] # If local_td is included with DER modeling, avoid allocating # distributed generation to central grid capacity because it will # be credited with adjusting load at the distribution node. From 8e879400d8b411ab87b56c70b2f54f5cfb737d01 Mon Sep 17 00:00:00 2001 From: Desmond Zhong Date: Mon, 10 May 2021 20:59:48 -0400 Subject: [PATCH 2/2] fix postprocessing errors in storage module --- switch_model/generators/extensions/storage.py | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/switch_model/generators/extensions/storage.py b/switch_model/generators/extensions/storage.py index bb6bb0613..32bd76a9b 100644 --- a/switch_model/generators/extensions/storage.py +++ b/switch_model/generators/extensions/storage.py @@ -328,8 +328,6 @@ def post_solve(instance, outdir): "load_zone", "IncrementalPowerCapacityMW", "IncrementalEnergyCapacityMWh", - "OnlinePowerCapacityMW", - "OnlineEnergyCapacityMWh", ), values=lambda m, g, bld_yr: ( g, @@ -337,10 +335,29 @@ def post_solve(instance, outdir): m.gen_load_zone[g], m.BuildGen[g, bld_yr], m.BuildStorageEnergy[g, bld_yr], - m.GenCapacity[g, bld_yr], - m.StorageEnergyCapacity[g, bld_yr], ), ) + + reporting.write_table( + instance, + instance.STORAGE_GEN_PERIODS, + output_file=os.path.join(outdir, "storage_builds_capacity.csv"), + headings=( + "generation_project", + "period", + "load_zone", + "OnlinePowerCapacityMW", + "OnlineEnergyCapacityMWh", + ), + values=lambda m, g, p: ( + g, + p, + m.gen_load_zone[g], + m.GenCapacity[g, p], + m.StorageEnergyCapacity[g, p], + ), + ) + reporting.write_table( instance, instance.STORAGE_GEN_TPS,