VISSIM COM接口车辆网络性能测量

2024-04-19 15:35:59 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用Python与VISSIM交通仿真软件通过COM接口进行通信。在

我试图在运行模拟时访问VehicleNetworkPerformanceMeasurement total delay属性

#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' )

最后一行返回一个错误

^{pr2}$

我试过除了“DelayTot”之外的其他属性,但都没用。我已经遵循了文档,并且能够查询其他对象。在

如何访问这些数据?在


Tags: runenvnet属性软件userscollect交通
1条回答
网友
1楼 · 发布于 2024-04-19 15:35:59

对于包含需要在查询中提供子属性的子属性的属性。下面是VISSIM文档中的一些示例代码,用于如何查询TravelTimeMeasurements

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.

相关问题 更多 >