Exporting probe data using Aimsun micro API

Technical Note #9

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)

Setting the Aimsun API

Ensure that all necessary files are located in the same local directory:


  • Aimsun network (ANG File)
  • Aimsun AAPI file (Must be consistent with the Aimsun version currently in use. It can be retrieved from the following directory: C:\Program Files\TSS-Transport Simulation Systems\Aimsun\programming\Aimsun API\AAPIPython)
  • Aimsun API python file (exportProbeDataAPI.py)

Procedure:


1. From the Aimsun UI, create two new groupings of sections and nodes to define the probe data collection areas.



Aimsun Synthetic Probe Data API

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.

More technical notes

Python: from function to attribute

August 2016: Most users are familiar with creating their own attributes within objects within an Aimsun model. Grant MacKinnon explains how you can also add a column to an object where a value is returned based on some Python Code, allowing you to calculate a value on the fly.

Scripting with time series

March 2021: Tessa Hayman guides you through the complexity of handling time series via Python scripting and explains how to create your custom time series in a way that can be visualized in the UI.

  • Got a question? Get in touch.

    We are here to help!

SHARE

Cite Aimsun Next

 

Aimsun Next 23

Aimsun (2023). Aimsun Next 23 User's Manual, Aimsun Next Version 23.0.0, Barcelona, Spain. Accessed on: July. 19, 2023. [Online].
Available: https://docs.aimsun.com/next/23.0.0/

 


 

Aimsun Next 20.0.5

Aimsun (2021). Aimsun Next 20.0.5 User's Manual, Aimsun Next Version 20.0.3, Barcelona, Spain. Accessed on: May. 1, 2021. [In software].
Available: qthelp://aimsun.com.aimsun.20.0/doc/UsersManual/Intro.html
 

Aimsun Next 23

@manual {​​​​​​​​AimsunManual,

title = {​​​​​​​​Aimsun Next 23 User's Manual}​​​​​,
author = {​​​​​​​​Aimsun}​​​​​​​​,
edition =  {​​​​​​​​​​​​​​​Aimsun Next 23.0.0}​​​​​​​​​​​​​​​,
address = {​​​​​​​​​​​​​​​Barcelona, Spain}​​​​​​​​​​​​​​​,
year  = {​​​​​​​​​​​​​​​2023. [Online]}​​​​​​​​​​​​​​​,
month = {​​​​​​​​​​​​​​​Accessed on: Month, Day, Year}​​​​​​​​​​​​​​​,
url = {​​​​​​​​​​​​​​​https://docs.aimsun.com/next/23.0.0/}​​​​​​​​​​​​​​​,
}​​​​​​​​​​​​​​​


Aimsun Next 20.0.5

@manual {​​​​​​​​AimsunManual,

title = {​​​​​​​​Aimsun Next 20.0.5 User's Manual}​​​​​​​​,
author = {​​​​​​​​Aimsun}​​​​​​​​,
edition =  {​​​​​​​​​​​​​​​Aimsun Next 20.0.5}​​​​​​​​​​​​​​​,
address = {​​​​​​​​​​​​​​​Barcelona, Spain}​​​​​​​​​​​​​​​,
year  = {​​​​​​​​​​​​​​​2021. [In software]}​​​​​​​​​​​​​​​,
month = {​​​​​​​​​​​​​​​Accessed on: Month, Day, Year}​​​​​​​​​​​​​​​,
url = {​​​​​​​​​​​​​​​qthelp://aimsun.com.aimsun.20.0/doc/UsersManual/Intro.html}​​​​​​​​​​​​​​​,
}​​​​​​​​​​​​​​​

Aimsun Next 23

TY  - COMP
T1  - Aimsun Next 23 User's Manual
A1  - Aimsun
ET - Aimsun Next Version 23.0.0
Y1  - 2023
Y2 - Accessed on: Month, Day, Year
CY  - Barcelona, Spain
PB  - Aimsun
UR  - [In software]. Available: https://docs.aimsun.com/next/23.0.0/


Aimsun Next 20.0.5

TY  - COMP
T1  - Aimsun Next 20.0.5 User's Manual
A1  - Aimsun
ET - Aimsun Next Version 20.0.5
Y1  - 2021
Y2 - Accessed on: Month, Day, Year
CY  - Barcelona, Spain
PB  - Aimsun
UR  - [In software]. Available: qthelp://aimsun.com.aimsun.20.0/doc/UsersManual/Intro.html