-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into sjs/feature/CEDS_Re…
…lease_April21
- Loading branch information
Showing
30 changed files
with
1,117 additions
and
2 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Copyright 2019 Battelle Memorial Institute; see the LICENSE file. | ||
|
||
#' module_energy_LA162.dac | ||
#' | ||
#' Sets up input, output, and IO coefficients for dac | ||
#' | ||
#' @param command API command to execute | ||
#' @param ... other optional parameters, depending on command | ||
#' @return Depends on \code{command}: either a vector of required inputs, | ||
#' a vector of output names, or (if \code{command} is "MAKE") all | ||
#' the generated outputs: \code{L162.out_Mt_R_dac_Yh}, | ||
#' @details This chunk defines historical demand for the climate engineering services sector, setting up structure for future competition. | ||
#' For all historical years, is met entirely by "no DAC" technology | ||
#' @importFrom assertthat assert_that | ||
#' @importFrom dplyr arrange bind_rows filter group_by left_join mutate select semi_join summarise summarise_all | ||
#' @importFrom tidyr complete gather nesting | ||
#' @author JF March 2021 | ||
module_energy_LA162.dac <- function(command, ...) { | ||
if(command == driver.DECLARE_INPUTS) { | ||
return(c(FILE = "energy/A62.calibration")) | ||
} else if(command == driver.DECLARE_OUTPUTS) { | ||
return(c("L162.out_Mt_R_dac_Yh")) | ||
} else if(command == driver.MAKE) { | ||
|
||
# Silence global variable package check | ||
. <- Biomass <- Biomass_EJ <- Coal <- Coal_EJ <- Country <- GCAM_region_ID <- Gas <- Gas_EJ <- | ||
IEA_fuelshare_region <- IEA_intensity_region <- IOelec <- Oil <- Oil_EJ <- TPE_GJkg <- | ||
Worrell_region <- cement_prod_Mt <- country_name <- elec_EJ <- elec_GJkg <- | ||
emiss_ktC <- fuel <- heat_EJ <- heat_GJkg <- in.value <- ind.value <- iso <- | ||
old.year <- out.value <- process_emissions_MtC <- process_emissions_ktC <- | ||
prod_Mt <- prod_emiss_ratio <- reg_process_emissions <- region_GCAM3 <- sector <- | ||
share <- value <- cement <- year <- value.y <- value.x <- NULL | ||
|
||
all_data <- list(...)[[1]] | ||
|
||
# Load required inputs | ||
|
||
ces_calibration <- get_data(all_data, "energy/A62.calibration") | ||
|
||
|
||
# =================================================== | ||
# 2. Perform computations | ||
|
||
# Set constants used for this chunk | ||
# --------------------------------- | ||
|
||
ces_calibration -> L162.out_Mt_R_dac_Yh | ||
|
||
|
||
L162.out_Mt_R_dac_Yh %>% | ||
add_units("Mt C") %>% | ||
add_comments("Outputs are calculated by simply transposing the calibration matrix, which contains arbitrarily high values for dac+noDAC") %>% | ||
add_legacy_name("L162.out_Mt_R_dac_Yh") %>% | ||
add_precursors("energy/A62.calibration") -> | ||
L162.out_Mt_R_dac_Yh | ||
|
||
|
||
return_data(L162.out_Mt_R_dac_Yh) | ||
} else { | ||
stop("Unknown command") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
# Copyright 2019 Battelle Memorial Institute; see the LICENSE file. | ||
|
||
#' module_energy_batch_dac_xml | ||
#' | ||
#' Construct XML data structure for \code{dac.xml}. | ||
#' | ||
#' @param command API command to execute | ||
#' @param ... other optional parameters, depending on command | ||
#' @return Depends on \code{command}: either a vector of required inputs, | ||
#' a vector of output names, or (if \code{command} is "MAKE") all | ||
#' the generated outputs: \code{dac.xml}. The corresponding file in the | ||
#' original data system was \code{batch_dac_xml.R} (energy XML). | ||
#' @author JF March 2021 | ||
module_energy_batch_dac_xml <- function(command, ...) { | ||
|
||
|
||
TECH_PARAMETRIZATION_INPUTS <- paste0("ssp", 1:5) | ||
if(command == driver.DECLARE_INPUTS) { | ||
return(c("L262.Supplysector_dac", | ||
"L262.FinalEnergyKeyword_dac", | ||
"L262.SubsectorLogit_dac", | ||
"L262.SubsectorShrwtFllt_dac", | ||
"L262.SubsectorInterp_dac", | ||
"L262.StubTech_dac", | ||
"L262.GlobalTechShrwt_dac", | ||
c(paste("L262.GlobalTechShrwt_dac", tolower(TECH_PARAMETRIZATION_INPUTS), sep = "_")), | ||
c(paste("L262.GlobalTechCoef_dac", tolower(TECH_PARAMETRIZATION_INPUTS), sep = "_")), | ||
c(paste("L262.GlobalTechCost_dac", tolower(TECH_PARAMETRIZATION_INPUTS), sep = "_")), | ||
"L262.GlobalTechCapture_dac", | ||
"L262.StubTechProd_dac", | ||
"L262.PerCapitaBased_dac", | ||
"L262.BaseService_dac", | ||
"L262.PriceElasticity_dac", | ||
"L262.GlobalTechSCurve_dac", | ||
"L262.GlobalTechProfitShutdown_dac")) | ||
} else if(command == driver.DECLARE_OUTPUTS) { | ||
return(c(XML = "dac_ssp1.xml", | ||
XML = "dac_ssp2.xml", | ||
XML = "dac_ssp3.xml", | ||
XML = "dac_ssp4.xml", | ||
XML = "dac_ssp5.xml")) | ||
} else if(command == driver.MAKE) { | ||
|
||
all_data <- list(...)[[1]] | ||
|
||
for(sce in TECH_PARAMETRIZATION_INPUTS){ | ||
# Load required inputs | ||
L262.Supplysector_dac <- get_data(all_data, "L262.Supplysector_dac") | ||
L262.FinalEnergyKeyword_dac <- get_data(all_data, "L262.FinalEnergyKeyword_dac") | ||
L262.SubsectorLogit_dac <- get_data(all_data, "L262.SubsectorLogit_dac") | ||
L262.SubsectorShrwtFllt_dac <- get_data(all_data, "L262.SubsectorShrwtFllt_dac") | ||
L262.SubsectorInterp_dac <- get_data(all_data, "L262.SubsectorInterp_dac") | ||
L262.StubTech_dac <- get_data(all_data, "L262.StubTech_dac") | ||
L262.GlobalTechShrwt_dac <- get_data(all_data, "L262.GlobalTechShrwt_dac") | ||
|
||
coef_name <- paste0("L262.GlobalTechCoef_dac_",tolower(sce)) | ||
cost_name <- paste0("L262.GlobalTechCost_dac_",tolower(sce)) | ||
shwt_name <- paste0("L262.GlobalTechShrwt_dac_",tolower(sce)) | ||
|
||
L262.GlobalTechCoef_dac <- get_data(all_data, coef_name) | ||
L262.GlobalTechCost_dac <- get_data(all_data, cost_name) | ||
L262.GlobalTechShrwt_dac <- get_data(all_data, shwt_name) | ||
|
||
L262.GlobalTechCapture_dac <- get_data(all_data, "L262.GlobalTechCapture_dac") | ||
L262.StubTechProd_dac <- get_data(all_data, "L262.StubTechProd_dac") | ||
L262.PerCapitaBased_dac <- get_data(all_data, "L262.PerCapitaBased_dac") | ||
L262.BaseService_dac <- get_data(all_data, "L262.BaseService_dac") | ||
L262.PriceElasticity_dac <- get_data(all_data, "L262.PriceElasticity_dac") | ||
L262.GlobalTechSCurve_dac <- get_data(all_data, "L262.GlobalTechSCurve_dac") | ||
L262.GlobalTechProfitShutdown_dac <- get_data(all_data, "L262.GlobalTechProfitShutdown_dac") | ||
|
||
|
||
|
||
xmlfn <- paste0("dac_",tolower(sce), '.xml') | ||
|
||
# =================================================== | ||
# Produce outputs | ||
create_xml(xmlfn) %>% | ||
add_logit_tables_xml(L262.Supplysector_dac, "Supplysector") %>% | ||
add_xml_data(L262.FinalEnergyKeyword_dac, "FinalEnergyKeyword") %>% | ||
add_logit_tables_xml(L262.SubsectorLogit_dac, "SubsectorLogit") %>% | ||
add_xml_data(L262.SubsectorShrwtFllt_dac, "SubsectorShrwtFllt") %>% | ||
add_xml_data(L262.SubsectorInterp_dac, "SubsectorInterp") %>% | ||
add_xml_data(L262.StubTech_dac, "StubTech") %>% | ||
add_xml_data(L262.GlobalTechShrwt_dac, "GlobalTechShrwt") %>% | ||
add_xml_data(L262.GlobalTechCoef_dac, "GlobalTechCoef") %>% | ||
add_xml_data(L262.GlobalTechCost_dac, "GlobalTechCost") %>% | ||
add_xml_data(L262.GlobalTechCapture_dac, "GlobalTechCapture") %>% | ||
add_xml_data(L262.StubTechProd_dac, "StubTechProd") %>% | ||
add_xml_data(L262.PerCapitaBased_dac, "PerCapitaBased") %>% | ||
add_xml_data(L262.BaseService_dac, "BaseService") %>% | ||
add_xml_data(L262.PriceElasticity_dac, "PriceElasticity") %>% | ||
add_xml_data(L262.GlobalTechSCurve_dac, "GlobalTechSCurve") %>% | ||
add_xml_data(L262.GlobalTechProfitShutdown_dac, "GlobalTechProfitShutdown") %>% | ||
add_precursors("L262.Supplysector_dac", | ||
"L262.FinalEnergyKeyword_dac", | ||
"L262.SubsectorLogit_dac", | ||
"L262.SubsectorShrwtFllt_dac", | ||
"L262.SubsectorInterp_dac", | ||
"L262.StubTechProd_dac", | ||
"L262.StubTech_dac", | ||
"L262.GlobalTechShrwt_dac", | ||
paste0("L262.GlobalTechShrwt_dac_",tolower(sce)), | ||
paste0("L262.GlobalTechCoef_dac_",tolower(sce)), | ||
paste0("L262.GlobalTechCost_dac_",tolower(sce)), | ||
"L262.GlobalTechCapture_dac", | ||
"L262.PerCapitaBased_dac", | ||
"L262.BaseService_dac", | ||
"L262.PriceElasticity_dac", | ||
"L262.GlobalTechSCurve_dac", | ||
"L262.GlobalTechProfitShutdown_dac") -> | ||
xmlobj | ||
assign(xmlfn, xmlobj) | ||
|
||
|
||
} | ||
return_data(dac_ssp1.xml, | ||
dac_ssp2.xml, | ||
dac_ssp3.xml, | ||
dac_ssp4.xml, | ||
dac_ssp5.xml)} | ||
else { | ||
stop("Unknown command") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# File: A_CDRU.csv | ||
# Title: Primary energy handling default coefficients | ||
# Units: Unitless | ||
#Description: Defines dummy coefficient table for atmospheric carbon stocks | ||
# Column types: ccccnnn | ||
# ---------- | ||
supplysector,subsector,technology,minicam.energy.input,1971,2010,2100 | ||
airCO2,airCO2,airCO2,atmospheric carbon stocks,1,1,1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# File: A62.calibration.csv | ||
# Title: Calibration values for the CO2 removal sector | ||
# Units: MtC | ||
# Column types: icin | ||
# ---------- | ||
GCAM_region_ID,sector,year,value | ||
1,CO2 removal,2015,2000 | ||
2,CO2 removal,2015,26.58921908 | ||
3,CO2 removal,2015,26.30296292 | ||
4,CO2 removal,2015,25.52156095 | ||
5,CO2 removal,2015,51.65929106 | ||
6,CO2 removal,2015,417.4775416 | ||
7,CO2 removal,2015,1012.357646 | ||
8,CO2 removal,2015,79.87707563 | ||
9,CO2 removal,2015,86.18576367 | ||
10,CO2 removal,2015,429.8246874 | ||
11,CO2 removal,2015,2116.541628 | ||
12,CO2 removal,2015,22.06217174 | ||
13,CO2 removal,2015,71.77458929 | ||
14,CO2 removal,2015,15.81592955 | ||
15,CO2 removal,2015,15.84963925 | ||
16,CO2 removal,2015,6.342950362 | ||
17,CO2 removal,2015,87.41423367 | ||
18,CO2 removal,2015,16.37849476 | ||
19,CO2 removal,2015,66.31417001 | ||
20,CO2 removal,2015,232.7632894 | ||
21,CO2 removal,2015,334.5848291 | ||
22,CO2 removal,2015,7.458686272 | ||
23,CO2 removal,2015,313.0929592 | ||
24,CO2 removal,2015,5.567627191 | ||
25,CO2 removal,2015,161.9684919 | ||
26,CO2 removal,2015,470.9671038 | ||
27,CO2 removal,2015,8.830836973 | ||
28,CO2 removal,2015,0 | ||
29,CO2 removal,2015,165.6920326 | ||
30,CO2 removal,2015,0.307808272 | ||
31,CO2 removal,2015,331.3724602 | ||
32,CO2 removal,2015,136.5132452 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# File: A62.demand.csv | ||
# Title: dac final demand perCapitaBased and price elasticity | ||
# Units: NA for perCapitaBased; Unitless for price.elasticity | ||
# Comments: perCapitaBased is a logical (Boolean) indicating whether to use a per-capita or per-GDP based demand function | ||
# Column types: cin | ||
# ---------- | ||
energy.final.demand,perCapitaBased,price.elasticity | ||
CO2 removal,0,0 |
10 changes: 10 additions & 0 deletions
10
input/gcamdata/inst/extdata/energy/A62.globaltech_co2capture.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# File: A62.globaltech_co2capture.csv | ||
# Title: CO2 capture rates for dac and process heat dac technology | ||
# Units: Unitless | ||
# Column types: cccnn | ||
# ---------- | ||
supplysector,subsector,technology,1971,2100 | ||
process heat dac,gas CCS,gas CCS,0.95,0.95 | ||
CO2 removal,dac,hightemp DAC NG,1,1 | ||
CO2 removal,dac,hightemp DAC elec,1,1 | ||
CO2 removal,dac,lowtemp DAC heatpump,1,1 |
21 changes: 21 additions & 0 deletions
21
input/gcamdata/inst/extdata/energy/A62.globaltech_coef_ssp1.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# File: A62.globaltech_coef_ssp1.csv | ||
# Title: Default coefficients for DAC | ||
# Units: airCO2 input is unitless (MtC from the atmosphere per Mt dac demand); all others are GJ per kg C (EJ of energy per Mt C) | ||
# Column types: ccccnnnn | ||
# ---------- | ||
supplysector,subsector,technology,minicam.energy.input,1971,2020,2050,2100 | ||
CO2 removal,dac,hightemp DAC NG,process heat dac,0.0297,0.0297,0.019433333,0.019433333 | ||
CO2 removal,dac,hightemp DAC NG,elect_td_ind,0.006526667,0.006526667,0.004766667,0.004766667 | ||
CO2 removal,dac,hightemp DAC NG,airCO2,1,1,1,1 | ||
CO2 removal,dac,hightemp DAC NG,water_td_ind_C,0.017233333,0.017233333,0.017233333,0.017233333 | ||
CO2 removal,dac,hightemp DAC NG,water_td_ind_W,0.017233333,0.017233333,0.017233333,0.017233333 | ||
CO2 removal,dac,no DAC,process heat dac,0,0,0,0 | ||
CO2 removal,dac,no DAC,elect_td_ind,0,0,0,0 | ||
CO2 removal,dac,no DAC,airCO2,0,0,0,0 | ||
process heat dac,gas CCS,gas CCS,wholesale gas,1,1,1,1 | ||
CO2 removal,dac,hightemp DAC elec,elect_td_ind,0.0220044,0.0220044,0.0186384,0.0186384 | ||
CO2 removal,dac,hightemp DAC elec,airCO2,1,1,1,1 | ||
CO2 removal,dac,hightemp DAC elec,water_td_ind_C,0.017233333,0.017233333,0.017233333,0.017233333 | ||
CO2 removal,dac,hightemp DAC elec,water_td_ind_W,0.017233333,0.017233333,0.017233333,0.017233333 | ||
CO2 removal,dac,lowtemp DAC heatpump,elect_td_ind,0.0200684,0.0200684,0.009320178,0.009320178 | ||
CO2 removal,dac,lowtemp DAC heatpump,airCO2,1,1,1,1 |
21 changes: 21 additions & 0 deletions
21
input/gcamdata/inst/extdata/energy/A62.globaltech_coef_ssp2.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# File: A62.globaltech_coef_ssp2.csv | ||
# Title: Default coefficients for DAC | ||
# Units: airCO2 input is unitless (MtC from the atmosphere per Mt dac demand); all others are GJ per kg C (EJ of energy per Mt C) | ||
# Column types: ccccnnnn | ||
# ---------- | ||
supplysector,subsector,technology,minicam.energy.input,1971,2020,2050,2100 | ||
CO2 removal,dac,hightemp DAC NG,process heat dac,0.0297,0.0297,0.019433333,0.019433333 | ||
CO2 removal,dac,hightemp DAC NG,elect_td_ind,0.006526667,0.006526667,0.004766667,0.004766667 | ||
CO2 removal,dac,hightemp DAC NG,airCO2,1,1,1,1 | ||
CO2 removal,dac,hightemp DAC NG,water_td_ind_C,0.017233333,0.017233333,0.017233333,0.017233333 | ||
CO2 removal,dac,hightemp DAC NG,water_td_ind_W,0.017233333,0.017233333,0.017233333,0.017233333 | ||
CO2 removal,dac,no DAC,process heat dac,0,0,0,0 | ||
CO2 removal,dac,no DAC,elect_td_ind,0,0,0,0 | ||
CO2 removal,dac,no DAC,airCO2,0,0,0,0 | ||
process heat dac,gas CCS,gas CCS,wholesale gas,1,1,1,1 | ||
CO2 removal,dac,hightemp DAC elec,elect_td_ind,0.0220044,0.0220044,0.0186384,0.0186384 | ||
CO2 removal,dac,hightemp DAC elec,airCO2,1,1,1,1 | ||
CO2 removal,dac,hightemp DAC elec,water_td_ind_C,0.017233333,0.017233333,0.017233333,0.017233333 | ||
CO2 removal,dac,hightemp DAC elec,water_td_ind_W,0.017233333,0.017233333,0.017233333,0.017233333 | ||
CO2 removal,dac,lowtemp DAC heatpump,elect_td_ind,0.0200684,0.0200684,0.009320178,0.009320178 | ||
CO2 removal,dac,lowtemp DAC heatpump,airCO2,1,1,1,1 |
21 changes: 21 additions & 0 deletions
21
input/gcamdata/inst/extdata/energy/A62.globaltech_coef_ssp3.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# File: A62.globaltech_coef_ssp3.csv | ||
# Title: Default coefficients for DAC | ||
# Units: airCO2 input is unitless (MtC from the atmosphere per Mt dac demand); all others are GJ per kg C (EJ of energy per Mt C) | ||
# Column types: ccccnnnn | ||
# ---------- | ||
supplysector,subsector,technology,minicam.energy.input,1971,2020,2050,2100 | ||
CO2 removal,dac,hightemp DAC NG,process heat dac,0.0297,0.0297,0.0297,0.0297 | ||
CO2 removal,dac,hightemp DAC NG,elect_td_ind,0.006526667,0.006526667,0.006526667,0.006526667 | ||
CO2 removal,dac,hightemp DAC NG,airCO2,1,1,1,1 | ||
CO2 removal,dac,hightemp DAC NG,water_td_ind_C,0.017233333,0.017233333,0.017233333,0.017233333 | ||
CO2 removal,dac,hightemp DAC NG,water_td_ind_W,0.017233333,0.017233333,0.017233333,0.017233333 | ||
CO2 removal,dac,no DAC,process heat dac,0,0,0,0 | ||
CO2 removal,dac,no DAC,elect_td_ind,0,0,0,0 | ||
CO2 removal,dac,no DAC,airCO2,0,0,0,0 | ||
process heat dac,gas CCS,gas CCS,wholesale gas,1,1,1,1 | ||
CO2 removal,dac,hightemp DAC elec,elect_td_ind,0.0220044,0.0220044,0.0220044,0.0220044 | ||
CO2 removal,dac,hightemp DAC elec,airCO2,1,1,1,1 | ||
CO2 removal,dac,hightemp DAC elec,water_td_ind_C,0.017233333,0.017233333,0.017233333,0.017233333 | ||
CO2 removal,dac,hightemp DAC elec,water_td_ind_W,0.017233333,0.017233333,0.017233333,0.017233333 | ||
CO2 removal,dac,lowtemp DAC heatpump,elect_td_ind,0.0200684,0.0200684,0.0200684,0.0200684 | ||
CO2 removal,dac,lowtemp DAC heatpump,airCO2,1,1,1,1 |
Oops, something went wrong.