Optimization of building integrated energy scheduling using an improved genetic whale algorithm

Renewable energy generation has become the general trend with increasing environmental problems. However, the instability of renewable energy generation and the diversification of user demand are highlighted and the optimization of energy scheduling has become the key to solve the problem. This study introduces an energy scheduling optimization model tailored for building integrated energy systems, encompassing elements like gas turbines, wind and solar modules, ground source heat pumps, electric vehicles, central air-conditioning, and energy storage. The model prioritizes economic efficiency and minimal carbon emissions by first collecting and pre-processing the data for the regional building conformance, and then utilizing an enhanced multi-objective genetic whale algorithm. Evaluations on a regional complex building highlighted the algorithm’s robust convergence and stability. The resulting optimized scheduling effectively balances economic and environmental concerns, reducing costs by about 92.896 yuan per day on average and reducing carbon emissions by about 0.091 tons, promoting efficient system operation, reducing costs and mitigating environmental impacts.

optimal energy management of the home microgrid system integrating photovoltaic and battery energy storage is proposed, and energy consumption and PV generation are managed through the integration of batteries.Both methods effectively ensure energy efficiency and balance the cost to a certain extent 10,11 .Lastly, considering the different needs of different users, the combined supply of cold, heat and electricity is introduced as the core power supply unit.An optimal scheduling approach is proposed that possesses flexibility and accounts for uncertainties in building heat load, while simultaneously considering the balancing of cold, heat, and electricity, as well as equipment constraints [12][13][14] .By integrating various algorithms, the optimization of comprehensive energy scheduling for buildings is achieved.Algorithms such as the Grey Wolf algorithm, multi-objective whale algorithm, and particle swarm algorithm, among others, have demonstrated the potential to enhance energy scheduling efficiency [15][16][17][18][19] .Aiming at the uncertainty of renewable energy, robust optimization is proposed, rolling optimization theory is applied to emergency energy scheduling, and weight factors are introduced into the optimization model to balance the importance of reducing and retaining power 20,21 .For the study of energy efficient building management systems, through data-driven optimization models and heating and cooling air conditioning systems, combined with indoor comfort environment, to maximize the comfort index while minimizing energy consumption 22 .In summary, the majority of the aforementioned literature focuses on comprehensive energy systems within industrial parks and isolated islands, aiming to facilitate the interconnection and conversion of electricity, heat, and gas sources.Additionally, these studies incorporate carbon trading mechanisms to account for the environmental impact of carbon emissions.On one hand, due to the inadequate energy structure prevalent in many buildings, the demand for diverse energy sources is increasing.On the other hand, the use of various equipment in buildings exhibits considerable potential to improve energy efficiency and curb carbon emissions.
Therefore, a new multi-objective optimal scheduling model is proposed in this paper, which combines genetic algorithm with improved whale algorithm and introduces fitness function to simulate and analyze building energy scheduling.Firstly, the composition of the system's equipment is analyzed, and the energy flow relationships within the system are delineated.Expanding upon the conventional combined cooling, heating, and power supply system, additional components such as wind and solar power generation systems, ground source heat pump systems, and energy storage systems are incorporated.Simultaneously, carbon emissions are introduced as one of the objective functions within the model to constrain economic costs.Finally, by analyzing and processing the collected data, the Pareto optimal solution set is obtained by using the improved multi-objective genetic whale optimization algorithm, and the optimal solution set is derived from it.
This paper is divided into four main parts, and discusses the superiority of the algorithm combined with mathematical model in solving the optimization of building energy scheduling.The first part introduces the establishment of mathematical models of each part of the system and the setting of objective function constraints.The next one introduces the optimization algorithm and the improvement and innovation of the algorithm.The third part analyzes the energy scheduling of the same set of data collected under different algorithms and obtains the load running diagram.The fourth part reviews the optimization objectives and discusses the adaptability of the algorithm in building energy optimization scheduling.Finally, the application prospect of artificial intelligence algorithm in building integrated energy optimization scheduling is prospected.

Building integrated energy optimization scheduling model
This study focuses on the investigation of building integrated energy systems characterized by stable electricity demand and heating (cooling) requirements at the load side.The primary objective is to optimize and reconfigure the conventional supply structure, to attain the minimization of economic costs and carbon emissions while ensuring the fulfillment of cooling, heating, and electricity demands within the building.Figure 1 illustrates the flow chart depicting the optimization process of building integrated energy systems.

