Development of Demand Response Energy Management Optimization at Building and District Levels Using Genetic Algorithm and Artificial Neural Network Modelling Power Predictions

Demand Response (DR) is a fundamental aspect of the smart grid concept, as it refers to the necessary open and transparent market framework linking energy costs to the actual grid operations. DR allows consumers to directly or indirectly participate in the markets where energy is being exchanged. One of the main challenges for engaging in DR is associated with the initial assessment of the potential rewards and risks under a given pricing scheme. In this paper, a Genetic Algorithm (GA) optimisation model, using Artificial Neural Network (ANN) power predictions for day-ahead energy management at the building and district levels, is proposed. Individual building and building group analysis is conducted to evaluate ANN predictions and GA-generated solutions. ANN-based short term electric power forecasting is exploited in predicting day-ahead demand, and form a baseline scenario. GA optimisation is conducted to provide balanced load shifting and cost-of-energy solutions based on two alternate pricing schemes. Results demonstrate the effectiveness of this approach for assessing DR load shifting options based on a Time of Use pricing scheme. Through the analysis of the results, the practical benefits and limitations of the proposed approach are addressed.

and comfort optimisation of load scheduling under different pricing schemes has been investigated using various techniques including linear, convex, PSO, MINLP [13]. Furthermore, technology readiness, opportunities, and requirements for the deployment of DR in buildings and blocks of buildings is addressed by Crosbie et al. in [14,15].
On the other hand, buildings worldwide are responsible for over 40% of total energy consumption, gas emissions, and global warming [16]. The role of smart grids for near-and zeroenergy building communities is investigated by researchers to test new approaches, identify critical aspects, and tackle challenges emerging when dealing with design and operational problems [17,18]. On the demand side, a wide variety of developed scientific tools influence the dynamics of advances in energy performance and energy management in buildings [19][20][21][22]. Such tools are embedded in data monitoring applications, such as innovative web-based energy management platforms [23,24] to enable improved analysis, decision making, and dynamic controls. Moving from Building Energy Management Systems (BEMS) [25,26] to District Energy Management Systems (DEMS) [27] entails the dynamic exchange and hierarchical processing of data streams between various components and systems, as in the Internet of Things (IoT) paradigm [28,29]. Various techniques and tools have been investigated for dealing with challenges in various fields pertaining to smart grids: smart metering data analysis and dynamic processing [30], power demand forecasting [31,32], Distributed Energy Resources (DER) management optimisation [33], users' engagement [34], etc.
In addition, Hybrid Renewable Energy Systems (HRES) have been implemented in various configurations to combine two or more renewable and non-renewable sources in order to deal with the intermittency of renewable energy sources, such as solar or wind. HRES have important attributes which make them increasingly attractive as alternatives to conventional fossil fuel energy sources in numerous applications [35][36][37][38]. Aligned with HRES, the concept of the microgrid as a semiautonomous system of increased flexibility and manageable energy resources, such as renewable energy generation, storage, backup systems and flexible demand, is of particular importance when it comes to supporting grid stability and decentralized control [39]. A comprehensive critical review on the energy management systems of microgrids is conducted by Zia et al. in [40], with reference to the level of maturity of real world applications. Communication issues, control technologies and architectures, deployment costs, energy management strategies, optimisation, objectives and limitations, are addressed. An auto-configuration function using a multi-agent approach is proposed in [41] to establish automatic connection or disconnection of DER at microgrid level, capable of dealing with system faults and re-optimising the new configuration as necessary. Unsymmetrical and ground faults analysis in microgrids distribution systems is proposed by Ou in [42,43]. Hirsch et al. in [44] surveyed technologies and key drivers of microgrid implementation and research, at international level. Reported drivers in this context include extreme weather related concerns, cascading outages, cyber and physical attacks, deferral of infrastructure expansion costs, reduced line losses, efficiency improvements, savings, responsiveness, balancing loads, RE generation, etc. In [45], the authors present a residential microgrid day-ahead planning approach to accommodate appliance scheduling by modelling, among other things, inter-phase delay duration and time preference, in order to take advantage of shiftable loads and energy storage charging/discharging time. In [46], multi-microgrid configurations are presented and analyzed by means of the power line technology (AC, DC), layout (series, parallel, mixed), and interconnection technology (transformer, converter). A comparison of architectures based on cost, scalability, protection, reliability, stability, communications and business models is performed. Energy management and DR of multimicrogrids based on hierarchical multi-agent approach by introducing adjustable power is proposed by Bui et al. in [47]. Different operation modes are evaluated according to a two-level management cooperative multi-microgrid MILP-based model for day-ahead scheduling. Towards the application of state of the art, a microgrid energy management a Genetic Algorithm (GA) approach is applied in [48] to optimize cost strategies for scheduling distributed energy resources. The Quasi-static Artificial Bee Colony approach is used to optimize a multi-objective DR problem, based on the cost of energy and peak demand at the building level [49], including PV, Combined Heat and Power (CHP), batteries, electrical energy from the grid, and natural gas. Particle Swarm Optimisation is used in [50] to solve a bi-level problem modelling the interaction between the retailer and consumers. The energy hub is explored in [51] to develop a multi-carrier Demand-Side Management Time of Use (DSM ToU) optimization balancing energy import, conversion, and storage. Furthermore, a GA approach using present and day-ahead data was tested by Ferrari et al. [52] with respect to the management of loads of an experimental plant case study in Italy. The analysis involves PV, wind generation, a micro-CHP with a gas boiler, and an absorption chiller coupled with thermal storage.
In addition, Artificial Neural Networks (ANN)-based short term power forecasting is practiced to estimate day-ahead loads and renewable energy production. ANN models are designed to imitate biological nervous system information processing and evolution. They have been used for years in different areas of engineering, science, and business to deal with highly complex and nonlinear data sets. The ANN models assimilate the natural bonds of neurons and their high level interconnection to model complex systems. In the case of short-term predictions, the ANN models can be more effective compared to statistical, linear, or non-linear programming techniques. They encompass capabilities such as adaptive learning, self-organization, real time operation, fault tolerance, and the approximation of complex nonlinear functions. Kalaitzakis et al. in [53] tested advanced neural network short-term load forecasting using data from the electric power grid of the island of Crete in Greece. Various structures and configurations were assessed, and a parallel processing approach for a 24 h-ahead prediction was demonstrated. ANN architectures for forecasting demand in electric power systems are presented in [54] by Tsekouras et al. A case study of the Greek electric power grid is used to explore the performance of different ANN configurations and factors, including period length and inputs for training, confidence interval, and more. Moreover, short term power forecasting is of particular value for prosumers to model, understand, and predict their consumption profiles, as well as to apply effective scheduling and control. A framework for district-level energy management and ANN forecasting at the building level was investigated by Hu et al. in [55], evaluating the performance for 6 buildings of different occupancy routines. Hybrid Short Term Load Forecasting ANN combined with techniques such as Fuzzy Logic, GA, and Particle Swarm Optimisation are briefly discussed in [31]. Furthermore, a 24 h-ahead prediction of excess power at microgrid level is proposed by Mavrigiannaki et al. [56], testing 3 different configurations with respect to possible exploitation potentials from an energy management perspective. Finally, an overview of load forecasting, dynamic pricing, and demand side management techniques in smart grid research applications reveals the potential for operational cost reductions between 5-25% [57].
The aim of the research work presented here is the development and testing of a DR energy management GA-based optimisation approach based on day ahead ANN generated prediction models. The developed GA algorithm incorporates load shifting for the day ahead (24 h period), and evaluates possible alternatives based on cost and assumptions related to the practicality of the obtained solutions. The practical benefits of the proposed approach are linked to the development of a valuable tool for the evaluation of the potential rewards and risks of engagement in DR. In the case study that follows, a Time of Use pricing scheme is compared to a flat tariff.
The paper is organised as follows. In Section 2, the infrastructure and the applied methodology are presented. The proposed day-ahead GA approach for cost of energy and load shifting optimization based on ANN hourly power predictions is analyzed in Section 3. Results and considerations on ANN power predictions and GA optimisation solutions are provided in Section 4. Finally, in Section 5, conclusions and recommendations for future work are summarised.

