Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
fbenke-pik committed Aug 28, 2024
1 parent 80bbdf4 commit 808fdbb
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 32 deletions.
72 changes: 40 additions & 32 deletions R/calcDiffInvestCosts.R
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
#' Aggregated investment cost data for REMIND regions (based on IEA_WEO)
#' @description Disaggregated investment cost data is aggregated and technologies renamed to REMIND names
#' @details REMIND does not have a classification of coal power plants e.g., sub-critical. Therefore, countries are given coal plant
#' costs assuming what type of coal plants are expected to develop there. For other technologies, certain assumptions are taken
#' @description Disaggregated investment cost data is aggregated and technologies
#' renamed to REMIND names
#' @details REMIND does not have a classification of coal power plants e.g., sub-critical.
#' Therefore, countries are given coal plant costs assuming what type of coal
#' plants are expected to develop there. For other technologies, certain assumptions are taken
#' to change to REMIND convention.
#' @param subtype Investment Costs, I&M Costs, and Efficiency
#' @return Magpie object with aggregated but diffrentiated investment costs for some technologies.
#' @author Aman Malik
#' @param subtype "Invest_Costs" or "Efficiency"
#' @return Magpie object with aggregated but differentiated investment
#' costs for some technologies.
#' @author Aman Malik, Falk Benke
#' @importFrom dplyr filter

