Macro Function Components in Aimsun

Technical Note #14

March 2016
By Margarida Delgado

Imagine your cost functions have several components, such as distance, travel time or tolls. If you want to evaluate them all individually and show them as an output (in addition to the total cost) you can declare as many Macro Function Components as you need in order to produce each one of the extra Outputs when executing an Assignment.

You can create new Macro Function Components in the same folder as Cost Functions.

There are two types of Components: non-derived and derived.

Non-derived components are based on the evaluation of a part of the cost function (a subfunction), and it is detected by the Function String.

 

That is, the Macro Function Component editor will contain a key word that must correspond with the name of a subfunction (in all macro cost funtions: Volume Delay functions for sections, and Turning Penalty and Junction Delay for turns).

For example, to define the components ‘Distance (km)’ and ‘Time (h)’: in the Macro Function Component, set the Function String ‘distance’ and ‘time’ respectively as key words.

Now, we need to introduce the definition of these components in all macro cost functions (caution with turns, their default turning penalty is hard-coded so it contains no components) so that the component can be evaluated at all sections and turns. In the function code, the last function (in the images, ‘def vdf’ and ‘def tpf’) is the main one. Before that, we have defined the subfunctions ‘distance’ and ‘time’, which will be evaluated at the end of the assignment giving the extra columns of outputs.

 

 

Additionally, we can define Derived Components that result of the combination of other components. For example, we could define Speed as Distance/Time:

 

 

Derived Components imply no additional changes in the functions definition.
When executing an assignment, extra columns will be created, containing the values for each component.

 

 

 

Path assignment results also contain results for the Macro Function Components. Non-derived components are added along the path, while derived components are calculated with the non-derived path values (for example, if we define speed as derived, we don’t add the speeds through the path but calculate the total length/ total time).

 

And Skim and Output Matrices will also be available for each component:

 

More technical notes

Exporting probe data using Aimsun micro API

July 2015: Dimitris Triantafyllos discusses how this Aimsun API allows research centres to work on the understanding of the innovative uses of probe vehicle data, available applications, visualisations, performance measures, and management techniques.

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

  • Got a question? Get in touch.

    We are here to help!

SHARE

Cite Aimsun Next

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/