Objective function
Optimizing and dispatching building integrated energy involves addressing a multi-objective quandary.In addition to considering system operating costs, environmental factors must also be taken into account.The attainment of both minimum system cost and carbon emission reduction is adopted as the objective function, wherein operation and maintenance costs encompass equipment, operational, and maintenance expenses, while carbon emission predominantly refers to carbon dioxide emissions.
In the context of this context,f toc , and f toe denote the variables representing operating and maintenance costs, as well as carbon emissions, respectively.
where, f B represents the cost of equipment,L represents the electric vehicle; M stands for gas turbine; N stands for ground source heat pump.
where, f G represents the expenditure for the acquisition of gas.M i symbolizes the i gas turbine.P M (t) denotes the generated power output by the gas turbine in a specific period, t. f g (t) represents the cost associated with the procurement of natural gas during the mentioned period, t.
where,N i symbolizes the I platform source heat pump, whereas P N (t) represents the power generated by the ground source heat pump in the specific period denoted as t.f e 1 (t) signifies the price of electricity procured from the grid during the same period t.P i (t) represents the power consumption of unit i, while f e 2 (t) denotes the price at which electricity is purchased from the grid during the aforementioned period.
where P s (t) and f es (t) represent the selling power and selling price of the t period respectively.
where,η 1 , η 2 , η 3 represents the utilization frequency of electric vehicles, heat storage tanks, and cold storage tanks, P Ein (t), P Eout (t) represents the power stored and discharged by the electric vehicle during period "t".P Hin (t), P Hout (t) denotes the heat storage and heat release power associated with the heat storage tank during the period "t", and P Cin (t), P Cout (t) represents the power employed for storage and refrigeration in the storage www.nature.com/scientificreports/tank during the period "t".Finally, f p (i), and f w (i) signifies the fixed maintenance costs for photovoltaic and wind modules, respectively.
where,E g t,t+1 , E e t,t+1 respectively denote the rate of natural gas and electricity consumption per unit of time.η g,co 2 , η e, and co 2 respectively signify the conversion factors for carbon dioxide emissions resulting from the com- bustion of natural gas and the generation of thermal power from electricity.

Constraints on the balance of cooling, heating, and electricity
The equilibrium between energy supply and demand within the system primarily encompasses the balance of electrical power, thermal power, and cooling power.
where,P b (t), P PV (t), P WT (t) signifies the purchased power, photovoltaic power, and wind power during the period t, each respectively.P Ei (t), P Hi (t), and PCI (t) respectively denote the periods associated with the user's electricity, heat, and cooling load.η h1 represents the heating efficiency of the waste heat boiler in the gas boiler system, η h2 , η c and represents the heating and cooling efficiency of the ground source heat pump.

Constraints on the energy storage system
The energy storage system mainly includes electric storage, heat storage, and cold storage devices.The energy storage device does not generate and consume energy spontaneously but only realizes energy transfer on a time scale.Take the electric storage device as an example: where,S min E and S max E are employed to signify the lower and upper bounds of the electric storage device, respectively.Correspondingly, P max in and P max out are utilized to denote the maximum charging power and maximum discharge power, respectively.e is indicative of the charge and discharge status of the storage device, constrained between the range of [0, 1].

Constraints on device running
In scenarios where the gas turbine's output is relatively low, the economic cost is considered, and a shutdown threshold is established to prevent inefficiencies arising from low generation efficacy.Accordingly, the gas turbine's output must surpass the predetermined shutdown power.The constraints are outlined as follows where, φ M represents the shutdown factor associated with a gas turbine, while P max M denotes the maximum output power generated by the gas turbine.On the other hand, other devices do not impose any shutdown constraints.To illustrate, let us consider the ground source heat pump, which is subject to the following operational constraints: where P max N symbolizes the maximal power output of the ground source heat pump.

Constraints on power purchase and sale
where,P min b and P max b are used to signify the minimum and maximum power purchased, respectively.Similarly, P min s and P max s are employed to denote the minimum and maximum power sold, respectively.

Multi-objective whale optimization algorithm
The optimization scheme suggested in this research for building integrated energy scheduling necessitates the simultaneous consideration of economic and environmental aspects, thereby establishing it as a multi-objective A visual representation of the WOA principle is illustrated in Fig. 2.

Based on improved multi-objective whale optimization algorithm
To enhance the convergence speed and prevent the Whale Algorithm from converging to local optima, this study incorporates the Genetic Algorithm (GA) and refines its fitness model.This integration serves to augment the global search capability and convergence speed of the Whale Algorithm, while concurrently ensuring the population's diversity and elevating the algorithm's accuracy.

Whale algorithm
After setting parameters, the whale position and fitness are first initialized, and when the global optimal solution and the whale optimal position are updated later, it is easy to fall into the local optimal.Therefore, optimization methods such as genetic algorithm are introduced later.Figure 3 shows the process of the whale algorithm initializing and updating the optimal solution.

Cross operation
Crossover is the driving force of genetic algorithm, resulting in the structured and accidental exchange of genetic material between solutions, and it is possible that special chromosomes produce better chromosomes, and random crossover is a necessary process of genetic algorithm.Figure 4 shows the random crossover of genetic algorithm.

