Skip to content

Commit

Permalink
Fix 485, 571 asymmetric storage STOR=2 NetRevenue (#602)
Browse files Browse the repository at this point in the history
Add columns for Inv_Cost_Charge_MW and Fixed_OM_Cost_Charge_MW in
NetRevenue.csv, and adds them to the total Costs.
  • Loading branch information
cfe316 authored Dec 22, 2023
1 parent 783f7cd commit fa5f5b8
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/write_outputs/write_net_revenue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,31 @@ function write_net_revenue(path::AbstractString, inputs::Dict, setup::Dict, EP::
# Add investment cost to the dataframe
dfNetRevenue.Inv_cost_MW = dfGen[!,:Inv_Cost_per_MWyr] .* dfCap[1:G,:NewCap]
dfNetRevenue.Inv_cost_MWh = dfGen[!,:Inv_Cost_per_MWhyr] .* dfCap[1:G,:NewEnergyCap]
dfNetRevenue.Inv_cost_charge_MW = dfGen[!,:Inv_Cost_Charge_per_MWyr] .* dfCap[1:G,:NewChargeCap]

if !isempty(VRE_STOR)
# Doesn't include charge capacities
if !isempty(SOLAR)
dfNetRevenue.Inv_cost_MW[VRE_STOR] += dfVRE_STOR[!,:Inv_Cost_Solar_per_MWyr] .* dfVreStor[1:VRE_STOR_LENGTH,:NewCapSolar]
end
if !isempty(DC)
dfNetRevenue.Inv_cost_MW[VRE_STOR] += dfVRE_STOR[!,:Inv_Cost_Inverter_per_MWyr] .* dfVreStor[1:VRE_STOR_LENGTH,:NewCapDC]
end
end
if !isempty(WIND)
dfNetRevenue.Inv_cost_MW[VRE_STOR] += dfVRE_STOR[!,:Inv_Cost_Wind_per_MWyr] .* dfVreStor[1:VRE_STOR_LENGTH,:NewCapWind]
end
end
if setup["ParameterScale"] == 1
dfNetRevenue.Inv_cost_MWh *= ModelScalingFactor # converting Million US$ to US$
dfNetRevenue.Inv_cost_MW *= ModelScalingFactor # converting Million US$ to US$
dfNetRevenue.Inv_cost_charge_MW *= ModelScalingFactor # converting Million US$ to US$
end

# Add operations and maintenance cost to the dataframe
dfNetRevenue.Fixed_OM_cost_MW = dfGen[!,:Fixed_OM_Cost_per_MWyr] .* dfCap[1:G,:EndCap]
dfNetRevenue.Fixed_OM_cost_MWh = dfGen[!,:Fixed_OM_Cost_per_MWhyr] .* dfCap[1:G,:EndEnergyCap]
dfNetRevenue.Fixed_OM_cost_charge_MW = dfGen[!, :Fixed_OM_Cost_Charge_per_MWyr] .* dfCap[1:G, :EndChargeCap]

dfNetRevenue.Var_OM_cost_out = (dfGen[!,:Var_OM_Cost_per_MWh]) .* dfPower[1:G,:AnnualSum]
if !isempty(VRE_STOR)
if !isempty(SOLAR)
Expand All @@ -59,10 +64,10 @@ function write_net_revenue(path::AbstractString, inputs::Dict, setup::Dict, EP::
if !isempty(WIND)
dfNetRevenue.Fixed_OM_cost_MW[VRE_STOR] += dfVRE_STOR[!,:Fixed_OM_Wind_Cost_per_MWyr] .* dfVreStor[1:VRE_STOR_LENGTH, :EndCapWind]
dfNetRevenue.Var_OM_cost_out[WIND] += dfVRE_STOR[(dfVRE_STOR.WIND.!=0),:Var_OM_Cost_per_MWh_Wind] .* (value.(EP[:vP_WIND][WIND, :]).data * inputs["omega"])
end
end
if !isempty(DC)
dfNetRevenue.Fixed_OM_cost_MW[VRE_STOR] += dfVRE_STOR[!,:Fixed_OM_Inverter_Cost_per_MWyr] .* dfVreStor[1:VRE_STOR_LENGTH, :EndCapDC]
end
end
if !isempty(DC_DISCHARGE)
dfNetRevenue.Var_OM_cost_out[DC_DISCHARGE] += dfVRE_STOR[(dfVRE_STOR.STOR_DC_DISCHARGE.!=0),:Var_OM_Cost_per_MWh_Discharge_DC] .* (value.(EP[:vP_DC_DISCHARGE][DC_DISCHARGE, :]).data .* dfVRE_STOR[(dfVRE_STOR.STOR_DC_DISCHARGE.!=0),:EtaInverter] * inputs["omega"])
end
Expand All @@ -73,6 +78,7 @@ function write_net_revenue(path::AbstractString, inputs::Dict, setup::Dict, EP::
if setup["ParameterScale"] == 1
dfNetRevenue.Fixed_OM_cost_MW *= ModelScalingFactor # converting Million US$ to US$
dfNetRevenue.Fixed_OM_cost_MWh *= ModelScalingFactor # converting Million US$ to US$
dfNetRevenue.Fixed_OM_cost_charge_MW *= ModelScalingFactor # converting Million US$ to US$
dfNetRevenue.Var_OM_cost_out *= ModelScalingFactor # converting Million US$ to US$
end

Expand Down Expand Up @@ -169,7 +175,18 @@ function write_net_revenue(path::AbstractString, inputs::Dict, setup::Dict, EP::
end

dfNetRevenue.Revenue = dfNetRevenue.EnergyRevenue .+ dfNetRevenue.SubsidyRevenue .+ dfNetRevenue.ReserveMarginRevenue .+ dfNetRevenue.ESRRevenue .+ dfNetRevenue.RegSubsidyRevenue
dfNetRevenue.Cost = dfNetRevenue.Inv_cost_MW .+ dfNetRevenue.Inv_cost_MWh .+ dfNetRevenue.Fixed_OM_cost_MW .+ dfNetRevenue.Fixed_OM_cost_MWh .+ dfNetRevenue.Var_OM_cost_out .+ dfNetRevenue.Var_OM_cost_in .+ dfNetRevenue.Fuel_cost .+ dfNetRevenue.Charge_cost .+ dfNetRevenue.EmissionsCost .+ dfNetRevenue.StartCost
dfNetRevenue.Cost = (dfNetRevenue.Inv_cost_MW
.+ dfNetRevenue.Inv_cost_MWh
.+ dfNetRevenue.Inv_cost_charge_MW
.+ dfNetRevenue.Fixed_OM_cost_MW
.+ dfNetRevenue.Fixed_OM_cost_MWh
.+ dfNetRevenue.Fixed_OM_cost_charge_MW
.+ dfNetRevenue.Var_OM_cost_out
.+ dfNetRevenue.Var_OM_cost_in
.+ dfNetRevenue.Fuel_cost
.+ dfNetRevenue.Charge_cost
.+ dfNetRevenue.EmissionsCost
.+ dfNetRevenue.StartCost)
dfNetRevenue.Profit = dfNetRevenue.Revenue .- dfNetRevenue.Cost

CSV.write(joinpath(path, "NetRevenue.csv"), dfNetRevenue)
Expand Down

0 comments on commit fa5f5b8

Please sign in to comment.