Skip to content

Aimsun Next API Network Information (Meso)

Read the Number of Sections

In C++ and Python

Explanation

Read the number of sections present on the road network including the virtual queues of the model. Virtual queues are considered as internal sections. Internal sections will return -1 with the function AMesoGetSectionId.

Format
int AMesoGetNumberSections (void * simhandler);
Parameters:
  • simhandler: simulator handler
Output
  • > 0: Number of sections in the road network
  • < 0: Error

Readthe Section Identifier

In C++ and Python

Explanation

Get the section id based on the section index.

Format
int AMesoGetSectionId (void * simhandler, int index);
Parameters:
  • simhandler: simulator handler
  • index: section index from 0 to AMesoGetNumberSections
Output
  • > 0: Number of sections in the road network
  • < 0: Error

Read the Number of Vehicle Types

In C++ and Python

Explanation

Read the total number of vehicle types.

Format
int AMesoNumberVehicles (void * simhandler);
Parameters:
  • simhandler: simulator handler
Output
  • > 0: Number of vehicle types
  • < 0: Error

Read the Vehicle Type Name

In C++ and Python

Explanation

Read the vehicle type name using the vehicle type index.

Format
const unsigned short *AMesoGetVehicleTypeName (void * simhandler, int vehTypePos);
Parameters:
  • simhandler: simulator handler
  • vehTypePos: index from 0 to AMesoNumberVehicles()-1
Output
  • <> NULL: Name of the vehicle type. Use AMesoConvertToAsciiString to convert to generic const char *.
  • = NULL: Error

Read the Vehicle Type ID

In C++ and Python

Explanation

Read the vehicle type ID using the vehicle type name. Note that the input paramater is a const unsigned short . You can need to use the function AMesoConvertFromAsciiString to convert the unsigned short to char .

Format
int AMesoGetVehicleTypeId(void * simhandler, const unsigned short * vehName);
Parameters:
  • simhandler: simulator handler
  • vehName: Name of the vehicle type
Output
  • >0: vehicle type ID
  • -1: error

Read the Vehicle index

In C++ and Python

Explanation

Returns the vehicle index used for the specified vehicle id.

Format
int AMesoGetVehicleTypeIndex(void * simhandler, int gkid);
Parameters:
  • simhandler: simulator handler
  • gkid: ID of the vehicle type to obtain its index from 0 to AMesoNumberVehicles()-1
Output
  • >0: vehicle type index
  • -1: error

Read the Vehicle ID

In C++ and Python

Explanation

Read the vehicle id using the vehicle index.

Format
int AMesoGetVehicleGKId (void * simhandler, int vehTypePos);
Parameters:
  • simhandler: simulator handler
  • vehTypePos: index from 0 to AMesoNumberVehicles()-1
Output
  • >0: vehicle type identifier
  • -1: error

Read the Number of Origin Centroids

In C++ and Python

Explanation

Read the number of origin centroids.

Format
int AMesoGetNumberOriginCentroids (void * simhandler);
Parameters:
  • simhandler: simulator handler
Output
  • > 0: Number of origin centroids in the road network
  • < 0: Error

Read the Number of Destination Centroids

In C++ and Python

Explanation

Read the number of destination centroids.

Format
int AMesoGetNumberDestinationCentroids (void * simhandler);
Parameters:
  • simhandler: simulator handler
Output
  • > 0: Number of origin centroids in the road network
  • < 0: Error

Read the Origin Centroid Identifier

In C++ and Python

Explanation

Read the origin centroid id by index.

Format
int AMesoOriginCentroidId (void * simhandler, int index);
Parameters:
  • simhandler: simulator handler
  • index: index from 0 to AMesoGetNumberOriginCentroids-1
Output
  • > 0:Origin identifier
  • < 0: Error

Read the Origin Centroid Identifier

In C++ and Python

Explanation

Read the origin centroid id by index.

Format
    int AMesoOriginCentroidId (void * simhandler, int index);
Parameters:
  • simhandler: simulator handler
  • index: index from 0 to AMesoGetNumberOriginCentroids-1
Output
  • > 0:Origin identifier
  • < 0: Error

Read the Origin Centroid external identifier

In C++ and Python

Explanation

Read the origin centroid external identifier by index. Index range is 0 to AMesoGetNumberOriginCentroids()

Format
    const unsigned short * AMesoOriginExternalId (void * simhandler, int index);
Parameters:
  • simhandler: simulator handler
  • index: index from 0 to AMesoGetNumberOriginCentroids-1
Output
  • Origin external identifier

Read the destination centroid external identifier

In C++ and Python

Explanation

Read the destination centroid external identifier by index. Index range is 0 to AMesoGetNumberDestinationCentroids()

Format
    const unsigned short * AMesoDestinationExternalId (void * simhandler, int index);
Parameters:
  • simhandler: simulator handler
  • index: index from 0 to AMesoGetNumberDestinationCentroids-1
Output
  • Destination external identifier

Read the Destination Centroid Identifier

In C++ and Python

Explanation

Read the destination centroid ID by index.

Format
int AMesoDestinationCentroidId (void * simhandler, int index);
Parameters:
  • simhandler: simulator handler
  • index: index from 0 to AMesoGetNumberDestinationCentroids-1
