4.2.1. Scenario 2(1): 25 VMs for Single DC and Power Storage

In this scenario, the effect of battery storage devices has been verified through simulations using the same performance metrices. Firstly, RT of the system is computed which is shown in Figure 13. RT of the system is optimized using the ESCE, RR and SJF algorithms which are used in the previous scenario. The RT of fog 1 is 50 ms, 43 ms and 42 ms; fog 2 is 45 ms, 43 ms and 42 ms; fog 3 is 49 ms, 43 ms and 42 ms; fog 4 is 48 ms, 43 ms and 42 ms; fog 5 is 38 ms, 35 ms and 34 ms; and fog 6 is 43 ms, 40 ms and 39 ms, respectively. Here SJF beats the other algorithms: ESCE and RR up to 16% and 14% for fog 1; 7% and 14% for fog 2; 15% and 14% for fog 3; 13% and 14% for fog 4; 11% and 14% for fog 5; and 10% and 14% for the fog 6, respectively.

**Figure 13.** RP of All the Consumers in Scenario *2(1)*.

Analysing the RT of the scenario, it is observed that SJF outperforms the other two algorithms due to the incorporation of the battery storage resources. RPH of this scenario is displayed in Figure 14 which is kept as the same according to the population of each region.

**Figure 14.** RPH of All the Consumers in Scenario *2(1)*.

Now the PT of each fog has been optimized for this scenario using these algorithms: ESCE, RR and SJF as shown in Figure 15. Each fog has optimal PT as: 11.5 ms, 7.5 ms and 6.5 ms for fog 1; 12.5 ms, 7.5 ms and 6.5 ms for fog 2; 11 ms, 7.5 ms ad 6.5 ms for fog 3; 11.3 ms, 7.5 ms and 6.5 ms for fog 4; 8.5 ms, 7.5 ms and 6.5 ms for fog 5; and 3.5 ms, 2.5 ms and 2.25 ms for fog 6. SJF beats the ESCE and RR upto 44% and 14% for fog 1; 46% and 14% for fog 2; 41% and 14% for fog 3; 43% and 14% for fog 4; 24% and 14% for fog 5; and 36% and 10% for fog 6.

**Figure 15.** PT of All the Consumers in Scenario *2(1)*.

The cost is also minimized up to 15% of the total cost of the scenario *1(1)* with the incorporation of the battery storage resources. It is displayed in Figure 16. Overall, RT and PT of this scenario have improved up to 15% with the integration of the battery storage resources as compared to scenario *1(1)*.

#### 4.2.2. Scenario 2(2): 50 VMs for Single DC and Battery Storage

In this scenario, battery storage devices are used with the increased number of VMs and DCs as compared to the scenario *2(1)*. The purpose of this scenario is also based on the optimization for the similar performance parameters. The RT is computed as: 30.5 ms, 27.5 ms and 26.75 ms for fog 1; 28.5 ms, 27.5 ms and 26.75 ms for fog 2; 30.5 ms, 27.5 ms and 26.75 ms for fog 3; 30 ms, 27.5 ms and 26.75 ms for fog 4; 25 ms, 22.5 ms and 21.5 for fog 5; and 22.5 ms, 21.5 ms and 19.5 ms for fog 6 as demonstrated in Figure 17. From these three algorithms, our proposed algorithm performs the best. It outperforms ESCE and RR up to: 13% and 3% for fog 1; 7% and 3% for fog 2; 13% and 3% for fog 3 which is similar to fog 1; 11% and 3% for fog 4; 14% and 3% for fog 5; and 14% and 10% for fog 6.

**Figure 16.** VM, MG and Data Transfer Cost.

**Figure 17.** RP of All the Consumers Scenario *2(2)*.

RPH is also kept similar in this case as displayed in Figure 18 for each region throughout the simulation.

**Figure 18.** RPH of All the Consumers in Scenario *2(2)*.

After discussing the RPH and RT, PT of the proposed framework is computed which is shown in Figure 19. The PT for all fogs is computed as: 6 ms, 3 ms, and 2.5 ms for fog 1; 5.5 ms, 3 ms and 2.5 ms for fog 2; 5.15 ms, 3 ms, and 2.5 ms for fog 3; 5.15 ms, 3 ms and 2.5 ms for fog 4; 3.5 ms, 3 ms and 2.5 ms for fog 5; and 1.5 ms, 1 ms and 0.75 ms for fog 6. In this case, previous algorithms compromise the performance where SJF performs efficiently using the storage devices. SJF outperforms ESCE and RR up to: 59% and 50% for fog 1; 55% and 50% for fog 2; 52% and 50% for fog 3; 52% and 50% for fog 4 which is similar to fog 3; 29% and 3% for fog 5; and 50% and 25% for fog 6, respectively.

**Figure 19.** PT of All the Consumers in Scenario *2(2)*.

The total system cost is shown in Figure 20. It improves the cost up to 15% of the scenario *1(2)* by installing the battery storage resources and by considering the electric vehicles.

**Figure 20.** VM, MG and Data Transfer Cost.
