are collapsed. It will be usable in any emergency situation. For example, the picture below depicts the fall of the Margalla towers in the year 2008, due to the earthquake. At that time all the networks had stopped working. CrANs can be used in these situations as a recovery network. It will be operatable if even a few nodes are available whether MANETs or FANETs.
In a third world country like Pakistan, no proper replacement for other networks works properly. In these type of emergency situations (which are quite frequent), CrANs can be used as a substitute. It does not require a strong infrastructure to be made.
6.3.5.7 Earth Quake
Pakistan is a country which experiences frequent earthquakes. There have been almost half a dozen major earthquakes in the past 20 years. In these times when most other networks collapse, CrANs can be used as it is designed for such purposes where there is no proper channel of communication.
6.3.5.8 Road Blasts
Due to security reasons, jammers are setup after such events. All other modes of communication fail at this time. We can use CrANs by connecting it to the VANETs which are basically present on all road sides. By using this, we can transfer information to inform security institutions and get help. One of the latest examples of such a devastation where all networks failed and communication breakdown is of the blast that occurred in Saiwan Shareef. No help could be provided immediately as there was no possible way of communication and security institutes were not able to get an idea of the situation. As a result of which, many lives were wasted.
6.4 Simulation of MANET Network
6.4.1 Deployment Area
To draw the deployment area, we have length and breadth. To find out area, we will multiply the length and breadth from input values. X label represents the length and y label represents the breadth. Here, length is 40 and breadth is 50. So deployment area is 200 as shown in Figure 6.14.
6.4.2 Divide Deployment Area Into Equal Zones
Divide the deployment area into the equal zones by involving l, b, and n. The parameters at which division is done are gap = l/n, x = 0: gap: l, y = 0:0.1: b, where x, y, n are axis and number of zones, respectively.
Figure 6.14 Positioning of sensor nodes.
6.4.3 Getting Positions of the Sensor Nodes
Sensor node function involves l, b, and n. n = length(x), it indicates the number of divisions + 1, and y = n − 1 represents number of divisions in deployment area where h = sn. Next, we see is the command window. Nodes are in even and odd spaces in their zones according to the command.
6.4.4 Mesh Formation
To form a mesh, we arrange the nodes into the even and odd position with the help of loop system and form a matrix by modulo operation and its range is from 0 to n − 1. The matrix form in the case of matrix is shown in Figure 6.15
6.4.5 Getting the Minimum Spanning Tree for the Whole Placement Area
To get the minimum spanning tree, we have two cases, even and odd. In even case node is always multiple by 2 in loop and in odd node is represented as n. We get the coordinates of the vertical and horizontal lines separately for each case. At the end, we put or apply the fitting function to get the minimum coordinates in the deployment area as shown in Figure 6.16.
6.4.6 Energy Calculation
Energy calculation is the amount of energy used from source to destination node. Read the energy from the excel file and it measures the energy from source node to zone scatter node (num1) then from zone scatter node to destination scatter node (num2) and at the end from destination scatter to destination node (num3). To find the final count of energy, we sum up all the forms of energy num = num1 + num2 + num3. To find the percentage of energy lost in the whole procedure is x = (num/N)*100. We also find out the energy used at each node for delivery packet from source to destination node.
Figure 6.15 Mesh formation.
Figure 6.16 Minimum spanning tree.
Figure 6.17 Throughput vs. delivery ratio.
6.4.7 Average Delay
Average delay is the delay in time (ms) from source to destination node by every node in the deployment area. We Enter the delay in time (ms) = 100. The average delay is 320.000 ms.
6.4.8 Throughput
It is defined as the total number of packets delivered over the total simulation time. We put the interval time 100 ms. Result of throughput is 420.000 kbps. The results are presented in Figure 6.17.
6.5 Simulation of VANET Network
For simulation of VANETs, we will first put the numbers of nodes in the area. First of all, we will set the coordinates of x and y. Coordinates of x and y is low = 0 (%lower bound to both the axis).
6.5.1 Placement of Nodes
Nodes value should be more than 80. Now, we will enter the sender node and the receiver node. Now, put the value of sensor nodes. In this case, we will put the value of number of sensors = 100 as shown in Figure 6.18.
6.5.2 Sender Node and Receiver Node
Next, we will put the value of sender node = 21 and receiver node = 57. The master nodes and receiver nodes in bold letters are presented in Figure 6.19
6.5.3 Euclidean Distance Between Two Coordinates
Now, we calculate the average distance between two nodes by the mean square root formula of the nodes with the help of coordinates of x and y. We calculate distance in upward, downward, leftward, and rightward direction by the average distance formula. To calculate the nodes in downward direction, select all the nodes down the current node and find out coordinates of node(x) and node(y) and find the down node index. Similarly, we will find out the upward by considering