Green Energy Strategic Management for Service of Quality Composition in the Internet of Things Environment

. With the rapid development of Internet of Things (IoT) technology, the energy consumption of service composition in the IoT environment is a key problem to be studied. At present, the problems of service composition in the IoTenvironment mostly focus on the evaluation research based on quality of service (QoS), ignoring the overall energy consumption in the process of dynamic conﬁguration of service composition. Therefore, we construct the service composition structure for the IoTand propose the QoS evaluation model and energy evaluation model for the service composition in the IoTenvironment. Considering that the service composition in the Internet of things environment is NP hard, moth algorithm (MFO) is successfully applied to the QoS evaluation model and energy evaluation model. The simulation results reveal that MFO has good optimization eﬀect in the abovementioned models, and the optimization eﬀect of MFO is improved by 8% and 6% compared with the genetic algorithm and particle swarm optimization, so as to realize the green energy strategic management of QoS composition in the environment of IoT.


Introduction
In recent years, the development of embedded devices has been rapid along with the growth of Internet of ings (IoT) [1][2][3]. e service-based information system connects the physical reality world and the network virtual world, making the boundary between them gradually blurred [4]. In the IoT, the service-oriented method is widely used and accepted in the development and integration of information [5]. More and more network resources can be freely obtained, such as public data and applications [6]. e traditional information publishing platform is gradually transformed into an open distributed computing infrastructure. With the wide acceptance of service-oriented, service has become the core resource in the network environment [7].
Web services provide the mechanism of service description, service publishing, and service discovery, forming an open, independent, and autonomous distributed environment [8]. In order to ensure the reusability of services, the function of a single service is relatively simple, but in the real application environment, a simple single service cannot meet the needs of users. When a single service cannot meet the complex needs of users, it is necessary to combine a large number of services with simple functions to form a powerful service that can meet the needs of users. erefore, scholars hope to create new and more powerful service functions by combining the existing service integration, so as to make full use of the previous resources, expand and extend the original services, fully tap the potential of Web services, and make them play a greater role [9]. From the perspective of task planning, service composition decomposes complex large-scale tasks and then selects atomic services that can complete the subtask for each subtask. With the continuous development of IoT and Web services technology, more and more functions and processes are packaged into standard Web services and published to the Internet, which leads to the exponential growth of the number of services. In order to ensure the interoperability of various information systems, researchers at home and abroad directly apply the service-oriented framework and Web service standards to physical devices. However, it is not appropriate to apply Web service standards directly in the IoT environment [10].
At present, most of the research studies on the quality of service (QoS) composition focus on the optimization of QoS indicators, and some preliminary results have been achieved [11]. However, how to realize the QoS-based green energy strategic management is still an open problem [12]. In reference [13], hybrid integer linear programming (MILP) is proposed for service selection, in which energy consumption is used as an indicator of QoS attributes. However, the time complexity of ILP increases exponentially with the size of the problem. In view of the limitations of integer linear programming (ILP) [14], service selection is formulated to solve the service composition quality problem with multiple constraints. References [15,16] break through the bottleneck of the classical service composition method which can only select a single candidate service and propose to allow multiple candidate services from a given service class to execute sequentially to improve the QoS of composite services [17]. e advantage of this method is to improve the selection time of the traditional multiconstrained shortest path by introducing the potential path of QoS requirements [18]. In reference [19], service composition is modelled as a path search problem of a directed acyclic graph, and heuristic ant colony algorithm is adopted to search the optimal path in a directed acyclic graph under global constraints [20].
However, the abovementioned research does not fully consider the dynamic nature and the complexity of service state in the optimization process [21,22]. In reference [23], K-means clustering technology is used to divide candidate services into clusters with roughly the same attributes. ese different clusters can be used to determine the best service composition under the condition of satisfying global QoS constraints [24]. Firstly, the QoS value is defined as a discrete random variable with probability quality function, and then, simulated annealing algorithm is used to select service composition satisfying global QoS constraints [25,26]. e advantage of the abovementioned method is that it can be optimized according to the QoS attributes that users are interested in, for searching the QoS composition path that satisfies the actual needs of users [27,28]. In references [29,30], the paper proposes the service composition selection by minimizing the weighted sum of energy consumption and response time.
To solve the abovementioned problems, this paper models the QoS evaluation and energy consumption of the QoS-based composition problem in the IoT environment and applies MFO algorithm to the abovementioned model successfully. Considering the quality of service composition and energy consumption, this paper puts forward the QoS evaluation model and energy evaluation model in the IoT environment and applies MFO (month flame optimization) algorithm to the QoS evaluation model and energy evaluation model successfully. e experimental results show that compared with PSO (particle swarm optimization) and GA (genetic algorithm), MFO can obtain the best QoS and effectively reduce energy consumption, so as to realize the green energy strategic management of service composition quality in the Internet of ings environment. e main contributions of this paper are as follows: (1) most of the service composition problems in the Internet of ings are focused on the evaluation of quality of service (QoS), ignoring the overall energy consumption in the dynamic configuration of service composition.
e service quality evaluation model and energy evaluation model of service composition in the Internet of ings environment are proposed to solve the abovementioned problems; (2) the month algorithm (MFO) is successfully applied to the QoS evaluation model and energy evaluation model. In addition, good optimization effect has been achieved. e rest of this article is designed as follows. Section 2 gives the structure and model design of QoS composition in IoT. In Section 3, the QoS-oriented green energy management model for IoT is studied. Section 4 conducted simulation experiments and analysed the results. Section 5 summarizes the full text.

