Aimsun Next API Transit Priority¶
Functions related to Transit Priority¶
Disable Transit Priority in a Node¶
In C++ and Python¶
Explanation¶
Sets the specified intersection to ignore the transit priorities defined.
Format¶
int ECIDisableBusPreemptionNode(int ajunction)
Parameters¶
- ajunction: The ID of the intersection where the transit priority will be disabled.
Output¶
- 0: If the bus priority has been correctly disabled.
- < 0: Error
Enable Transit Priority in a Node¶
In C++ and Python¶
Explanation¶
Sets the specified intersection to consider the transit priorities defined after they have been previously disabled.
Format¶
int ECIEnableBusPreemptionNode (int ajunction)
Parameters¶
- ajunction: The ID of the intersection where the transit priority will be considered again.
Output¶
- 0: If the bus priority has been correctly enabled.
- < 0: Error
Check Transit Priority state in a Node¶
In C++ and Python¶
Explanation¶
Returns whether the transit priorities defined are currently considered or ignored.
Format¶
int ECIIsBusPreemptionNodeEnabled (int ajunction)
Parameters¶
- ajunction: The ID of the intersection where the transit priority will be disabled.
Output¶
- 1: If the bus priorities are considered as defined.
- 0: If the bus priorities defined have been disabled.
- < 0: Error
Get the Number of Priority Sets¶
In C++ and Python¶
Explanation¶
Get the number of priority sets for a junction in the current control plan.
Format¶
int ECIGetNbPreemptionSets( int idJunction, double timeSta );
Parameters¶
- idJunction: A valid junction identifier.
- timeSta: The current simulation time in seconds from midnight, used to find the control plan that is being executed
Output¶
- ≥ 0: Number of priority sets
- < 0: Error
Get the Priority Set Parameters¶
In C++ and Python¶
Explanation¶
Get the Priority set parameters for a junction in the current control plan.
Format¶
int ECIGetPreemptionSetParameters( int idJunction, double timeSta, int index, double* delay, double *minDwell, double *reserve, double * inhibit, double *maxDwell, int *type );
Parameters¶
- idJunction: A valid junction identifier.
- timeSta: The current simulation time in seconds from midnight, used to find the control plan that is being executed
- index: A value between 0 and the ECIGetNbPreemptionSets -1
Output¶
- ≥0: No Error
- delay: The number of seconds to delay the start of the priority timing
- minDwell: The minimum duration in seconds of the dwell phase
- reserve: The time during which any other priority request is prevented.
- inhibit: The duration in seconds of the interval while the activation of any phase that is not the requested priority phase is prevented
- maxDwell: The maximum duration in seconds of the dwell phase
- type: The priority type. 0 means Alternative, 1 means Serve All
- < 0: Error
Sample code in Python¶
The following code reads the first priority parameters of node 203 at time 0:00:00 and if they are read successfully it prints the delay read:
delay = doublep()
minDwell = doublep()
reserve = doublep()
inhibit = doublep()
maxDwell = doublep()
type = intp()
report = ECIGetPreemptionSetParameters( 203, 0.0, 0, delay, minDwell, reserve, inhibit, maxDwell, type )
if report == 0:
string = "Delay: " + str(delay.value())
AKIPrintString(string)
AKIPrintString("OK")
else :
AKIPrintString("Not OK")
Get the Priority Set Number of Transit Lines¶
In C++ and Python¶
Explanation¶
Get the priority set number of transit lines that are considered for a junction in the current control plan.
Format¶
int ECIGetPreemptionSetNbLines( int idJunction, double timeSta, int index);
Parameters¶
- idJunction: A valid junction identifier.
- timeSta The current simulation time in seconds from midnight, used to find the control plan that is being executed
- index: A value between 0 and the ECIGetNbPreemptionSets -1
Output¶
- ≥0: the number of lines in the priority set
- < 0: Error
Get the Priority Set Transit Lines¶
In C++ and Python¶
Explanation¶
Get the priority set transit lines that are considered for a junction in the current control plan.
Format¶
int ECIGetPreemptionSetLines( int idJunction, double timeSta, int index, int nbLines , int *lines );
Parameters¶
- idJunction: A valid junction identifier.
- timeSta: The current simulation time in seconds from midnight, used to find the control plan that is being executed
- index: A value between 0 and the ECIGetNbPreemptionSets -1
- nbLines: The number of lines returned by ECIGetPreemptionSetNbLines
- lines: An integer array of size equal to nbLines.
Output¶
- ≥ 0: No Error
- lines is a vector of line identifiers
- < 0: Error
Sample code in Python¶
nblines = ECIGetPreemptionSetNbLines( 203, 0.0 )
lines = intArray( nblines )
report = ECIGetPreemptionSetLines( 203, 0.0, 0, nblines, lines )
if report == 0:
string = "Number of lines: " + str(nblines)
AKIPrintString(string)
for i in range(nblines):
string = "Line " + str(i) + ": " + str(lines[i])
AKIPrintString(string)
Get the Priority Set Number of Phases¶
In C++ and Python¶
Explanation¶
Get the priority set number of dwell phases for a junction in the current control plan.
Format¶
int ECIGetPreemptionSetNbPhases( int idJunction, double timeSta, int index);
Parameters¶
- idJunction: A valid junction identifier.
- index: A value between 0 and the ECIGetNbPreemptionSets -1
- timeSta:The current simulation time in seconds from midnight, used to find the control plan that is being executed
Output¶
- ≥ 0: number of phases
- < 0: Error
Get the Priority Set Phases¶
In C++ and Python¶
Explanation¶
Get the Priority set dwell phases for a junction in the current control plan.
Format¶
int ECIGetPreemptionSetPhases( int idJunction, double timeSta, int index, int nbPhases , int *phases );
Parameters¶
- idJunction A valid junction identifier.
- timeSta: The current simulation time in seconds from midnight, used to find the control plan that is being executed
- index: A value between 0 and the ECIGetNbPreemptionSets -1.
- nbPhases: The number of phases.
- phases: An int array of size equal to nbPhases.
Output¶
- ≥ 0: No Error
- phases is a vector of phase identifiers, which are between 1 and N, where N is the number of phases.
- < 0: Error
Sample code in Python¶
nbphases = ECIGetPreemptionSetNbPhases( 203, 0.0 )
phases = intArray(nbphases)
report = ECIGetPreemptionSetPhases( 203, 0.0, 0, nbphases, phases )
if report == 0:
string = "Number of phases: " + str(nbphases)
AKIPrintString(string)
for i in range(nbphases):
string = "Line " + str(i) + ": " + str(phases[i])
AKIPrintString(string)
Get the Priority Set Number of Request Detectors¶
In C++ and Python¶
Explanation¶
Get the Priority set number of request detectors for a junction in the current control plan.
Format¶
int ECIGetPreemptionSetNbRequestDetectors ( int idJunction, double timeSta, int index);
Parameters¶
- idJunction: A valid junction identifier.
- timeSta: The current simulation time in seconds from midnight, used to find the control plan that is being executed
- index: A value between 0 and the ECIGetNbPreemptionSets -1
Output¶
- ≥ 0: The number of request detectors
- < 0: Error
Get the Priority Set Request Detectors¶
In C++ and Python¶
Explanation¶
Get the priority set request detectors for a junction in the current control plan.
Format¶
int ECIGetPremptionSetRequestDetectors ( int idJunction, double timeSta, int index, int nbDetectors, int * detectors );
Parameters¶
- idJunction: A valid junction identifier.
- timeSta: The current simulation time in seconds from midnight, used to find the control plan that is being executed
- index: A value between 0 and the ECIGetNbPreemptionSets -1
- nbDetectors: The number of request detectors
- detectors: An int array of size equal to nbDetectors.
Output¶
- ≥ 0: No Error
- detectors is a vector of request detectors identifiers
- < 0: Error
Sample code in Python¶
nbdets = ECIGetPreemptionSetNbRequestDetectors( 203, 0.0 )
dets = intArray(nbdets)
report = ECIGetPreemptionSetRequestDetectors( 203, 0.0, 0, nbdets, dets )
if report == 0:
string = "Number of detectors: " + str(nbdets)
AKIPrintString(string)
for i in range(nbphases):
string = "Detector " + str(i) + ": " + str(dets[i])
AKIPrintString(string)
Get the Priority Set Number of End Detectors¶
In C++ and Python¶
Explanation¶
Get the priority set number of end detectors for a junction in the current control plan.
Format¶
int ECIGetPreemptionSetNbEndDetectors ( int idJunction, double timeSta, int index);
Parameters¶
- idJunction: A valid junction identifier.
- timeSta: The current simulation time in seconds from midnight, used to find the control plan that is being executed
- index: A value between 0 and the ECIGetNbPreemptionSets -1
Output¶
- ≥ 0: The number of end detectors
- < 0: Error
Get the Priority Set End Detectors¶
In C++ and Python¶
Explanation¶
Get the priority set end detectors for a junction in the current control plan.
Format¶
int ECIGetPreemptionSetEndDetectors ( int idJunction, double timeSta, int index, int nbDetectors, int * detectors );
Parameters¶
- idJunction: A valid junction identifier.
- timeSta: The current simulation time in seconds from midnight, used to find the control plan that is being executed
- index: A value between 0 and the ECIGetNbPreemptionSets -1
- nbDetectors: The number of end detectors
- detectors: An int array of size equal to nbDetectors
Output¶
- ≥ 0: No Error
- < 0: Error
Sample code in Python:¶
nbdets = ECIGetPremptionSetNbEndDetectors( 203, 0.0 )
dets = intArray(nbdets)
report = ECIGetPreemptionSetEndDetectors( 203, 0.0, 0, nbdets, dets )
if report == 0:
string = "Number of detectors: " + str(nbdets)
AKIPrintString(string)
for i in range(nbphases):
string = "Detector " + str(i) + ": " + str(dets[i])
AKIPrintString(string)