Research Article

Automated Real-Time Intelligent Traffic Control System for Smart Cities Using Wireless Sensor Networks

Pseudocode 1

Behavior of different sensor nodes in a road crossing.
1: All the nodes of each crossroads execute out self-organization protocol to form a cluster-free network topology
2: Cluster Head Selection in each Cluster
3: For i=1 to N do   //N: Number of the crossroad in the city
4: For j=1 to M do //M: Number of the nodes in the crossroad
5:  Execute flowchart // execute flowchart of validation of the detection state by the nodes (Figure 17)
6:  T⟵flowchart// flowchart: return 1 occupied state, return 0 open state
7:  If (T==1)then  //return 1 occupied state
8:   Sensor node prepares the corresponding data structure with occupied state
9:   If (Sensor node is a cluster head) then
10:    Sensor node uses the aggregation of all the data received from these members
11:    Sends all information to the neighboring Cluster Head or to the Gateway depending on its next hop
12:   Else
13:    Sensor node prepares the corresponding data structure according to its role in the crossroad
14:    Sends those data to its Cluster Head
15:   End if
16:  Else     //return 0 open state
17:   Sensor node prepares the corresponding data structure with open state
18:   Go to 9
19:  End if
20: End for
21: End for
22: Next round
23: Go to 2