Structure and Model Design of QoS Composition in IoT
How to realize the optimal selection of QoS composition in the IoT environment to meet the actual needs of users for services is an NP hard problem. At present, a large number of literature research mainly focuses on QoS-based service selection. However, with the increase of service categories, each candidate service generates energy consumption, which makes the overall energy consumption increase. erefore, QoS evaluation and energy consumption evaluation are of great significance for the optimization of service composition. erefore, structure and model design of QoS composition in IoT is the core research.

Multilayer Architecture Design of IoT.
IoT is closely related to a ubiquitous network, and its hierarchical structure is also very similar to a ubiquitous network. e multilayer structure of IoT includes a perception layer, access layer, network layer, support layer, and application layer, which is shown in Figure 1. e perception layer mainly realizes the collection and information processing. e research content of the sensing layer is how to achieve the goal of miniaturization and intellectualization of nodes while saving energy and how to use renewable energy. At the same time, multihop and other research contents of the traditional WSN can be reflected in this layer. e access layer mainly completes the Internet access of all kinds of devices. e network layer is the original Internet, which mainly completes the function of long-distance transmission of information. ere are still many contents to be further studied in this layer, such as Internet of ings content distribution technology. e support layer, also known as the middle layer or business layer, mainly completes three parts of functions: the lower needs cognitive network resources and then achieves the purpose of adaptive transmission; its core content is to complete the expression and processing of information and ultimately achieve the purpose of information sharing; this layer also needs to provide a unified interface and virtualization support; virtualization includes computing virtualization and storage virtualization; the more typical technology is Cloud Computing. e application layer is the comprehensive utilization of information to provide help for users.

Qos Constraint Model in IoT.
Based on the new features of context adding QoS ontology and semantic IOTservices, a QoS constrained service model in IOT is proposed, as shown in Figure 2. Among them, the interaction model shows the relationship between IOT services, service producers, and service consumers; the state model shows the state transition of services; the function model shows the behaviour of services; the three and the relationship between them are marked by the QoS ontology of relevant ontology in the knowledge base.
In the service model based on the Internet of ings shown in Figure 2, the protocol of the underlying sensor may be quite different from the transmission protocol of the Internet, so there is a home gateway between the two network protocols. Home gateway is responsible for the access of nodes in a small range. Either ID or home protocol are not supported at the same time. In addition, objects may use a variety of physical layer transmission methods, such as wired, WiFi, ZigBee, or Bluetooth, so the home gateway must also have the function of heterogeneous network access. In the case of coexistence of various heterogeneous and same frequency wireless transmission modes, how to reduce the interference between various wireless transmission modes is particularly important, such as the interference problem when ZigBee and WiFi coexist.
After the introduction of object mobility, the network architecture may also need to introduce an access gateway (located between the home gateway and the regional server), which is mainly responsible for the mobility management of nodes in a larger range and the management of existing IOT devices. Of course, if the home gateway is powerful enough, the mobility management of objects can be completed directly in the home gateway under the guidance of a network flattening idea. From the networking technology of the Internet of ings discussed before, the gateway based on DTN is more suitable for architecture of the IoT, so the home gateway discussed here can be implemented in the way of DTN. However, in order to meet some real-time applications (such as actuator control and alarm), the home gateway must have the priority-based data transmission function.

