# Aimsun Next API Vehicles Information¶

### Read Number of Vehicles in a Section¶

#### In C++ and Python¶

##### Explanation¶

Read the total number of vehicles in a section.

##### Format¶
int AKIVehStateGetNbVehiclesSection(int aidSec, bool considerAllSegments)

###### Parameters¶
• aidSec: Section Identifier
• considerAllSegments: this parameter must always be set to true.
###### Output¶
• ≥ 0: Total number of vehicles.
• < 0: Error.

### Read the Number of Vehicles in a Junction¶

#### In C++ and Python¶

##### Explanation¶

Read the total number of vehicles in a junction.

##### Format¶
int AKIVehStateGetNbVehiclesJunction(int aidJunction)

##### Parameters¶
• aidJunction: Junction Identifier
##### Output¶
• ≥ 0: Total number of vehicles
• < 0: Error

### Read the Information of a Vehicle in a Section¶

#### In C++ and Python¶

##### Explanation¶

Read the information of a vehicle in a section. This function requires the number of vehicles in the section is obtained calling AKIVehStateGetNbVehiclesSection for the same section without any additional calls to the AKIVehStateGetNbVehiclesSection for other sections.

##### Format¶
InfVeh AKIVehStateGetVehicleInfSection(int aidSec, int indexveh)

##### Parameters¶
• aidSec: Section Identifier
• indexveh: Vehicle index, from 0 to (Total Number of Vehicles in the Section – 1)
##### Output¶
struct InfVeh{
int report;
int idVeh;
int type;
// Information in Vehicle when it is in a section
int idSection;
int segment;
int numberLane;

// Information in Vehicle when it is in a node
int idJunction;
int idSectionFrom;
int idLaneFrom;
int idSectionTo;
int idLaneTo;

double CurrentPos;
double distance2End;
double xCurrentPos, yCurrentPos, zCurrentPos;
double xCurrentPosBack, yCurrentPosBack, zCurrentPosBack;
double CurrentSpeed, PreviousSpeed;

double TotalDistance;

double SystemGenerationT;
double SystemEntranceT;
double SectionEntranceT;
double CurrentStopTime;
bool stopped;
uint mNbLostTurnings;
};


where:

• report: 0, OK, else error code
• idVeh: the vehicle identifier
• type: is the position of the vehicle type in the list of vehicles types being used. 0 must be used for all vehicle types and a value from 1 to AKIVehGetNbVehTypes (), for a specific vehicle type.
• idSection: the section identifier
• segment: the segment number of the section where the vehicle is located (from 0 to n-1)
• numberLane: the lane number in the segment (from 1, the rightmost lanet, to N, the leftmost lane)
• CurrentPos: the position inside the section = distance (m or feet, depending on the units defined in the network) from the beginning of the section.
• distance2End: the distance to the end of the section (m or feet, depending on the units defined in the network)
• xCurrentPos, yCurrentPos, zCurrentPos: world coordinates of the middle point of the front bumper of the vehicle.
• xCurrentPosBack, yCurrentPosBack, zCurrentPosBack: world coordinates of the middle point of the rear bumper of the vehicle.
• CurrentSpeed: the current speed (in km/h or mph, depending on the units defined in the network
• PreviousSpeed: the speed in the previous simulation step (in km/h or mph, depending on the units defined in the network.
• TotalDistance: the total distance traveled (m or feet) by the vehicle.
• SystemGenerationT: the absolute generation time of the vehicle into the system. If no virtual queue found in its entrance section it will be the same as the SystemEntranceT.
• SystemEntranceT: the absolute entrance time of the vehicle into the system, that is into its entrance section. If no virtual queue found in its entrance section it will be the same as the SystemGenerationT.
• SectionEntranceT: the absolute entrance time of the vehicle into the current section.
• CurrentStopTime: the current stop time.
• stopped: True if the vehicle remains stopped.
• mNbLostTurnings The number of lost turnings.

The other fields or attributes have no meaning; their value is set to –1.

### Read the information of a Vehicle in a Junction¶

#### In C++ and Python¶

##### Explanation¶

Read the information of a vehicle in a junction. This function requires the number of vehicles in the junction is obtained by calling the function AKIVehStateGetNbVehiclesJunction for the same junction without any additional calls to the AKIVehStateGetNbVehiclesJunction for other junctions.

##### Format¶

InfVeh AKIVehStateGetVehicleInfJunction(int aidJunction, int indexveh)

##### Parameters¶
• aidJunction: the junction identifier
• indexveh: vehicle index, from 0 to (Total Number of Vehicles in the junction – 1)
##### Output¶
struct InfVeh{
int report;
int idVeh;
int type;
// Information in Vehicle when it is in a section
int idSection;
int segment;
int numberLane;

// Information on Vehicle when it is in a node
int idJunction;
int idSectionFrom;
int idLaneFrom;
int idSectionTo;
int idLaneTo;

double CurrentPos;
double distance2End;
double xCurrentPos, yCurrentPos, zCurrentPos;
double xCurrentPosBack, yCurrentPosBack, zCurrentPosBack;
double CurrentSpeed, PreviousSpeed;

double TotalDistance;

double SystemGenerationT;
double SystemEntranceT;
double SectionEntranceT;
double CurrentStopTime;
bool stopped;
uint mNbLostTurnings;
};


where:

• report: 0, OK, else error code
• idVeh: the vehicle identifier
• type: is the position of the vehicle type in the list of vehicles types being used. 0 must be used for all vehicle types and a value from 1 to AKIVehGetNbVehTypes (), for a specific vehicle type.
• idSectionFrom: the origin section identifier
• idLaneFrom: origin section's lane where the vehicle enters the junction from. 1 being the rightmost lane and N the leftmost lane, being N the number of lanes in the origin section.
• idSectionTo: destination section identifier
• idLaneTo: destination section's lane where the vehicle exits the junction to. 1 being the rightmost lane and N the leftmost lane, being N the number of lanes in the destination section.
• CurrentPos: the position inside the junction = distance (m or feet, depending on the units defined in the network) from the entrance to the junction.
• distance2End: the distance to end of the turning (m or feet, depending on the units defined in the network).
• xCurrentPos, yCurrentPos, zCurrentPos: world coordinates of the middle point of the front bumper of the vehicle.
• xCurrentPosBack, yCurrentPosBack, zCurrentPosBack: world coordinates of the middle point of the rear bumper of the vehicle.
• CurrentSpeed: current speed (in km/h or mph, depending on the units defined in the network
• PreviousSpeed: speed in the previous simulation step (in km/h or mph, depending on the units defined in the network
• TotalDistance: total distance traveled (m or feet)
• SystemGenerationT: the absolute generation time of the vehicle into the system. If no virtual queue found in its entrance section it will be the same as the SystemEntranceT.
• SystemEntranceT: the absolute entrance time of the vehicle into the system, that is into its entrance section. If no virtual queue found in its entrance section it will be the same as the SystemGenerationT.
• CurrentStopTime: the current stop time
• stopped: True if the vehicle remains stopped.
• mNbLostTurnings The number of lost turnings. Other fields or attributes have no meaning; their value is set to -1

### Read the Static Information of a Vehicle in a Section¶

#### In C++ and Python¶

##### Explanation¶

Read the static information of a vehicle in a section. Static information means the characteristics of the vehicle that were set when the vehicle entered in the system. This function requires the number of vehicles in the section is found by calling AKIVehStateGetNbVehiclesSection.

##### Format¶
StaticInfVeh AKIVehGetVehicleStaticInfSection(int aidSec, int indexveh)

##### Parameters¶
• aidSec: section Identifier
• indexveh: vehicle index, from 0 to (Total Number of Vehicles in the section – 1)
##### Output¶
struct StaticInfVeh{
int report;
int idVeh;
int type;
double length;
double width;
double maxDesiredSpeed;
double maxAcceleration;
double normalDeceleration;
double maxDeceleration;
double speedAcceptance;
double minDistanceVeh;
double giveWayTime;
double guidanceAcceptance;
int enrouted;
int equipped;
int tracked;

bool keepfastLane;
double safetyMarginFactor;
double sensitivityFactor;
double reactionTime;
double reactionTimeAtStop;
double reactionTimeAtTrafficLight;

bool laneChangingCooperation;
double laneChangingAggressivenessLevel;
double distanceZoneFactor;

int centroidOrigin;
int centroidDest;
int idsectionExit;

int idLine;
void * internalInfo;

int engineTypeId;
int vehicleSegmentId;
int EUEmissionId;
double energyCapacity;
};

where:

• report: 0, OK, else error code
• idVeh: vehicle identifier
• type: is the position of the vehicle type in the list of vehicles types being used. 0 must be used for all vehicle types and a value from 1 to AKIVehGetNbVehTypes (), for a specific vehicle type.
• length: vehicle length (m or feet, depending on the units defined in the network).
• width: vehicle width (m or feet, depending on the units defined in the network).
• maxDesiredSpeed: Maximum desired speed of the vehicle (km/h or mph, depending on the units defined in the network).
• maxAcceleration: Maximum acceleration of the vehicle (m/s2 or ft/ s2, depending on the units defined in the network).
• normalDeceleration: Maximum deceleration of the vehicle that can apply under normal conditions (m/s2 or ft/ s2, depending the units defined in the network).
• maxDeceleration: Maximum deceleration of the vehicle that can apply under special conditions (m/s2 or ft/ s2, depending the units defined in the network).
• speedAcceptance: degree of acceptance of the speed limits.
• minDistanceVeh: distance that the vehicle keeps between itself and the preceding vehicle (meters or feet, depending on the units defined in the network).
• giveWayTime: time after which the vehicle becomes more aggressive in yield situations (seconds).
• guidanceAcceptance: level of compliance of the vehicle to guidance indications.
• enrouted: 0 means vehicle will not update path en route, 1 means vehicle will change path en route depending on the defined percentage of vehicles that update path en route.
• equipped: 0 means vehicle not equipped, 1 means vehicle equipped.
• tracked: 0 means vehicle not tracked, 1 means vehicle tracked.
• keepfastLane: means vehicle keep fast lane during overtaking
• safetyMarginFactor: safety margin factor
• sensitivityFactor: estimation of the acceleration of the leader
• reactionTime: reaction time of the vehicle
• reactionTimeAtStop: reaction time at stop of the vehicle
• reactionTimeAtTrafficLight: reaction time of the vehicle when stopped the first one of the queue in a traffic light.
• laneChangingCooperation: the vehicle is at present co-operating in another vehicle's lane change maneuver.
• laneChangingAggressivenessLevel: the aggressiveness factor for this vehicle in lane changing where 0% means the full safety gap is required for the lane change and 100% means the minimum gap is accepted in the lane change.
• distanceZoneFactor: the multiplier this vehicle applies to the zone 1,2,3 distances which control when it starts to consider a forthcoming lane change. A value > 1 implies it tries to get into lane earlier than normal and a value < 1 implies it tries to get into lane later than normal.
• centroidOrigin: Identifier of centroid origin of the vehicle, when the traffic conditions are defined by an OD matrix.
• centroidDest: Identifier of centroid destination of the vehicle, when the traffic conditions are defined by an OD matrix.
• idsectionExit: Identifier of exit section destination of the vehicle, when the destination centroid uses percentages as destination (otherwise is –1) and the traffic conditions are defined by an OD matrix.
• idLine: Identifier of Transit Line, when the vehicle has been generated as a transit vehicle.
• internalInfo: only for internal use
• engineTypeId: Identifier of the engine type of the vehicle (emission, consumption, MFC acceleration models)
• vehicleSegmentId: Identifier of the Euro Car Segment of the vehicle for the MFC acceleration model/Battery Consumption model: None = 0, A = 1, B = 2, C = 3, D = 4, E = 5, F = 6, J = 7, NM = 8.
• EUEmissionId: Identifier Standard Emission for LEM. Null= 0, Zero = 1, Euro 0 = 2, Euro 1 = 3, Euro 2 = 4, Euro 3= 5, Euro 4 = 6, Euro 5 = 7, Euro 6 = 8, Euro 6c = 9 (Light Duty vehicles (car, taxi, van) ), Euro I = 10, Euro II = 11, Euro III = 12, Euro IV = 13, Euro IV EGR = 14, Euro V = 15, Euro V EGR = 16, Euro V SCR = 17, Euro VI = 18 (Heavy Duty vehicles (LGV, HGV, Bus, Coach) ).
• energyCapacity: Total Capacity of the tank (l) or battery (kW)

### Read the Static Information of a Vehicle in a Junction¶

#### In C++ and Python¶

##### Explanation¶

Read the static information of a vehicle in a junction. Static information means the characteristics of the vehicle that were set when the vehicle entered the system. This function requires having previously obtained the number of Vehicles in the junction by calling function AKIVehStateGetNbVehiclesJunction.

##### Format¶

StaticInfVeh AKIVehGetVehicleStaticInfJunction(int aidJunction, int indexveh)

##### Parameters¶
• aidJunction: the junction identifier
• indexveh: vehicle index, from 0 to (Total Number of Vehicles in the junction – 1)
##### Output¶
struct StaticInfVeh{
int report;
int idVeh;
int type;
double length;
double width;
double maxDesiredSpeed;
double maxAcceleration;
double normalDeceleration;
double maxDeceleration;
double speedAcceptance;
double minDistanceVeh;
double giveWayTime;
double guidanceAcceptance;
int enrouted;
int equipped;
int tracked;

bool keepfastLane;
double safetyMarginFactor;
double sensitivityFactor;
double reactionTime;
double reactionTimeAtStop;
double reactionTimeAtTrafficLight;

bool laneChangingCooperation;
double laneChangingAggressivenessLevel;
double distanceZoneFactor;

int centroidOrigin;
int centroidDest;
int idsectionExit;

int idLine;
void * internalInfo;

int engineTypeId;
int vehicleSegmentId;
int EUEmissionId;
double energyCapacity;
};

where:

• report: 0, OK, else error code
• idVeh: vehicle identifier
• type: is the position of the vehicle type in the list of vehicles types being used. 0 must be used for all vehicle types and a value from 1 to AKIVehGetNbVehTypes (), for a specific vehicle type.
• length: vehicle length (m or feet, depending on the units defined in the network).
• width: vehicle width (m or feet, depending on the units defined in the network).
• maxDesiredSpeed: Maximum desired speed of the vehicle (km/h or mph, depending on the units defined in the network).
• maxAcceleration: Maximum acceleration of the vehicle (m/s2 or ft/ s2, depending on the units defined in the network).
• normalDeceleration: Maximum deceleration of the vehicle that can apply under normal conditions (m/s2 or ft/ s2, depending the units defined in the network).
• maxDeceleration: Maximum deceleration of the vehicle that can apply under special conditions (m/s2 or ft/ s2, depending the units defined in the network).
• speedAcceptance: degree of acceptance of the speed limits.
• minDistanceVeh: distance that the vehicle keeps between itself and the preceding vehicle (meters or feet, depending on the units defined in the network).
• giveWayTime: time after which the vehicle becomes more aggressive in yield situations (seconds).
• guidanceAcceptance: level of compliance of the vehicle to guidance indications.
• enrouted: 0 means vehicle will not update path en route, 1 means vehicle will change path en route depending on the defined percentage of vehicles that update path en route.
• equipped: 0 means vehicle not equipped, 1 means vehicle equipped.
• tracked: 0 means vehicle not tracked, 1 means vehicle tracked.
• keepfastLane: means vehicle keep fast lane during overtaking
• safetyMarginFactor: safety margin factor
• sensitivityFactor: estimation of the acceleration of the leader
• reactionTime: reaction time of the vehicle
• reactionTimeAtStop: reaction time at stop of the vehicle
• reactionTimeAtTrafficLight: reaction time of the vehicle when stopped the first one of the queue in a traffic light.
• laneChangingCooperation:
• laneChangingAggressivenessLevel:
• distanceZoneFactor:
• centroidOrigin: Identifier of centroid origin of the vehicle, when the traffic conditions are defined by an OD matrix.
• centroidDest: Identifier of centroid destination of the vehicle, when the traffic conditions are defined by an OD matrix.
• idsectionExit: Identifier of exit section destination of the vehicle, when the destination centroid uses percentages as destination (otherwise is –1) and the traffic conditions are defined by an OD matrix.
• idLine: Identifier of Transit Line, when the vehicle has been generated as a transit vehicle.
• internalInfo: only for internal use
• engineTypeId: Identifier of the engine type of the vehicle (emission, consumption, MFC acceleration models)
• vehicleSegmentId: Identifier of the Euro Car Segment of the vehicle for the MFC acceleration model/Battery Consumption model: None = 0, A = 1, B = 2, C = 3, D = 4, E = 5, F = 6, J = 7, NM = 8.
• EUEmissionId: Identifier Standard Emission for LEM. Null= 0, Zero = 1, Euro 0 = 2, Euro 1 = 3, Euro 2 = 4, Euro 3= 5, Euro 4 = 6, Euro 5 = 7, Euro 6 = 8, Euro 6c = 9 (Light Duty vehicles (car, taxi, van) ), Euro I = 10, Euro II = 11, Euro III = 12, Euro IV = 13, Euro IV EGR = 14, Euro V = 15, Euro V EGR = 16, Euro V SCR = 17, Euro VI = 18 (Heavy Duty vehicles (LGV, HGV, Bus, Coach) ).
• energyCapacity: Total Capacity of the tank (l) or battery (kW)

### Modify the Static Information of a Vehicle in a Section¶

#### In C++ and Python¶

##### Explanation¶

Modify some of the static parameters of a vehicle in a section. Static parameters are the characteristics of the vehicle which were set when the vehicle entered in the system. The static parameters which can be changed are: type, length width, maxDesiredSpeed, maxAcceleration, normalDeceleration, maxDeceleration, speedAcceptance, minDistanceVeh, giveWayTime, guidanceAcceptance, enrouted, equipped, tracked, keepfastLane, safetyMarginFactor, headwayMin, sensitivityFactor, reactionTime, reactionTimeAtStop, reactionTimeAtTrafficLight, centroidOrigin, centroidDest and idsectionExit (the exit section has meaning when the destination centroid uses destination percentages; if the identifier of the section is invalid or –1 then Aimsun Next will determine the exit section according to criteria defined in the centroid). Aimsun Next does not store the previous values, so it cannot recover them. This function requires having previously obtained the number of Vehicles in the section calling AKIVehStateGetNbVehiclesSection.

##### Format¶
int AKIVehSetVehicleStaticInfSection(int aidSec, int indexveh, StaticInfVeh staticinfVeh)

##### Parameters¶
• aidSec: the section identifier
• indexveh: vehicle index, from 0 to (Total Number of Vehicles in the section – 1)
• staticinfVeh: new static parameters to be assigned
##### Output¶
• = 0: No Error
• < 0: Error

### Modify the Static Information of a Vehicle in a Junction¶

#### In C++ and Python¶

##### Explanation¶

Modify some of the static parameters of a vehicle in a junction. Static parameters mean the characteristics of the vehicle which were set when the vehicle entered in system. The static parameters which can be changed are: type, length width, maxDesiredSpeed, maxAcceleration, normalDeceleration, maxDeceleration, speedAcceptance, minDistanceVeh, giveWayTime, guidanceAcceptance, enrouted, equipped, tracked, keepfastLane, safetyMarginFactor, headwayMin, sensitivityFactor, reactionTime, reactionTimeAtStop, reactionTimeAtTrafficLight, centroidOrigin, centroidDest and idsectionExit (the exit section has meaning when the destination centroid uses destination percentages; if the identifier of the section is invalid or –1 then Aimsun Next will determine the exit section according to criteria defined in the centroid). Aimsun Next does not store the previous values, so it cannot recover them. This function requires having previously obtained the number of Vehicles in the junction by calling AKIVehStateGetNbVehiclesJunction.

##### Format¶

int AKIVehSetVehicleStaticInfJunction(int aidJunct,int indexveh, StaticInfVeh staticinfVeh)

##### Parameters¶
• aidJunct: junction Identifier
• indexveh: the vehicle index, from 0 to (Total Number of Vehicles in the junction – 1)
• staticinfVeh: new static parameters to be assigned.
##### Output¶
• = 0: No Error
• < 0: Error

### Read the Adaptive Cruise Control Information of a Vehicle in a Section¶

#### In C++ and Python¶

##### Explanation¶

Read the Adaptive Cruise Control parameters from a vehicle in a section. ACC Parameters establish the capabilities and influence the behavior of Adaptive Cruise Control of the vehicle. These parameters were set when the vehicle entered the system. This function requires the number of vehicles in the section is found by calling AKIVehStateGetNbVehiclesSection.

##### Format¶
StaticInfVehACCParams AKIVehGetVehicleStaticInfACCParamsSection( int aidSec, int indexveh )

##### Parameters¶
• aidSec: section Identifier
• indexveh: vehicle index, from 0 to (Total Number of Vehicles in the section – 1)
##### Output¶
struct StaticInfVehACCParams {
int report;
int idVeh;
int accType;

double minClearanceDistance;
double maxClearanceDistance;
double speedGainFreeFlow;
double distanceGain;
double speedGainPrec;
double desiredTimeGap;

double connectedDistanceGain;
double connectedSpeedGain;
double minTimeGapThreshold;
double maxTimeGapThreshold;
double followerTimeGap;
};


where:

Parameters common to all simulated vehicles:

• report: Error code returned (0 means success).
• idVeh: The simulated vehicle's ID.
• accType: The simulated vehicle's ACC module (0: None, 1: ACC, 2: CACC).

ACC Model Parameters:

(All these parameters will be -1 when the module is disabled)

• minClearanceDistance: The lower threshold for the space between the rear bumper of a vehicle and the front bumper of the following (m).
• maxClearanceDistance: The upper threshold for the space between the rear bumper of a vehicle and the front bumper of the following (m).
• speedGainFreeFlow: The gain on the speed difference between the free flow speed and the subject vehicle’s current speed (s-1).
• distanceGain: The gain on the position difference between the preceding vehicle and the subject vehicle (s-2).
• speedGainPrec: The gain on the speed difference between the preceding vehicle and the subject vehicle (s-1).
• desiredTimeGap: The desired time gap of the ACC controller (s).

CACC Model Parameters:

(All these parameters will be -1 when the module is disabled)

• connectedDistanceGain: The gain on the position difference between the preceding connected vehicle and the subject CACC vehicle (s-1).
• connectedSpeedGain: The gain on the speed difference between the preceding connected vehicle and the subject CACC vehicle.
• minTimeGapThreshold: The lower threshold for the time gap (s).
• maxTimeGapThreshold: The upper threshold for the time gap (s).
• followerTimeGap: The constant time gap between the last vehicle of the preceding connected string and the subject CACC vehicle (s).
• leaderTimeGap: The constant time gap between the last vehicle of the preceding connected string and the subject CACC vehicle (s).

### Read the Adaptive Cruise Control Information of a Vehicle in a Junction¶

#### In C++ and Python¶

##### Explanation¶

Read the Adaptive Cruise Control parameters from a vehicle in a junction. ACC Parameters establish the capabilities and influence the behavior of Adaptive Cruise Control of the vehicle. These parameters were set when the vehicle entered the system. This function requires the number of vehicles in the section is found by calling AKIVehStateGetNbVehiclesJunction.

##### Format¶
StaticInfVehACCParams AKIVehGetVehicleStaticInfACCParamsJunction( int aidJunction, int indexveh )

##### Parameters¶
• aidJunction: the junction identifier
• indexveh: vehicle index, from 0 to (Total Number of Vehicles in the junction – 1)
##### Output¶
struct StaticInfVehACCParams {
int report;
int idVeh;
int accType;

double minClearanceDistance;
double maxClearanceDistance;
double speedGainFreeFlow;
double distanceGain;
double speedGainPrec;
double desiredTimeGap;

double connectedDistanceGain;
double connectedSpeedGain;
double minTimeGapThreshold;
double maxTimeGapThreshold;
double followerTimeGap;
};


where:

Parameters common to all simulated vehicles:

• report: Error code returned (0 means success).
• idVeh: The simulated vehicle's ID.
• accType: The simulated vehicle's ACC module (0: None, 1: ACC, 2: CACC).

ACC Model Parameters:

(All these parameters will be -1 when the module is disabled)

• minClearanceDistance: The lower threshold for the space between the rear bumper of a vehicle and the front bumper of the following (m).
• maxClearanceDistance: The upper threshold for the space between the rear bumper of a vehicle and the front bumper of the following (m).
• speedGainFreeFlow: The gain on the speed difference between the free flow speed and the subject vehicle’s current speed (s-1).
• distanceGain: The gain on the position difference between the preceding vehicle and the subject vehicle (s-2).
• speedGainPrec: The gain on the speed difference between the preceding vehicle and the subject vehicle (s-1).
• desiredTimeGap: The desired time gap of the ACC controller (s).

CACC Model Parameters:

(All these parameters will be -1 when the module is disabled)

• connectedDistanceGain: The gain on the position difference between the preceding connected vehicle and the subject CACC vehicle (s-1).
• connectedSpeedGain: The gain on the speed difference between the preceding connected vehicle and the subject CACC vehicle.
• minTimeGapThreshold: The lower threshold for the time gap (s).
• maxTimeGapThreshold: The upper threshold for the time gap (s).
• followerTimeGap: The constant time gap between the last vehicle of the preceding connected string and the subject CACC vehicle (s).
• leaderTimeGap: The constant time gap between the last vehicle of the preceding connected string and the subject CACC vehicle (s).

### Modify the Adaptive Cruise Control Information of a Vehicle in a Section¶

#### In C++ and Python¶

##### Explanation¶

Modify the ACC parameters of a vehicle in a section. ACC Parameters establish the capabilities and influence the behavior of Adaptive Cruise Control of the vehicle. These parameters were set when the vehicle entered the system. All parameters can be changed except idVeh and report. Aimsun Next does not store the previous values, so it cannot recover them. This function requires having previously obtained the number of Vehicles in the section calling AKIVehStateGetNbVehiclesSection.

##### Format¶
int AKIVehSetVehicleStaticInfACCParamsSection( int aidSec, int indexveh, StaticInfVehACCParams staticinfVehACC )

##### Parameters¶
• aidSec: the section identifier
• indexveh: vehicle index, from 0 to (Total Number of Vehicles in the section – 1)
• staticinfVehACC: new ACC parameters to be assigned
##### Output¶
• = 0: No Error
• < 0: Error

### Modify the Adaptive Cruise Control Information of a Vehicle in a Junction¶

#### In C++ and Python¶

##### Explanation¶

Modify the ACC parameters of a vehicle in a junction. ACC Parameters establish the capabilities and influence the behavior of Adaptive Cruise Control of the vehicle. These parameters were set when the vehicle entered the system. All parameters can be changed except idVeh and report. Aimsun Next does not store the previous values, so it cannot recover them. This function requires having previously obtained the number of Vehicles in the junction calling AKIVehStateGetNbVehiclesJunction.

##### Format¶
int AKIVehSetVehicleStaticInfACCParamsJunction( int aidJunct,int indexveh, StaticInfVehACCParams staticinfVehACC )

##### Parameters¶
• aidJunct: junction Identifier
• indexveh: the vehicle index, from 0 to (Total Number of Vehicles in the junction – 1)
• staticinfVehACC: new ACC parameters to be assigned.
##### Output¶
• = 0: No Error
• < 0: Error

### Remove a Vehicle from a Section¶

#### In C++ and Python¶

##### Explanation¶

Removes a vehicle from a section. This function requires the number of vehicles in the section was obtained by calling function AKIVehStateGetNbVehiclesSection.

##### Format¶
int AKIRemoveVehicle(int aidSec, int indexveh )

##### Parameters¶
• aidSec: section Identifier
• indexveh: vehicle index, from 0 to (Total Number of Vehicles in the section – 1)
##### Output¶
• = 0: No Error
• < 0: Error

### Remove a Vehicle from a Junction¶

#### In C++ and Python¶

##### Explanation¶

Removes a vehicle from a junction. This function requires the number of vehicles in the section was obtained by calling function AKIVehStateGetNbVehiclesJunction.

##### Format¶
int AKIRemoveVehicleJunction( int idJunction, int indexveh )

##### Parameters¶
• idJunction: junction Identifier
• indexveh: vehicle index, from 0 to (Total Number of Vehicles in the junction – 1)
##### Output¶
• = 0: No Error
• < 0: Error

### Read the information of a Vehicle¶

#### In C++ and Python¶

##### Explanation¶

Read the information of a vehicle. This function can slow the simulation as every call to this function implies finding the vehicle inside the network. To avoid this search, it is recommended that the vehicle is set as Tracked to make its information more accessible.

##### Format¶
InfVeh AKIVehGetInf(int aidVeh)

##### Parameters¶
• aidVeh: Vehicle Identifier
##### Output¶
struct InfVeh{
int report;
int idVeh;
int type;
// Information in Vehicle when it is in a section
int idSection;
int segment;
int numberLane;

// Information in Vehicle when it is in a node
int idJunction;
int idSectionFrom;
int idLaneFrom;
int idSectionTo;
int idLaneTo;

double CurrentPos;
double distance2End

double xCurrentPos, yCurrentPos, zCurrentPos;
double xCurrentPosBack, yCurrentPosBack, zCurrentPosBack;
double CurrentSpeed, PreviousSpeed;

double TotalDistance;

double SystemGenerationT;
double SystemEntranceT;
double SectionEntranceT;
double CurrentStopTime;
bool stopped;
uint mNbLostTurnings;
double energyState;
};


where:

• report: 0, OK, otherwise value represents an error code
• idVeh: the vehicle identifier.
• type: the vehicle type (car, bus, truck, etc.) from 1 to AKIVehGetNbVehTypes ()
• idSection: the section identifier.
• segment: the segment number of the section where the vehicle is located (from 0 to n-1).
• numberLane: the lane number in the segment (from 1, the rightmost lane, to N, the leftmost lane).
• idSectionFrom: the origin section identifier.
• idLaneFrom: the number of the lane of the origin section where the vehicle has entered the junction.
• idSectionTo: the destination section identifier.
• idLaneTo: the number of the lane of the destination section where the vehicle exits the junction.
• section given by its distance (m or feet, depending on the units defined in the network) from the beginning of the section or vehicle’s position inside the junction given by its distance from the entrance to the junction.
• distance2End: distance to the end of the section (m or feet, depending on the units defined in the network) when the vehicle is located in a section or the distance to end of the turning when the vehicle is in a junction.
• xCurrentPos, yCurrentPos, zCurrentPos: world coordinates of the middle point of the front bumper of the vehicle.
• xCurrentPosBack, yCurrentPosBack, zCurrentPosBack: world coordinates of the middle point of the rear bumper of the vehicle.
• CurrentSpeed: current speed (in km/h or mph, depending on the units defined in the network.
• PreviousSpeed: speed in the previous simulation step (in km/h or mph, depending on the units defined in the network
• TotalDistance: total distance traveled (m or feet)
• SystemGenerationT: the absolute generation time of the vehicle into the system. If no virtual queue found in its entrance section it will be the same as the SystemEntranceT.
• SystemEntranceT: the absolute entrance time of the vehicle into the system, that is into its entrance section. If no virtual queue found in its entrance section it will be the same as the SystemGenerationT.
• SectionEntranceT: the absolute entrance time of the vehicle in the current section
• CurrentStopTime: the current stop time
• stopped: True if the vehicle remains stopped.
• mNbLostTurnings The number of lost turnings.
• energyState Current fuel tank level in combustion vehicles (l) or current battery State of Charge in electric vehicles (kW)

### Read the Static information of a Vehicle¶

#### In C++ and Python¶

##### Explanation¶

Read the static information of a vehicle. Static information is the characteristics of the vehicle which were set when the vehicle entered in the system. This function can slow the simulation because every call of this function implies finding the vehicle inside the network. To avoid this search, it is recommended that the vehicle is set as Tracked to make its information more accessible.

##### Format¶
StaticInfVeh AKIVehGetStaticInf (int aidVeh)

##### Parameters¶
• aidVeh: Vehicle Identifier
##### Output¶
struct StaticInfVeh{
int report;
int idVeh;
int type;
double length;
double width;
double maxDesiredSpeed;
double maxAcceleration;
double normalDeceleration;
double maxDeceleration;
double speedAcceptance;
double minDistanceVeh;
double giveWayTime;
double guidanceAcceptance;
int enrouted;
int equipped;
int tracked;

bool keepfastLane;
double safetyMarginFactor;
double sensitivityFactor;
double reactionTime;
double reactionTimeAtStop;
double reactionTimeAtTrafficLight;

bool laneChangingCooperation;
double laneChangingAggressivenessLevel;
double distanceZoneFactor;

int centroidOrigin;
int centroidDest;
int idsectionExit;

int idLine;
void * internalInfo;

int engineTypeId;
int vehicleSegmentId;
int EUEmissionId;
double energyCapacity;
};


where:

• report: 0, OK, else error code
• idVeh: vehicle identifier
• type: vehicle type (car, bus, truck, etc.)
• length: vehicle length (m or feet, depending on the units defined in the network).
• width: vehicle width (m or feet, depending on the units defined in the network).
• maxDesiredSpeed: Maximum desired speed of the vehicle (km/h or mph, depending on the units defined in the network).
• maxAcceleration: Maximum acceleration of the vehicle (m/s2 or ft/ s2, depending on the units defined in the network).
• normalDeceleration: Maximum deceleration of the vehicle that can apply under normal conditions (m/s2 or ft/ s2, depending the units defined in the network).
• maxDeceleration: Maximum deceleration of the vehicle that can apply under special conditions (m/s2 or ft/ s2, depending the units defined in the network).
• speedAcceptance: degree of acceptance of the speed limits.
• minDistanceVeh: distance that the vehicle keeps between itself and the preceding vehicle (meters or feet, depending on the units defined in the network).
• giveWayTime: time after which the vehicle becomes more aggressive in yield situations (seconds).
• guidanceAcceptance: level of compliance of the vehicle to guidance indications.
• enrouted: 0 means vehicle will not update path en route, 1 means vehicle will change path en route depending on the defined percentage of vehicles that update path en route.
• equipped: 0 means vehicle not equipped, 1 means vehicle equipped.
• tracked: 0 means vehicle not tracked, 1 means vehicle tracked.
• keepfastLane: means vehicle keep fast lane during overtaking
• safetyMarginFactor: safety margin factor
• sensitivityFactor: estimation of the acceleration of the leader
• reactionTime: reaction time of the vehicle
• reactionTimeAtStop: reaction time at stop of the vehicle
• reactionTimeAtTrafficLight: reaction time of the vehicle when stopped the first one of the queue in a traffic light.
• laneChangingCooperation:
• laneChangingAggressivenessLevel:
• distanceZoneFactor:
• centroidOrigin: Identifier of centroid origin of the vehicle, when the traffic conditions are defined by an OD matrix.
• centroidDest: Identifier of centroid destination of the vehicle, when the traffic conditions are defined by an OD matrix.
• idsectionExit: Identifier of exit section destination of the vehicle, when the destination centroid uses percentages as destination (otherwise is –1) and the traffic conditions are defined by an OD matrix.
• idLine: Identifier of Transit Line, when the vehicle has been generated as a transit vehicle.
• internalInfo: only for internal use
• engineTypeId: Identifier of the engine type of the vehicle (emission, consumption, MFC acceleration models)
• vehicleSegmentId: Identifier of the Euro Car Segment of the vehicle for the MFC acceleration model/Battery Consumption model: None = 0, A = 1, B = 2, C = 3, D = 4, E = 5, F = 6, J = 7, NM = 8.
• EUEmissionId: Identifier Standard Emission for LEM. Null= 0, Zero = 1, Euro 0 = 2, Euro 1 = 3, Euro 2 = 4, Euro 3= 5, Euro 4 = 6, Euro 5 = 7, Euro 6 = 8, Euro 6c = 9 (Light Duty vehicles (car, taxi, van) ), Euro I = 10, Euro II = 11, Euro III = 12, Euro IV = 13, Euro IV EGR = 14, Euro V = 15, Euro V EGR = 16, Euro V SCR = 17, Euro VI = 18 (Heavy Duty vehicles (LGV, HGV, Bus, Coach) ).
• energyCapacity: Total Capacity of the tank (l) or battery (kW)

### Modify the Static Information of a Vehicle¶

#### In C++ and Python¶

##### Explanation¶

Modify some of the static parameters of a vehicle. Static parameters are the characteristics of the vehicle which were set when the vehicle entered in the system. The static parameters that it is possible to change are: type, length width, maxDesiredSpeed, maxAcceleration, normalDeceleration, maxDeceleration, speedAcceptance, minDistanceVeh, giveWayTime, guidanceAcceptance, enrouted, equipped, tracked, keepfastLane, safetyMarginFactor, headwayMin, sensitivityFactor, reactionTime, reactionTimeAtStop, reactionTimeAtTrafficLight, equipped, tracked, centroidOrigin, centroidDest and idsectionExit (the exit section has meaning when the destination centroid uses destination percentages; if the identifier of the section is invalid or –1 then Aimsun Next will determine the exit section according to criteria defined in the centroid). Aimsun Next does not store the previous values, so it cannot recover them. This function can slow the simulation because every call to this function implies finding the vehicle inside the network. To avoid this search, set the vehicle as Tracked then read its information.

##### Format¶
int AKIVehSetStaticInf (int aidVeh, StaticInfVeh staticinfVeh)

##### Parameters¶
• aidVeh: Vehicle Identifier
• staticinfVeh: new static parameters to be assigned.
##### Output¶
• = 0: No Error
• < 0: Error

#### In C++ and Python¶

##### Format¶
LeaderInfVeh AKIVehGetLeaderInfVeh( int aidVeh )

##### Parameters¶
• aidVeh: Vehicle Identifier
##### Output¶
struct LeaderInfVeh{
int report;
int idVeh;
double gap;
double spacing;
double clearance;
};


where:

• report: 0, OK, else error code
• idVeh: vehicle identifier
• headway: time between the front bumper of a vehicle and the front bumper of the following vehicle (s).
• gap: time between the rear bumper of a vehicle and the front bumper of the following vehicle (s).
• spacing: space between the front bumper of a vehicle and the front bumper of the following vehicle (m).
• clearance: space between the rear bumper of a vehicle and the front bumper of the following (m).

#### In C++ and Python¶

##### Explanation¶

Read the Adaptive Cruise Control parameters from a vehicle. ACC Parameters establish the capabilities and influence the behavior of Adaptive Cruise Control of the vehicle. These parameters were set when the vehicle entered the system. This function can slow the simulation because every call of this function implies finding the vehicle inside the network. To avoid this search, it is recommended that the vehicle is set as Tracked to make its information more accessible.

##### Format¶
StaticInfVehACCParams AKIVehGetStaticInfACCParams( int aidVeh )

##### Parameters¶
• aidVeh: Vehicle Identifier
##### Output¶
struct StaticInfVehACCParams {
int report;
int idVeh;
int accType;

double minClearanceDistance;
double maxClearanceDistance;
double speedGainFreeFlow;
double distanceGain;
double speedGainPrec;
double desiredTimeGap;

double connectedDistanceGain;
double connectedSpeedGain;
double minTimeGapThreshold;
double maxTimeGapThreshold;
double followerTimeGap;
};


where:

Parameters common to all simulated vehicles:

• report: Error code returned (0 means success).
• idVeh: The simulated vehicle's ID.
• accType: The simulated vehicle's ACC module (0: None, 1: ACC, 2: CACC).

ACC Model Parameters:

(All these parameters will be -1 when the module is disabled)

• minClearanceDistance: The lower threshold for the space between the rear bumper of a vehicle and the front bumper of the following (m).
• maxClearanceDistance: The upper threshold for the space between the rear bumper of a vehicle and the front bumper of the following (m).
• speedGainFreeFlow: The gain on the speed difference between the free flow speed and the subject vehicle’s current speed (s-1).
• distanceGain: The gain on the position difference between the preceding vehicle and the subject vehicle (s-2).
• speedGainPrec: The gain on the speed difference between the preceding vehicle and the subject vehicle (s-1).
• desiredTimeGap: The desired time gap of the ACC controller (s).

CACC Model Parameters:

(All these parameters will be -1 when the module is disabled)

• connectedDistanceGain: The gain on the position difference between the preceding connected vehicle and the subject CACC vehicle (s-1).
• connectedSpeedGain: The gain on the speed difference between the preceding connected vehicle and the subject CACC vehicle.
• minTimeGapThreshold: The lower threshold for the time gap (s).
• maxTimeGapThreshold: The upper threshold for the time gap (s).
• followerTimeGap: The constant time gap between the last vehicle of the preceding connected string and the subject CACC vehicle (s).
• leaderTimeGap: The constant time gap between the last vehicle of the preceding connected string and the subject CACC vehicle (s).

### Modify the Adaptive Cruise Control Information of a Vehicle¶

#### In C++ and Python¶

##### Explanation¶

Modify the ACC parameters of a vehicle. ACC Parameters establish the capabilities and influence the behavior of Adaptive Cruise Control of the vehicle. These parameters were set when the vehicle entered the system. All parameters can be changed except idVeh and report. Aimsun Next does not store the previous values, so it cannot recover them. This function can slow the simulation because every call to this function implies finding the vehicle inside the network. To avoid this search, set the vehicle as Tracked then read its information.

##### Format¶
int AKIVehSetStaticInfACCParams( int aidVeh, StaticInfVehACCParams staticinfVehACC )

##### Parameters¶
• aidVeh: Vehicle Identifier
• staticinfVehACC: new ACC parameters to be assigned.
##### Output¶
• = 0: No Error
• < 0: Error

### Read the position of a Vehicle in a Section¶

#### In C++ and Python¶

##### Explanation¶

Read the position of a vehicle in a section

##### Format¶
InfVehPos AKIVehGetVehicleGetPosSection( int asect, int indexveh, int nbPos );

##### Parameters¶
• asect: Section Identifier
• indexVeh: the index of the vehicle in the section
• nbPos: number of positions to read
##### Output¶
• report= 0: No Error
• report < 0: Error

### Read the position of a Vehicle in a section reusing the InfVehPos struct¶

#### In C++ and Python¶

##### Explanation¶

Reads the position of a vehicle in a section. It is faster than the AKIVehGetVehicleGetPosSection function

##### Format¶
int AKIVehGetVehicleGetPosSectionWithStruct( int asect, int indexveh, int nbPos, InfVehPos *pinfVehPos );

##### Parameters¶
• asect: Section Identifier
• indexVeh: the index of the vehicle in the section
• nbPos: number of positions to read
• pinfVehPos: the pointer to the struct.
##### Output¶
• = 0: No Error
• < 0: Error

### Read the position of a Vehicle in a Junction¶

#### In C++ and Python¶

##### Format¶
InfVehPos AKIVehGetVehicleGetPosJunction( int ajunction, int indexveh, int nbPos );

##### Parameters¶
• ajunction: Junction Identifier
• indexVeh: the index of the vehicle in the section
• nbPos: number of positions to read
##### Output¶
• report = 0: No Error
• report < 0: Error

### Read the position of a Vehicle in a junction reusing the InfVehPos struct¶

#### In C++ and Python¶

##### Explanation¶

Reads the position of a vehicle over a junction. It is faster than the previous AKIVehGetVehicleGetPosJunction function.

##### Format¶
int AKIVehGetVehicleGetPosJunctionWithStruct( int ajunction, int indexveh, int nbPos, InfVehPos *pinfVehPos );

##### Parameters¶
• ajunction: Junction Identifier
• indexVeh: the index of the vehicle in the section
• nbPos: number of positions to read
• pinfVehPos: the pointer to the struct.
##### Output¶
• = 0: No Error
• < 0: Error

### Enable the Graphical Information of a Vehicle¶

#### In C++ and Python¶

##### Explanation¶

Enables the Graphical Information of a Vehicle. In command line executions (aconsole.exe) and batch simulations, it is necessary to call this function in order to read Graphical Information of vehicles.

##### Format¶
int AKIVehEnableGraphicalInf()

##### Output¶
• = 0: No Error

### Disable the Graphical Information of a Vehicle¶

#### In C++ and Python¶

##### Explanation¶

Disables the Graphical Information of a Vehicle

##### Format¶
int AKIVehDisableGraphicalInf()

##### Output¶
• = 0: No Error

### Read the Graphical Information of a Vehicle from a section¶

#### In C++ and Python¶

##### Explanation¶

Reads the Graphical Information of a Vehicle from a section

##### Format¶
GraphicInfVeh AKIVehGetVehicleGraphicInfSection(int asect, int indexveh);

struct GraphicInfVeh{
int report;
int idVeh;
bool leftTurnSignal;
bool rightTurnSignal;
bool brakeLight;
}

##### Parameters¶
• asect: Section Identifier
• indexveh: Index of the vehicle in the section
##### Output¶
• report = 0: No Error
• report < 0: Error

### Read the Graphical Information of a Vehicle from a junction¶

#### In C++ and Python¶

##### Explanation¶

Reads the Graphical Information of a Vehicle from a junction

##### Format¶
GraphicInfVeh AKIVehGetVehicleGraphicInfJunction(int ajunction, int indexveh);

##### Parameters¶
• ajunction: Junction Identifier
• indexveh: Index of the vehicle in the junction
##### Output¶
• report = 0: No Error
• report &lt 0: Error

### Modify a Vehicle to drive backwards or normal¶

#### In C++ and Python¶

##### Explanation¶

Modifies the drawing mode of a vehicle. If the value parameter is true, the vehicle will be drawn as going backwards

##### Format¶
int AKIVehSetDrivingBackwards(int aidSec, int indexveh, bool value);

##### Parameters¶
• aidSec Section Identifier
• indexveh: Index of the vehicle in the section
• value: Drawing mode
##### Output¶
• report = 0: No Error
• report < 0: Error

### Read the number of sections to reach destination¶

#### In C++ and Python¶

##### Explanation¶

Read the number of sections to reach the destination of a vehicle path. The vehicle could be in a section or in a junction. Valid for OD and transit vehicles, otherwise returns 0. AKIVehStateGetNbVehiclesSection or AKIVehStateGetNbVehiclesJunction must be called before calling this function. If idsection parameter is set to -1, the number of sections from the beginning to destination is returned, otherwise the number of sections from section with idsection Identifier to the destination is returned.

##### Format¶
int AKIVehStateGetNbSectionsVehiclePathSection( int aidSection, int indexveh, int idsection )

int AKIVehStateGetNbSectionsVehiclePathJunction( int aidJunction, int indexveh, int idsection )

##### Parameters¶
• aidSection: Section Identifier.
• aidJunction: Junction Identifier.
• indexveh: Section or junction vehicle index ( 0 ≤ indexveh < Number of vehicles in section or junction )
• idsection: Sections are counted from idsection. If idsection is set to -1 sections are counted from the beginning.
##### Output¶
• ≥ 0: Number of sections to reach destination.

### Read the Identifiers of sections to reach destination¶

#### In C++ and Python¶

##### Explanation¶

Read the identifier of section elem-th of the vehicle path to reach destination. The vehicle could be in a section or in a junction.Valid for OD and transit vehicles, otherwise returns 0. AKIVehStateGetNbSectionsVehiclePathSection or AKIVehStateGetNbSectionsVehiclePathJunction must be called before call this functions. If idsection parameter is set to -1, the identifiers of sections from the beginning to destination are returned, otherwise the identifiers of sections from section with idsection Identifier to destination are returned.

##### Format¶
int AKIVehStateGetIdSectionVehiclePathSection( int aidSection, int indexveh, int idsection, int indexsection)

int AKIVehStateGetIdSectionVehiclePathJunction( int aidJunction, int indexveh, int idsection, int indexsection)

##### Parameters¶
• aidSection: Section Identifier.
• aidJunction: Junction Identifier.
• indexveh: Section or junction vehicle index ( 0 ≤ indexveh ≤ Number of vehicles in section or junction )
• idsection: Sections are counted from idsection. If idsection is set to -1 sections are counted from the beginning.
• indexsection: section index ( 0 ≤ indexsection < Number of sections )
##### Output¶
• > 0: Section Identifier.

#### In C++ and Python¶

##### Format¶
int AKIVehGetLeaderId( int idVehicle )

##### Parameters¶
• idVehicle: Vehicle Identifier.
##### Output¶
• > 0: Vehicle Leader Identifier.
• AKIInfVehNotFound: Error

### Read the Vehicle Follower ID¶

#### In C++ and Python¶

##### Format¶
int AKIVehGetFollowerId( int idVehicle )

##### Parameters¶
• idVehicle: Vehicle Identifier.
##### Output¶
• > 0: Vehicle's Follower Identifier.
• AKIInfVehNotFound: Error

#### In C++ and Python¶

##### Format¶
LeaderInfVeh AKIVehGetLeaderVehInfSection( int aidSec, int indexveh );


##### Parameters¶
• aidVeh: Vehicle Identifier
• aidSec: Section Identifier
• ajunction: Junction Identifier
##### Output¶
struct LeaderInfVeh{
int report;
int idVeh;
double gap;
double spacing;
double clearance;
};


where:

• report: 0, OK, else error code
• idVeh: vehicle identifier
• headway: time between the front bumper of a vehicle and the front bumper of the following vehicle (s).
• gap: time between the rear bumper of a vehicle and the front bumper of the following vehicle (s).
• spacing: space between the front bumper of a vehicle and the front bumper of the following vehicle (m).
• clearance: space between the rear bumper of a vehicle and the front bumper of the following (m).

### Read the Vehicle Accumulated Delay¶

#### In C++ and Python¶

##### Explanation¶

double AKIVehGetAccumulatedDelay( int idVehicle )