Infrastructure and Methods
The proposed novel approach was developed and tested on the basis of data available from the MyLeaf platform, which monitors and controls the Leaf Community buildings. The Leaf Community is located in Angeli di Rosora, a small rural area in Marche region of Italy. It hosts industrial facilities of the Loccioni Group, a firm leading research and innovation activities in energy, environment, automotive, aviation, and other sectors. The Leaf community ( Figure 1) consists of 5 industrial buildings (L3-AEA, L4-Leaf Lab, L5-Kite Lab, L6), one office building (L2-Summa), and a building used mainly for business meetings (Leaf Farm). All buildings (except the Leaf Farm) are equipped with rooftop photovoltaics (PV) of total power 629.2 kWp, and ground water heat pumps. In addition, a 2-axis solar tracker of 18 kWp, a 48 kWp micro-hydro plant, a 224 kWh battery storage, and a 523.25 kWh/K thermal storage are connected to the microgrid, which also features electric vehicle charging stations. Buildings, renewable energy systems (PVs, micro-hydro), and storage systems are all coupled and connected to the main power grid via a single interconnection line (point of delivery). The buildings in the Leaf Community are highly thermally-insulated, and are equipped with automations for controlling the HVAC systems, as well as the natural and artificial lighting by means of adjustable external louvers and luminance sensors. The primary annual energy consumption for the Leaf Lab, is rated at 35.4 kWh/m 2 (including the PV power production and subtracting industrial consumption) [22], based on year-round measurements, while the L6 (new building, not fully operated yet), is estimated at 46.85 kWh/m 2 . These ratings prove to be a factual determinant of their near zero energy performance. Table 1 summarizes the basic components of the building envelopes and systems installed at the Leaf Community buildings under consideration.
The elaborated methodology comprises several steps, as shown in Figure 2. 1. Collection of data: All data from measuring equipment, sensors, and actuators in the Leaf Community is collected, organized, and made remotely available through the MyLeaf platform [33]. In this case, the MyLeaf platform is used to collect data on the power demand of the buildings considered in the analysis. 2. Development and testing of ANN models: ANN models are developed and exploited to perform day-ahead predictions of consumption power using Matlab. For the 24 h-ahead prediction of power consumption, the day of week, the time, and the external temperature are used as inputs, while the 24 h-ahead electrical power is used as a target. Trials of various combinations for the ANN model parameterization are performed, considering the structure, algorithm, the number of hidden layers, and the delays. A Lavemberg-Marquardt algorithm was deployed in a Nonlinear Autoregressive ANN structure with Exogenous Input (NARX), with 3 hidden layers and a delay of 1. 3. GA approach: A genetic algorithm (GA) optimization scheme was developed and tested in Matlab, in order to provide alternative solutions for load shifting. The GA optimization scheme is based on the mathematical model analyzed in Section 3. The objective function encounters of the criteria of energy and load shifting. Market information is used to construct the hourly pricing profiles used in the optimization process. Weighting coefficients are applied to both normalized criteria to enable consideration of several alternatives, depending on several priorities, and energy management capabilities. Weighting coefficients are used to provide a trade-off between cost and load shift. The role of weighting coefficients is to allow a decision maker to investigate a set of solutions and obtain solutions which better match his/her preferences. Preferences differ based on the decision maker's knowledge and understanding, but may also be influenced by other factor priorities during the various time periods. For example, cost savings could be considered to be the "default" priority, but during certain periods, the minimization of load shifting could be upgraded to become the dominant factor in the optimization process. 4. Sensitivity analysis and evaluation of results: Sensitivity analysis is performed by changing the GA parameters, such as crossover, population size, mutation rate, tolerance etc. Furthermore, since load shifting is related to changes in the operation of building systems (HVAC, lighting, etc.) and operations (industrial, office), it also needs to be minimized in order to avoid significant intervention in the buildings' use. On the other hand, the cost of energy is minimized when load shifting occurs from hours of high prices to hours of low prices. The solutions are hence evaluated considering the hourly/daily cost of energy and load shifting preferences.
The developed approach is illustrated with the aid of the flowchart of Figure 3.

