Skip to content

Aimsun Next API Vehicle Path Information

Notes

When simulating a Microscopic simulation with Aimsun Next the traffic demand can be described either by states or OD Matrices. When the traffic demand type is OD Matrices, vehicles move through the network using paths. These paths are derived from three different sources:

  • Route Choice Paths: These are the paths that have been calculated by the route choice model.
  • User Defined Paths: These paths are user edited, or can be automatically created by a static assignment experiment.
  • User Defined Shortest Path Trees: These are the shortest path trees where for each destination centroid there is a path from every point in the network assuming one exists. These paths can be created either by a Macro or Dynamic experiment.

The following functions can be used to retrieve vehicle path information as well as the path itself.

Get Vehicle Path Information

In C++ and Python

Explanation

Read the information of the used path for a vehicle. This function requires having the vehicle identification.

Format
PathInfVeh AKIVehInfPath( int idveh )
Parameters
  • idveh: the vehicle identifier
Output
struct PathInfVeh{
    int report;
    int idVeh;
    int type;
    int entranceSectionId;
    int numSectionsInPath;
    double totalDistance;
    double totalFreeFlowTravelTime;
};

where:

  • report: 0 OK, otherwise check the error code.
  • idVeh: Vehicle identifier.
  • type: Path type:
    • 1: Route choice path
    • 2: User Defined Route
    • 3: User Defined Shortest Path Tree
  • entranceSectionId. Entrance section identifier. This is the section from where the vehicle enters the network.
  • numSectionsInPath. Total number of sections that have the path.
  • totalDistance. Total distance of the path in meters.
  • totalFreeFlowTravelTime. Total free flow travel time of the vehicle in seconds using the vehicle speed acceptance.

Get Vehicle Path Information on in a section

In C++ and Python

Explanation

Read the information of a vehicle in a section. This function requires, that the number of vehicles in the section has been obtained by calling AKIVehStateGetNbVehiclesSection.

Format
PathInfVeh AKIVehInfPathSection(int aidSec, int indexveh)
Parameters
  • aidSec: Section Identifier
  • indexveh: Vehicle index, from 0 to (Total Number of Vehicles in the section – 1)
Output
struct PathInfVeh{
    int report;
    int idVeh;
    int type;
    int entranceSectionId;
    int numSectionsInPath;
    double totalDistance;
    double totalFreeFlowTravelTime;
};

where:

  • report: 0 OK, otherwise check the error code.
  • idVeh: Vehicle identifier.
  • type: Path type:
    • 1: Route choice path
    • 2: User Defined Route
    • 3: User Defined Shortest Path Tree
  • entranceSectionId: Entrance section identifier. This is the section from where the vehicle enters the network.
  • numSectionsInPath: Total number of sections that have the path.
  • totalDistance: Total distance of the path in meters.
  • totalFreeFlowTravelTime. Total free flow travel time of the vehicle in seconds using the vehicle speed acceptance.

Get next section in vehicle path

In C++ and Python

Explanation

Returns the next section identifier that is using a vehicle. When using OD matrices it returns the next section from whatever section in vehicle's path. If it is using states then it will return only the next section for the next 4 sections in vehicle's path because when using states the full path to destination it is not pre-calculated from the beginning. Only the next 4 sections are always available.

Format
int AKIVehInfPathGetNextSection(int idveh, int fromsection)
Parameters
  • idveh: The vehicle identifier
  • fromsection: The "from" section identifier.
Output
  • >0: next section identifier from the fromsection
  • -1: fromsection is the last section of the path otherwise: check error code

Check if section is in vehicle path

In C++ and Python

Explanation

Indicates if a specified section is in the path of the given vehicle. The complete path of the vehicle is examined.

Format
int AKIVehInfSectionInPath(int idveh, int idsection);
Parameters
  • idveh: The vehicle identifier
  • section: The section to check identifier.
Output
  • >1: The section is indeed inside the vehicle path
  • 0: The section is not inside the vehicle path
  • <0: Check error code

Get next section in vehicle path in section

In C++ and Python

Explanation

Read the next section identifier of certain vehicle in a section. This function requires, previously, get the number of Vehicles in the section calling AKIVehStateGetNbVehiclesSection.

Format
int AKIVehInfPathGetNextSectionInSection(int aidSec, int indexveh, int fromsection)
Parameters
  • aidSec: Section Identifier
  • indexveh: vehicle index, from 0 to (Total Number of Vehicles in the section – 1)
  • fromsection: The "from" section identifier.
Output
  • >0: next section identifier from the fromsection
  • -1: fromsection is the last section of the path otherwise: check error code