Skip to content

Commit

Permalink
Merge pull request #113 from BayAreaMetro/fix-prepare-network-error
Browse files Browse the repository at this point in the history
Fix transit travel time errors
  • Loading branch information
i-am-sijia authored Jun 12, 2023
2 parents 0a84236 + f388725 commit 6d96d24
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions tm2py/components/network/create_tod_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def _create_highway_scenarios(self):
"fd3",
"fd4",
"fd5",
"fd6",
"fd7",
"fd9",
"fd10",
Expand Down Expand Up @@ -342,6 +343,8 @@ def _create_transit_scenarios(self):
link["@trantime"] = (
60 * link.length / speed + link.length * 5 * 0.33
)
else:
link["@trantime"] = 0
else:
link["@trantime"] = 60 * link.length / speed
# set TAP connector distance to 60 feet
Expand Down Expand Up @@ -517,6 +520,8 @@ def _set_capclass(network):
area_type = link["@area_type"]
if area_type < 0:
link["@capclass"] = -1
elif (link["@ft"] == 99) & (link["@assignable"] == 1):
link["@capclass"] = 10 * area_type + 7
else:
link["@capclass"] = 10 * area_type + link["@ft"]

Expand Down
8 changes: 6 additions & 2 deletions tm2py/components/network/transit/transit_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6d96d24

Please sign in to comment.