| Inputs: , , , , , , , , , as defined in Table 3. |
| Initialize variables |
(1) | For each |
(i) | Set # set the closing time for the roads equals the current time |
(ii) | Set # initialize the vehicle counts in all the roads |
(2) | Set # initialize the Open Timer to the average of the minimum and maximum open timers |
(3) | Set # Set the current open road to be the first one |
(4) | Repeat forever: |
(5) | Calculate the number of vehicles in each road with the distance to the intersection |
| # To minimize the computation and iterating on a very large number of entries, we use the following approach: |
(6) | # For the open road, when a vehicle is crossing the intersection stop line from any lane , |
(7) | Set |
(8) | # For all the roads including the open one, on the arrival of any vehicle on the road r in any lane , |
(9) | Set |
(10) | If (no more cars are withinin the open road): # the open road is empty |
(11) | Wait for the transition time, |
(12) | Close the open road, |
(13) | Call “Select Next Open Road” algorithm. |
(14) | If (Emergency vehicle on a Closed Road): |
(15) | Call Handle_Emergency_Vehicle : |
(16) | If: # When the green timer expired |
(17) | Call “Select Next Open Road” algorithm. |
(18) | Inform the vehicles about the currently open road |
(19) | Periodically send a broadcast message to all the roads: “the only road having heading direction” is open for at most . |
(20) | Continue Repeating |
| End of the Main Algorithm. |