From f3887256fb304d9d4a90a09c69f4b9c465f188a6 Mon Sep 17 00:00:00 2001 From: Sijia Wang Date: Mon, 12 Jun 2023 12:23:42 -0400 Subject: [PATCH] calc bus time for links not assigned in the hwy net --- tm2py/components/network/transit/transit_network.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tm2py/components/network/transit/transit_network.py b/tm2py/components/network/transit/transit_network.py index d004d332..906c8d16 100644 --- a/tm2py/components/network/transit/transit_network.py +++ b/tm2py/components/network/transit/transit_network.py @@ -328,13 +328,17 @@ def _get_highway_travel_times( _highway_net = _highway_scenario.get_partial_network( ["LINK"], include_attributes=False ) - travel_time_attributes = {"LINK": ["#link_id", "auto_time"]} + travel_time_attributes = {"LINK": ["#link_id", "auto_time", "@lanes"]} self.emme_manager.copy_attribute_values( _highway_scenario, _highway_net, travel_time_attributes ) # TODO can we just get the link attributes as a DataFrame and merge them? + # if the link does not have meaningful travel time in highway assigned network + # such as bus only link, managed lanes, etc. + # assume default bus speed of 30 mph auto_link_time_dict = { - auto_link["#link_id"]: auto_link.auto_time + auto_link["#link_id"] : ( auto_link.auto_time + if auto_link["@lanes"] > 0 else 60*auto_link["length"]/30 ) for auto_link in _highway_net.links() } return auto_link_time_dict