Skip to content

Commit

Permalink
Removing walking stages from create_max_mode function Ref ITHIM#77
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
danielgils committed Jun 1, 2021
1 parent 0328b8d commit 58953ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions R/create_max_mode_share_scenarios.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
2 changes: 1 addition & 1 deletion R/walk_to_pt_and_combine_scen.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 58953ca

Please sign in to comment.