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

Adjust NAVIGATE scenarios #235

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '2556190'
ValidationKey: '2756880'
AutocreateReadme: yes
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
gamstransfer=?ignore
any::lucode2
any::covr
any::madrat
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exclude: '^tests/testthat/_snaps/.*$'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-case-conflict
- id: check-json
Expand All @@ -15,7 +15,7 @@ repos:
- id: mixed-line-ending

- repo: https://github.com/lorenzwalthert/precommit
rev: v0.3.2.9021
rev: v0.3.2.9025
hooks:
- id: parsable-R
- id: deps-in-desc
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: 'edgeTransport: Prepare EDGE Transport Data for the REMIND model'
version: 1.3.0
date-released: '2023-11-02'
version: 1.4.0
date-released: '2023-12-01'
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
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: edgeTransport
Title: Prepare EDGE Transport Data for the REMIND model
Version: 1.3.0
Version: 1.4.0
Authors@R: c(
person("Alois", "Dirnaichner", email = "[email protected]", role = c("aut", "cre")),
person("Marianna", "Rottoli", email = "[email protected]", role = "aut"),
Expand All @@ -15,7 +15,7 @@ Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.3
VignetteBuilder: knitr
Date: 2023-11-02
Date: 2023-12-01
Config/testthat/edition: 3
Imports:
rmndt,
Expand Down
19 changes: 18 additions & 1 deletion R/incotrend.R
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ Hybrid Electric,Liquids")
FVtarget_tb[, value := ifelse(year==2035,0.3*value[year==2015],value),by = c("region","technology")]
FVtarget_tb[, value := ifelse(year==2040,0.2*value[year==2015],value),by = c("region","technology")]
FVtarget_tb[, value := ifelse(year==2045,0.1*value[year==2015],value),by = c("region","technology")]
FVtarget_tb[year>=2045, value := 0.05]
FVtarget_tb[year > 2045, value := value * 0.05]

FVtarget=rbind(FVtarget_all,FVtarget_tb)

Expand All @@ -316,6 +316,23 @@ Hybrid Electric,Liquids")

FVtarget=rbind(FVtarget_all,FVtarget_tb)

} else if (tech_scen %in% c("NAV_all", "NAV_ele")) {

FVtarget_all = FVtarget[!(technology %in% c("Liquids","NG") & subsector_L1 %in% c("trn_freight_road_tmp_subsector_L1", "Bus_tmp_subsector_L1"))]

FVtarget_all[, value := ifelse(
is.na(target), value, apply_logistic_trends(year, target, symmyr, speed) * value),
by=c("region", "vehicle_type", "technology")]

## ICE trucks and buses
FVtarget_tb = FVtarget[subsector_L1 %in% c("trn_freight_road_tmp_subsector_L1", "Bus_tmp_subsector_L1") & technology %in% c("Liquids", "NG")]
FVtarget_tb[, value := ifelse(year==2025,0.6*value[year==2015],value),by = c("region","technology")]
FVtarget_tb[, value := ifelse(year==2030,0.3*value[year==2015],value),by = c("region","technology")]
FVtarget_tb[, value := ifelse(year==2035,0.1*value[year==2015],value),by = c("region","technology")]
FVtarget_tb[year >= 2040, value := 0]

FVtarget=rbind(FVtarget_all,FVtarget_tb)

} else {

FVtarget[, value := ifelse(
Expand Down
53 changes: 41 additions & 12 deletions R/logit.R
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ toolCalculateLogitIncost <- function(prices,
0.5*exp(1)^(weighted_sharessum[year == (t-1)]*bmodelav),
pinco_tot), by = c("region", "technology", "vehicle_type", "subsector_L1")]

if(tech_scen %in% c("PhOP", "Mix3", "Mix4", "HydrHype4", "ECEMF_HighEl_ModEff", "ECEMF_HighEl_HighEff", "ECEMF_HighEl_LifestCha", "ECEMF_HighH2_ModEff", "ECEMF_HighH2_HighEff", "ECEMF_HighH2_LifestCha", "CAMP_lscWeak", "CAMP_lscStrong") & t>= 2030){
if(tech_scen %in% c("PhOP", "Mix3", "Mix4", "HydrHype4", "ECEMF_HighEl_ModEff", "ECEMF_HighEl_HighEff", "ECEMF_HighEl_LifestCha", "ECEMF_HighH2_ModEff", "ECEMF_HighH2_HighEff", "ECEMF_HighH2_LifestCha", "CAMP_lscWeak", "CAMP_lscStrong", "NAV_all", "NAV_ele") & t>= 2030){
## phase-out of all light-duty vehicle ICEs
EUreg <- c("DEU", "ECE", "ECS", "ENC", "ESC", "ESW", "EWN", "FRA", "UKI", "EUR")

Expand All @@ -583,33 +583,62 @@ toolCalculateLogitIncost <- function(prices,
floorEU <- linIncrease(t, 2032, 0.35, 2034, 0.95)
} else if (t== 2035){
floorEU <- 0.95
} else {
} else if (t > 2035){
floorEU <- 1
}

if(t > 2035 & t <= 2037){
floorGLO <- linIncrease(t, 2035, floor, 2037, 0.15)
} else if(t > 2037 & t <= 2039){
floorGLO <- linIncrease(t, 2037, 0.15, 2039, 1.6)
} else if (t == 2040){
floorGLO <- 2
} else if (t > 2040){
floorGLO <- 2.2
}


tmp[technology == "Liquids" & region %in% EUreg, pinco_tot := ifelse(year == t,
pmax(pinco_tot, floorEU),
pinco_tot), by = c("region", "technology", "vehicle_type", "subsector_L1")]

tmp[technology == "Liquids" & !region %in% EUreg, pinco_tot := ifelse(year == t,
pmax(pinco_tot, floor),
pinco_tot), by = c("region", "technology", "vehicle_type", "subsector_L1")]
tmp[technology == "Hybrid Electric" & region %in% EUreg, pmod_av := ifelse(year == t,
pmax(pmod_av, floorEU),
pmod_av), by = c("region", "technology", "vehicle_type", "subsector_L1")]

tmp[technology == "NG" & region %in% EUreg, pref := ifelse(year == t,
pmax(pref, floorEU),
pref), by = c("region", "technology", "vehicle_type", "subsector_L1")]

tmp[technology == "Hybrid Electric" & region %in% EUreg, pmod_av := ifelse(year == t,
pmax(pmod_av, floorEU),
pmod_av), by = c("region", "technology", "vehicle_type", "subsector_L1")]
if (tech_scen %in% c("NAV_all", "NAV_ele") & t > 2035){
tmp[technology == "Liquids" & !region %in% EUreg, pinco_tot := ifelse(year == t,
pmax(pinco_tot, floorGLO),
pinco_tot), by = c("region", "technology", "vehicle_type", "subsector_L1")]

} else {
tmp[technology == "NG" & !region %in% EUreg, pref := ifelse(year == t,
pmax(pref, floorGLO),
pref), by = c("region", "technology", "vehicle_type", "subsector_L1")]

tmp[technology == "Liquids", pinco_tot := ifelse(year == t,
tmp[technology == "Hybrid Electric" & !region %in% EUreg, pmod_av := ifelse(year == t,
pmax(pmod_av, floorGLO),
pmod_av), by = c("region", "technology", "vehicle_type", "subsector_L1")]


} else {
tmp[technology == "Liquids" & !region %in% EUreg, pinco_tot := ifelse(year == t,
pmax(pinco_tot, floor),
pinco_tot), by = c("region", "technology", "vehicle_type", "subsector_L1")]

}


} else {

tmp[technology == "Liquids", pinco_tot := ifelse(year == t,
pmax(pinco_tot, floor),
pinco_tot), by = c("region", "technology", "vehicle_type", "subsector_L1")]

}
}


## hybrid electric inconvenience cost cannot decrease below 50% of 2020 value
Expand Down Expand Up @@ -689,7 +718,7 @@ toolCalculateLogitIncost <- function(prices,
df_shares[, tot_VOT_price:=0]

## merge value of time for the selected level and assign 0 to the entries that don't have it
df <- merge(df, value_time, by=intersect(names(df),names(value_time)), all.x=TRUE)
df <- merge(df, value_time, by=intersect(names(df),names(value_time)), all.x = TRUE)
df <- df[is.na(time_price), time_price := 0]
df <- df[, tot_VOT_price := time_price]
df <- df[, tot_price := tot_price + time_price]
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prepare EDGE Transport Data for the REMIND model

R package **edgeTransport**, version **1.3.0**
R package **edgeTransport**, version **1.4.0**

[![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)

Expand Down Expand Up @@ -46,7 +46,7 @@ In case of questions / problems please contact Alois Dirnaichner <dirnaichner@pi

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

Dirnaichner A, Rottoli M, Hoppe J (2023). _edgeTransport: Prepare EDGE Transport Data for the REMIND model_. R package version 1.3.0, <https://github.com/pik-piam/edgeTransport>.
Dirnaichner A, Rottoli M, Hoppe J (2023). _edgeTransport: Prepare EDGE Transport Data for the REMIND model_. R package version 1.4.0, <https://github.com/pik-piam/edgeTransport>.

A BibTeX entry for LaTeX users is

Expand All @@ -55,7 +55,7 @@ A BibTeX entry for LaTeX users is
title = {edgeTransport: Prepare EDGE Transport Data for the REMIND model},
author = {Alois Dirnaichner and Marianna Rottoli and Johanna Hoppe},
year = {2023},
note = {R package version 1.3.0},
note = {R package version 1.4.0},
url = {https://github.com/pik-piam/edgeTransport},
}
```
20 changes: 10 additions & 10 deletions inst/extdata/inconv_factor.csv
Original file line number Diff line number Diff line change
Expand Up @@ -593,20 +593,20 @@ SSP2EU,NAV_tec,targetValICE,0
SSP2EU,NAV_tec,ratioPHEV,0.5
SSP2EU,NAV_ele,startYeBEV,2025
SSP2EU,NAV_ele,startValBEV,0.5
SSP2EU,NAV_ele,targetYeBEV,2030
SSP2EU,NAV_ele,targetYeBEV,2035
SSP2EU,NAV_ele,targetValBEV,0
SSP2EU,NAV_ele,startYeICE,2020
SSP2EU,NAV_ele,targetYeICE,2027
SSP2EU,NAV_ele,targetValICE,0.1
SSP2EU,NAV_ele,ratioPHEV,0.3
SSP2EU,NAV_ele,startYeICE,2023
SSP2EU,NAV_ele,targetYeICE,2055
SSP2EU,NAV_ele,targetValICE,1.5
SSP2EU,NAV_ele,ratioPHEV,1.5
SSP2EU,NAV_all,startYeBEV,2025
SSP2EU,NAV_all,startValBEV,0.5
SSP2EU,NAV_all,targetYeBEV,2030
SSP2EU,NAV_all,targetYeBEV,2035
SSP2EU,NAV_all,targetValBEV,0
SSP2EU,NAV_all,startYeICE,2020
SSP2EU,NAV_all,targetYeICE,2027
SSP2EU,NAV_all,targetValICE,0.1
SSP2EU,NAV_all,ratioPHEV,0.3
SSP2EU,NAV_all,startYeICE,2023
SSP2EU,NAV_all,targetYeICE,2055
SSP2EU,NAV_all,targetValICE,1.5
SSP2EU,NAV_all,ratioPHEV,1.5
SSP2EU,NAV_lce,startYeBEV,2025
SSP2EU,NAV_lce,startValBEV,0.5
SSP2EU,NAV_lce,targetYeBEV,2035
Expand Down