The Proposed Day-Ahead GA Approach for Cost of Energy/Load Shifting Optimization Based on ANN Hourly Power Predictions
The GA optimisation scheme is based on the developed mathematical model presented hereafter. The two criteria, namely the normalised cost of energy and load shifting, form the objective function as shown in Equation (1): At building group level, the cost and load shift terms of the objective function in Equation (1), are given by Equations (2) and (6) which are further specified by Equations (3)-(5) and (7) where: The following constraints in Equations (10)- (12) are applied to ensure that there is no deviation between the total daily energy consumed between baseline and the optimized solutions for each building: Whether the optimization concerns a building or a building group analysis, for the evaluation of the GA based results, a comparison to baseline consumption, as obtained by the Artificial Neural Network day-ahead prediction, is conducted. The total cost linked to the genetic algorithm optimized solution is compared to the total cost of the baseline scenario, as evaluated by Equations (13) and (14) respectively:

ANN Based Predictions
The results of ANN-based predictions for the period from 1 May 2017 to 1 August 2017 and from 1 December 2017 to 1 March 2018, for each building, are presented in Figure 4 and  Table 2.

Genetic Algorithm Optimization Results
In this section, the GA optimization results for 21 July 2017 and 16 February 2018 are presented and analyzed for the weighting coefficient values = = 0.5. For the baseline scenario, a flat tariff at 0.07 €/kWh is used. The optimized scenario is calculated taking into account a 2-zone tariff pricing scheme of 0.0675 €/kWh from 8 a.m. to 6 p.m., and 0.0525 €/kWh from 6 p.m. to 8 a.m. (Figure 7).    With respect to the Leaf Lab, it is observed in Figure 8 that load shifting occurs from the highprice to low-price hours. This is also reflected, in terms of the cost profile, on the day which accounts for a reduction of 15.77% from € 174.97 to €147.37. Likewise, the load in Summa is shifted outside the high price region, with the baseline daily cost of €20.55 being decreased down to €17.80, a relevant reduction of 13.38%. Similarly, the load shifting in Kite Lab occurs from the high tariff zone towards the morning and the evening hours, without a reduction in total power consumption. In this case, the baseline cost is €101.89, and the optimized total cost is €87.40, achieving a reduction percentage of 14.22%.
The analysis of the winter results is displayed in Figure 9. The shift for the Leaf Lab power profile leads to a cost reduction of 10.23% from €48.21 in the baseline scenario down to €43.27.
Load shifting throughout the 24 h occurs in Summa in a way that changes the overall power profile to the early hours of the day. This transition of loads corresponds to 18.59% of costs savings, reflecting also the differences between the flat and the 2-zone tariff pricing scheme.
With respect to the daily power in Kite Lab during the winter, changes between baseline and optimized scenarios appear to take place in a harmonic way from high to low price hours. In this case, a 14.97% cost saving is achieved, since the baseline daily cost is €118.1, compared to the optimized daily cost of €100.42.
In Figure , the total power consumption of the 3 buildings is illustrated. In the first case, the high power consumption according to the baseline power is shifted from working hours towards early morning and late evening hours. In terms of cost, the total baseline cost at district level is 293.95 €, and the total optimized cost is €251.30, corresponding to a 14.51% reduction.
With respect to the winter period, the hourly-district level GA-optimized power values for equal weighting coefficients undergo a smooth differentiation to the left of the graph with respect to the baseline. The district-level total baseline cost is €195.27, and the total optimized cost is €167, achieving a reduction percentage of 14.47%.   Table 3, regarding the Leaf Lab, the results for each case prove that the optimization is successful, bearing in mind that the baseline cost is €174.90 and the optimized values range from €142.24 to €153.97, a maximum operational costs percentage reduction of 18.67%. For Summa, as for the Leaf Lab, the optimized cost for each pair of weights is lower than the baseline cost of €20, and varies between €17.80 and €17.12. The percentage reduction in this case reaches 14.4% Furthermore, the optimization for the Kite Lab revealed that the GA produces better results compared to the baseline cost of €101.9 for all pairs of weights ranging from €87.62 down to €85.78. The percentage reduction in this case is up to 15.82%. The last column of the table represents the optimized cost for the group of buildings, which is lower than the baseline cost of €293 for all pairs of weighting coefficients varying from €253.91 to €247.89. The maximum percentage reduction in this case is 15.39%.  Table 4 includes the results of optimization for each pair of weighting coefficients at both the building and district levels for the winter period. The results for the Leaf Lab depict the optimized cost for all weights combinations. As shown, in all cases, the optimized cost varies between €43.48 to €42.81, which is lower than the baseline cost of €48 in this case, and accounts for a percentage reduction of up to 10.81%. Moreover, the optimization for the Summa building revealed genetic algorithm solutions with costs from €23.58 to €23.27, a percentage reduction of 16.89% compared to the baseline cost of €28 in this building. Subsequently, in the Kite Lab, the optimized cost is from €102.06 down to €99.85, equal to a percentage reduction of up to 15.38% lower than the baseline cost of €118. The last column represents the optimized cost in the group of buildings during the winter, varying from €168.19 to €166.53, leading to a percentage reduction of 14.6% compared to the baseline cost of €195.

