Skip to content

Commit

Permalink
remove Price|Carbon|Imported|Coal, |Gas, |Oil, adjust variable name, …
Browse files Browse the repository at this point in the history
…load peFos
  • Loading branch information
orichters committed Dec 6, 2023
1 parent 86109c0 commit 95aa02e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
4 changes: 2 additions & 2 deletions R/reportEnergyInvestment.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ reportEnergyInvestment <- function(gdx, regionSubsetList = NULL, t = c(seq(2005,
pebio <- readGDX(gdx, c("peBio", "pebio"), format = "first_found")
ttot <- readGDX(gdx, name = "ttot", format = "first_found")
# read variables
v_directteinv <- readGDX(gdx, name = c("v_costInvTeDir", "v_directteinv"), field = "l", format = "first_found")
v_adjustteinv <- readGDX(gdx, name = c("v_costInvTeAdj", "v_adjustteinv"), field = "l", format = "first_found")
v_directteinv <- readGDX(gdx, name = c("v_costInvTeDir", "vm_costInvTeDir", "v_directteinv"), field = "l", format = "first_found")
v_adjustteinv <- readGDX(gdx, name = c("v_costInvTeAdj", "vm_costInvTeAdj", "v_adjustteinv"), field = "l", format = "first_found")

# read parameters for additional calculations:
pm_data <- readGDX(gdx, c("pm_data"), format = "first_found")
Expand Down
2 changes: 1 addition & 1 deletion R/reportLCOE.R
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ LCOE.avg <- NULL
### Read marginal adjustment costs ----

# Read marginal adjustment cost calculated in core/postsolve.gms
# It is calculated as d(v_costInvTeAdj) / d(vm_deltaCap).
# It is calculated as d(vm_costInvTeAdj) / d(vm_deltaCap).
# Unit: trUSD2005/ (TW(out)/yr).
o_margAdjCostInv <- readGDX(gdx, "o_margAdjCostInv", restore_zeros = F)

Expand Down
20 changes: 7 additions & 13 deletions R/reportPrices.R
Original file line number Diff line number Diff line change
Expand Up @@ -786,23 +786,20 @@ reportPrices <- function(gdx, output=NULL, regionSubsetList=NULL,
"Price|Carbon|AggregatedByGrossCO2 (US$2005/t CO2)")) # AggregatedByEmiGHGGross
}

tradeFossil <- c("pecoal", "pegas", "peoil")
p21_tau_Import <- readGDX(gdx, name = "p21_tau_Import", react = "silent")[, t, tradeFossil]
peFos <- readGDX(gdx, "peFos") # fossil PE carriers
p21_tau_Import <- readGDX(gdx, name = "p21_tau_Import", react = "silent")[, t, peFos]
tax_import_type_21 <- readGDX(gdx, name = "tax_import_type_21", react = "silent")
if (! is.null(p21_tau_Import) && ! is.null(tax_import_type_21)) {
pm_taxCO2eqMport <- 0
if ("c02taxmarkup" %in% tax_import_type_21) {
pm_taxCO2eqMport <- pm_taxCO2eqMport + dimSums(p21_tau_Import[,,"c02taxmarkup"], dim = 3.2) * pm_taxCO2eqSum
if ("CO2taxmarkup" %in% tax_import_type_21) {
pm_taxCO2eqMport <- pm_taxCO2eqMport + dimSums(p21_tau_Import[,,"CO2taxmarkup"], dim = 3.2) * pm_taxCO2eqSum
}
if ("avC02taxmarkup" %in% tax_import_type_21) {
pm_taxCO2eqMport <- pm_taxCO2eqMport + dimSums(p21_tau_Import[,, "avC02taxmarkup"], dim = 3.2) * pmax(pm_taxCO2eqSum, magpie_expand(colMeans(pm_taxCO2eqSum), pm_taxCO2eqSum))
if ("avCO2taxmarkup" %in% tax_import_type_21) {
pm_taxCO2eqMport <- pm_taxCO2eqMport + dimSums(p21_tau_Import[,, "avCO2taxmarkup"], dim = 3.2) * pmax(pm_taxCO2eqSum, magpie_expand(colMeans(pm_taxCO2eqSum), pm_taxCO2eqSum))
}
pm_taxCO2eqMport <- pm_taxCO2eqMport * 1000 * 12/44
out <- mbind(out, setNames(pm_taxCO2eqMport[,, "pecoal"], "Price|Carbon|Imported|Coal (US$2005/t CO2)"))
out <- mbind(out, setNames(pm_taxCO2eqMport[,, "pegas" ], "Price|Carbon|Imported|Gas (US$2005/t CO2)"))
out <- mbind(out, setNames(pm_taxCO2eqMport[,, "peoil" ], "Price|Carbon|Imported|Oil (US$2005/t CO2)"))
# use unweighted average, because weighing according to import volumes might lead to big jumps
out <- mbind(out, setNames(dimSums(pm_taxCO2eqMport, dim = 3.1)/3, "Price|Carbon|Imported (US$2005/t CO2)"))
out <- mbind(out, setNames(dimSums(pm_taxCO2eqMport, dim = 3.1)/length(peFos), "Price|Carbon|Imported (US$2005/t CO2)"))
}

#
Expand Down Expand Up @@ -906,9 +903,6 @@ reportPrices <- function(gdx, output=NULL, regionSubsetList=NULL,
"Price|Carbon|Demand|Industry (US$2005/t CO2)" = "FE (EJ/yr)",
"Price|Carbon|Supply (US$2005/t CO2)" = "FE (EJ/yr)",
"Price|Carbon|Imported (US$2005/t CO2)" = "FE (EJ/yr)",
"Price|Carbon|Imported|Coal (US$2005/t CO2)" = "FE (EJ/yr)",
"Price|Carbon|Imported|Gas (US$2005/t CO2)" = "FE (EJ/yr)",
"Price|Carbon|Imported|Oil (US$2005/t CO2)" = "FE (EJ/yr)",

"Price|Carbon|AggregatedByGrossCO2 (US$2005/t CO2)" = "Emi|GHG|Gross|Energy (Mt CO2eq/yr)",
"Price|Carbon|Captured|AggregatedByGrossCO2 (US$2005/t CO2)" = "Emi|GHG|Gross|Energy (Mt CO2eq/yr)",
Expand Down

0 comments on commit 95aa02e

Please sign in to comment.