Skip to content

Commit

Permalink
Pull request #262: Pw/feature/hydrogen det ind
Browse files Browse the repository at this point in the history
Merge in JGCRI/gcam-core from pw/feature/hydrogen_det_ind to master

Squashed commit of the following:

commit bf1f88b
Merge: 4fd8bbb 631cf61
Author: Pralit Patel <[email protected]>
Date:   Fri Jun 3 18:02:10 2022 -0400

    Merge remote-tracking branch 'origin/master' into pw/feature/hydrogen_det_ind

commit 4fd8bbb
Author: fuhr472 <[email protected]>
Date:   Wed Jun 1 11:11:23 2022 -0400

    Clarify comments per reviewer requests, mostly by moving down summary comments from the top of the code block, down to the lines where they are actually applied

commit 30abc96
Author: Page Kyle <[email protected]>
Date:   Wed Jun 1 00:49:38 2022 -0600

    improve code commenting and delete unnecessary (commented out) rows, as per pull request review comments

commit 2860a2d
Author: Page Kyle <[email protected]>
Date:   Tue May 31 20:40:08 2022 -0600

    silence R package checks of un-binded variable names in gcamdata/R code

commit 2d6a852
Author: Page Kyle <[email protected]>
Date:   Tue May 31 15:22:40 2022 -0600

    drop international aviation BEV technology terminal share-weight to 0.1 (speculative technology, was becoming dominant in 2.6 scenarios)

commit 3b4ff65
Author: Page Kyle <[email protected]>
Date:   Tue May 31 14:22:36 2022 -0600

    clean up comments and re-build documentation (no changes to XML files from this commit)

commit ef95138
Author: Page Kyle <[email protected]>
Date:   Fri May 27 18:10:38 2022 -0600

    remove EMF-37 hydrogen T&D infrastructure XML files that were not intended to be on this branch
    re-build GCAM_DATA_MAP after recent revisions

commit 2b2f04a
Author: Page Kyle <[email protected]>
Date:   Fri May 27 15:19:20 2022 -0600

    remove EMF37 policy and transport R code files that were unintentionally migrated from sha/projects/gcam-policy branch

commit 45a2e9f
Author: Page Kyle <[email protected]>
Date:   Fri May 27 11:34:54 2022 -0600

    revise A25.globaltech_coef to specify that the electricity input to NGSR is for compression and refrigeration
    (this energy requirement had been getting dropped, supplanted with the electricity requirements of NGSR production only)

commit b0f6475
Author: Page Kyle <[email protected]>
Date:   Wed May 11 13:50:40 2022 -0600

    reduce coefficient of hydrogen liquefaction from 9.2 kwh/kg in 2025 to 8 kwh/kg in 2040 and 7 kwh/kg in 2060
    based on email exchange with Amgad Elgowainy 5/11/2022

commit a69bc10
Author: Page Kyle <[email protected]>
Date:   Wed May 11 13:38:57 2022 -0600

    revise representation of renewable electrolysis to assign a ratio of electrolyzer:renewable capacity that is less than 1

commit a583e96
Author: Patrick O'Rourke <[email protected]>
Date:   Sat May 7 14:34:56 2022 -0400

    Update green hydrogen minicam.non.energy.input name

    - Change from "non-energy" to "electrolyzer"

commit 38d9b20
Author: Page Kyle <[email protected]>
Date:   Fri May 6 15:25:46 2022 -0600

    remove A25.stubtech_cost and replace with calculations performed in zchunk_L225.hydrogen and zchunk_LA125.hydrogen

commit dd11833
Author: Patrick O'Rourke <[email protected]>
Date:   Tue May 3 16:56:14 2022 -0400

    Regionalize Green H2

    - Add regional wind and solar assumptions, with electrolzer separated from wind turbines or solar panels
    - Set global green H2 to USA regional values

commit 9b047c9
Author: Page Kyle <[email protected]>
Date:   Mon May 2 10:10:40 2022 -0600

    move airCO2 PrimaryFuelCO2Coef from Ccoef.xml to the dac_*.xml files.
    Avoids warning message in model run about not being able to find the airCO2 market when DAC is not read in

