From 58953caea233afe82d69350188e4d2370a33a316 Mon Sep 17 00:00:00 2001 From: Daniel Gil Date: Tue, 1 Jun 2021 07:45:46 -0500 Subject: [PATCH] Removing walking stages from create_max_mode function Ref #77 Since the walking stage is being added for all scenarios in the functions "walk_to_pt_and_combine_scen" and "add_walk_trips", there is no need to add them in "create_max_mode_share_scenarios" function. In this way we make sure that all walking components for PT are created equally in all scenarios. --- R/create_max_mode_share_scenarios.R | 14 +++++++------- R/walk_to_pt_and_combine_scen.R | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/R/create_max_mode_share_scenarios.R b/R/create_max_mode_share_scenarios.R index f0b3dee0..94432cdb 100644 --- a/R/create_max_mode_share_scenarios.R +++ b/R/create_max_mode_share_scenarios.R @@ -52,13 +52,13 @@ create_max_mode_share_scenarios <- function(trip_set){ change_trips$stage_mode <- mode_name change_trips$stage_duration <- change_trips$stage_distance * 60 / MODE_SPEEDS$speed[MODE_SPEEDS$stage_mode == mode_name] ## if bus scenario: - if (mode_name == 'bus'){ - walk_trips <- change_trips; - walk_trips$stage_mode <- 'walk_to_pt'; - walk_trips$stage_duration <- BUS_WALK_TIME; - walk_trips$stage_distance <- walk_trips$stage_duration * MODE_SPEEDS$speed[MODE_SPEEDS$stage_mode == 'pedestrian'] / 60 - change_trips <- rbind(change_trips, walk_trips) - } + # if (mode_name == 'bus'){ + # walk_trips <- change_trips; + # walk_trips$stage_mode <- 'walk_to_pt'; + # walk_trips$stage_duration <- BUS_WALK_TIME; + # walk_trips$stage_distance <- walk_trips$stage_duration * MODE_SPEEDS$speed[MODE_SPEEDS$stage_mode == 'pedestrian'] / 60 + # change_trips <- rbind(change_trips, walk_trips) + # } rdr_copy[[j]] <- rbind(rdr_copy[[j]][!rdr_copy[[j]]$trip_id%in%change_trip_ids,],change_trips) } } diff --git a/R/walk_to_pt_and_combine_scen.R b/R/walk_to_pt_and_combine_scen.R index 1c3301c7..5bde5302 100644 --- a/R/walk_to_pt_and_combine_scen.R +++ b/R/walk_to_pt_and_combine_scen.R @@ -33,7 +33,7 @@ walk_to_pt_and_combine_scen <- function(SYNTHETIC_TRIPS){ # further separate out bus trips WITHOUT pedestrian component pt_trips_wo_walk <- rd_list[[i]] %>% filter(trip_id %in% pt_trips$trip_id) %>% group_by(trip_id) %>% - mutate(ped = if(any(stage_mode == 'pedestrian')) 1 else 0) %>% + mutate(ped = if(any(stage_mode == 'walk_to_pt')) 1 else 0) %>% ungroup() %>% filter(ped == 0) %>% dplyr::select(-ped)