Dynamic Composition Framework of Internet of ings
Services Based on QoS. Figure 3 shows the core functions of the dynamic composition framework of QoS-based semantic IoT services; it also shows the dynamic composition model based on QoS and how to optimize the combination mainly including the following modules: (1) Service preliminary screening module: the module analyses the user's direct request for the target service, and the related domain ontology forms the standard service request description file, carries on the preliminary matching with the service in the service library, and obtains the candidate service set.
(2) Restricted service description file generation module: the module senses the context information related to users and physical devices through the sensing devices around the physical devices mapped by users and candidate service sets. With the support of context-added QoS ontology, the module calculates the impact of context information changes on the QoS information of services required by users and services provided by physical devices and forms a standard Q without a semantic conflict service description file of OS restriction. (3) QoS-based service selection module: after dimensionless processing of QoS parameter values of the request service description file and each service description file in the candidate service set, atomic matching and aggregate matching are carried out, respectively, and compared with corresponding atomic threshold and aggregation threshold, and one or more subservices that meet some or all requirements of users are selected to form the service set to be combined. (4) Service composition module based on graph search: the module dynamically constructs the directed graph of the service and the input/output data of the service set to be composed and obtains one or more new services that meet the specific conditions. e

QoS Evaluation Model in the Environment of IoT.
Assuming that a composite service can be composed of N services with different functions, all services can be divided into n classes according to their corresponding functions, which are called service classes. Assuming that there are m atomic services in each service class, each service is called a candidate service. e core processing idea of the QoSdriven service composition model is based on the corresponding QoS attribute requirements, and a candidate service is selected from each service class, so as to find a service sequence that can make the QoS attribute optimal or better.
We pay attention to the QoS evaluation model in the Internet of ings environment. T � T 1 , T 2 · · · T i · · · T D is defined as a complex Internet of ings service, where D means the service categories for a service.
Each service category T i contains C i specific service S j i , where i is the service category, j means the number of following services, and j � 1, 2, · · · C i , the set of QoS metrics used to evaluate each candidate service. Figure 4 describes the main process of service composition of IoT. As can be seen from Figure 1, the goal of IOT service composition is to select the best path to satisfy the service requirements of customers. eoretically, there are D j�1 C i service composition paths. e path of QoS composition simplifies as x � x 1 , x 2 , x i , . . . , x D , where x i is the candidate service for executing the i − th service category, where 1 ≤ i ≤ C i . Generally, according to several reduction principles, serial, parallel, and circular structures can be converted into sequential structures when evaluating paths with QoS metrics.
We suppose that the QoS parameter value of each service { }, and indicators are estimated, considering the specific rules and the characteristics of the QoS indicator. e target is defined as where w 1 , w 2 , w 3 corresponds to the weight of each QoS indicator, which is set to 1/3 in this paper.

Energy Assessment Model Based on IoT.
e objective function of the energy evaluation model is defined as follows: where T and N ES are number of system segments and energy services (ES). ES includes various kinds of power generation services, such as photovoltaic (PV) service, wind turbine (WT) service, battery (BAT) service, and fuel cell (fuel cell) service cell (FC) service, and microturbine (MT) service; i is the number of ES categories. P i (t) is the power generation at time t, and η i is the generation efficiency of the i − th ES. C run is the operating cost of each ES; C om is the maintenance cost of each ES. C Grid is the power price grid, and P Grid is the exchanged power. e power balance constraint equation is as follows: where P Load (t) is the load power at time t and P ESO (t) is the discharge power of ES at time t. Equation (3) illustrates that the IoT-based energy management must meet the total power balance conditions in the whole period. e power constraint equation is as follows: where P ES,min and P ES,max are minimum and maximum limits of the ES output; ΔP ES,down and ΔP ES,up are the maximum reduction and increase of power per unit time of ES.