commit 4ea40c4
Author: Page Kyle <[email protected]>
Date:   Sun May 1 23:18:58 2022 -0600

    revise emission_factor_controls.xml to only delete gdp-control functions from technologies that have them
    this avoids error messages XML parsing

commit 78282a5
Author: Page Kyle <[email protected]>
Date:   Wed Apr 27 23:15:25 2022 -0600

    modify zchunk_L253.emission_controls.R to avoid trying to assign emissions factors to district heat in Taiwan (which is not modeled)

commit 9a9cd06
Author: Page Kyle <[email protected]>
Date:   Wed Apr 27 17:43:18 2022 -0600

    revise "industrial energy use" to "other industrial energy use" in A53.em_ctrl_param_china_industry.csv

commit 081d0a8
Merge: f0ea4a0 952b050
Author: Page Kyle <[email protected]>
Date:   Wed Apr 27 12:41:18 2022 -0600

    Merge branch 'master' into pw/feature/hydrogen_det_ind
    NOT YET TESTED
    Resolve all conflicts
    Rebuild package data
    Use master version of util/testing-framework

commit f0ea4a0
Merge: 0b368f7 ae27b64
Author: Page Kyle <[email protected]>
Date:   Tue Apr 26 15:36:57 2022 -0600

    Merge branch 'pw/feature/hydrogen_det_ind' into pw/feature/hydrogen_usa

... and 158 more commits
  • Loading branch information
pralitp committed Jun 4, 2022
1 parent 631cf61 commit d330871
Show file tree
Hide file tree
Showing 146 changed files with 8,194 additions and 10,120 deletions.
18 changes: 17 additions & 1 deletion input/gcamdata/R/constants.R
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ CONV_TONNE_GJ_RFO <- 40.87 # tons to GJ residual fuel oil
# Time
CONV_YEAR_HOURS <- 24 * 365.25
CONV_DAYS_YEAR <- 1 / 365.25
CONV_DAY_HOURS <- 24

# Energy
CONV_MWH_GJ <- 3.6 # Megawatt hours to Gigajoules
Expand All @@ -150,6 +151,8 @@ CONV_KBTU_EJ <- 1.0551e-12 # KiloBTU to EJ
CONV_TBTU_EJ <- 0.0010551 # TeraBTU to EJ
CONV_MJ_BTU <- 947.777
CONV_BTU_KJ <- 1.0551
CONV_MMBTU_KGH2 <- 0.113939965425114 # MMBTU/kg H2 - LHV Source: H2 CCTP Workbook.xls (Used for older GCAM assumptions)
CONV_GJ_KGH2 <- 0.12021 #GJ/kg H2 - LHV

# Distance
CONV_MILE_KM <- 1.60934 # Mile to km
Expand All @@ -164,6 +167,7 @@ CONV_HA_M2 <- 1e4 # ha to m2
CONV_BM2_M2 <- 1e9
CONV_MILFT2_M2 <- 92900 # Million square feet to square meters
CONV_FT2_M2 <- 0.0929 # Square feet to square meters
CONV_GAL_M3 <- 0.00378541 #gallons to m3
CONV_MI_KM <- 1.60934
CONV_PERS_MILPERS <- 1000000 #Person to million-passengers

Expand Down Expand Up @@ -496,10 +500,13 @@ energy.PV_LIFETIME <- 30 # years
energy.PV_RESID_INSTALLED_COST <- 9500 # 2005USD per kw
energy.PV_RESID_OM <- 100 # 2005USD per kw per year
energy.CSP_STORAGE_CF_DIFF <- 0.25 # capacity factor difference between CSP_storage (0.5) and CSP (0.25)
energy.SOLAR_ELECTROLYSIS_KGH2_D <- 50000 # kg of h2 produced per day at a solar-electrolysis plant
energy.ELECTROLYZER_RENEWABLE_CAPACITY_RATIO <- 0.618 # unitless capacity ratio of electrolyzers to renewable-electric equipment

# Wind related constants
energy.WIND_CURVE_MIDPOINT <- 0.5
energy.WIND_MIN_POTENTIAL <- 0.001
energy.WIND_ELECTROLYSIS_KGH2_D <- 50000 # kg of h2 produced per day at a wind-electrolysis plant