Output
  • > 0: Destination identifier
  • < 0: Error

Read the Origin Centroid index

In C++ and Python

Explanation

Read the origin centroid index using the identifier.

Format
int AMesoGetOriginCentroidIndex (void * simhandler, int id);
Parameters:
  • simhandler: simulator handler
  • id: Centroid identifier
Output
  • > 0: centroid index
  • < 0: Error

Read the Destination Centroid index

In C++ and Python

Explanation

Read the destination centroid index using the identifier.

Format
    int AMesoGetDestinationCentroidIndex (void * simhandler, int id);
Parameters:
  • simhandler: simulator handler
  • id: Centroid identifier
Output
  • > 0: centroid index
  • < 0: Error

Get origin centroid index by centroid external id

In C++ and Python

Explanation

Read the destination centroid index using the identifier.

Format
    int AMesoGetOriginCentroidIndexByExternalId (void * simhandler, const unsigned short * externalId);
Parameters:
  • simhandler: simulator handler
  • id: external identifier using the const unsigned short * format. You might need to use the function AMesoConvertToAsciiString to get the char * format.
Output
  • > 0: centroid index
  • < 0: Error

Get destination centroid index by centroid external id

In C++ and Python

Explanation

Read the destination centroid index using the identifier.

Format
    int AMesoGetDestinationCentroidIndexByExternalId (void * simhandler, const unsigned short * externalId);
Parameters:
  • simhandler: simulator handler
  • id: external identifier using the const unsigned short * format. You might need to use the function AMesoConvertToAsciiString to get the char * format.
Output
  • > 0: centroid index
  • < 0: Error

Read the Destination Centroid index

In C++ and Python

Explanation

Read the destination centroid index using the identifier.

Format
int AMesoGetDestinationCentroidId (void * simhandler, int id);
Parameters:
  • simhandler: simulator handler
  • id: Centroid identifier
Output
  • > 0: centroid index
  • < 0: Error

Set Section User Defined Cost

In C++ and Python

Explanation

Set the user defined cost for section with id.

Format
bool AMesoSetSectionUserDefinedCost (void * simhandler, int sectionId, double value);
Parameters:
  • simhandler: simulator handler
  • sectionId: Section identifier
  • value: user defined cost
Output
  • True: If section id was found.
  • False: Section not found.

Set Section User Defined Cost 2

In C++ and Python

Explanation

Set user defined cost 2 for section with id.

Format
bool AMesoSetSectionUserDefinedCost2 (void * simhandler, int sectionId, double value);
Parameters:
  • simhandler: simulator handler
  • sectionId: Section identifier
  • value: user defined cost
Output
  • True: If section id was found.
  • False: Section not found.

Set Section User Defined Cost 3

In C++ and Python

Explanation

Set the user defined cost 3 for section with id.

Format
bool AMesoSetSectionUserDefinedCost3 (void * simhandler, int sectionId, double value);
Parameters:
  • simhandler: simulator handler
  • sectionId: Section identifier
  • value: user defined cost
Output
  • True: If section id was found.
  • False: Section not found.

Get Section User Defined Cost

In C++ and Python

Explanation

Get user defined cost for section with id.

Format
double AMesoGetSectionUserDefinedCost (void * simhandler, int sectionId);
Parameters:
  • simhandler: simulator handler
  • sectionId: Section identifier
Output
  • > 0: User defined cost for section
  • < 0: Error: Section not found.

Get Section User Defined Cost 2

In C++ and Python

Explanation

Get user defined cost 2 for section with id.

Format
double AMesoGetSectionUserDefinedCost2 (void * simhandler, int sectionId);
Parameters:
  • simhandler: simulator handler
  • sectionId: Section identifier
Output
  • > 0: User defined cost 2 for section
  • < 0: Error: Section not found.

Get Section User Defined Cost 3

In C++ and Python

Explanation

Get user defined cost 3 for section with id.

Format
double AMesoGetSectionUserDefinedCost3 (void * simhandler, int sectionId);
Parameters:
  • simhandler: simulator handler
  • sectionId: Section identifier
Output
  • > 0: User defined cost 3 for section
  • < 0: Error: Section not found

Get replication random seed

In C++ and Python

Explanation

Get the random seed defined in the replication.

Format
    int AMesoGetRandomSeed (void * simhandler);
Parameters:
  • simhandler: simulator handler
Output
  • Random seed number

Get replication identifier

In C++ and Python

Explanation

Get the replication identifier.

Format
    int AMesoGetReplication (void * simhandler);
Parameters:
  • simhandler: simulator handler
Output
  • Replication identifier

Get current iteration

In C++ and Python

Explanation

Get the current iteration in a DUE.

Format
    int AMesoGetCurrentIteration (void * simhandler);
Parameters:
  • simhandler: simulator handler
Output
  • Current iteration number

Get an experiment variable value

In C++ and Python

Explanation

Returns the value of an experiment variable. The returned value can be transformed to a generic const char * using the AMesoConvertToAsciiString function.

Format
    const unsigned short * AMesoGetValueForExperimentVariable(void * simhandler, const char * stringvalue);
Parameters:
  • simhandler: simulator handler
  • stringvalue: name of the experiment variable
Output
  • value of the experiment variable in const unsigned short format