Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct reporting of industry carbon captured for chemical feedstocks #609

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 35 additions & 5 deletions R/reportEmi.R
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,14 @@ reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL,
fety = 'all_enty1', 'secInd37', 'emiMkt' = 'all_emiMkt',
o37_demFEindsub = 'value')


vm_demFENonEnergySector_tibble <- vm_demFENonEnergySector %>%
as_tibble() %>%
select(t = 'ttot', regi = 'all_regi', sety = 'all_enty',
fety = 'all_enty1', 'emiMkt' = 'all_emiMkt',
vm_demFENonEnergySector = 'value') %>%
mutate( secInd37 = "chemicals")

pm_emifac_tibble <- pm_emifac %>%
mselect(mutate(se2fe, all_enty2 = 'co2')) %>%
as_tibble() %>%
Expand All @@ -225,25 +233,45 @@ reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL,

subsector_total_emissions <- inner_join(
o37_demFeIndSub_tibble,

pm_emifac_tibble,

c('t', 'regi', 'sety', 'fety')
) %>%
left_join(
vm_demFENonEnergySector_tibble,
c('t', 'regi', 'sety', 'fety', 'emiMkt', 'secInd37')
) %>%
mutate( vm_demFENonEnergySector = ifelse(is.na(.data$vm_demFENonEnergySector),
0,
.data$vm_demFENonEnergySector)) %>%

group_by(.data$t, .data$regi, .data$secInd37) %>%
summarise(
subsector_total_emissions = sum(.data$o37_demFEindsub * .data$pm_emifac),
.groups = 'drop')
summarise(
# calculate industry smokestack emissions as (FE - FE Non-energy Use) * emissions factor
subsector_total_emissions = sum( (.data$o37_demFEindsub - .data$vm_demFENonEnergySector) * .data$pm_emifac),
.groups = 'drop')


subsector_emissions <- inner_join(
o37_demFeIndSub_tibble,
pm_emifac_tibble,

c('t', 'regi', 'sety', 'fety')
) %>%

left_join(
vm_demFENonEnergySector_tibble,
c('t', 'regi', 'sety', 'fety', 'emiMkt', 'secInd37')
) %>%
mutate( vm_demFENonEnergySector = ifelse(is.na(.data$vm_demFENonEnergySector),
0,
.data$vm_demFENonEnergySector)) %>%

group_by(.data$t, .data$regi, .data$secInd37, .data$sety, .data$fety,
.data$emiMkt) %>%
summarise(
subsector_emissions = sum(.data$o37_demFEindsub * .data$pm_emifac),
subsector_emissions = sum((.data$o37_demFEindsub - .data$vm_demFENonEnergySector) * .data$pm_emifac),
.groups = 'drop')

pm_IndstCO2Captured <- subsector_emissions %>%
Expand All @@ -269,7 +297,9 @@ reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL,
as.magpie(spatial = 2, temporal = 1, data = ncol(.)) %>%
ifelse(is.finite(.), ., 0) # replace NaN by 0

rm(vm_emiIndCCS_tibble, subsector_total_emissions, pm_emifac_tibble)
rm(vm_emiIndCCS_tibble, subsector_total_emissions, pm_emifac_tibble, vm_demFENonEnergySector_tibble)



# utility functions ----
# Convert a mixer table into a list that can be passed to mselect() to
Expand Down
Loading