Aimsun Next API Traffic Lights¶
Functions related to Traffic Lights¶
Read Number of traffic lights in a node or ramp meter¶
In C++ and Python¶
Explanation¶
Read the number of signal groups present on a node or the traffic lights on a ramp meter.
Format¶
int ECIGetNumberSem(int idObject)
Parameters¶
- idObject: A valid node or ramp meter identifier.
Output¶
- ≥ 0: For a node: Number of signal groups in the node. For delay and green by lane ramp meters: number of traffic lights, one by lane covered by the ramp meter. 1 for other types of ramp meters.
- < 0: Error
Read the position of a traffic light or ramp meter in a section ¶
In C++ and Python¶
Explanation¶
Read the position in the section of a ramp meter or traffic light in the current simulation time. This requires there is a control plan loaded.
Format¶
double ECIGetPositionSem(int idObject, int numsem )
Parameters¶
- idObject: A valid node or ramp meter identifier.
- numsem: A valid counter from 0 to (ECIGetNumberSem(idObject)-1)
Output¶
- ≥0: For ramp meters: distance to the beginning of the section where the ramp meter is located.
- <= 0 :For nodes: distance from the end of the section where the signal group is located, that is, 0 by default or a negative value to subtract to the section's length (section where the traffic light is located at).
- <= 1000: Error
Read the state of a traffic light or ramp meter ¶
In C++ and Python¶
Explanation¶
Read the state of a ramp meter or traffic light.
Format¶
double ECIGetStateSem (int idObject, int numsem)
Parameters¶
- idObject: A valid node or ramp meter identifier.
- numsem: A valid counter from 0 to (ECIGetNumberSem(idObject)-1).
Output¶
- 0: traffic light or ramp meter in red
- 1: traffic light or ramp meter in green
- 2: traffic light or ramp meter in yellow
- 3: traffic light or ramp meter in flashing green