Skip to content

Aimsun Next API Vehicle Information(Meso)

Get Vehicle Information

In C++ and Python

Explanation

Get the current vehicle information

Format
AMesoVehicleInfo AMesoGetVehicleInfo(void * simhandler, void * vehhandler);
Parameters
  • simhandler: simulator handler
  • vehhandler: vehicle handler
Output
struct AMesoVehicleInfo {
        int id;
        int vehicleTypeIndex;
        int origin;
        int entranceSection; 
        int destination;
        double valueOfTime;
        double entranceTime; 
        double generationTime; 
        int currentSection;  
        int currentTurning;  
        int currentEntranceLane; 
        int currentExitLane; 
        double currentExitTime;
};

Where:

  • Id: vehicle identifier
  • Vehicle Type Index: vehicle type index.
  • origin: origin centroid identifier
  • destination: destination centroid identifier
  • valueOfTime: value of time used by this vehicle
  • entranceTime: entrance vehicle time into the network
  • generationTime: generation vehicle time, this time is always lower than or equal to entranceTime
  • currentSection: current section identifier, if the vehicle is in a turn then this current section is set to 0
  • currentTurning: current turn identifier, if the vehicle is in a section it is set to 0
  • currentEntranceLane: current entrance lane identifier from 0 to number of section lanes -1. If there’s no current entrance lane then it is -1
  • currentExitLane: current exit lane identifier from 0 to number of section lanes -1. If there’s no current exit lane then it is -1
  • currentExitTime: this is the estimated exit time of the vehicle. It's the estimated section exit time if currentSection > 0 otherwise is the current turn exit time.

Set new estimated vehicle exit time in section or turn

In C++ and Python

Explanation

Sets a new minimum time for a vehicle exit time in a section or turn.

Format
int AMesoSetVehicleExitTime(void * simhandler, void * vehhandler, double exittime);
Parameters
  • simhandler: simulator handler
  • vehhandler: vehicle handler
  • exittime: new minimum exit time
Output

Returns 0 if could execute the action -1 otherwise.

Get number vehicles following a transit line

In C++ and Python

Explanation

It gets the current number of vehicles following a transit line.

Format
int AMesoGetNbVehiclesFollowingPTLine(void * simhandler, int idline);
Parameters
  • simhandler: simulator handler
  • idline: transit line identifier
Output

Returns number of vehicles following a transit line.

Get the vehicle following a transit line

In C++ and Python

Explanation

It gets the vehicle following a transit line.

Format
void * AMesoGetVehicleFollowingPTLine(void * simhandler, int idline, int vehPos)
Parameters
  • simhandler: simulator handler
  • idline: transit line identifier
  • vehPos: transit vehicle identifier from 0 to AMesoGetNbVehiclesFollowingPTLine-1
Output

Returns the vehicle following a transit line.

Get the current accumulated delay of a vehicle

In C++ and Python

Explanation

It gets the accumulated delay of a vehicle. The dwell time of the vehicle is not included.

Format
double AMesoVehGetAccumulatedDelay(void * simhandler, void* vehhandler)
Parameters
  • simhandler: simulator handler
  • vehhandler: vehicle handler
Output

Returns the current accumulated delay of the vehicle.

Get the current accumulated travel time of a vehicle

In C++ and Python

Explanation

It gets the accumulated travel time of a vehicle.

Format
double AMesoVehGetAccumulatedTravelTime(void * simhandler, void* vehhandler)
Parameters
  • simhandler: simulator handler
  • vehhandler: vehicle handler
Output

Returns the current accumulated travel time of the vehicle.

Get the ID of a vehicle

In C++ and Python

Explanation

It gets the identificator (ID) of a vehicle.

Format
int AMesoGetVehicleID(void* vehhandler)
Parameters
  • vehhandler: vehicle handler
Output

Returns the ID of the vehicle.

Get next exit time from section or turn

In C++ and Python

Explanation

Returns the current exit vehicle time to the section if the vehicle is in the section or exit turn time if the vehicle is in the node.

Format
double AMesoVehGetSectionExitTime(void* vehhandler)
Parameters
  • vehhandler: vehicle handler
Output

Returns expected exit time. Relative time in the simulation.

Get the next turn in vehicle's path

In C++ and Python

Explanation

Returns the next turn in vehicle's path. When the vehicle is located in the turn, the next turn is the current turn.

Format
int AMesoVehNextTurn(void* vehhandler)
Parameters
  • vehhandler: vehicle handler
Output

Returns vehicle's next turn ID.

Get the current vehicle's waiting time

In C++ and Python

Explanation

Returns the current vehicle waiting time. This is the current simulation time minus the initial expected exit time. The initial expected exit time is the earliest time the vehicle could exit the section when it's been the first in the queue.

Format
double AMesoVehGetWaitingTime(void* simhandler, void* vehhandler)
Parameters
  • simhandler: simulation handler
  • vehhandler: vehicle handler
Output

Returns waiting time in seconds.

Returns the expected arrival time to a section

In C++ and Python

Explanation

Returns the expected arrival time to the section id. The section has to be part of the path from the current position. Otherwise the expected arrival time is 0.

Format
double AMesoExpectedArrivalTimeToSection( void* simhandler, void* vehhandler, int sectionId )
Parameters
  • simhandler: simulation handler
  • vehhandler: vehicle handler
  • sectionId: section identifier
Output

Returns an expected arrival time.

Returns if a turn has a yield sign or not

In C++ and Python

Explanation

Returns true if the turn with turn id has a yield/give way

Format
bool AMesoIsTurnWithGiveway( void* simhandler, int turnId )
Parameters
  • simhandler: simulation handler
  • sectionId: turn identifier
Output

Returns true if the turn has a yield sign false otherwise.

Returns the initial safety margin for the turn id

In C++ and Python

Explanation

Returns the initial safety margin for the turn id.

Format
double AMesoGetInitialSafteyMargin( void* simhandler, int turnId )
Parameters
  • simhandler: simulation handler
  • sectionId: turn identifier
Output

Returns the initial safety margin.

Returns the final safety margin for the turn id

In C++ and Python

Explanation

Returns the final safety margin for the turn id.

Format
double AMesoGetFinalSafteyMargin( void* simhandler, int turnId )
Parameters
  • simhandler: simulation handler
  • sectionId: turn identifier
Output

Returns the final safety margin.