Energy Optimization of Fog Computing and IoT Application

The Internet of Things (IoT) and the 5G app need many services to be real, as they have very limited processing and storage resources, and their cloud computing connection is a relevant factor and great interest for researchers from all over the world. Latency, big data, storage, and power processing problems near high-end devices led to the appearance of fog computing. Fog computing is the interconnection between IoT devices and cloud computing and can bring processing and storage capacity to IoT devices, making it possible for new technologies and applications to address these flaws today. This paper introduces the concept of fog computing, its challenges, theoretical context, implementation and implementation of fog computing, and the application of a genetic algorithm for the distribution of resources for IoT devices using integrated systems platforms and comparing their results with those obtained by a high-performance server. The Fog-Sys system was developed with the main objective of simulating, receiving, verifying, and storing data from IoT devices to be transferred to the cloud computing, and it works like a fog computing to provide the storage as a service (StaaS) service. Also using a fuzzy genetic algorithm (FGA) to try to reduce the energy consumed. The results showed that implementing this service in the built-in system devices can be a good alternative to reduce one of these problems, in this case, storing data and reducing the energy consumed, which today affects IoT devices.


Introduction
Cloud computing and the Internet of Things (IoT) are two very different technologies that are already part of our life. It is expected that their adoption and use will become increasingly widespread, making them important components of the Internet of the Future. A new paradigm in which Cloud and IoT are linked together is the meaning that there will be advanced technologies to facilitate a large number of application scenarios in everyday life. Thus, Cloud IoT emerges an innovative IT paradigm in which Cloud and IoT, two complementary technologies, have joined to merge with the current and future Internet. In the last decades, it has been observed that computing services such as storage, data processing, and control have been migrated to the "cloud" [1].
The opportunity for unlimited computing in the cloud allows end-users to access extensive information easily, it is also possible to see that mobile devices and sensors, such as smartphones, have become powerful equipment, which has led to the emergence of new systems and applications. These systems and applications introduce new functional demands in computing and networks that the "cloud" alone cannot meet in this scenario, it is realized that local computing at one edge of the network is often necessary. For example, to process data in real-time, create location recognition contexts from local sensors, and maximize the efficiency of wireless communications at the edge of the network. However, the cloud is too far away from IoT devices to satisfy latency requirements and is too centralized to deal with contextual heterogeneity and diversity in a local area, it is also very costly to load all individual sensor data into the cloud [2]. To overcome these limitations, portions of the cloud computing capacity move to the edge of the network and form a local computing environment, that is, a "Fog Computing" also called "fog". By distributing computing and network services closer to where user data is generated, Fog Computing better meets emerging demands [2]. Fog Computing can solve many Internet of Things (IoT) problems, for example, Fog services will be able to improve the bandwidth and cost constraints of long-range communications. However, many challenges still remain in fog computing, such as modeling a system architecture for Fog; how to implement, organize and manage fog devices; how fog interacts with the cloud and devices; and how to manage fog's physical and logical connectivity. Also modeling the consumed energy by applying the fuzzy genetic algorithm (FGA) [2]. This paper clarifies and tries to solve the problem of allocating resources between fog and clouds and mobile phones.

Structure
The Fog Computing concept was adopted by Cisco Systems as a new paradigm in 2012. Fog Computing is an innovative paradigm that performs distributed computing, network, and storage services, as well as communication between Data-Cloud Computing Centers to devices along the edge of the network [3]. This communication expands the operations and services inherent in computing in the cloud, thus allowing a new generation of applications. The main function is to filter and aggregate data to Cloud data centers and apply logical intelligence to devices final. Before transferring data to the cloud, you should be able to decide what to send (content), how (data format) and when to send (time). During this process. Here in this paper, we will benefit from the application of fog computing to reduce energy consumption by resource allocation [3]. The cloud computing networks that operate on the fifth-generation technology(5G) provide high performance of data processing and storage, and the data and information sources can be easily accessed. One of the solutions proposed to reduce latency time and reduce the energy consumed is to identify the sources for all of the totals of data required for implementation always and put them in the fog network nodes.
This model presented will help reduce the time required to reach the cloud servers and thus will reduce the energy consumed. The sources will be determined through the application of the FGA. Initially, a genetic algorithm is applied where the method of making genetic algorithms is inspired by the processes that occur during the evolution process in living organisms, and these processes are natural selection (genetics), crossover, mutation, and genetic algorithms are that it is a programmatic system where there is a set of solutions (Demographics) of a specific problem, which evolves and evolves to be better [3].
After the genetic algorithm is applied, a set of conditions representing a vague logic can be assigned to the identification of vectors and vectors. Where conditions of fuzzy logic are entered through the use of IF-THEN instructions, and through these conditions, he will control the selection process of children in the list of the new generation in addition to the mutation that will occur in the genetic algorithm and fitness process, matrices are used to store the rules of fuzzy logic, and elements are displayed in a form Essential for determining the degree of affiliation, i.e. [4]. Fuzzy groups are included in the fog group (0-1) when presenting slides and platforms. It is necessary to check the conditions of fuzzy logic to be applied within the genetic algorithm (GA) because wrong, incomplete or uncertain conditions lead to disorganized results. The following figure sets the framework for the FGA algorithm.

Methodology
The fuzzy set is the membership function. We denote by µ (x) the degree to which the element x belongs to a fuzzy set, which is a generalization of the concept of the characteristic function of an ordinary set. Then a fuzzy set C is a set of ordered pairs of the form C = {µ (x) / x}, and µ (x) can take any values in the interval [0, 1]. The value µ (x) = 0 means the absence of membership in the set, 1 -full membership. We have already mentioned that through the application of fuzzy logic, a set of rules must be established that are applied to the functions of the genetic algorithm [5], and they are applied through the use of (if-then) as following If x 1 =O 1 and x 2 =O 2 , and xa is ad then class1, 1 ≤ k ≤ M Where (x1 ...... xn) is dimensional model vectors, and (O1, ... ,O2) parameter represents fuzzy set and class1 is the class name of the algorithm.
To determine the harmony grade of each training model xO={xO1,xO2,….,xOn} with (IF-THEN) rule of fuzzy [5] μ(X O )= μ(X O1 )× μ(X O2 )×……×μ(X On ) (1) The first population for the GA based inquiry calculation has been arbitrarily browsed all conceivable subset mix of v properties. After that, the GA algorithm will use crossover and mutation functions, where you will choose the best value element for the production of the new generation, according to the rules of fuzzy logic, and then you will apply these rules to mutation functions. The mutation is a strategy for creating new chromosomes to investigate new areas of the pursuit space. The non-uniform change was created by (Michalewicz) to handle numerical parameter streamlining issues. This operator is a dynamical and versatile transformation administrator which can diminish the hindrance of irregular change in GA. Be that as it may, the encoding technique for fluffy rationale rules and participation work in this paper depends on the whole number, so the estimation of the quality chose for transformation ought to be adjusted to the closest whole number. It very well may be delineated as follows [6].
We use this equation above to calculate total energy consumed, hop represent the number of hop in simulation according to at the used topology [7].

Results and Discussion
Through the proposed algorithm in the fog network layer where we have made the resources that the user repeatedly requests, where I am like cache memory. In the following figure2, it shows the allocation of the required resources repeatedly as a percentage is allocated according to the frequency in the fog network and by increasing the implementation time.  The values shown in the previous table show a decrease in the total energy consumed over time, as the values decrease as the time increases, the energy consumed is measured in joule. After distributing the sources according to the frequency and the use of fog as a temporary memory, we will notice reducing the mobile's energy consumption.