*1.1. Motivation*

Previous studies [10–12] have incorporated the cloud services in SG environment. Cloud computing based infrastructure has been presented for the future generation power grid by Luo et al. in [10]. Authors have considered the charging and discharging schedules of the electric vehicles in a decentralized manner to procure the load shuffling facility [11]. The scheduling problem is formulated with the help of mixed discrete programming technique. However, they have not incorporated the cloud platforms by organizing the demands of electric vehicles' customers. Another decentralized algorithm for optimally scheduling the electric vehicles charging has been proposed by Gan et al. [12] and the proposed algorithm has led to the exploitations in terms of electric vehicles loads for filling the valleys in their load profiles. Fog computing [13] is integrated as the middle layer between the consumers and cloud environment. It minimizes the latency and improves reliability of the cloud services. All of the aforementioned studies are either based on the cloud or

fog based environment. None of the earlier techniques are based on the fog and cloud environment together for the optimal resource allocation. Although, cloud provides on-demand availability of the resources; however, it degrades the latency and effects Response Time (RT) for the consumers which creates frustrations. Fog computing resolves these issues very efficiently. We have proposed the concept of C2F2C based environment in order to minimize the latency and efficient scheduling of the resources in the residential buildings. This study also considers the optimal RT, cost of data transfer, MG and Virtual Machines (VMs), consumers' requests time and PT, which is provided by fog computing.