Green Energy Model of Internet of ings by Adopting
Moth Algorithm. Because the QoS composition in IoT is an NP hard problem, the traditional mathematical methods have some problems such as high computational complexity and low efficiency. e intelligent optimization algorithm has better optimization effect in solving the abovementioned problems. e references show that MFO has better optimization effect and higher stability than the traditional intelligent optimization algorithm in single peak function, multimodal reference function, and composite reference function. erefore, this paper selects MFO to simulate QoS evaluation model and energy evaluation model. e population size of moth is n, and its flight space is d dimension, which is the same as the number of service categories. Initial population x 1 , x 2 · · · x n where X i is the position of the moth. x i is produced by the following equation:  where dub and lb d are the upper and lower limits of d-dimension, respectively, and rand(0, 1) rand (0, 1) is a value randomly generated between (0, 1). FMO defines the moth population and the corresponding fitness value, the flame population, and the corresponding fitness value by combining the specific trajectory of moth tending to artificial light. By updating the moth population in the form of helix and calculating the fitness value of the evolutionary moth population, the optimal fitness value and corresponding solution are obtained. In this algorithm, the updation of moth position is as shown in the following equations: where F j means the moth position, M i is the flame position, and D i shows the distance between the position of the moth and the position of the flame. It can be seen from formula (7) that the position update of the moth is relative to the position of the flame. Let t in formula (8) be a random digit between [r 1] in the iterative process. In this way, the moth can make better use of the corresponding flame in the iteration process.

Simulation Parameter Setting.
Due to the lack of a common data set, the service composition problem in the IoT environment is simulated by using the data set with composite QoS attributes according to the references. In order to verify the effectiveness of the algorithm, MFO is compared with PSO and GA. Software environment: Microsoft Windows 10 professional edition (64 bit), version number 16299, Matlab r2015a. Hardware environment: inter (R) core (TM) i7-6700 CPU @ 3.40 GHz, 3408 mhz, 4 cores, 8 logical processing units, 8.00 gb physical memory, 1 t hard disk. e experimental parameters are set as follows: for the QoS evaluation model, the QoS attribute value of each service is randomly generated, and the service category D and candidate service C increase from a small value. For the energy consumption evaluation model, the duration of sample interval Δt is 1 h, and total duration was 24 hours. i is the category of energy services, and the initial population N is the number of candidate services. In the experiment, two cases were selected: i fixed at 72, N increased from 100 to 1000; n fixed at 100, I changed from 72 to 720. e parameters of GA are shown as follows: the population number is 100, iterations are 200, fitness normalized elimination acceleration index is 2, crossover probability is 0.8, and mutation probability is 0.05. e initial position is random. e main parameters of PSO are as follows: the max iterations are 800; number of independent variables of objective function is 2; particle swarm size is 50; and individual learning factor and social factor of each particle are 2.

Validation of the QoS Evaluation Model.
In order to verify the change of an individual's maximum fitness with population algebra, firstly, the number of service classes in composite service is set to 45, and the number of candidate services in each service class is 35. e corresponding test data are generated by the range of QoS attribute generation.
As is revealed from Figure 5, the performance of MFO algorithm is obviously better than that of GA and PSO algorithms under different number of alternative services. e difference is smaller and more stable. We can obtain that MFO has better global optimization ability and can find the global optimal solution of the service composition problem with greater probability.
At the same time, the fitness function value of the QoS evaluation model in Figure 5(b) decreases with the increase in the number of iterations. With the increase in iteration times, the error of fitness function gradually decreases, which shows that the optimization efficiency of MFO is higher than that of particle swarm optimization and genetic algorithm. MFO algorithm can reach the convergence state after 1000 iterations, which is more efficient than 1300 and 2200 times of PSO and GA. is also indirectly shows that the optimization strategy based on moth algorithm is better than particle swarm optimization and genetic algorithm. e sharp increase of GA results is mainly caused by three reasons: the multisolution genetic algorithm does not converge, the initial feasible solution has problems, and the evaluation function is not distinguished enough.

