Skip to content

Aimsun Next API Vehicle Types Information

Read Number of Vehicles Types

In C++ and Python

Explanation

Read the total number of vehicles types. If Transit is modelled, this includes the transit vehicle types.

Format
int AKIVehGetNbVehTypes ()
Parameters

None

Output
  • > 0: Total number of vehicles Types
  • < 0: Error

Read the Name of a Vehicle Type

In C++ and Python

Explanation

Read the name of a vehicle Type in utf16 and \0 terminated. The result has to be deleted with delete().

Format:
const unsigned short *AKIVehGetVehTypeName(int vehTypePos);
Parameters
  • vehTypePos: The position of the vehicle type in the list of vehicles types being used in the range 1 to AKIVehGetNbVehTypes (), for a specific vehicle type.
Output
  • ≠ NULL: name of the vehicle type
  • = NULL: Error

The recommended usage in Python APIs is:

anyNonAsciiChar = boolp()
AKIConvertToAsciiString(AKIVehGetVehTypeName(vehTypePos), True, anyNonAsciiChar))

Read the Vehicle Type ID using the Position of a Vehicle Type

In C++ and Python

Explanation

Read the vehicle type ID given the vehicle type position in the list of vehicle types.

Format
int AKIVehTypeGetIdVehTypeANG (int vehTypePos );
Parameters
  • vehTypePos The position of the vehicle type in the list of vehicles types being used, in the range 1 to AKIVehGetNbVehTypes (), for a specific vehicle type.
Output
  • >0: The ID of the vehicle type
  • -1: No vehicle type with the position provided found

Read the Position of a Vehicle Type using the Vehicle Type ID

In C++ and Python

Explanation

Read the position of a vehicle Type given the vehicle type identifier.

Format:
int AKIVehGetVehTypeInternalPosition (int aimsunVehicleTypeId );
Parameters
  • aimsunVehicleTypeId: The vehicle type identifier.
Output
  • > 0: A value from 1 to the total number of vehicle types
  • < 0: No vehicle with the name provided found

Read the Position of a Vehicle Type using the Vehicle Type Name

The name of a vehicle type, as it is user-edited, can be not unique. However, the ID is always unique. Therefore, it is recommended that the AKIVehGetVehTypeInternalPosition is used as explained above to get the position of a vehicle type.

If there is a need to access the vehicle type position from the vehicle type name, the following functions can be used. As an example, to get the internal veh position for vehicle type 'car' in a Python API the code would be:

idVeh = ANGConnGetObjectIdByType( AKIConvertFromAsciiString( "car" ), AKIConvertFromAsciiString( "GKVehicle" ), False )
vehPos = AKIVehGetVehTypeInternalPosition( idVeh )

This uses the ANGConnGetObjectIdByType function and the AKIVehGetVehTypeInternalPosition

Read the Minimum and the Maximum Length of a Vehicle Type

In C++ and Python

Explanation

Read the minimum and maximum length of the vehicle type

Format
double AKIVehGetMinLengthVehType (int vehTypePos)
double AKIVehGetMaxLengthVehType (int vehTypePos)
Parameters
  • vehTypePos The position of the vehicle type in the list of vehicles types being used. 0 is used for all vehicle types and a value from 1 to AKIVehGetNbVehTypes (), for a specific vehicle type.
Output
  • > 0: The Minimum and the Maximum Length of the vehicle type.
  • < 0: Error

Read if the Imprudent Lane-changing behavior is activated or not

In C++ and Python

Explanation

Reads if a vehicle type has the Imprudent Lane-changing behavior activated.

Format
bool AKIVehTypeGetImprudentLaneChanging( int idVehicleType )
Parameters
  • idVehicleType: Identifier of the vehicle Type.
Output
  • True: The vehicle type has the Imprudent Lane-changing behavior active.
  • False: The vehicle type has the Imprudent Lane-changing behavior not active.

Activate/deactivate the Imprudent Lane-changing behavior of a Vehicle Type

In C++ and Python

Explanation

Activates/deactivates the Imprudent Lane-changing behavior of a vehicle type.

Format
int AKIVehTypeSetImprudentLaneChanging( int idVehType, bool value )
Parameters
  • idVehType: Identifier of the vehicle Type.
  • value: True to activate the Imprudent Lane-changing behavior, false otherwise.
Output
  • 0: OK
  • < 0: Error

Read the Percentage for Staying in the Fast Lane of a Vehicle Type

In C++ and Python

Explanation

Reads the percentage specified for staying in a fast lane after a lane-changing of a vehicle type.

Format
double AKIVehTypeGetPercentageForStayingInFastLane ( int idVehType )

Parameters:

  • idVehType: Identifier of the vehicle Type.
Output
  • > 0: The Percentage of the vehicle type for staying in fast lane after an overtaking.
  • < 0: Error

Modify the Staying in the Fast Lane Percentage of a Vehicle Type

In C++ and Python

Explanation

Modifies the percentage specified for staying in a fast lane after a lane-changing of a vehicle type.

Format
int AKIVehTypeSetPercentageForStayingInFastLane ( int idVehType, double newPercentage )
Parameters
  • idVehType Identifier of the vehicle Type.
  • newPercentage: Value between 0 and 100 to define the new percentage that will be used from the moment the function is called.
Output
  • 0: OK
  • < 0: Error

Read the Overtake Speed Threshold of a Vehicle Type

In C++ and Python

Explanation

Reads the overtake speed threshold of a vehicle type.

Format
double AKIVehTypeGetOvertakeSpeedThreshold ( int idVehType )
Parameters
  • idVehType: Identifier of the vehicle Type.
Output
  • > 0: The overtake speed threshold of the vehicle type.
  • < 0: Error

Modify the Overtake Speed Threshold of a Vehicle Type

In C++ and Python

Explanation

Modifies the overtake speed threshold of a vehicle type.

Format
int AKIVehTypeSetOvertakeSpeedThreshold ( int idVehicleType, double newPercentage )
Parameters
  • idVehType: Identifier of the vehicle Type.
  • newPercentage: Value between 0 and 100 to define the new overtake speed threshold that will be used from the moment the function is called.
Output
  • 0: OK
  • < 0: Error

Read the Lane Recovery Speed Threshold of a Vehicle Type

In C++ and Python

Explanation

Reads the lane recovery speed threshold of a vehicle type.

Format
double AKIVehTypeGetLaneRecoverySpeedThreshold ( int idVehType )
Parameters
  • idVehType: Identifier of the vehicle Type.
Output
  • > 0: The lane recovery speed threshold of the vehicle type.
  • < 0: Error

Modify the Lane Recovery Speed Threshold of a Vehicle Type

In C++ and Python

Explanation

Modifies the lane recovery speed threshold of a vehicle type.

Format
int AKIVehTypeSetLaneRecoverySpeedThreshold ( int idVehicleType, double newPercentage )
Parameters
  • idVehType: Identifier of the vehicle Type.
  • newPercentage: Value between 0 and 100 to define the new lane recovery speed threshold that will be used from the moment the function is called.
Output
  • 0: OK
  • < 0: Error