Mutation operation
After cross operation, the chromosome is maintained in the mutation process.This operation is designed to prevent the genetic algorithm from falling into local minima.Mutations have two main purposes, one is to restore extinct genetic material, and the other is to destroy genetic information.Appropriate mutation probabilities can maintain the diversity of the population 23 .Figure 5 shows the compilation operation process.

Genetic algorithm fitness function improvement
To address the necessity of balancing the global and local search capabilities within the Whale Algorithm, this study proposes the integration of an adaptive weight mechanism alongside the calculation of an individual's relative position within the entire population to enable adaptive position updates.The conventional adaptive weight approach solely divides the whale individuals into best, worst, and average groups, wherein the classification of most general group individuals remains inadequate.In this paper, an enhanced adaptive function fitness model is introduced, enabling a more detailed classification of general group individuals into superior, inferior, and ordinary groups.The specific workflow proceeds as follows: the fitness of individual whales in the population is ranked in ascending order, generating the respective averages for the preceding, succeeding, and  1.In circumstances where the fitness value f(i) of an individual whale falls below a certain threshold, it signifies that said individual belongs to the optimal group within the population.In response, a minor weight value is assigned to reinforce its local search proficiency.

When the fitness value f(i) of an individual whale falls within the interval [lower bound] and [upper bound],
it signifies that said individual belongs to the general group within the population.Consequently, a weight value of 1 is assigned, ensuring that the individual can continue approaching the optimal position through the algorithm mechanism.3. When comparing the fitness value f(i) of an individual whale with that of the optimal whale, a situation arises wherein the former surpasses the latter, signifying the individual's classification as belonging to the inferior group within the population.In this case, it becomes imperative to reinforce its capability for global exploration.This is achieved by selecting a larger or smaller weight, with a probability of 50%, to facilitate the prompt evasion of local optima.
To achieve a more refined classification of general group individuals in (2), the individuals are subjected to a detailed categorization, enabling a clearer differentiation between superior and inferior individuals within this group.This improved classification is facilitated by the introduction of an adaptive function.
where, refers to the coefficient which takes values within the range of [0,1].denotes the length of the feature subset, while C represents the total number of feature attributes.Additionally, signifies the degree of dependence of the conditional attribute on the decision attribute.where f(i) represents the fitness value of the first whale.Moreover, k is a random number that falls within the inclusive range of [0,1].Additionally, ω 1 , ω 2 , ω 3 denotes the adaptive weight limit, while ω 3 > ω 2 > ω 1 refers to a variable.Utilizing the aforementioned adaptive weights, the position update formula of the whale algorithm is improved to:

Calculate the difference between individual whale I and the best and worst individual in
where, is a stochastic variable, uniformly distributed in the interval [0,1].The results depicted in Figs. 6, 7, and 8 demonstrate the efficacy of the algorithm's enhancements.When considering an objective function with two objectives and a defined opposition, the curve of the optimal solution set closely approximates the Pareto frontier.It is evident that the algorithm successfully achieves a close approximation to the Pareto frontier, thereby significantly enhancing its accuracy.

Result
In order to evaluate the effectiveness of the above model and algorithm and comprehensively solve the problems related to economic cost and environmental pollution, the example adopts the improved multi-objective genetic whale algorithm.The parameter setting and operator selection are consistent with the above description, and the convergence speed and accuracy as well as the reliability of the results are demonstrated by comparing with other algorithms.This study takes the regional complex building as an example to optimize the simulation.Specifically, we chose a single day as the focus of our analysis.The building primarily relies on grid power, gas turbines, and new energy generation for its electricity supply.As for heat energy, the waste heat boiler, central air conditioning, and ground source heat pump play prominent roles by utilizing micro-gas turbines to absorb heat from high-temperature flue gas.Additionally, the cold energy is sourced from the central air conditioning and ground source heat pump.The system configuration is depicted in Fig. 9.

Basic data
In this paper, load data of a comprehensive commercial building in a province of China is collected, initial data is cleaned, abnormal data is deleted, and blank data is supplemented by K-nearest neighbor Imputation.Purchase and sale prices, heating and cooling prices and incentive subsidy prices ref. 18, while Table 1 provides an overview of the operational parameters of the equipment.

Algorithm comparison
The main experimental tools for building energy optimization scheduling are matlab, custom programming algorithms, and general optimization packages.
In order to verify the feasibility of the proposed algorithm in building comprehensive energy optimization scheduling, algorithms were compared for the same scenario.
Algorithm 1: The improved genetic whale algorithm proposed in this paper is used for energy scheduling, and the adjustment of gas turbines, wind power generation and energy storage equipment is realized by analyzing demand data and response data.
Algorithm 2: The improved whale algorithm is used for energy scheduling, and its data analysis is consistent with algorithm 1.
Figure 10 presents a comparative analysis of the iteration speed and accuracy between the original Whale Algorithm and the enhanced Genetic Whale Algorithm.The simulation results indicate that the improved algorithm not only enhances the iteration speed but also exhibits a substantial improvement in accuracy.Table 2 shows the comparison of economic costs and carbon emissions of power grid procurement scheduling and integrated energy system scheduling under different algorithms in wind power and photovoltaic forecast scenarios.

