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:


Más notas técnicas

Componentes de función macro

Marzo 2016: Marga Delgado explica cómo usar los componentes de función macro para crear elementos de salida adicionales a la hora de llevar a cabo una asignación.

  • ¿Tienes alguna pregunta? Ponte en contacto.

    ¡Estamos aquí para ayudarte!

  • ¿Tienes alguna pregunta? Ponte en contacto.

    ¡Estamos aquí para ayudarte!