From aa423b8aedc113666ba0de67272e59950b4adacb Mon Sep 17 00:00:00 2001 From: johannah-pik <89136160+johannah-pik@users.noreply.github.com> Date: Mon, 4 Nov 2024 14:54:28 +0100 Subject: [PATCH 1/3] bugfix iterative script + export of function calls for debugging --- R/iterativeEDGETransport.R | 2 +- R/toolCalculateFVdemand.R | 12 ++++++++++++ R/toolCalculateVehicleDepreciationFactors.R | 1 + R/toolLoadREMINDfuelCosts.R | 1 + R/toolPrepareDataEndogenousCosts.R | 1 + 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/R/iterativeEDGETransport.R b/R/iterativeEDGETransport.R index 0ccd37f..60bd1d0 100644 --- a/R/iterativeEDGETransport.R +++ b/R/iterativeEDGETransport.R @@ -175,7 +175,7 @@ iterativeEdgeTransport <- function() { helpers) ESdemandFVsalesLevel <- toolCalculateFVdemand(inputData$REMINDsectorESdemand, - vehSalesAndModeShares, + vehSalesAndModeShares$shares, helpers, inputData$histESdemand, baseYear) diff --git a/R/toolCalculateFVdemand.R b/R/toolCalculateFVdemand.R index 59a8b67..7342be5 100644 --- a/R/toolCalculateFVdemand.R +++ b/R/toolCalculateFVdemand.R @@ -1,3 +1,15 @@ +#' Calculate eneryg service demand on fuel vehicle level +#' +#' @author Johanna Hoppe +#' @param sectorESdemand energy service demand on CES node level +#' @param salesAndModeShares vehicle sales and mode shares +#' @param helpers List with helpers +#' @param histESdemand historcial energy service demand for iterative EDGE-T +#' @param baseYear ned year of historical energy service demand +#' @returns data.table +#' @import data.table +#' @export + toolCalculateFVdemand <- function(sectorESdemand, salesAndModeShares, helpers, histESdemand = NULL, baseYear = NULL){ # Calculate FV to sector shares -------------------------------------------- diff --git a/R/toolCalculateVehicleDepreciationFactors.R b/R/toolCalculateVehicleDepreciationFactors.R index 22f24d9..68eb92b 100644 --- a/R/toolCalculateVehicleDepreciationFactors.R +++ b/R/toolCalculateVehicleDepreciationFactors.R @@ -5,6 +5,7 @@ #' @param helpers list with helpers #' @returns data.table including vehicle depreciation factors over service life#' #' @import data.table +#' @export toolCalculateVehicleDepreciationFactors <- function(annuityCalc, helpers) { diff --git a/R/toolLoadREMINDfuelCosts.R b/R/toolLoadREMINDfuelCosts.R index 0901c64..4636961 100644 --- a/R/toolLoadREMINDfuelCosts.R +++ b/R/toolLoadREMINDfuelCosts.R @@ -11,6 +11,7 @@ #' @importFrom gdx readGDX #' @importFrom magclass lowpass #' @importFrom magrittr `%>%` +#' @export toolLoadREMINDfuelCosts <- function(gdxPath, hybridElecShare, helpers){ value <- unit <- variable <- `Hybrid electric` <- fuel <- NULL diff --git a/R/toolPrepareDataEndogenousCosts.R b/R/toolPrepareDataEndogenousCosts.R index 8450fd5..5727ea6 100644 --- a/R/toolPrepareDataEndogenousCosts.R +++ b/R/toolPrepareDataEndogenousCosts.R @@ -6,6 +6,7 @@ #' @param helpers List with helpers #' @returns data.table including all cost components #' @import data.table +#' @export toolPrepareDataEndogenousCosts <- function(inputData, lambdas, helpers) { From 2b5d6a4d60d70a02fb72f1c67128f2daf0340054 Mon Sep 17 00:00:00 2001 From: johannah-pik <89136160+johannah-pik@users.noreply.github.com> Date: Mon, 4 Nov 2024 15:01:11 +0100 Subject: [PATCH 2/3] buildlib --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- NAMESPACE | 4 ++++ README.md | 6 +++--- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index 4df49d0..a7c9097 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '5607280' +ValidationKey: '5628711' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/CITATION.cff b/CITATION.cff index 4ab1f71..edc0eb6 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -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: 'edgeTransport: Prepare EDGE Transport Data for the REMIND model' -version: 2.8.0 -date-released: '2024-10-30' +version: 2.8.1 +date-released: '2024-11-04' abstract: EDGE-T is a fork of the GCAM transport module https://jgcri.github.io/gcam-doc/energy.html#transportation with a high level of detail in its representation of technological and modal options. It is a partial equilibrium model with a nested multinomial logit structure and diff --git a/DESCRIPTION b/DESCRIPTION index 2a21afb..1b2d4fa 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: edgeTransport Title: Prepare EDGE Transport Data for the REMIND model -Version: 2.8.0 +Version: 2.8.1 Authors@R: c( person("Johanna", "Hoppe", , "johanna.hoppe@pik-potsdam.de", role = c("aut", "cre"), comment = c(ORCID = "0009-0004-6753-5090")), @@ -19,7 +19,7 @@ Encoding: UTF-8 LazyData: true RoxygenNote: 7.3.2 VignetteBuilder: knitr -Date: 2024-10-30 +Date: 2024-11-04 Config/testthat/edition: 3 Imports: rmndt, diff --git a/NAMESPACE b/NAMESPACE index 55c6501..d5d12ca 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -9,7 +9,9 @@ export(iterativeEdgeTransport) export(toolApplyICEbanOnPreferences) export(toolApplyMixedTimeRes) export(toolCalculateFS3share) +export(toolCalculateFVdemand) export(toolCalculateFleetComposition) +export(toolCalculateVehicleDepreciationFactors) export(toolCheckAllLevelsComplete) export(toolDemandRegression) export(toolDiscreteChoice) @@ -18,8 +20,10 @@ export(toolLoadDecisionTree) export(toolLoadInputs) export(toolLoadIterativeInputs) export(toolLoadREMINDesDemand) +export(toolLoadREMINDfuelCosts) export(toolNormalizePreferences) export(toolOrderandCheck) +export(toolPrepareDataEndogenousCosts) export(toolPrepareScenInputData) export(toolTraverseDecisionTree) export(toolUpdateEndogenousCosts) diff --git a/README.md b/README.md index bf5cacb..5415c58 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Prepare EDGE Transport Data for the REMIND model -R package **edgeTransport**, version **2.8.0** +R package **edgeTransport**, version **2.8.1** [![CRAN status](https://www.r-pkg.org/badges/version/edgeTransport)](https://cran.r-project.org/package=edgeTransport) [![R build status](https://github.com/pik-piam/edgeTransport/workflows/check/badge.svg)](https://github.com/pik-piam/edgeTransport/actions) [![codecov](https://codecov.io/gh/pik-piam/edgeTransport/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/edgeTransport) [![r-universe](https://pik-piam.r-universe.dev/badges/edgeTransport)](https://pik-piam.r-universe.dev/builds) @@ -46,7 +46,7 @@ In case of questions / problems please contact Johanna Hoppe . +Hoppe J, Dirnaichner A, Rottoli M, Muessel J (2024). _edgeTransport: Prepare EDGE Transport Data for the REMIND model_. R package version 2.8.1, . A BibTeX entry for LaTeX users is @@ -55,7 +55,7 @@ A BibTeX entry for LaTeX users is title = {edgeTransport: Prepare EDGE Transport Data for the REMIND model}, author = {Johanna Hoppe and Alois Dirnaichner and Marianna Rottoli and Jarusch Muessel}, year = {2024}, - note = {R package version 2.8.0}, + note = {R package version 2.8.1}, url = {https://github.com/pik-piam/edgeTransport}, } ``` From fc748a009f744f7b5ebe2f3c2b8f48775222ddb0 Mon Sep 17 00:00:00 2001 From: johannah-pik <89136160+johannah-pik@users.noreply.github.com> Date: Mon, 4 Nov 2024 15:11:09 +0100 Subject: [PATCH 3/3] bugfix --- R/iterativeEDGETransport.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/iterativeEDGETransport.R b/R/iterativeEDGETransport.R index 60bd1d0..505ad1a 100644 --- a/R/iterativeEDGETransport.R +++ b/R/iterativeEDGETransport.R @@ -186,7 +186,7 @@ iterativeEdgeTransport <- function() { # Calculate vehicle stock for cars, trucks and busses ------- fleetSizeAndComposition <- toolCalculateFleetComposition(ESdemandFVsalesLevel, vehicleDepreciationFactors, - vehSalesAndModeShares, + vehSalesAndModeShares$shares, inputData$annualMileage, inputData$scenSpecLoadFactor, helpers)