From d92e50764d548c0b497d33f8ea09a2940e92329e 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 94f6a440d..6b64ba4eb 100644 --- a/switch_model/balancing/planning_reserves.py +++ b/switch_model/balancing/planning_reserves.py @@ -224,7 +224,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 88abc164128b6a7345c7aa8806e2b37f74de54fa 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 | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/switch_model/generators/extensions/storage.py b/switch_model/generators/extensions/storage.py index 6bc3d47aa..92940f892 100644 --- a/switch_model/generators/extensions/storage.py +++ b/switch_model/generators/extensions/storage.py @@ -294,13 +294,23 @@ def post_solve(instance, outdir): instance, instance.STORAGE_GEN_BLD_YRS, output_file=os.path.join(outdir, "storage_builds.csv"), headings=("generation_project", "period", "load_zone", - "IncrementalPowerCapacityMW", "IncrementalEnergyCapacityMWh", - "OnlinePowerCapacityMW", "OnlineEnergyCapacityMWh" ), + "IncrementalPowerCapacityMW", "IncrementalEnergyCapacityMWh" + ), values=lambda m, g, bld_yr: ( g, bld_yr, 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] + m.BuildGen[g, bld_yr], m.BuildStorageEnergy[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, output_file=os.path.join(outdir, "storage_dispatch.csv"), @@ -310,4 +320,4 @@ def post_solve(instance, outdir): g, m.tp_timestamp[t], m.gen_load_zone[g], m.ChargeStorage[g, t], m.DispatchGen[g, t], m.StateOfCharge[g, t] - )) + )) \ No newline at end of file