diff --git a/scripts/output/comparison/EDGEcomparison.R b/scripts/output/comparison/EDGEcomparison.R index af5f718dabf97abb9c79b5fd06cdb2922ce1b7f7..7ec13edeb8d29713ec780847767342c2659e70f9 100644 --- a/scripts/output/comparison/EDGEcomparison.R +++ b/scripts/output/comparison/EDGEcomparison.R @@ -40,8 +40,10 @@ EJmode_all = NULL ESmodecap_all = NULL ESmodeabs_all = NULL CO2km_int_newsales_all = NULL -EJfuels_all = NULL emidem_all = NULL +EJfuelsPass_all = NULL +EJfuelsFrgt_all = NULL +emidemPass_all = NULL scenNames <- getScenNames(outputdirs) EDGEdata_path <- path(outputdirs, paste("EDGE-T/")) @@ -300,17 +302,22 @@ EJfuelsFun = function(demandEJ, FEliq_source){ demandEJ[, technology := ifelse(technology %in% c("BEV", "LA-BEV", "Electric"), "Electricity", technology)] demandEJ[, technology := ifelse(technology %in% c("FCEV"), "Hydrogen", technology)] ## aggregate - demandEJ = demandEJ[, .(demand_EJ = sum(demand_EJ)), by = c("region", "year","technology")] + demandEJ = demandEJ[, .(demand_EJ = sum(demand_EJ)), by = c("region", "year","technology", "sector")] ## merge with liquids composition demandEJ = merge(demandEJ, FEliq_source, all = TRUE, by = c("region", "year", "technology"), allow.cartesian=TRUE) ## fuels that are not Liquids need a 1 as a share, otherwie would have an NA demandEJ[, shareliq := ifelse(is.na(shareliq), 1, shareliq)] demandEJ[, subtech := ifelse(is.na(subtech), technology, subtech)] ## calculate demand by fuel including oil types - demandEJ = demandEJ[,.(demand_EJ = demand_EJ*shareliq), by = c("region", "year", "subtech")] + demandEJ = demandEJ[,.(demand_EJ = demand_EJ*shareliq), by = c("region", "year", "subtech", "sector")] ## filter out years demandEJ = demandEJ[year >= 2015 & year <= 2100] + ## save separately passenger and freight + demandEJpass = demandEJ[sector %in% c("trn_pass", "trn_aviation_intl")] + demandEJfrgt = demandEJ[sector %in% c("trn_freight", "trn_shipping_intl")] + + demandEJ = list(demandEJpass = demandEJpass, demandEJfrgt = demandEJfrgt) return(demandEJ) } @@ -321,6 +328,12 @@ emidemFun = function(emidem){ } +emidemPassFun = function(emidemPass){ + emidemPass = emidemPass[region!="World" & year >= 2015 & year <= 2100] + emidemPass[, variable := as.character(variable)] + return(emidemPass) +} + for (outputdir in outputdirs) { ## load mif file name_mif = list.files(path = outputdir, pattern = "REMIND_generic", full.names = F) @@ -349,6 +362,7 @@ for (outputdir in outputdirs) { ## select useful entries from mif file FEliq_source = miffile[variable %in% c("FE|Transport|Liquids|Biomass", "FE|Transport|Liquids|Hydrogen", "FE|Transport|Liquids|Coal", "FE|Transport|Liquids|Oil"),] emidem = miffile[variable %in% c("Emi|CO2|Transport|Demand"),] + emidemPass = miffile[variable %in% c("Emi|CO2|Transport|Pass|Short-Medium Distance|Demand"),] ## modify mif file entries to be used in the functions FEliq_source = FEliq_sourceFun(FEliq_source, gdp) @@ -369,9 +383,12 @@ for (outputdir in outputdirs) { CO2km_int_newsales = CO2km_int_newsales_Fun(shares_LDV, mj_km_data, sharesVS1, FEliq_source$FEliq_sourceISO, gdp) ## calculate FE for all transport sectors by fuel, dividng Oil into Biofuels and Synfuels EJfuels = EJfuelsFun(demandEJ, FEliq_source$FEliq_sourceR) + EJfuelsPass = EJfuels[["demandEJpass"]] + EJfuelsFrgt = EJfuels[["demandEJfrgt"]] ## calculate demand emissions emidem = emidemFun(emidem) - + ## calculate emissions from passenger demand SM + emidemPass = emidemPassFun(emidemPass) ## add scenario dimension to the results fleet[, scenario := as.character(unique(miffile$scenario))] salescomp[, scenario := unique(miffile$scenario)] @@ -380,9 +397,10 @@ for (outputdir in outputdirs) { ESmodecap[, scenario := as.character(unique(miffile$scenario))] ESmodeabs[, scenario := as.character(unique(miffile$scenario))] CO2km_int_newsales[, scenario := as.character(unique(miffile$scenario))] - EJfuels[, scenario := as.character(unique(miffile$scenario))] emidem[, scenario := as.character(unique(miffile$scenario))] - + EJfuelsPass[, scenario := as.character(unique(miffile$scenario))] + EJfuelsFrgt[, scenario := as.character(unique(miffile$scenario))] + emidemPass[, scenario := as.character(unique(miffile$scenario))] ## rbind scenarios salescomp_all = rbind(salescomp_all, salescomp) fleet_all = rbind(fleet_all, fleet) @@ -391,8 +409,10 @@ for (outputdir in outputdirs) { ESmodecap_all = rbind(ESmodecap_all, ESmodecap) ESmodeabs_all = rbind(ESmodeabs_all, ESmodeabs) CO2km_int_newsales_all = rbind(CO2km_int_newsales_all, CO2km_int_newsales) - EJfuels_all = rbind(EJfuels_all, EJfuels) emidem_all = rbind(emidem_all, emidem) + EJfuelsPass_all = rbind(EJfuelsPass_all, EJfuelsPass) + EJfuelsFrgt_all = rbind(EJfuelsFrgt_all, EJfuelsFrgt) + emidemPass_all = rbind(emidemPass_all, emidemPass) } outdir = paste0("output/comparerunEDGE", gsub(" | ^([[:alpha:]]*).*","", Sys.time())) @@ -407,8 +427,10 @@ saveRDS(EJroad_all, paste0(outdir, "/EJroad_all.RDS")) saveRDS(ESmodecap_all, paste0(outdir, "/ESmodecap_all.RDS")) saveRDS(ESmodeabs_all, paste0(outdir, "/ESmodeabs_all.RDS")) saveRDS(CO2km_int_newsales_all, paste0(outdir, "/CO2km_int_newsales_all.RDS")) -saveRDS(EJfuels_all, paste0(outdir, "/EJfuels_all.RDS")) saveRDS(emidem_all, paste0(outdir, "/emidem_all.RDS")) +saveRDS(EJfuelsPass_all, paste0(outdir, "/EJfuelsPass_all.RDS")) +saveRDS(EJfuelsFrgt_all, paste0(outdir, "/EJfuelsFrgt_all.RDS")) +saveRDS(emidemPass_all, paste0(outdir, "/emidemPass_all.RDS")) file.copy(file.path("./scripts/output/comparison/notebook_templates", md_template), outdir) rmarkdown::render(path(outdir, md_template), output_format="pdf_document") diff --git a/scripts/output/comparison/notebook_templates/EDGETransportComparison.Rmd b/scripts/output/comparison/notebook_templates/EDGETransportComparison.Rmd index ee06d9e8c24f0ca05ccec9fc0c6df7a8cf89192d..2470681175254e92ea540f11dedd198a285d5960 100644 --- a/scripts/output/comparison/notebook_templates/EDGETransportComparison.Rmd +++ b/scripts/output/comparison/notebook_templates/EDGETransportComparison.Rmd @@ -29,7 +29,8 @@ fleet_all = readRDS("fleet_all.RDS") salescomp_all = readRDS("salescomp_all.RDS") ESmodecap_all = readRDS("ESmodecap_all.RDS") CO2km_int_newsales_all = readRDS("CO2km_int_newsales_all.RDS") -EJfuels_all = readRDS("EJfuels_all.RDS") +EJpass_all = readRDS("EJfuelsPass_all.RDS") +EJfrgt_all = readRDS("EJfuelsFrgt_all.RDS") emidem_all = readRDS("emidem_all.RDS") setConfig(forcecache=T) @@ -360,12 +361,33 @@ CO2km_int_newsalespf(CO2km_int_newsales_all) ```{r, echo=FALSE, message=FALSE, warning=FALSE, fig.width=14, fig.height=12} -## LDV by fuel -EJfuels_pf = function(dt){ - dt = dt[year >= 2020] - plot = ggplot()+ - geom_area(data = dt, aes(x=year, y=demand_EJ, group = subtech, fill = subtech), color="black", size=0.05, position= position_stack())+ - labs(x = "", y = "[EJ]", title = "Transport FE demand by fuel")+ +## passenger by fuel +EJfuels_pf = function(dt_p, dt_f){ + dt_p = dt_p[year >= 2020] + dt_p = dt_p[, .(demand_EJ = sum(demand_EJ)), by = c("subtech", "year", "region", "scenario")] + plotp = ggplot()+ + geom_area(data = dt_p, aes(x=year, y=demand_EJ, group = subtech, fill = subtech), color="black", size=0.05, position= position_stack())+ + labs(x = "", y = "[EJ]", title = "Passenger transport FE demand by fuel")+ + theme_minimal()+ + facet_grid(scenario~region)+ + scale_fill_manual("Technology",values = cols, breaks=legend_ord)+ + expand_limits(y = c(0,1))+ + scale_x_continuous(breaks = c(2020, 2030,2050, 2100))+ + theme(axis.text.x = element_text(angle = 90, size = 14, vjust=0.5, hjust=1), + axis.text.y = element_text(size = 14), + axis.title = element_text(size = 14), + title = element_text(size = 14), + legend.text = element_text(size = 14), + legend.title = element_text(size = 14), + strip.text = element_text(size = 14), + strip.background = element_rect(color = "grey"), + axis.line = element_line(size = 0.5, colour = "grey")) + + dt_f = dt_f[year >= 2020] + + plotf_lo = ggplot()+ + geom_area(data = dt_f[sector == "trn_shipping_intl"], aes(x=year, y=demand_EJ, group = subtech, fill = subtech), color="black", size=0.05, position= position_stack())+ + labs(x = "", y = "[EJ]", title = "International freight FE demand by fuel")+ theme_minimal()+ facet_grid(scenario~region)+ scale_fill_manual("Technology",values = cols, breaks=legend_ord)+ @@ -380,10 +402,30 @@ EJfuels_pf = function(dt){ strip.text = element_text(size = 14), strip.background = element_rect(color = "grey"), axis.line = element_line(size = 0.5, colour = "grey")) + + plotf_sm = ggplot()+ + geom_area(data = dt_f[sector == "trn_freight"], aes(x=year, y=demand_EJ, group = subtech, fill = subtech), color="black", size=0.05, position= position_stack())+ + labs(x = "", y = "[EJ]", title = "Short-medium freight FE demand by fuel")+ + theme_minimal()+ + facet_grid(scenario~region)+ + scale_fill_manual("Technology",values = cols, breaks=legend_ord)+ + expand_limits(y = c(0,1))+ + scale_x_continuous(breaks = c(2020, 2030,2050, 2100))+ + theme(axis.text.x = element_text(angle = 90, size = 14, vjust=0.5, hjust=1), + axis.text.y = element_text(size = 14), + axis.title = element_text(size = 14), + title = element_text(size = 14), + legend.text = element_text(size = 14), + legend.title = element_text(size = 14), + strip.text = element_text(size = 14), + strip.background = element_rect(color = "grey"), + axis.line = element_line(size = 0.5, colour = "grey")) + + plot = list(plotf_lo = plotf_lo, plotf_sm = plotf_sm, plotp = plotp) return(plot) } -EJfuels_pf(EJfuels_all) +EJfuels_pf(dt_p = EJpass_all, dt_f = EJfrgt_all) ``` diff --git a/scripts/output/comparison/notebook_templates/EDGEdashboard.Rmd b/scripts/output/comparison/notebook_templates/EDGEdashboard.Rmd index f830d9c1f0441b38d1037282889c1a73bccb13db..067af2a3cf1e7b35d3006e4fd7ed7a76470384ed 100644 --- a/scripts/output/comparison/notebook_templates/EDGEdashboard.Rmd +++ b/scripts/output/comparison/notebook_templates/EDGEdashboard.Rmd @@ -38,7 +38,7 @@ legend=plotlist$legend #data frame with help tooltips helpTooltip_df <- data.frame( - title=c("Per capita Passenger Transport Energy Services Demand", "Total Passenger Transport Energy Services Demand", "Sales composition", "Final energy LDVs by fuel","Transport Final Energy Demand", "Fleet composition", "Fleet composition comparison", "Emission intensity, new sales comparison", "Comparison of final energy demand"), + title=c("Per capita Passenger Transport Energy Services Demand", "Total Passenger Transport Energy Services Demand", "Sales composition", "Final energy LDVs by fuel","Transport Passenger Final Energy Demand", "Fleet composition", "Fleet composition comparison", "Emission intensity, new sales comparison", "Comparison of passenger final energy demand"), placement=c("right", "left", "right", "left", "left", "left", "right", "left", "left")) @@ -95,7 +95,7 @@ helpTooltip = function(tooltipdf){ <!--Creating First Page - LDV Page--> Overview {data-icon="glyphicon glyphicon-scale"} ===================================== -Side Navigation {.sidebar data-width=60} +Side Navigation {.sidebar .sidebarOverview data-width=60} ------------------------------------- [](#overview){class="fas fa-thermometer-three-quarters sidebar-button selected"} @@ -141,22 +141,22 @@ plotlist$`ConvCase NoTax`$plot$ESmodeabs Row {data-heigth=500} ----------------------------------------------------------------------- -### Transport Final Energy Demand +### Transport Passenger Final Energy Demand ```{r} -plotlist$`ConvCase NoTax`$plot$EJfuels +plotlist$`ConvCase NoTax`$plot$EJpassfuels ``` -### Emissions transport demand +### Emissions passenger transport demand ```{r} -plotlist$`ConvCase NoTax`$plot$emidem +plotlist$`ConvCase NoTax`$plot$emipdem ``` Overview Conv scenario {.hidden data-icon="glyphicon glyphicon-tint"} ===================================== -Side Navigation {.sidebar data-width=60} +Side Navigation {.sidebar .sidebarOverview data-width=60} ------------------------------------- [](#overview){class="fas fa-thermometer-three-quarters sidebar-button"} @@ -204,23 +204,23 @@ plotlist$ConvCase$plot$ESmodeabs Row {data-heigth=500} ----------------------------------------------------------------------- -### Transport Final Energy Demand +### Transport Passenger Final Energy Demand ```{r} -plotlist$ConvCase$plot$EJfuels +plotlist$ConvCase$plot$EJpassfuels ``` -### Emissions transport demand +### Emissions passenger transport demand ```{r} -plotlist$ConvCase$plot$emidem +plotlist$ConvCase$plot$emipdem ``` Overview FCEV scenario {.hidden data-icon="glyphicon glyphicon-tint"} ===================================== -Side Navigation {.sidebar data-width=60} +Side Navigation {.sidebar .sidebarOverview data-width=60} ------------------------------------- [](#overview){class="fas fa-thermometer-three-quarters sidebar-button"} @@ -268,23 +268,22 @@ plotlist$HydrHype$plot$ESmodeabs Row {data-heigth=500} ----------------------------------------------------------------------- -### Transport Final Energy Demand +### Transport Passenger Final Energy Demand ```{r} -plotlist$HydrHype$plot$EJfuels +plotlist$HydrHype$plot$EJpassfuels ``` -### Emissions transport demand +### Emissions passenger transport demand ```{r} -plotlist$HydrHype$plot$emidem +plotlist$HydrHype$plot$emipdem ``` Overview BEV scenario { .hidden data-icon="glyphicon glyphicon-flash"} ===================================== - -Side Navigation {.sidebar data-width=60} +Side Navigation {.sidebar .sidebarOverview data-width=60} ------------------------------------- [](#overview){class="fas fa-thermometer-three-quarters sidebar-button"} @@ -331,22 +330,22 @@ plotlist$ElecEra$plot$ESmodeabs Row {data-heigth=500} ----------------------------------------------------------------------- -### Transport Final Energy Demand +### Transport Passenger Final Energy Demand ```{r} -plotlist$ElecEra$plot$EJfuels +plotlist$ElecEra$plot$EJpassfuels ``` -### Emissions transport demand +### Emissions passenger transport demand ```{r} -plotlist$ElecEra$plot$emidem +plotlist$ElecEra$plot$emipdem ``` Overview Synfuel scenario {.hidden data-icon="glyphicon glyphicon-random"} ===================================== -Side Navigation {.sidebar data-width=60} +Side Navigation {.sidebar .sidebarOverview data-width=60} ------------------------------------- [](#overview){class="fas fa-thermometer-three-quarters sidebar-button"} @@ -392,23 +391,23 @@ plotlist$SynSurge$plot$ESmodeabs Row {data-heigth=500} ----------------------------------------------------------------------- -### Transport Final Energy Demand +### Transport Passenger Final Energy Demand ```{r} -plotlist$SynSurge$plot$EJfuels +plotlist$SynSurge$plot$EJpassfuels ``` -### Emissions transport demand +### Emissions passenger transport demand ```{r} -plotlist$SynSurge$plot$emidem +plotlist$SynSurge$plot$emipdem ``` LDVs {data-icon="fa-car"} ===================================== -Side Navigation {.sidebar data-width=60} +Side Navigation {.sidebar .sidebarLDV data-width=60} ------------------------------------- [](#ldvs){class="fas fa-thermometer-three-quarters sidebar-button selected"} @@ -471,8 +470,7 @@ plotlist$`ConvCase NoTax`$plot$vintcomp LDVs Conv scenario { .hidden data-icon="glyphicon glyphicon-flash"} ===================================== - -Side Navigation {.sidebar data-width=60} +Side Navigation {.sidebar .sidebarLDV data-width=60} ------------------------------------- [](#ldvs){class="fas fa-thermometer-three-quarters sidebar-button"} @@ -537,7 +535,7 @@ plotlist$ConvCase$plot$vintcomp LDVs FCEV scenario {.hidden data-icon="glyphicon glyphicon-tint"} ===================================== -Side Navigation {.sidebar data-width=60} +Side Navigation {.sidebar .sidebarLDV data-width=60} ------------------------------------- [](#ldvs){class="fas fa-thermometer-three-quarters sidebar-button"} @@ -604,7 +602,7 @@ LDVs BEV scenario { .hidden data-icon="glyphicon glyphicon-flash"} ===================================== -Side Navigation {.sidebar data-width=60} +Side Navigation {.sidebar .sidebarLDV data-width=60} ------------------------------------- [](#ldvs){class="fas fa-thermometer-three-quarters sidebar-button"} @@ -670,7 +668,7 @@ plotlist$ElecEra$plot$vintcomp LDVs Synfuel scenario {.hidden data-icon="glyphicon glyphicon-random"} ===================================== -Side Navigation {.sidebar data-width=60} +Side Navigation {.sidebar .sidebarLDV data-width=60} ------------------------------------- [](#ldvs){class="fas fa-thermometer-three-quarters sidebar-button"} @@ -749,14 +747,17 @@ plotlist$comparison$plot$CO2km_intensity_newsales_scen Row {data-height=300} ----------------------------------------------------------------------- -### Comparison of final energy demand +### Comparison of passenger final energy demand ```{r} -plotlist$comparison$plot$EJfuels_scen +plotlist$comparison$plot$EJpassfuels_scen ``` Assumptions {data-icon="fa-comment"} ===================================== +Column {data-width= 450} +----------------------------------------------------------------------- + ### Conventional Case {data-height=200} * Conventional consumers patterns @@ -768,14 +769,15 @@ Assumptions {data-icon="fa-comment"} * Learning rate on BEVs and FCEVs * Optimistic trend of hydrogen refuelling stations -* Rebates-feebates scheme: 5000 € subsidies starting in 2020 on FCEVs, phasing out by 2035. 1000 € mark-up cost on internal combustion engines +* Rebates-feebates scheme: 5000 ? subsidies starting in 2020 on FCEVs, phasing out by 2035. 1000 ? mark-up cost on internal combustion engines * Market-driven behavior of light duty vehicles powertrain choice * Policy push of FCEVs +* Hydrogen from renewable resources (green hydrogen) is set to be above 95\% of the total hydrogen ### Electric Era {data-height=200} * Learning rate on BEVs and FCEVs -* Rebates-feebates scheme: 5000 € subsidies starting in 2020 on BEVs, phasing out by 2035. 1000 € mark-up cost on internal combustion engines +* Rebates-feebates scheme: 5000 ? subsidies starting in 2020 on BEVs, phasing out by 2035. 1000 ? mark-up cost on internal combustion engines * Market-driven behavior of light duty vehicles powertrain choice ### Synfuel Surge {data-height=200} @@ -783,7 +785,9 @@ Assumptions {data-icon="fa-comment"} * Conventional consumers patterns * Learning rate on BEVs and FCEVs * Market-driven behavior of light duty vehicles powertrain choice -* Synfuels are forced in the liquids mix reaching 10% in 2035 +* Synfuels are forced in the liquids mix reaching 10\% in 2035 +* Hydrogen from renewable resources (green hydrogen) is set to be above 95% of the total hydrogen + <!-- creating information tooltip --> ```{r, results='asis'} @@ -792,6 +796,39 @@ for(i in 1:nrow(helpTooltip_df)){ } ``` +<!-- #### additional html, js and CSS #### --> + +<!-- js --> + +<script type="text/javascript"> + var is_chrome = (typeof window.chrome === "object" && navigator.appVersion.indexOf('Edge') === -1); +</script> + + +<!-- Adding js function to add "memory" to the nav bar navigation --> +```{r} +navBarMemory = function(topMenuLabel, sideBarClass){ + result = "" + result = paste0(result,"<script type='text/javascript'>\n"); + result = paste0(result,"$(document).ready(function () {\n"); + result = paste0(result," $(\"",sideBarClass," a\").click(function(){\n"); + result = paste0(result," console.log($(this).attr('href'));\n"); + result = paste0(result," console.log($(\".nav.navbar-nav.navbar-left a:contains('",topMenuLabel,"')\").attr('href'));\n"); + result = paste0(result," $(\".nav.navbar-nav.navbar-left a:contains('",topMenuLabel,"')\").attr('href', $(this).attr('href'));\n"); + result = paste0(result," if(!is_chrome){\n"); + result = paste0(result," window.FlexDashboardUtils.showPage($(this).attr('href'));\n"); + result = paste0(result," }\n"); + result = paste0(result," })\n"); + result = paste0(result,"})\n"); + result = paste0(result,"</script>"); + return(result) +} +``` + +```{r, results='asis'} + cat(navBarMemory("Overview",".sidebarOverview")) + cat(navBarMemory("LDVs",".sidebarLDV")) +``` <!-- ADVANCED: using CSS to define the appearance of the side bar --> diff --git a/scripts/output/comparison/notebook_templates/helper_dashboard.R b/scripts/output/comparison/notebook_templates/helper_dashboard.R index be23779601403890b25112db1d130af45beac488..49e78b6a1afd893f2ee425f6161477a517cd8692 100644 --- a/scripts/output/comparison/notebook_templates/helper_dashboard.R +++ b/scripts/output/comparison/notebook_templates/helper_dashboard.R @@ -92,8 +92,8 @@ salescomp_all = readRDS("salescomp_all.RDS") ESmodecap_all = readRDS("ESmodecap_all.RDS") ESmodeabs_all = readRDS("ESmodeabs_all.RDS") CO2km_int_newsales_all = readRDS("CO2km_int_newsales_all.RDS") -EJfuels_all = readRDS("EJfuels_all.RDS") -emidem_all = readRDS("emidem_all.RDS") +EJpass_all = readRDS("EJfuelsPass_all.RDS") +emipdem_all = readRDS("emidemPass_all.RDS") ## scenarios scens = unique(EJmode_all$scenario) @@ -307,8 +307,8 @@ ESmodeabs_dash = function(dt, scen){ } -EJfuels_dash = function(dt, scen){ - dt = dt[region == region_plot & scenario == scen & year >= 2015 & year <= 2050] +EJpass_dash = function(dt, scen){ + dt = dt[region == region_plot & scenario == scen & year >= 2015 & year <= 2050 & sector == "trn_pass"] dt[, details := paste0("Demand: ", round(demand_EJ, digits = 0), " [EJ]","<br>", "Technology: ", subtech, "<br>", "Region: ", region," <br>", "Year: ", year) ] plot = ggplot()+ @@ -316,7 +316,7 @@ EJfuels_dash = function(dt, scen){ theme_minimal()+ scale_fill_manual("Technology",values = cols, breaks=legend_ord)+ expand_limits(y = c(0,1))+ - ylim(0, 25)+ + ylim(0, 20)+ labs(x = "", y = "")+ scale_x_continuous(breaks = c(2015, 2030, 2050))+ theme(axis.text.x = element_text(angle = 90, size = 8, vjust=0.5, hjust=1), @@ -340,9 +340,9 @@ EJfuels_dash = function(dt, scen){ return(output) } -EJfuels_scen_dash = function(dt){ +EJpass_scen_dash = function(dt){ dt[, scenario := ifelse(scenario == "Base_ConvCase", "ConvCaseNoTax", scenario)] - dt = dt[region == region_plot & year %in% c(2015, 2030, 2050)] + dt = dt[region == region_plot & year %in% c(2015, 2030, 2050) & sector == "trn_pass"] dt[, details := paste0("Demand: ", round(demand_EJ, digits = 0), " [EJ]","<br>", "Technology: ", subtech, "<br>", "Region: ", region," <br>", "Year: ", year) ] dt[, scenario := gsub(".*_", "", scenario)] dt[, scenario := factor(scenario, levels = c("ConvCaseNoTax", "ConvCase", "HydrHype", "ElecEra", "SynSurge"))] @@ -495,7 +495,7 @@ EJLDVdash <- function(dt, scen){ } -emidem_dash = function(dt, scen){ +emipdem_dash = function(dt, scen){ dt = dt[region == region_plot & scenario == scen & year <= 2050] plot = ggplot()+ @@ -558,13 +558,13 @@ create_plotlist = function(scens, salescomp_all, fleet_all, ESmodecap_all, EJfue ## energy services demand, total ESmodeabs = ESmodeabs_dash(ESmodeabs_all, scen) ## final energy demand - EJfuels = EJfuels_dash(EJfuels_all, scen) ## Final Energy demand all modes, passenger and freight + EJpassfuels = EJpass_dash(EJpass_all, scen) ## Final Energy demand all modes, passenger ## CO2 intensity new sales LDVs CO2km_int_newsales = CO2km_intensity_newsalesdash(CO2km_int_newsales_all, scen) ## final energy LDVs by fuel EJLDV = EJLDVdash(EJroad_all, scen) - ## emissions transport demand - emidem = emidem_dash(emidem_all, scen) + ## emissions passenger transport demand + emipdem = emipdem_dash(emipdem_all, scen) ## collect plots output[[scenname]]$plot$vintcomp = vintcomp$plot @@ -572,10 +572,10 @@ create_plotlist = function(scens, salescomp_all, fleet_all, ESmodecap_all, EJfue output[[scenname]]$plot$ESmodecap_pass = ESmodecap$plot$plot_pass output[[scenname]]$plot$ESmodecap_frgt = ESmodecap$plot$plot_frgt output[[scenname]]$plot$ESmodeabs = ESmodeabs$plot - output[[scenname]]$plot$EJfuels = EJfuels$plot + output[[scenname]]$plot$EJpassfuels = EJpassfuels$plot output[[scenname]]$plot$CO2km_int_newsales = CO2km_int_newsales output[[scenname]]$plot$EJLDV = EJLDV$plot - output[[scenname]]$plot$emidem = emidem + output[[scenname]]$plot$emipdem = emipdem output[[scenname]]$emiscen = emiscen } @@ -585,12 +585,12 @@ create_plotlist = function(scens, salescomp_all, fleet_all, ESmodecap_all, EJfue ## CO2 intensity of new sales CO2km_intensity_newsales_scen = CO2km_intensity_newsales_scen_dash(CO2km_int_newsales_all) ## Final energy demand - EJfuels_scen = EJfuels_scen_dash(EJfuels_all) + EJpassfuels_scen = EJpass_scen_dash(EJpass_all) output[["comparison"]]$plot$vintscen = vintscen$plot output[["comparison"]]$plot$CO2km_intensity_newsales_scen = CO2km_intensity_newsales_scen$plot - output[["comparison"]]$plot$EJfuels_scen = EJfuels_scen$plot + output[["comparison"]]$plot$EJpassfuels_scen = EJpassfuels_scen$plot legend$'Sales composition'$contents <- lapply(salescomp$vars, function(var) { return(list("fill"=toString(cols[var]),"linetype"=NULL)) }) @@ -603,8 +603,8 @@ create_plotlist = function(scens, salescomp_all, fleet_all, ESmodecap_all, EJfue names(legend$'Per capita Freight Transport Energy Services Demand'$contents) <- ESmodecap$vars$vars_frgt legend$'Final energy LDVs by fuel'$contents <- lapply(EJLDV$vars, function(var) { return(list("fill"=toString(cols[var]),"linetype"=NULL)) }) names(legend$'Final energy LDVs by fuel'$contents) <- EJLDV$vars - legend$'Transport Final Energy Demand'$contents <- lapply(EJfuels$vars, function(var) { return(list("fill"=toString(cols[var]),"linetype"=NULL)) }) - names(legend$'Transport Final Energy Demand'$contents) <- EJfuels$vars + legend$'Transport Passenger Final Energy Demand'$contents <- lapply(EJpassfuels$vars, function(var) { return(list("fill"=toString(cols[var]),"linetype"=NULL)) }) + names(legend$'Transport Passenger Final Energy Demand'$contents) <- EJpassfuels$vars legend$'Fleet composition'$contents <- lapply(vintcomp$vars, function(var) { return(list("fill"=toString(cols[var]),"linetype"=NULL)) }) names(legend$'Fleet composition'$contents) <- vintcomp$vars @@ -613,8 +613,8 @@ create_plotlist = function(scens, salescomp_all, fleet_all, ESmodecap_all, EJfue names(legend$'Fleet composition comparison'$contents) <- vintscen$vars legend$'Emission intensity, new sales comparison'$contents <- lapply(CO2km_intensity_newsales_scen$vars, function(var) { return(list("fill"=toString(cols[var]),"linetype"=NULL)) }) names(legend$'Emission intensity, new sales comparison'$contents) <- CO2km_intensity_newsales_scen$vars - legend$'Comparison of final energy demand'$contents <- lapply(EJfuels_scen$vars, function(var) { return(list("fill"=toString(cols[var]),"linetype"=NULL)) }) - names(legend$'Comparison of final energy demand'$contents) <- EJfuels_scen$vars + legend$'Comparison of passenger final energy demand'$contents <- lapply(EJpassfuels_scen$vars, function(var) { return(list("fill"=toString(cols[var]),"linetype"=NULL)) }) + names(legend$'Comparison of passenger final energy demand'$contents) <- EJpassfuels_scen$vars output$legend = legend return(output)