![](https://www.aimsun.com/wp-content/uploads/2021/05/tech-note-59-500x333.jpg)
Switching to Python 3
May 2021: Python 2 reached end-of-life status in January 2020. Tessa Hayman gives you some tips on getting your script Python 3-ready for optimum performance in Aimsun Next
July 2015
By Dimitris Triantafyllos
An essential step toward solving traffic congestion is the deployment of more accurate and reliable traffic monitoring systems. Traditionally, traffic monitoring systems are mostly limited to highways and rely soley on data feeds from sensors installed in the infrastructure, such as loop detectors, radars or cameras. However, this is not really sufficient, particularly on arterials. Probe-vehicle data are the only significant data source available today that have the potential for global coverage in the future; sources include smartphones, fleet vehicles periodically reporting their location, aftermarket devices or radio-frequency identification tags.
This Aimsun Application Programming Interface (API) enables researchers to increase their understanding of the use of probe vehicle data, available applications, visualisations, performance measures and management techniques.
This API can export synthetic probe data by running an Aimsun micro simulation with a frequency defined by the user e.g., every 30 seconds.
The study area from which you want to export Probe Data can be restricted by defining two different groupings:
1. Section grouping
2. Node grouping
The data exported using this API are Vehicle_ID,time,x,y,z,speed(m/sec).
The complete code is available here (Python script file format)
Ensure that all necessary files are located in the same local directory:
Procedure:
1. From the Aimsun UI, create two new groupings of sections and nodes to define the probe data collection areas.
Click to enlarge: Defining the probe data collection areas
2. Open the exportProbeDataAPI.py file. Set the frequency in the next Cycle variable and place the objects’ grouping IDs into the grouping list variable
nextCycle = 30.0 groupinglist = [10005971,10005972]
3. Set a file to export every specified frequency
filename ='ProbeData_%i.csv'%(nextCycle)
4. Load the Aimsun API on the desired Dynamic Scenario. Double-click on the Dynamic Scenario, go to the Aimsun API tab folder, click Add and select « ExportProbeDataAPI.py »
5. Execute the Replication
6. Hereafter, « ProbeData_XX.csv » files will be generated
For more detailed info about setting groupings and finding their IDs, please refer to the manuals.
May 2021: Python 2 reached end-of-life status in January 2020. Tessa Hayman gives you some tips on getting your script Python 3-ready for optimum performance in Aimsun Next
January 2017: Paolo Rinelli and Dimitris Triantafyllos explain a technique for modelling connected vehicles using Aimsun API: Cooperative Adaptive Cruise Control.
SHARE
Aimsun Next 24
Aimsun (2024). Aimsun Next 24 User’s Manual, Aimsun Next Version 24.0.0, Barcelona, Spain. Accessed on: April. 16, 2024. [Online].
Available: https://docs.aimsun.com/next/24.0.0/
Aimsun Next 24
@manual {AimsunManual,
title = {Aimsun Next 24 User’s Manual},
author = {Aimsun},
edition = {Aimsun Next 24.0.0},
address = {Barcelona, Spain},
year = {2024. [Online]},
month = {Accessed on: Month, Day, Year},
url = {https://docs.aimsun.com/next/24.0.0},
}
Aimsun Next 24
TY – COMP
T1 – Aimsun Next 24 User’s Manual
A1 – Aimsun
ET – Aimsun Next Version 24.0.0
Y1 – 2024
Y2 – Accessed on: Month, Day, Year
CY – Barcelona, Spain
PB – Aimsun
UR – [In software]. Available:
https://docs.aimsun.com/next/24.0.0/