Skip to content

Commit

Permalink
add transmission and distribution losses to SE|Input reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
robertpietzcker committed Dec 5, 2024
1 parent 3744954 commit 7ebdf3a
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions R/reportSE.R
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ reportSE <- function(gdx, regionSubsetList = NULL, t = c(seq(2005, 2060, 5), seq
se.prod( vm_prodSe, dataoc, oc2te, entySe, "pewin", "seel", te = c(windonStr, "windoff"), name = "SE|Electricity|+|Wind (EJ/yr)"),
se.prod( vm_prodSe, dataoc, oc2te, entySe, "pewin", "seel", te = windonStr, name = "SE|Electricity|Wind|+|Onshore (EJ/yr)"),
se.prod( vm_prodSe, dataoc, oc2te, entySe, "pewin", "seel", te = "windoff", name = "SE|Electricity|Wind|+|Offshore (EJ/yr)"),

se.prodLoss(vm_prodSe, dataoc, oc2te, entySe, "pewin", "seel", te = c(windonStr, "windoff"), name = "SE|Electricity|Curtailment|+|Wind (EJ/yr)"),
se.prodLoss(vm_prodSe, dataoc, oc2te, entySe, "pewin", "seel", te = windonStr, name = "SE|Electricity|Curtailment|Wind|+|Onshore (EJ/yr)"),
se.prodLoss(vm_prodSe, dataoc, oc2te, entySe, "pewin", "seel", te = "windoff", name = "SE|Electricity|Curtailment|Wind|+|Offshore (EJ/yr)")
Expand Down Expand Up @@ -354,7 +354,7 @@ reportSE <- function(gdx, regionSubsetList = NULL, t = c(seq(2005, 2060, 5), seq
"SE|Gases|Hydrogen|Net Imports (EJ/yr)"))
}

# SE Demand Flows ----
## SE Demand Flows ----
# SE|Input|X|Y variables denote the demand of energy carrier X
# flowing into sector/production of Y.

Expand Down Expand Up @@ -392,7 +392,7 @@ reportSE <- function(gdx, regionSubsetList = NULL, t = c(seq(2005, 2060, 5), seq
# SE electricity use

### calculation of electricity use for own consumption of energy system
vm_prodFe <- readGDX(gdx, "vm_prodFe", field = "l", restore_zeros = FALSE)
vm_prodFe <- readGDX(gdx, "vm_prodFe", field = "l", restore_zeros = FALSE) * pm_conv_TWa_EJ # all energy values are first converted to EJ
vm_co2CCS <- readGDX(gdx, "vm_co2CCS", field = "l", restore_zeros = FALSE)

# filter for coupled production coefficents which consume seel
Expand All @@ -404,7 +404,7 @@ reportSE <- function(gdx, regionSubsetList = NULL, t = c(seq(2005, 2060, 5), seq

# FE and SE production that has own consumption of electricity
# calculate vm_prodSe back to TWa (was in EJ before), but prod couple coefficient is defined in TWa(input)/Twa(output)
prodOwnCons <- mbind(vm_prodFe, vm_prodSe / pm_conv_TWa_EJ)[, , getNames(CoeffOwnConsSeel_woCCS, dim = 3)]
prodOwnCons <- mbind(vm_prodFe / pm_conv_TWa_EJ, vm_prodSe / pm_conv_TWa_EJ)[, , getNames(CoeffOwnConsSeel_woCCS, dim = 3)]

tmp1 <- mbind(tmp1, setNames(
-pm_conv_TWa_EJ *
Expand Down Expand Up @@ -476,7 +476,13 @@ reportSE <- function(gdx, regionSubsetList = NULL, t = c(seq(2005, 2060, 5), seq
setNames(dimSums(mselect(vm_demSe, all_enty = "seel", all_enty1 = "seh2", all_te = "elh2"), dim = 3),
"SE|Input|Electricity|Hydrogen|+|Standard Electrolysis (EJ/yr)"),
setNames(dimSums(mselect(vm_demSe, all_enty = "seel", all_enty1 = "seh2", all_te = "elh2VRE"), dim = 3),
"SE|Input|Electricity|Hydrogen|+|VRE Storage (EJ/yr)")
"SE|Input|Electricity|Hydrogen|+|VRE Storage (EJ/yr)"),
setNames(dimSums(vm_demSe[,,"feels"] + vm_demSe[,,"feelt"], dim = 3) -
dimSums(vm_prodFe[,,"feels"] + vm_prodFe[,,"feelt"], dim = 3),
"SE|Input|Electricity|T&D losses (EJ/yr)"),
setNames(dimSums(vm_demSe[,,"feels"] * (1 - pm_eta_conv[,,"tdels"]) , dim = 3) +
dimSums(vm_demSe[,,"feelt"] * (1 - pm_eta_conv[,,"tdelt"]) , dim = 3),
"SE|Electricity|Transmission Losses (EJ/yr)") # this variable name was used before and might still be needed by some templates
)

# electricity for specific H2 usages
Expand Down Expand Up @@ -508,11 +514,20 @@ reportSE <- function(gdx, regionSubsetList = NULL, t = c(seq(2005, 2060, 5), seq
p_shareElec_H2 / mselect(pm_eta_conv, all_te = "elh2"),
"SE|Input|Electricity|Hydrogen|Synthetic Fuels|+|Gases (EJ/yr)"))


# transmission losses from se2fe conversion of electricity
# other t&d losses
tmp1 <- mbind(tmp1,
setNames(dimSums(vm_demSe[, , "tdels"] * (1 - pm_eta_conv[, , "tdels"]), dim = 3),
"SE|Electricity|Transmission Losses (EJ/yr)"))
setNames(dimSums(vm_demSe[,,"fegas"] + vm_demSe[,,"fegat"] - vm_prodFe[,,"fegas"] - vm_prodFe[,,"fegat"], dim = 3),
"SE|Input|Gases|T&D losses (EJ/yr)"),
setNames(dimSums(vm_demSe[,,"fehes"] - vm_prodFe[,,"fehes"], dim = 3),
"SE|Input|Heat|T&D losses (EJ/yr)"),
setNames(dimSums(vm_demSe[,,"fehos"] + vm_demSe[,,"fepet"] + vm_demSe[,,"fedie"]
- vm_prodFe[,,"fehos"] - vm_prodFe[,,"fepet"] - vm_prodFe[,,"fedie"], dim = 3),
"SE|Input|Liquids|T&D losses (EJ/yr)"),
setNames(dimSums(vm_demSe[,,"feh2s"] + vm_demSe[,,"feh2t"] - vm_prodFe[,,"feh2s"] - vm_prodFe[,,"feh2t"], dim = 3),
"SE|Input|Hydrogen|T&D losses (EJ/yr)"),
setNames(dimSums(vm_demSe[,,"fesos"] - vm_prodFe[,,"fesos"], dim = 3),
"SE|Input|Solids|T&D losses (EJ/yr)")
)

# add global values
out <- mbind(tmp1, dimSums(tmp1, dim = 1))
Expand Down

0 comments on commit 7ebdf3a

Please sign in to comment.