Aimsun Next API Traffic Lights¶
Functions related to Traffic Lights¶
Read Number of traffic lights in a node or metering¶
In C++ and Python¶
Explanation¶
Read the number of signal groups present on a node or the traffic lights on a metering
Format¶
int ECIGetNumberSem(int idObject)
Parameters¶
- idObject: A valid node or metering identifier.
Output¶
- ≥ 0: For a node: Number of signal groups in the node. For delay and green by lane meterings: number of traffic lights, one by lane covered by the metering. 1 for other types of meterings
- < 0: Error
Read the position of a traffic light or metering in a section ¶
In C++ and Python¶
Explanation¶
Read the position in the section of a metering 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 metering identifier.
- numsem: A valid counter from 0 to (ECIGetNumberSem(idObject)-1)
Output¶
- ≥0: For meterings: distance to the beginning of the section where the metering 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 metering ¶
In C++ and Python¶
Explanation¶
Read the state of a metering or traffic light.
Format¶
double ECIGetStateSem (int idObject, int numsem)
Parameters¶
- idObject: A valid node or metering identifier.
- numsem: A valid counter from 0 to (ECIGetNumberSem(idObject)-1).
Output¶
- 0: traffic light or metering in red
- 1: traffic light or metering in green
- 2: traffic light or metering in yellow
- 3: traffic light or metering in flashing green