2017-05-17 21 views
0

私はPythonを使用して、COMインターフェイスを使用してVISSIMトラフィックシミュレーションソフトウェアと通信しています。VISSIM COMインターフェイスVehicleNetworkPerformanceMeasurement

#run vissim 
env = win32com.client.Dispatch('Vissim.Vissim.800') 

#load layout,network 
env.LoadNet(r'X:\Users\rHalabi\singleIntersection\Ryan.inpx') 
env.LoadLayout(r'X:\Users\rHalabi\singleIntersection\Ryan.layx') 

#tell vissim to collect vehicle performance data 
env.Net.Evaluation.SetAttValue('VehNetPerfCollectData', 1) 

#run a few steps 
for i in range(10): 
    env.Simulation.RunSingleStep() 

#collect results 
env.Net.VehicleNetworkPerformanceMeasurement.AttValue('DelayTot') 

は、最後の行は、私は「DelayTot」はほかに他の属性を試してみた

com_error: (-2147352567, 'Exception occurred.', (0, 'VISSIM.Vissim.800', 'Sub-attribute not specified', None, 0, -2147352567), None) 

エラーに返しシミュレーションを実行している間、私はVehicleNetworkPerformanceMeasurement総遅延属性にアクセスしようとしている

なし。私はドキュメンテーションに従っており、他のオブジェクトに何の問題も問いませんでした。

このデータにアクセスするにはどうすればよいですか?

答えて

0

は、サブ属性を持つ属性では、サブアトリビュートをクエリに指定する必要があります。 TravelTimeMeasurementsを照会する方法については、VISSIMのドキュメントのコード例を参照してください。

Veh_TT_measurement = Vissim.Net.VehicleTravelTimeMeasurements.ItemByKey(Veh_TT_measurement_number) 
# Syntax to get the travel times: 
# Veh_TT_measurement.AttValue('TravTm(sub_attribut_1, sub_attribut_2, sub_attribut_3)') 
# 
# sub_attribut_1: SimulationRun 
#  1, 2, 3, ... Current:  the value of one specific simulation (number according to the tribute "No" of Simulation Runs (see List of Simulation Runs)) 
#  Avg, StdDev, Min, Max: aggregated value of all simulations runs: Avg, StdDev, Min, Max 
# sub_attribut_2: TimeInterval 
#  1, 2, 3, ... Last:  the value of one specific time interval (number of time interval always starts at 1 (first time interval), 2 (2nd TI), 3 (3rd TI), ...) 
#  Avg, StdDev, Min, Max: aggregated value of all time interval of one simulation: Avg, StdDev, Min, Max 
#  Total:     sum of all time interval of one simulation 
# sub_attribut_3: VehicleClass 
#  10, 20 or All    values only from vehicles of the defined vehicle class number (according to the attribute "No" of Vehicle Classes) 
#         Note: You can only access the results of specific vehicle classes if you set it in Evaluation > Configuration > Result Attributes 
# 
# The value of on time interval is the arithmetic mean of all single travel times of the vehicles. 
関連する問題