@@ -56,6 +56,10 @@ class StrategyBasedAnalysis(_m.Tool()):
5656
5757 xtmf_in_vehicle_trip_component = _m .Attribute (str )
5858
59+ xtmf_transit_volumes_attribute = _m .Attribute (str )
60+ xtmf_aux_transit_attribute = _m .Attribute (str )
61+ xtmf_aux_transit_volumes_attribute = _m .Attribute (str )
62+
5963 def __init__ (self ):
6064 #---Init internal variables
6165 self .TRACKER = _util .ProgressTracker (self .number_of_tasks ) #init the ProgressTracker
@@ -67,20 +71,32 @@ def page(self):
6771 branding_text = "XTMF" )
6872 return pb .render ()
6973
70- def __call__ (self , xtmf_ScenarioNumber , xtmf_ClassName , xtmf_DemandMatrixNumber , xtmf_sub_path_combination_operator , xtmf_StrategyValuesMatrixNumber , xtmf_in_vehicle_trip_component ):
71- if xtmf_ClassName == '' :
72- xtmf_ClassName = None
73- if xtmf_in_vehicle_trip_component == '' :
74- xtmf_in_vehicle_trip_component = None
74+ def value_or_none (self , value ):
75+ if value == '' :
76+ return None
77+ else :
78+ return value
79+
80+ def __call__ (self , xtmf_ScenarioNumber , xtmf_ClassName , xtmf_DemandMatrixNumber , xtmf_sub_path_combination_operator , xtmf_StrategyValuesMatrixNumber ,
81+ xtmf_in_vehicle_trip_component , xtmf_transit_volumes_attribute ,
82+ xtmf_aux_transit_attribute , xtmf_aux_transit_volumes_attribute ):
83+
84+ xtmf_ClassName = self .value_or_none (xtmf_ClassName )
85+ xtmf_in_vehicle_trip_component = self .value_or_none (xtmf_in_vehicle_trip_component )
86+
87+ xtmf_transit_volumes_attribute = self .value_or_none (xtmf_transit_volumes_attribute )
88+ xtmf_aux_transit_attribute = self .value_or_none (xtmf_aux_transit_attribute )
89+ xtmf_aux_transit_volumes_attribute = self .value_or_none (xtmf_aux_transit_volumes_attribute )
90+
7591 database = _MODELLER .emmebank
7692 tool = _MODELLER .tool ('inro.emme.transit_assignment.extended.strategy_based_analysis' )
77- strategyValuesMatrixNumber = self .InitializeMatrix (database , xtmf_StrategyValuesMatrixNumber )
93+ strategyValuesMatrixId = self .InitializeMatrix (database , xtmf_StrategyValuesMatrixNumber )
7894 spec = {
7995 "trip_components" :
8096 {
8197 "boarding" : None ,
8298 "in_vehicle" : xtmf_in_vehicle_trip_component ,
83- "aux_transit" : None ,
99+ "aux_transit" : xtmf_aux_transit_attribute ,
84100 "alighting" : None
85101 },
86102 "sub_path_combination_operator" : xtmf_sub_path_combination_operator ,
@@ -94,10 +110,10 @@ def __call__(self, xtmf_ScenarioNumber, xtmf_ClassName, xtmf_DemandMatrixNumber,
94110 "constraint" : None ,
95111 "results" :
96112 {
97- "strategy_values" : strategyValuesMatrixNumber . id ,
113+ "strategy_values" : strategyValuesMatrixId ,
98114 "selected_demand" : None ,
99- "transit_volumes" : None ,
100- "aux_transit_volumes" : None ,
115+ "transit_volumes" : xtmf_transit_volumes_attribute ,
116+ "aux_transit_volumes" : xtmf_aux_transit_volumes_attribute ,
101117 "total_boardings" : None ,
102118 "total_alightings" : None
103119 },
@@ -106,8 +122,10 @@ def __call__(self, xtmf_ScenarioNumber, xtmf_ClassName, xtmf_DemandMatrixNumber,
106122 tool (spec , database .scenario (xtmf_ScenarioNumber ), class_name = xtmf_ClassName , num_processors = 'max' )
107123
108124 def InitializeMatrix (self , database , matrixNumber ):
125+ if matrixNumber == 0 :
126+ return None
109127 matrix_name = "mf" + str (matrixNumber )
110128 matrix = database .matrix (matrix_name )
111129 if matrix is None :
112130 matrix = database .create_matrix (matrix_name )
113- return matrix
131+ return matrix . id
0 commit comments