Limitations of the Adopted Two-Level Model
The proposed approach entails some level of abstraction with respect to the load shift which is achievable within the capacity of individual systems and components. Evaluating load shift in conjunction with a pricing scheme requires deep knowledge, and depends on the specificities of each case study. In this respect, load shift is determined by technical factors, i.e., installed systems technical characteristics, control scheme, etc., as well as organisational factors, i.e., the potential shift of the industrial operations within each building. A detailed knowledge of the operation of each system in a building, along with data, i.e., power consumption profile, is not available in most cases. This logic can be applied to some extent by using constraints to ensure that a specific percentage of the power at any time remains unchanged. Consequently, optimisation can be conducted based on the flexible share of the consumption power for every hour.
Also, the proposed approach is linked to the accuracy of the prediction, which may vary according to the building under study, and other factors, e.g., type of loads, industrial operations, season, etc. Therefore, it is important to evaluate the risk associated with different prediction error levels according to the examined pricing scheme. Although this risk is low in a two zone pricing scheme, it may become significant when considering dynamic pricing profiles.

Conclusions
The main contribution of this work is related to linking ANN short-term electric forecasting and GA multi-objective optimization as a tool for generating and evaluating alternative day-ahead load shifting solutions. The first step of the proposed approach is exploiting Artificial Neural Network modelling for the prediction of the power consumption in a period of 24 h ahead. Predictions of hourly-consumption power levels using day of week, time of day, and external temperature as inputs were obtained for each of the 3 buildings of the Leaf Community (Leaf Lab, Summa, and Kite Lab). The results proved that a close correlation between predicted and actual values exists during the studied summer and winter periods, as evaluated based on correlation coefficient R for the whole period, as well as Mean Bias Error (MBE) and Mean Average Predicted Error (MAPE) for the specific days used in the optimization process.
The second step was to create an optimization function to include energy cost and load shifting using appropriate variables and constraints. The objective function was minimized using a Genetic Algorithm to obtain solutions at individual building and building group levels. Results demonstrated the effectiveness of this approach in considering alternative pricing schemes and load shifting possibilities as a way to examine cost savings. Cost savings of between 10.81% and 18.67% at the building level were associated with significant load shifting solutions obtained by the GA scheme in the considered two-zone ToU pricing scheme. At the district level, cost savings in the range of 13.34% and 15.39% were obtained.
Future steps in this work may involve: (i) extending research activities to include renewable energy generation and storage capabilities, (ii) reforming the GA obtained solutions so as to take into consideration actual loads (base, fixed, flexible), renewable energy production, and storage, and (iii) exploiting the potential for improvements in power predictions using ANN models. hourly value of total energy consumption in each building (kWh) X hourly value of total energy consumption in Leaf Lab (L4) building (kWh) X Baseline (predicted) hourly value of total energy consumption in Leaf Lab (L4) building (kWh) X hourly value of total energy consumption in Summa (L2) building (kWh) X baseline (predicted) hourly value of total energy consumption in Summa (L2) building (kWh) X _ hourly value of total energy consumption in Kite (L5) building (kWh) X baseline (predicted) hourly value of total energy consumption in Kite (L5) building (kWh) X GA optimised hourly electrical energy (kWh) at building or building group level X baseline hourly electrical energy (kWh) based on day-ahead Neural Network predictions