Skip to content

Commit

Permalink
Modify model code to add renewable portfolio standard capabilities (#47)
Browse files Browse the repository at this point in the history
Creates a separate RPS technology set where technologies able to contribute to the RPS can be added. This set is indexed by region. The total electricity demand which is endogenously determined is estimated using recycled logic from the Reserve Margin constraint.
  • Loading branch information
kathjordan authored Aug 29, 2023
1 parent dbe565c commit b009f03
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
2 changes: 2 additions & 0 deletions temoa_model/temoa_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def query_table (t_properties, f):
['set', 'regions', '', '', 0],
['set', 'tech_curtailment', '', '', 0],
['set', 'tech_flex', '', '', 0],
['set', 'tech_rps', '', '', 1],
['set', 'tech_reserve', '', '', 0],
['set', 'technologies', 'tech_resource', 'r', 0],
['set', 'technologies', 'tech_production', ['p','pb','ps'], 0],
Expand Down Expand Up @@ -148,6 +149,7 @@ def query_table (t_properties, f):
['param','MaxNewCapacity', '', '', 3],
['param','MaxActivity', '', '', 3],
['param','MinActivity', '', '', 3],
['param','RenewablePortfolioStandard','', '', 2],
['param','MinAnnualCapacityFactor', '', '', 4],
['param','MaxAnnualCapacityFactor', '', '', 4],
['param','MinActivityGroup', '', '', 3],
Expand Down
11 changes: 11 additions & 0 deletions temoa_model/temoa_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def temoa_create_model(name="Temoa"):
M.tech_capacity_min = Set(within=M.tech_all)
M.tech_capacity_max = Set(within=M.tech_all)
M.tech_curtailment = Set(within=M.tech_all)
M.tech_rps = Set(within=M.regions*M.tech_all)
M.tech_flex = Set(within=M.tech_all)
M.tech_exchange = Set(within=M.tech_all)
M.groups = Set(dimen=1) # Define groups for technologies
Expand Down Expand Up @@ -161,6 +162,8 @@ def temoa_create_model(name="Temoa"):
M.TechInputSplitAverage = Param(M.regions, M.time_optimize, M.commodity_physical, M.tech_variable)
M.TechOutputSplit = Param(M.regions, M.time_optimize, M.tech_all, M.commodity_carrier)

M.RenewablePortfolioStandard = Param(M.regions, M.time_optimize)

# The method below creates a series of helper functions that are used to
# perform the sparse matrix of indexing for the parameters, variables, and
# equations below.
Expand Down Expand Up @@ -633,6 +636,14 @@ def temoa_create_model(name="Temoa"):
M.TechOutputSplitAnnualConstraint = Constraint(
M.TechOutputSplitAnnualConstraint_rptvo, rule=TechOutputSplitAnnual_Constraint
)

M.RenewablePortfolioStandardConstraint_rpt = Set(
dimen=2, initialize=lambda M: M.RenewablePortfolioStandard.sparse_iterkeys()
)
M.RenewablePortfolioStandardConstraint = Constraint(
M.RenewablePortfolioStandardConstraint_rpt, rule=RenewablePortfolioStandard_Constraint
)

M.LinkedEmissionsTechConstraint_rpsdtve = Set(dimen=7, initialize=LinkedTechConstraintIndices)
M.LinkedEmissionsTechConstraint = Constraint(
M.LinkedEmissionsTechConstraint_rpsdtve, rule=LinkedEmissionsTech_Constraint)
Expand Down
29 changes: 29 additions & 0 deletions temoa_model/temoa_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -2540,6 +2540,35 @@ def TechOutputSplitAnnual_Constraint ( M, r, p, t, v, o):
expr = out >= M.TechOutputSplit[r, p, t, o] * total_out
return expr

def RenewablePortfolioStandard_Constraint(M, r, p):
r"""
Allows users to specify the share of electricity generation in a region
coming from RPS-eligible technologies.
"""

inp = sum(
M.V_FlowOut[r, p, s, d, S_i, t, v, S_o]
for (_r,t) in M.tech_rps if _r == r
for (_t,v) in M.processReservePeriods[r, p] if _t == t
for s in M.time_season
for d in M.time_of_day
for S_i in M.processInputs[r, p, t, v]
for S_o in M.ProcessOutputsByInput[r, p, t, v, S_i]
)

total_inp = sum(
M.V_FlowOut[r, p, s, d, S_i, t, v, S_o]
for (t,v) in M.processReservePeriods[r, p]
for s in M.time_season
for d in M.time_of_day
for S_i in M.processInputs[r, p, t, v]
for S_o in M.ProcessOutputsByInput[r, p, t, v, S_i]
)


expr = inp >= (value(M.RenewablePortfolioStandard[r, p]) * total_inp)
return expr

# ---------------------------------------------------------------
# Define rule-based parameters
# ---------------------------------------------------------------
Expand Down

0 comments on commit b009f03

Please sign in to comment.