Skip to content

Commit

Permalink
Aux transit volumes (#384)
Browse files Browse the repository at this point in the history
* Add `aux_transit_volume` attribute and extra attribute name check

* Add saving and printing of `aux_transit_volume` attribute

* Add volume factor
  • Loading branch information
Jens West committed Oct 28, 2021
1 parent 11206d1 commit e78a951
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Scripts/assignment/assignment_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,10 @@ def _assign_congested_transit(self):
class_name=tc)
base_timtr = param.uncongested_transit_time
time_attr = self.extra(base_timtr)
volax_attr = self.extra("aux_transit")
network = self.emme_scenario.get_network()
for link in network.links():
link[volax_attr] = link.aux_transit_volume
for segment in network.transit_segments():
segment[time_attr] = segment['@'+base_timtr]
self.emme_scenario.publish_network(network)
Expand Down
4 changes: 2 additions & 2 deletions Scripts/assignment/emme_assignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def aggregate_results(self, resultdata):
if res != "transit_volumes":
self._node_24h(
transit_class, param.segment_results[res])
ass_classes = list(param.emme_demand_mtx) + ["bus"]
ass_classes = list(param.emme_demand_mtx) + ["bus", "aux_transit"]
for ass_class in ass_classes:
self._link_24h(ass_class)

Expand Down Expand Up @@ -343,7 +343,7 @@ def _create_attributes(self, scenario, extra):
self.emme_project.create_extra_attribute(
"LINK", extra(ass_class), ass_class + " volume",
overwrite=True, scenario=scenario)
for attr in ("total_cost", "toll_cost", "car_time"):
for attr in ("total_cost", "toll_cost", "car_time", "aux_transit"):
self.emme_project.create_extra_attribute(
"LINK", extra(attr), attr,
overwrite=True, scenario=scenario)
Expand Down
7 changes: 7 additions & 0 deletions Scripts/assignment/emme_bindings/mock_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,8 @@ def publish_network(self, network):

class ExtraAttribute:
def __init__(self, name, attr_type, default_value, scenario):
if len(name) > 20 or name[0] != '@':
raise ArgumentError("Invalid extra attribute ID: {}".format(name))
self.name = name
self.type = attr_type
self.default_value = default_value
Expand Down Expand Up @@ -644,6 +646,7 @@ def __init__(self, network, i_node, j_node, modes):
self.num_lanes = 1
self.volume_delay_func = 0
self.auto_time = 0.1
self.aux_transit_volume = 0.0
self._segments = []

@property
Expand Down Expand Up @@ -721,3 +724,7 @@ def j_node(self):

class ExistenceError(Exception):
pass


class ArgumentError(Exception):
pass
2 changes: 1 addition & 1 deletion Scripts/helmet_validate_inputfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def main(args):
nr_vehicle_classes = len(param.emme_demand_mtx) + 1
nr_new_attr = {
"nodes": nr_transit_classes * (nr_segment_results-1),
"links": nr_vehicle_classes + 3,
"links": nr_vehicle_classes + 4,
"transit_lines": 0,
"transit_segments": nr_transit_classes*nr_segment_results + 1,
}
Expand Down
1 change: 1 addition & 0 deletions Scripts/parameters/assignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@
"iht": 1 / 0.497,
},
}
volume_factors["aux_transit"] = volume_factors["transit"]
# Factor for converting weekday traffic into yearly day average
years_average_day_factor = 0.85
# Factor for converting day traffic into 7:00-22:00 traffic
Expand Down

0 comments on commit e78a951

Please sign in to comment.