Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate reserves into creation and constraints #580

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
36 changes: 24 additions & 12 deletions src/model/core/reserves.jl
Original file line number Diff line number Diff line change
Expand Up @@ -259,17 +259,29 @@ function reserves_core!(EP::Model, inputs::Dict, setup::Dict)
sum(dfGen[y,:Reg_Cost]*vRSV[y,t] for y in RSV, t=1:T) +
sum(dfGen[y,:Rsv_Cost]*vREG[y,t] for y in REG, t=1:T) )
add_to_expression!(EP[:eObj], eTotalCRsvPen)
end

### Constraints ###

## Total system reserve constraints
# Regulation requirements as a percentage of demand and scheduled variable renewable energy production in each hour
# Note: frequencty regulation up and down requirements are symmetric and all resources contributing to regulation are assumed to contribute equal capacity to both up and down directions
if !isempty(REG)
@constraint(EP, cReg[t=1:T], sum(vREG[y,t] for y in REG) >= EP[:eRegReq][t])
end
if !isempty(RSV)
@constraint(EP, cRsvReq[t=1:T], sum(vRSV[y,t] for y in RSV) + vUNMET_RSV[t] >= EP[:eRsvReq][t])
end

function reserves_constraints!(EP, inputs)
T = inputs["T"] # Number of time steps (hours)

REG = inputs["REG"]
RSV = inputs["RSV"]
vREG = EP[:vREG]
vRSV = EP[:vRSV]
vUNMET_RSV = EP[:vUNMET_RSV]
eRegulationRequirement = EP[:eRegReq]
eReserveRequirement = EP[:eRsvReq]

## Total system reserve constraints
# Regulation requirements as a percentage of demand and scheduled
# variable renewable energy production in each hour.
# Note: frequency regulation up and down requirements are symmetric and all resources
# contributing to regulation are assumed to contribute equal capacity to both up
# and down directions
if !isempty(REG)
@constraint(EP, cReg[t=1:T], sum(vREG[y,t] for y in REG) >= eRegulationRequirement[t])
end
if !isempty(RSV)
@constraint(EP, cRsvReq[t=1:T], sum(vRSV[y,t] for y in RSV) + vUNMET_RSV[t] >= eReserveRequirement[t])
end
end
10 changes: 7 additions & 3 deletions src/model/generate_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ function generate_model(setup::Dict,inputs::Dict,OPTIMIZER::MOI.OptimizerWithAtt
EP[:eObj] = AffExpr(0.0)

create_empty_expression!(EP, :eGenerationByZone, (Z, T))

# Energy losses related to technologies
create_empty_expression!(EP, :eELOSSByZone, Z)

# Initialize Capacity Reserve Margin Expression
if setup["CapacityReserveMargin"] > 0
create_empty_expression!(EP, :eCapResMarBalance, (inputs["NCapacityReserveMargin"], T))
Expand Down Expand Up @@ -191,6 +191,10 @@ function generate_model(setup::Dict,inputs::Dict,OPTIMIZER::MOI.OptimizerWithAtt

# Policies

if setup["Reserves"] > 0
reserves_constraints!(EP, inputs)
end

# CO2 emissions limits
if setup["CO2Cap"] > 0
co2_cap!(EP, inputs, setup)
Expand Down Expand Up @@ -236,4 +240,4 @@ function generate_model(setup::Dict,inputs::Dict,OPTIMIZER::MOI.OptimizerWithAtt
end

return EP
end
end