Skip to content

Commit

Permalink
Crunching the mass-based and demand-rate based into one expression in… (
Browse files Browse the repository at this point in the history
#610)

Crunching the mass-based and demand-rate based into one expression in write_net_revenue.jl

The expressions are exactly the same
  • Loading branch information
sambuddhac authored Jan 13, 2024
1 parent a15e37f commit 66ba310
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/write_outputs/write_net_revenue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,7 @@ function write_net_revenue(path::AbstractString, inputs::Dict, setup::Dict, EP::
co2_cap_dual = dual(EP[:cCO2Emissions_systemwide][cap])
CO2ZONES = findall(x->x==1, inputs["dfCO2CapZones"][:,cap])
GEN_IN_ZONE = dfGen[[y in CO2ZONES for y in dfGen[:, :Zone]], :R_ID]
if setup["CO2Cap"]==1 # Mass-based
# Cost = sum(sum(emissions of gen y * dual(CO2 constraint[cap]) for z in Z) for cap in setup["NCO2"])
temp_vec = value.(EP[:eEmissionsByPlant][GEN_IN_ZONE, :]) * inputs["omega"]
dfNetRevenue.EmissionsCost[GEN_IN_ZONE] += - co2_cap_dual * temp_vec
elseif setup["CO2Cap"]==2 # Demand + Rate-based
if setup["CO2Cap"]==1 || setup["CO2Cap"]==2 # Mass-based or Demand + Rate-based
# Cost = sum(sum(emissions for zone z * dual(CO2 constraint[cap]) for z in Z) for cap in setup["NCO2"])
temp_vec = value.(EP[:eEmissionsByPlant][GEN_IN_ZONE, :]) * inputs["omega"]
dfNetRevenue.EmissionsCost[GEN_IN_ZONE] += - co2_cap_dual * temp_vec
Expand Down

0 comments on commit 66ba310

Please sign in to comment.