Result analysis
Following a thorough analysis of the scheduling outcomes, the resulting electrical load, thermal load, cooling load, and power diagram are visually represented in Figs.11, 12, 13, and 14, respectively.
Based on the representation in Fig. 9, it can be observed that the main sources of power demand for the building are the main supply and gas turbine generation.This can be attributed to the stable supply from the mains grid, accompanied by the advantages of high power quality and low maintenance costs associated with the full operation of micro-gas turbines.Moreover, photovoltaic power generation is primarily concentrated between 9 and 16 h, with minimal involvement in power supply during other periods.On the other hand, wind power generation remains relatively stable throughout the day.The building relies on the battery for electricity provision in scenarios where the power supply is insufficient, while surplus power is stored during periods of excess supply.
The analysis of Fig. 10 reveals that the heat load primarily relies on waste heat absorption and the ground source heat pump.Throughout the daytime, the ground source heat pump predominantly provides the requisite heat supply, with a minor contribution from the boiler.However, during nighttime, the majority of the heat       www.nature.com/scientificreports/requirement is fulfilled by the boiler.Additionally, a surplus of heat energy is observed between 12 and 14 noon, which is stored in the heat storage tank for subsequent heating purposes at other times.According to the representation in Fig. 11, the primary origins contributing to the cooling load comprise the ground source heat pump and central air conditioning systems.From 8 to 21 h, a robust cooling demand persists through the day.To fulfill this demand, intermittent cooling supply is employed, alongside periodic replenishment of the cooling load within the cold storage tank, which ensures the fulfillment of the cooling load requirements during the night-time period.
As depicted in Fig. 12, the primary source of electricity supply is derived from the mains, resulting in a higher demand for purchased power during most daylight hours.However, during peak solar irradiation at noon, photovoltaic power generation yields a surplus, leading to a reduction in purchased power and enabling the heat storage tank to accumulate a substantial portion of the generated heat.During nighttime, the electrical load demand significantly decreases, resulting in excess power generation across all systems.In addition to storing a portion of this excess load, the remaining surplus power is exported back to the grid.

Conclusion
By utilizing an enhanced multi-objective whale algorithm, this study formulates a model for optimizing the scheduling of building-integrated energy systems.Through the incorporation of simulation cases, the paper derives the subsequent conclusions: this study addresses the conflicting objectives of minimizing economic costs and carbon emissions through the formulation of an objective function that simultaneously satisfies both criteria.A Pareto dynamic optimization approach is employed to obtain the curve representing the optimal solution set.Moreover, an enhanced multi-objective genetic whale algorithm is proposed in this research.Simulation results show that the improved algorithm effectively reduces the sensitivity of whale algorithm to local optimization, and improves the global search ability and convergence speed.In the case of using the algorithm, the daily cost is saved 92.896 yuan, and the carbon emission is reduced by 0.091 tons.In addition, the enhanced algorithm has strong adaptability in solving multi-objective scheduling problems.
The future work should further test the application and schedule the acquisition analysis for a variety of buildings to improve the universality of the algorithm.In addition, it can be applied by combining various optimization methods to continuously improve the speed and accuracy of the algorithm in solving practical problems.

Figure 1 .
Figure 1.Flow chart of building integrated energy optimization.

Figure 3 .
Figure 3. Initial and updated optimal solutions of whale algorithm.

Figure 4 .
Figure 4. Genetic algorithm to optimize cross operation.

Figure 5 .
Figure 5. Genetic algorithm to optimize mutation operation.

Figure 14 .
Figure 14.Operation power diagram of each system.
t+1 × η e,co 2 P b (t) − P s (t) + P M (t) + P PV (t) + P WT (t) + P Eout (t) = P N (t) + P Ei (t) + P Ein (t) η h1 × P M (t) + η h2 × P N (t) + P Hout (t) = P Hi (t) + P Hin (t) η c × P N (t) + P Cout (t) = P Ci (t) + P Cin (t) optimization problem.The utilization of the Whale Optimization Algorithm (WOA) stems from the imitation of humpback whale groups' hunting behavior in nature.Through a series of sequential actions including searching, encircling, hunting, and attacking prey, the WOA aims to accomplish the objective of optimization search.The conventional WOA comprises distinct stages such as prey encircling, spiral bubble formation, and prey detection.

Table 2 .
Scheduling comparison under different algorithms.