# Digits for rounding into XMLs
energy.DIGITS_CALOUTPUT <- 7
Expand Down Expand Up @@ -527,6 +534,11 @@ energy.DIGITS_SHRWT <- 4
energy.DIGITS_SPEED <- 1
energy.DIGITS_TECHCHANGE <- 4

#jf 2021-10-21
#defines fraction of liquid fuel consumption used for off-road vehicles in agriculture, mining, and construction energy use.
#the remainder is allocated to stationary equipment (e.g., generators)
energy.LIQUID_FUEL_MOBILE_FRAC <- 0.8

# Policy assumptions for module_energy_L270.limits
energy.NEG_EMISS_POLICY_NAME <- "negative_emiss_budget"
energy.NEG_EMISS_TARGET_GAS <- "CO2_LTG" # the name of the gas to target in the negative emiss budget
Expand Down Expand Up @@ -565,7 +577,7 @@ income.param.usa<-0.4875

# Constants for global detailed industry
energy.OFF_ROAD.BIOMASS_GROWTH <- c("Africa_Eastern","Africa_Southern","Africa_Western") #limit fast growth of biomass in agriculture energy use
energy.IRON_STEEL.DEFAULT_COEF <- c("Biomass-based","scrap","H2 enduse") #assign iron & steel global technology coefficients
energy.IRON_STEEL.DEFAULT_COEF <- c("Biomass-based","scrap","H2 wholesale delivery") #assign iron & steel global technology coefficients

# Socioeconomics constants ======================================================================

Expand Down Expand Up @@ -852,6 +864,10 @@ gcamusa.GEOTHERMAL_DEFAULT_EFFICIENCY <- 0.1

gcamusa.ELECT_TD_SECTORS <- c("elect_td_bld", "elect_td_ind", "elect_td_trn")

#Fuels whose markets will be represented with state-specific prices
gcamusa.STATE_FUEL_MARKETS <- c(gcamusa.ELECT_TD_SECTORS, "H2 industrial", "H2 retail delivery", "H2 retail dispensing",
"H2 wholesale delivery", "H2 wholesale dispensing","H2 central production","H2 pipeline","H2 liquid truck")

