Skip to content

Commit e78a951

Browse files
author
Jens West
authored
Aux transit volumes (#384)
* Add `aux_transit_volume` attribute and extra attribute name check * Add saving and printing of `aux_transit_volume` attribute * Add volume factor
1 parent 11206d1 commit e78a951

File tree

5 files changed

+14
-3
lines changed

5 files changed

+14
-3
lines changed

Scripts/assignment/assignment_period.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,10 @@ def _assign_congested_transit(self):
767767
class_name=tc)
768768
base_timtr = param.uncongested_transit_time
769769
time_attr = self.extra(base_timtr)
770+
volax_attr = self.extra("aux_transit")
770771
network = self.emme_scenario.get_network()
772+
for link in network.links():
773+
link[volax_attr] = link.aux_transit_volume
771774
for segment in network.transit_segments():
772775
segment[time_attr] = segment['@'+base_timtr]
773776
self.emme_scenario.publish_network(network)

Scripts/assignment/emme_assignment.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def aggregate_results(self, resultdata):
150150
if res != "transit_volumes":
151151
self._node_24h(
152152
transit_class, param.segment_results[res])
153-
ass_classes = list(param.emme_demand_mtx) + ["bus"]
153+
ass_classes = list(param.emme_demand_mtx) + ["bus", "aux_transit"]
154154
for ass_class in ass_classes:
155155
self._link_24h(ass_class)
156156

@@ -343,7 +343,7 @@ def _create_attributes(self, scenario, extra):
343343
self.emme_project.create_extra_attribute(
344344
"LINK", extra(ass_class), ass_class + " volume",
345345
overwrite=True, scenario=scenario)
346-
for attr in ("total_cost", "toll_cost", "car_time"):
346+
for attr in ("total_cost", "toll_cost", "car_time", "aux_transit"):
347347
self.emme_project.create_extra_attribute(
348348
"LINK", extra(attr), attr,
349349
overwrite=True, scenario=scenario)

Scripts/assignment/emme_bindings/mock_project.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,8 @@ def publish_network(self, network):
430430

431431
class ExtraAttribute:
432432
def __init__(self, name, attr_type, default_value, scenario):
433+
if len(name) > 20 or name[0] != '@':
434+
raise ArgumentError("Invalid extra attribute ID: {}".format(name))
433435
self.name = name
434436
self.type = attr_type
435437
self.default_value = default_value
@@ -644,6 +646,7 @@ def __init__(self, network, i_node, j_node, modes):
644646
self.num_lanes = 1
645647
self.volume_delay_func = 0
646648
self.auto_time = 0.1
649+
self.aux_transit_volume = 0.0
647650
self._segments = []
648651

649652
@property
@@ -721,3 +724,7 @@ def j_node(self):
721724

722725
class ExistenceError(Exception):
723726
pass
727+
728+
729+
class ArgumentError(Exception):
730+
pass

Scripts/helmet_validate_inputfiles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def main(args):
129129
nr_vehicle_classes = len(param.emme_demand_mtx) + 1
130130
nr_new_attr = {
131131
"nodes": nr_transit_classes * (nr_segment_results-1),
132-
"links": nr_vehicle_classes + 3,
132+
"links": nr_vehicle_classes + 4,
133133
"transit_lines": 0,
134134
"transit_segments": nr_transit_classes*nr_segment_results + 1,
135135
}

Scripts/parameters/assignment.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@
348348
"iht": 1 / 0.497,
349349
},
350350
}
351+
volume_factors["aux_transit"] = volume_factors["transit"]
351352
# Factor for converting weekday traffic into yearly day average
352353
years_average_day_factor = 0.85
353354
# Factor for converting day traffic into 7:00-22:00 traffic

0 commit comments

Comments
 (0)