Skip to content

Script Library

Using the Scripting documentation

The documentation of all the classes and methods of Aimsun Next available for scripting is provided as a set of HTML files: Open these with an internet browser

Program Files/Aimsun/Aimsun Next X.X/programming/Scripting/docs/index.html.


Scripting documentation Main Page

Click on the Classes tab to list the classes available.


List of Classes

The Class Hierarchy tab shows the inheritance relationship between the classes.


Class Hierarchy

Here we can see that a Macro Adjustment Experiment inherits from a Macro Experiment which in turn inherits from a GK Generic Experiment which inherits from a GKObject and finally from the GK Base object.

The class documentation for a class can be displayed by clicking on it as displayed below for the Macro Adjustment Experiment class. This shows the class hierarchy and the methods specific to this class.


Section Documentation

Under Public Member Functions, the methods specific to this class are shown. For example, to run the experiment, call:

success=myMacroAdjExperiment.Execute("1001")

and to set the number of gradient descent iterations ( to 5) call:

myMacroAdjExperiment.setGradientDescentIterations(5)

Clicking on the method name scrolls down to a more detailed description of the method, describing its purpose, the order of parameters, etc.

Language constraints

Because the Aimsun Next Scripting documentation is a subset of the Aimsun Next microSDK documentation, which shows C++ methods and classes and uses C++ for all the examples, there are some changes when using it with Python:

  • Methods in a class are shown as CLASS_NAME::METHOD_NAME. For example, for the getSystem method found in the GKSystem class the documentation will show GKSystem::getSystem. In Python the double colons are substituted by a single dot, so to call the method use GKSystem.getSystem().
  • C++ examples can show object methods accessed through pointers in the "objectName->method(argument list)" form. In Python, the format should be objectName.method(argument list).
  • The NULL value in C/C++ is the None value in Python. The NULL value is equivalent to the integer value 0 although it is recommended to use None.
  • Boolean values in C++ are true and false. In Python, they are True and False.
  • QList and QVector are internally converted into Python lists, while QMap is converted into a dictionary.
  • QString is internally converted into Python Unicode string.

Inheritance

The "leaf" classes in the class hierarchy tree only specify the methods specific to that type of object. In the example of the Macro Adjustment Experiment, there are functions to get and set the Gradient Descent Iterations, as this is a concept unique to that type of experiment but there is no getName() method in that class or any option to set the Macro engine ( i.e AoN, MSA, Frank Wolfe..) for that experiment.

These attributes are defined at the most appropriate level further up in the class hierarchy. Clicking on the Macro Experiment class shows it has the methods to get and set the Macro engine as this is a function required for all types of Macro Experiment. The methods to get and set the name of the object (and its external ID and description) are defined in the top level GKBaseObject class - all GKObjects will have these attributes. Hence it is logical to look in the higher level classes for a generic attribute and further down the class hierarchy for attributes and methods with increasing specialization.