# Indicate whether to use regional ?cost adders? to differentiate
# fuel prices by grid region in GCAM-USA (FALSE = same prices in all states)
gcamusa.USE_REGIONAL_FUEL_MARKETS <- TRUE
Expand Down
Binary file modified input/gcamdata/R/sysdata.rda
Binary file not shown.
3 changes: 2 additions & 1 deletion input/gcamdata/R/zchunk_L101.water_supply_groundwater.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ module_water_L101.water_supply_groundwater <- function(command, ...) {
lower_cost <- upper_cost <-
grade <- elec_EJ <- elec_coef <- Superwell_country <-
GCAM_region_ID <- minNEcost <- available <-
minNEcost_bilUSD <- maxNEcost_bilUSD <- maxNEcost <- NULL
minNEcost_bilUSD <- maxNEcost_bilUSD <- maxNEcost <-
lower <- upper <- range_mult <- NULL

all_data <- list(...)[[1]]

Expand Down
2 changes: 1 addition & 1 deletion input/gcamdata/R/zchunk_L112.ceds_ghg_en_R_S_T_Y.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ module_emissions_L112.ceds_ghg_en_R_S_T_Y <- function(command, ...) {
emiss_share <- prod_share <- total_prod <- crop_area_share <- prod_share_GLU <- GLU <- Prod_R_C <- crop_area_total <- scalar <- EPA_emissions <-
CEDS_emissions <- epa_emissions <- ch4_em_factor <- production <- feed <- GCAM_commodity <- input.emissions <- EPA_agg_fuel_ghg <- EPA_agg_sector <-
EDGAR_agg_sector <- globalemfact <- emfact <- value <- em_fact <- . <- FF_driver <- natural_gas <- UCD_category <- Non.co2 <-
quantile <- upper <- GCAM_subsector <- value_median <- NULL
quantile <- upper <- GCAM_subsector <- value_median <- share_in_global_ship <- main.fuel <- CEDS_agg_fuel_remapped <- NULL


#Get CEDS_GFED data
Expand Down
2 changes: 1 addition & 1 deletion input/gcamdata/R/zchunk_L201.en_nonco2.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module_emissions_L201.en_nonco2 <- function(command, ...) {
input.emissions <- `2000` <- emiss.coef <- ctrl.name <- max_reduction <- variable <-
steepness <- SO2 <- NOx <- CO <- BC <- OC <- NMVOC <- resource <- has_district_heat <-
. <- region <- supplysector <- max.reduction <- technology <- minicam.energy.input <-
tranSubsector <- tranTechnology <- input.name <- efficiency <- NULL # silence package check notes
tranSubsector <- tranTechnology <- input.name <- efficiency <- fuel <- subsector_orig <- NULL # silence package check notes

# Load required inputs
GCAM_region_names <- get_data(all_data, "common/GCAM_region_names")
Expand Down
2 changes: 1 addition & 1 deletion input/gcamdata/R/zchunk_L212.unmgd_nonco2.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module_emissions_L212.unmgd_nonco2 <- function(command, ...) {
# Silencing package checks
GCAM_region_ID <- region <- AgSupplySubsector <- GLU <- itemName <- AgSupplySector <-
UnmanagedLandTechnology <- year <- value <- Non.CO2 <- em_factor <- technology <-
emiss.coef <- input.emissions <- input.name <- NULL
emiss.coef <- input.emissions <- input.name <- Land_Type <- prot_frac <- NULL

all_data <- list(...)[[1]]

Expand Down
6 changes: 3 additions & 3 deletions input/gcamdata/R/zchunk_L222.en_transformation_USA.R
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@ module_gcamusa_L222.en_transformation_USA <- function(command, ...) {
grid_region, market.name)) %>%
select(-grid_region) -> L222.StubTechMarket_en_USA

# Finish L222.StubTechMarket_en_USA by Setting electricity to the state markets
# Finish L222.StubTechMarket_en_USA by assigning state fuel markets
L222.StubTechMarket_en_USA %>%
filter(minicam.energy.input %in% gcamusa.ELECT_TD_SECTORS) %>%
filter(minicam.energy.input %in% gcamusa.STATE_FUEL_MARKETS) %>%
mutate(market.name = region) ->
tmp

Expand All @@ -364,7 +364,7 @@ module_gcamusa_L222.en_transformation_USA <- function(command, ...) {
L222.StubTech_en_USA_key

L222.StubTechMarket_en_USA %>%
filter(!(minicam.energy.input %in% gcamusa.ELECT_TD_SECTORS)) %>%
filter(!(minicam.energy.input %in% gcamusa.STATE_FUEL_MARKETS)) %>%
bind_rows(tmp) %>%
select(one_of(LEVEL2_DATA_NAMES[["StubTechMarket"]])) %>%
unite(key, supplysector, subsector, stub.technology, sep = "~") %>%
Expand Down
18 changes: 5 additions & 13 deletions input/gcamdata/R/zchunk_L2231.nonewcoal_USA.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ module_gcamusa_L2231.nonewcoal_USA <- function(command, ...) {
FILE = "gcam-usa/A23.elecS_tech_availability",
FILE = "gcam-usa/A23.elecS_tech_mapping_cool",
"L222.StubTechMarket_en_USA",
"L222.StubTech_en",
"L225.StubTech_h2"))
"L222.StubTech_en"))
} else if(command == driver.DECLARE_OUTPUTS) {
return(c("L2231.SubsectorShrwt_nonewcoal_elecS_cool_USA",
"L2231.StubTechShrwt_nonewcoal_nongen_USA",
Expand All @@ -40,7 +39,6 @@ module_gcamusa_L2231.nonewcoal_USA <- function(command, ...) {
# Load required inputs
L222.StubTechMarket_en_USA <- get_data(all_data, "L222.StubTechMarket_en_USA")
L222.StubTech_en <- get_data(all_data, "L222.StubTech_en")
L225.StubTech_h2 <- get_data(all_data, "L225.StubTech_h2")
A23.elecS_tech_mapping <- get_data(all_data, "gcam-usa/A23.elecS_tech_mapping", strip_attributes = TRUE)
A23.elecS_tech_availability <- get_data(all_data, "gcam-usa/A23.elecS_tech_availability")
A23.elecS_tech_mapping_cool <- get_data(all_data, "gcam-usa/A23.elecS_tech_mapping_cool")
Expand Down Expand Up @@ -71,8 +69,6 @@ module_gcamusa_L2231.nonewcoal_USA <- function(command, ...) {

L222.StubTech_en %>%
filter(region == gcam.USA_REGION, subsector == "coal gasification", !grepl("CCS",stub.technology)) %>%
bind_rows(L225.StubTech_h2 %>%
filter(region == gcam.USA_REGION, subsector == "coal", !grepl("CCS",stub.technology))) %>%
repeat_add_columns(tibble(year = MODEL_FUTURE_YEARS)) %>%
mutate(share.weight = 0) %>%
select(LEVEL2_DATA_NAMES[["StubTechYr"]], share.weight) ->
Expand Down Expand Up @@ -121,8 +117,7 @@ module_gcamusa_L2231.nonewcoal_USA <- function(command, ...) {
"gcam-usa/A23.elecS_tech_availability",
"gcam-usa/A23.elecS_tech_mapping_cool",
"L222.StubTechMarket_en_USA",
"L222.StubTech_en",
"L225.StubTech_h2") ->
"L222.StubTech_en") ->
L2231.SubsectorShrwt_nonewcoal_elecS_cool_USA

L2231.StubTechShrwt_nonewcoal_nongen_USA %>%
Expand All @@ -133,8 +128,7 @@ module_gcamusa_L2231.nonewcoal_USA <- function(command, ...) {
add_precursors("gcam-usa/A23.elecS_tech_mapping",
"gcam-usa/A23.elecS_tech_availability",
"L222.StubTechMarket_en_USA",
"L222.StubTech_en",
"L225.StubTech_h2") ->
"L222.StubTech_en") ->
L2231.StubTechShrwt_nonewcoal_nongen_USA

L2231.SubsectorShrwt_coal_delay_elecS_cool_USA %>%
Expand All @@ -147,8 +141,7 @@ module_gcamusa_L2231.nonewcoal_USA <- function(command, ...) {
"gcam-usa/A23.elecS_tech_availability",
"gcam-usa/A23.elecS_tech_mapping_cool",
"L222.StubTechMarket_en_USA",
"L222.StubTech_en",
"L225.StubTech_h2") ->
"L222.StubTech_en") ->
L2231.SubsectorShrwt_coal_delay_elecS_cool_USA

L2231.StubTechShrwt_coal_delay_nongen_USA %>%
Expand All @@ -160,8 +153,7 @@ module_gcamusa_L2231.nonewcoal_USA <- function(command, ...) {
"gcam-usa/A23.elecS_tech_availability",
"gcam-usa/A23.elecS_tech_mapping_cool",
"L222.StubTechMarket_en_USA",
"L222.StubTech_en",
"L225.StubTech_h2") ->
"L222.StubTech_en") ->
L2231.StubTechShrwt_coal_delay_nongen_USA

L2231.SubsectorShrwt_coal_delay_elecS_cool_USA
Expand Down
4 changes: 3 additions & 1 deletion input/gcamdata/R/zchunk_L2236.elecS_ghg_emissions_USA.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ module_gcamusa_L2236.elecS_ghg_emissions_USA <- function(command, ...) {
calOutputValue <- emiss.coeff <- fuel <- fuel_input <- fuel_input_USA <-
fuel_input_share <- input.emissions <- palette <- region <- segment_share <-
state <- stub.technology <- subsector <- subsector_1 <- supplysector <-
tech_calOuput <- tech_fuel_input <- technology <- value <- year <- NULL
tech_calOuput <- tech_fuel_input <- technology <- value <- year <-
to.technology <- plant_type <- cooling_system <- water_type <-
to.technology <- supplysector.y <- supplysector.x <- subsector0 <- NULL



Expand Down
Loading

0 comments on commit d330871

Please sign in to comment.