Skip to content

Commit

Permalink
Bug Fix: ESR and Transmission Loss
Browse files Browse the repository at this point in the history
  • Loading branch information
xuqingyu committed Nov 17, 2023
1 parent 83a3516 commit c536d00
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/model/core/transmission.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ function transmission!(EP::Model, inputs::Dict, setup::Dict)
NetworkExpansion = setup["NetworkExpansion"]
CapacityReserveMargin = setup["CapacityReserveMargin"]
MultiStage = setup["MultiStage"]
EnergyShareRequirement = setup["EnergyShareRequirement"]
IncludeLossesInESR = setup["IncludeLossesInESR"]

## sets and indices for transmission losses and expansion
TRANS_LOSS_SEGS = inputs["TRANS_LOSS_SEGS"] # Number of segments used in piecewise linear approximations quadratic loss functions - can only take values of TRANS_LOSS_SEGS =1, 2
Expand Down
2 changes: 1 addition & 1 deletion src/write_outputs/write_co2_load_emission_rate_cap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function write_co2_load_emission_rate_cap_price_revenue(path::AbstractString, in
Transmissionloss = DataFrame(Transmissionloss_MWh = zeros(Z))
if Z > 1
if (setup["PolicyTransmissionLossCoverage"] == 1)
Transmissionloss.Transmissionloss_MWh .= 0.5 * value.(EP[:eTransLossByZoneYear])
Transmissionloss.Transmissionloss_MWh .= value.(EP[:eTransLossByZoneYear])
end
end
dfCO2LoadRateCapRev = DataFrame(Zone=1:Z, AnnualSum=zeros(Z))
Expand Down
20 changes: 10 additions & 10 deletions src/write_outputs/write_outputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@ function write_outputs(EP::Model, path::AbstractString, setup::Dict, inputs::Dic
dfESRRev = write_esr_revenue(path, inputs, setup, EP)
dfESRPayment = write_esr_payment(path, inputs, setup, EP)
if !isempty(inputs["STOR_ALL"])
if setup["StorageLosses"] == 1
if setup["IncludeLossesInESR"] == 1
dfESRStoragelossPayment = write_esr_storagelosspayment(path, inputs, setup, EP)
end
end
if inputs["Z"] > 1
if setup["PolicyTransmissionLossCoverage"] == 1
if setup["IncludeLossesInESR"] == 1
dfESRtransmissionlosspayment = write_esr_transmissionlosspayment(path, inputs, setup, EP)
end
end
Expand Down Expand Up @@ -224,24 +224,24 @@ function write_outputs(EP::Model, path::AbstractString, setup::Dict, inputs::Dic
end

# # Carbon Emission Credit Market -- Mase-based
# dfCO2MassCapCost = DataFrame()
# dfCO2MassCapRev = DataFrame()
# dfCO2Price = DataFrame()
dfCO2MassCapCost = DataFrame()
dfCO2MassCapRev = DataFrame()
dfCO2Price = DataFrame()
# if setup["CO2Cap"] == 1 && has_duals(EP) == 1
# dfCO2Price, dfCO2MassCapRev, dfCO2MassCapCost = write_co2_cap_price_revenue(path, inputs, setup, EP)
# end

# # Carbon Emission Credit Market -- Generation Emission Rate Based
# dfCO2GenRateCapCost = DataFrame()
# dfCO2GenRatePrice = DataFrame()
dfCO2GenRateCapCost = DataFrame()
dfCO2GenRatePrice = DataFrame()
# if setup["CO2GenRateCap"] == 1 && has_duals(EP) == 1
# dfCO2GenRatePrice, dfCO2GenRateCapCost = write_co2_generation_emission_rate_cap_price_revenue(path, inputs, setup, EP)
# end

# # Carbon Emission Credit Market -- Load Emission Rate Based
# dfCO2LoadRateCapCost = DataFrame()
# dfCO2LoadRateCapRev = DataFrame()
# dfCO2LoadRatePrice = DataFrame()
dfCO2LoadRateCapCost = DataFrame()
dfCO2LoadRateCapRev = DataFrame()
dfCO2LoadRatePrice = DataFrame()
# if setup["CO2LoadRateCap"] == 1 && has_duals(EP) == 1
# dfCO2LoadRatePrice, dfCO2LoadRateCapRev, dfCO2LoadRateCapCost = write_co2_load_emission_rate_cap_price_revenue(path, inputs, setup, EP)
# end
Expand Down

0 comments on commit c536d00

Please sign in to comment.