Skip to content

Commit

Permalink
Merge pull request #679 from robertpietzcker/2024-12-addSEreporting
Browse files Browse the repository at this point in the history
Add T&D losses to SE|Input reporting
  • Loading branch information
robertpietzcker authored Dec 5, 2024
2 parents b185220 + f966bbf commit c2958bc
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '232787844'
ValidationKey: '232919820'
AcceptedWarnings:
- .*following variables are expected in the piamInterfaces.*
- Summation checks have revealed some gaps.*
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cff-version: 1.2.0
message: If you use this software, please cite it using the metadata from this file.
type: software
title: 'remind2: The REMIND R package (2nd generation)'
version: 1.160.4
date-released: '2024-12-04'
version: 1.161.0
date-released: '2024-12-05'
abstract: Contains the REMIND-specific routines for data and model output manipulation.
authors:
- family-names: Rodrigues
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: remind2
Title: The REMIND R package (2nd generation)
Version: 1.160.4
Date: 2024-12-04
Version: 1.161.0
Date: 2024-12-05
Authors@R: c(
person("Renato", "Rodrigues", , "[email protected]", role = c("aut", "cre")),
person("Lavinia", "Baumstark", role = "aut"),
Expand Down
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The REMIND R package (2nd generation)

R package **remind2**, version **1.160.4**
R package **remind2**, version **1.161.0**

[![CRAN status](https://www.r-pkg.org/badges/version/remind2)](https://cran.r-project.org/package=remind2) [![R build status](https://github.com/pik-piam/remind2/workflows/check/badge.svg)](https://github.com/pik-piam/remind2/actions) [![codecov](https://codecov.io/gh/pik-piam/remind2/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/remind2) [![r-universe](https://pik-piam.r-universe.dev/badges/remind2)](https://pik-piam.r-universe.dev/builds)

Expand Down Expand Up @@ -49,7 +49,7 @@ In case of questions / problems please contact Renato Rodrigues <renato.rodrigue

To cite package **remind2** in publications use:

Rodrigues R, Baumstark L, Benke F, Dietrich J, Dirnaichner A, Duerrwaechter J, Führlich P, Giannousakis A, Hasse R, Hilaire J, Klein D, Koch J, Kowalczyk K, Levesque A, Malik A, Merfort A, Merfort L, Morena-Leiva S, Pehl M, Pietzcker R, Rauner S, Richters O, Rottoli M, Schötz C, Schreyer F, Siala K, Sörgel B, Spahr M, Strefler J, Verpoort P, Weigmann P, Rüter T (2024). _remind2: The REMIND R package (2nd generation)_. R package version 1.160.4, <https://github.com/pik-piam/remind2>.
Rodrigues R, Baumstark L, Benke F, Dietrich J, Dirnaichner A, Duerrwaechter J, Führlich P, Giannousakis A, Hasse R, Hilaire J, Klein D, Koch J, Kowalczyk K, Levesque A, Malik A, Merfort A, Merfort L, Morena-Leiva S, Pehl M, Pietzcker R, Rauner S, Richters O, Rottoli M, Schötz C, Schreyer F, Siala K, Sörgel B, Spahr M, Strefler J, Verpoort P, Weigmann P, Rüter T (2024). _remind2: The REMIND R package (2nd generation)_. R package version 1.161.0, <https://github.com/pik-piam/remind2>.

A BibTeX entry for LaTeX users is

Expand All @@ -58,7 +58,7 @@ A BibTeX entry for LaTeX users is
title = {remind2: The REMIND R package (2nd generation)},
author = {Renato Rodrigues and Lavinia Baumstark and Falk Benke and Jan Philipp Dietrich and Alois Dirnaichner and Jakob Duerrwaechter and Pascal Führlich and Anastasis Giannousakis and Robin Hasse and Jérome Hilaire and David Klein and Johannes Koch and Katarzyna Kowalczyk and Antoine Levesque and Aman Malik and Anne Merfort and Leon Merfort and Simón Morena-Leiva and Michaja Pehl and Robert Pietzcker and Sebastian Rauner and Oliver Richters and Marianna Rottoli and Christof Schötz and Felix Schreyer and Kais Siala and Björn Sörgel and Mike Spahr and Jessica Strefler and Philipp Verpoort and Pascal Weigmann and Tonn Rüter},
year = {2024},
note = {R package version 1.160.4},
note = {R package version 1.161.0},
url = {https://github.com/pik-piam/remind2},
}
```

0 comments on commit c2958bc

Please sign in to comment.