Validation of the Energy Evaluation Model.
In order to obtain the best combination of QoS, the method of choosing proper parameters is the same as that in the QoS model. In this simulation, MFO, PSO, and GA are selected to estimate the energy consumption under different parameters. Figure 6(a) shows that the optimization effect of MFO on the energy consumption evaluation model is significantly better than PSO and GA.
In Figure 6(b), simulation results reveal that the energy consumption of MFO-based service combination in the Internet of ings environment is significantly less than that of PSO and GA algorithm. In addition, Figure 6(b) shows that, with the increase of candidate services, energy consumption also increases because each service category selection will generate energy consumption, and a linear relationship existed. Also, the optimization effect of MFO is improved by 8% and 6% compared with the genetic algorithm and particle swarm optimization.

Comparison of QoS Energy Consumption in Internet of
ings. In order to verify the design advantages, we compare the performance and energy utilization of the hierarchical management data centre and the UN optimized hybrid data centre. We use professional precision power and energy meters to detect the energy consumption and power consumption of the server in real time and monitor the number of requests waiting for the queue to accumulate to analyse its performance. Figure 7 shows the change in tasks number in queue with time. e larger the value, the more serious the task accumulation, the lower the performance of the data centre, and the more difficult it is to meet the computing requirements. Complexity Figures 7(a) and 7(b) shows the change in the length of the task waiting queue with time under the traditional and QoS-oriented strategies, respectively. e traditional task-scheduling mode lacks the control and allocation of random arriving tasks, so the data centre has the phenomenon of uneven task allocation and certain task accumulation. Compared with Figure 7(a), the tasks in the waiting queue in Figure 7(b) can be very fast. On the one hand, it shows that the hierarchical organizational structure can improve the performance of the hybrid data centre, that is, the waiting time of tasks; on the other hand, it also shows that there is free space for computing resources in the case of layering. Even if some computing resources are shut down, some of them may still meet the computing needs, and there is a potential to trade performance for energy efficiency.
In Figure 8, we compare the overall energy-saving effect of the data centre under different sleep states. We directly measured that the power consumption of all servers (hybrid data centre system) is about 8% of the maximum power in Figure 8 8 Complexity represents the sleep ratio of servers in the central data centre. It can be seen that, with the growth of dynamic sleep time, the data centre can save more energy, but this energy efficiency advantage is also affected by the data centre performance constrained, that is, when the closed computing resources are too much or the data centre computing resources are not enough, leading to a serious decline in the QoS. In the experiment, moderate load integration and collective sleep strategy for all levels of IOTdata centre can bring more than 12% energy saving. In conclusion, in view of the IOT environment, the hierarchical organization structure of service composition can be realized reasonable management and planning of computing resources, and the reasonable collective sleep strategy in this hierarchical structure can further improve energy efficiency with low performance impact.

Conclusions
In this paper, aiming at the deficiency of traditional methods only based on QoS evaluation to optimize services in the IoT environment, this paper proposes a QoS evaluation model and energy evaluation model of QoS-based composition and successfully applies MFO to the QoS evaluation model and energy evaluation model. Simulation results reveal that MFO algorithm has more remarkable optimization effect than PSO and GA. erefore, when MFO is used to solve the service composition problem, it can not only satisfy the requirements for QoS in the Internet of ings but also achieve optimal energy efficiency. It is proved that MFO has better large-scale processing ability and global optimization ability than traditional genetic algorithm and PSO and can find the global optimal solution of the QoS composition problem with greater probability. In the next step of research, we can obtain real data sets from experiments to evaluate the QoS of composition and energy consumption under the IoT. In addition, MFO has strong performance, but it is possible to fall into local optimum. erefore, we can consider combining MFO with other intelligent optimization algorithms to improve MFO for overcoming the local optimization for the QoS problem.

Data Availability
e data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
e authors declare that they have no known conflicts of interest or personal relationships that could have appeared to influence the work reported in this paper.