calcDiffInvestCosts <- function(subtype) {

if (subtype == "Invest_Costs") {
x <- readSource("IEA_WEO", subtype = "Invest_Costs")
x_REN21 <- readSource("REN21", subtype = "investmentCosts")
x_IEA_PVPS <- readSource("IEA_PVPS", subtype = "CAPEX")

x[, , ] <- as.numeric(x[, , ]) # convertng data values into numeric
x <- readSource("IEA_WorldEnergyOutlook", subtype = "assumptions")
x <- x[, , "Stated Policies"][, , "Capital costs (USD/kW)"] %>%
dimReduce()

# Various mapping files used to get needed mappings, for e.g., South Asia
countries <- toolGetMapping("regionmappingREMIND.csv", where = "mappingfolder", type = "regional")
Expand All @@ -29,6 +32,7 @@ calcDiffInvestCosts <- function(subtype) {
"Coal.Steam Coal - SUPERCRITICAL",
"Coal.Steam Coal - ULTRASUPERCRITICAL"
)] <- 0

# For countries in LAM, IND, FSU and MEA use supercritical plant investment costs as standard coal plant costs
x[c(
countries$CountryCode[countries$RegionCode == "LAM"], "IND",
Expand All @@ -39,11 +43,12 @@ calcDiffInvestCosts <- function(subtype) {
"Coal.Steam Coal - ULTRASUPERCRITICAL"
)] <- 0

# For countries in OECD and CHN use ultrasupercritical investment costs ultrasupercritical plants for "Coal.Steam Coal - ULTRASUPERCRITICAL")] <- 0
# For countries in OECD and CHN use ultrasupercritical investment costs
x[c("CHN", "KOR", "MAC", "HKG", countries3$CountryCode[countries3$RegionCode == "OECD"]), , c(
"Coal.Steam Coal - SUBCRITICAL",
"Coal.Steam Coal - SUPERCRITICAL"
)] <- 0

# For remaining countries not covered above, use subcritical plant investment costs
years <- getYears(x)
for (y in years) {
Expand All @@ -57,7 +62,10 @@ calcDiffInvestCosts <- function(subtype) {
)
] <- 0
}
tech_mapping <- toolGetMapping("comparison.csv", where = "mappingfolder", type = "sectoral") %>% filter(!is.na(!!sym("tech")))

tech_mapping <- toolGetMapping("techmapping_IEA_WEO_PG_assumptions.csv",
where = "mrremind", type = "sectoral") %>%
filter(!is.na(.data$tech))

# create new magpie object with names of corresponding REMIND technologies
x_new <- new.magpie(getRegions(x), names = unique(tech_mapping$tech), years = getYears(x), fill = 0)
Expand All @@ -66,30 +74,32 @@ calcDiffInvestCosts <- function(subtype) {
x_new[, , "pc"] <- x[, , "Coal.Steam Coal - SUBCRITICAL"] + x[, , "Coal.Steam Coal - SUPERCRITICAL"] +
x[, , "Coal.Steam Coal - ULTRASUPERCRITICAL"]

# for "spv" take 1/4 of costs from small-scale and 3/4 costs from large scale (utility scale)ildings
x_new[, , "spv"] <- 0.75 * x[, , "Renewables.Solar photovoltaics - Large scale"] + 0.25 * x[, , "Renewables.Solar photovoltaics - Buildings"]
# for "spv" take 1/4 of costs from small-scale buildings and 3/4 costs from large scale (utility scale)
x_new[, , "spv"] <- 0.75 * x[, , "Renewables.Solar photovoltaics - Large scale unit"] +
0.25 * x[, , "Renewables.Solar photovoltaics - Buildings"]

# same for hydro - removed when hydro values are fed from "private" data source
# x_new[,,"hydro"] <- 0.75*x[,,"Renewables.Hydropower - large-scale"] + 0.25*x[,,"Renewables.Hydropower - small-scale"]
x_new[, , "hydro"] <- x[, , "Renewables.Hydropower - large-scale"]
# and Biomass CHP
x_new[, , "biochp"] <- 0.75 * x[, , "Renewables.Biomass CHP Medium"] + 0.25 * x[, , "Renewables.Biomass CHP Small"]
# same for hydro
x_new[, , "hydro"] <- 0.75 * x[, , "Renewables.Hydropower - large-scale unit"] +
0.25 * x[, , "Renewables.Hydropower - small-scale unit"]

# for rest of technologies, simply match
further_techs_to_map <- filter(tech_mapping, !(!!sym("tech") %in% c("pc", "spv", "hydro", "biochp")))
# for rest of technologies, simply match (they all have a 1 to 1 relationship)
further_techs_to_map <- filter(tech_mapping, !(.data$tech %in% c("pc", "spv", "hydro")))
x_new[, , further_techs_to_map$tech] <- as.numeric(x[, , further_techs_to_map$IEA])

x_new <- time_interpolate(x_new, c(2025, 2035), integrate_interpolated_years = T)
# overwrite investmetn costs vor renewables with data form REN21
x_new <- time_interpolate(x_new, c(2025, 2035, 2040), integrate_interpolated_years = TRUE)

# overwrite investment costs for renewables with data form REN21

x_REN21 <- readSource("REN21", subtype = "investmentCosts")

x_REN21_wa <- collapseNames(x_REN21[, , "wa"]) # use weighted average
getNames(x_REN21_wa) <- gsub("hydropower", "hydro", getNames(x_REN21_wa))
getNames(x_REN21_wa) <- gsub("Solar PV", "spv", getNames(x_REN21_wa))
getNames(x_REN21_wa) <- gsub("wind-on", "wind", getNames(x_REN21_wa))

x_REN21_wa <- x_REN21_wa[, , c("Biopower", "Geothermal Power", "wind-off", "csp"), invert = TRUE]
# use REN21 data for all time steps for hydro
# x_new[,,"hydro"] <- x_REN21_wa[,,"hydro"]
# use REN21 data only for 2015 for spv,csp and wind; all other time steps are 0

# use REN21 data only for 2015 for spv, csp and wind; all other time steps are 0
x_new[, , c("spv", "wind")] <- 0
x_new[, 2015, c("spv", "wind")] <- x_REN21_wa[, , c("spv", "wind")]
x_new["JPN", 2015, "wind"] <- x_REN21["JPN", , "wind-on.max"]
Expand Down Expand Up @@ -147,14 +157,15 @@ calcDiffInvestCosts <- function(subtype) {
x_adj_iso <- toolAggregate(x_adj, regmapping)

# regions which have not been manually adjusted -> replace by original IEA PVPS data
x_IEA_PVPS <- readSource("IEA_PVPS", subtype = "CAPEX")
x_adj_iso[which(is.na(x_adj_iso))] <- x_IEA_PVPS[which(is.na(x_adj_iso))]
# add new 2020 values PV
x_new[, "y2020", "spv"] <- x_adj_iso

return(list(x = x_new, weight = x_new, unit = "USD$/KW 2015", description = "Investment costs data"))
} else if (subtype == "O&M_Costs") {
x <- readSource("IEA_WEO", subtype = "Invest_Costs")

} else if (subtype == "Efficiency") {

x <- readSource("IEA_WEO", subtype = "Efficiency")
x[, , ] <- as.numeric(x[, , ]) # convertng data values into numeric

Expand Down Expand Up @@ -212,12 +223,9 @@ calcDiffInvestCosts <- function(subtype) {
further_techs_to_map <- filter(tech_mapping, !(!!sym("tech") %in% c("pc", "spv", "hydro", "biochp")))
x_new[, , further_techs_to_map$tech] <- as.numeric(x[, , further_techs_to_map$IEA])

x_new <- time_interpolate(x_new, c(2025, 2035), integrate_interpolated_years = T)
x_new <- time_interpolate(x_new, c(2025, 2035), integrate_interpolated_years = TRUE)

return(list(x = x_new, weight = x_new, unit = "NA", description = "Efficiency data"))
}

if (subtype == "Invest_Costs" | subtype == "O&M_Costs") {
return(list(x = x_new, weight = x_new, unit = "USD$/KW 2015", description = "Investment costs data"))
}
}
27 changes: 27 additions & 0 deletions inst/extdata/sectoral/techmapping_IEA_WEO_PG_assumptions.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
IEA,tech,Comments
Steam Coal - SUBCRITICAL,pc,"Africa, South Asia"
Steam Coal - SUPERCRITICAL,pc,"LAM, IND, FSU, MEA"
Steam Coal - ULTRASUPERCRITICAL,pc,"China, OECD/IEA"
IGCC,igcc,
CCGT,ngcc,
Gas turbine,ngt,
CCGT - CHP,gaschp,
Fuel cell (distributed electricity generation),NA,Not in REMIND
Coal + CCS,pcc,
Oxyfuel + CCS,pco,
IGCC + CCS,igccc,
CCGT + CCS,ngccc,
Nuclear,tnrs,
Bioenergy - Large scale unit,NA,
Bioenergy - Cofiring,NA,Not in REMIND
Bioenergy - Medium-scale CHP,biochp,
Bioenergy + CCUS,NA,
Geothermal,geohdr,
Hydropower - large-scale unit,hydro,
Hydropower - small-scale unit,hydro,
Solar photovoltaics - Large scale unit,spv,
Solar photovoltaics - Buildings,spv,
Concentrating solar power,csp,
Marine,NA,Not in REMIND
Wind onshore,wind,
Wind offshore,NA,Not in REMIND

0 comments on commit 808fdbb

Please sign in to comment.