Forecasting of Electrical Energy Consumption of Households in a Smart Grid

This paper aims to develop a hybrid model for forecasting electrical energy consumption of households based on a Particle Swarm Optimization (PSO) algorithm associated with the Grey and Adaptive Neuro-Fuzzy Inference System (ANFIS). This paper proposes a new Grey-ANFIS-PSO model that is based on historical data from smart meters in order to estimate and improve the accuracy of forecasting electrical energy consumption. This accuracy will be characterized by coefficients such as Root Mean Square Error (RMSE), Mean Absolute Error (MAE) and Mean Absolute Percentage Error (MAPE). The PSO will allow to optimally design the Neuro-fuzzy forecasting. This method is implemented on Cameroon consumption data over the 24-years period in order to forecast energy consumption for the next years. Using this model, we were able to estimate that electricity consumption will be 1867 GWH in 2028 with 0.20158 RMSE and 0.62917% MAPE. The simulation results obtained show that implementation of this new optimized Neuro-fuzzy model on consumption data for a long period presents better results on prediction of electrical energy consumption compared to single artificial intelligence models of literature such as Support Vector Machine (SVM) and Artificial Neural Network (ANN).


INTRODUCTION
Initially, power grids only included operations of production, transmission and distribution of energy, the capacities of which were not sufficient to ideally meet energy requirements. In recent years, these classical grid infrastructures have gradually undergone a transformation by a combination of digital systems referring to the notion of smart grid (Guerrero-Prado et al., 2020; Advanced Metering Infrastructure (AMI) whose role is crucial in energy distribution systems through recording and processing of load profiles and real-time consumption data thereby facilitating power flow distribution and information flow to ensure reliability and energy efficiency (Jiang et al., 2018). The advantages that the integration of smart meters brings into a network are diverse, in particular: the acquisition of energy management and used data, the management of its electricity consumption, safer billing, more reliable service, reduction of technical losses, reduction of energy theft, improvement of the security profile for consumers, and optimization in data management. The smart meters will therefore allow daily reading and collecting consumption data in real time. Analysing this data could be useful for utilities in understanding customer consumption behaviours (Bhattarai et al., 2019;Hurst and Curbelo Montañez, 2019). In addition, this data can also be transmitted to the data center for storage and automated processing (Völker et al., 2021). This opens up unprecedented possibilities for the analysis, storage, and combination of energy system data for the two entities which are the consumers and the operators of the electricity grid (Yem Souhe et al., 2021;Mbey et al., 2020).
Given the complexity of smart grid system, inefficient and inaccurate forecasting of electrical energy consumption could lead to load shedding, loss in production and consumption and possible grid collapse. So, it is necessary to make a forecast of energy demand in order to ensure a better transition to smart grid technologies . In the literature, several models have been proposed for forecasting electrical energy consumption. These models include: conventional models and artificial intelligence models.
Among the artificial intelligence models, Abdulsalam and Babatunde (2019) proposed a model for forecasting demand of electrical energy using a neural network for Lagos State in Nigeria. This model provides better results in terms of accuracy compared to other models. Wei et al. (2019) reviewed conventional models and artificial intelligence models. The conventional models are time series (TS) models, regression models and grid models. For Artificial Intelligence (AI) models, it introduced Artificial Neural Network (ANN) models, SVM models, and Random Forest (RF) models. Comert and Yildiz (2021) show a new model of Artificial Neuronal Network for forecasting energy demand improving by temperature level and unemployment rate. Zougagha et al. (2021) proposed hybrid artificial intelligence models for improving forecasting accuracy. This paper aims to study the artificial intelligence models used for forecasting. Kouhi and Keynia (2013) applied a cascade neural network model for the short-term prediction of the New York City energy system. Chae et al. (2016) also proposed a short-term forecasting model of building consumption based on artificial neural network model combined with a Bayesian regulation algorithm. Also, Mordjaoui et al. (2017) proposed a forecast of power consumption using a dynamic neuronal network. The performance of the model is verified by simulations on data collected from the network operator in France. In same time, Ahmad et al. (2014) reviewed various methods of predicting electrical energy in buildings using artificial intelligence methods such as SVM, neural networks. They shows that the hybridization of two forecasting techniques brings better results than with a single technique. The authors make comparisons showing that hybrid models provide better accuracy. In addition, Zhu et al. (2011) developed an improved hybrid model for electrical energy demand in China with an advantage over combined methods, hybrid models and optimization algorithms. This model is implemented on four power grids in China. The authors compared their models with the Seasonal Autoregressive Integrated Moving Average (SARIMA) model with the same time series. Other authors as Ardakani and Ardehali (2014) developed optimized regression and neural network models for forecasting electrical energy consumption based on several optimization methods. The authors presented a long-term forecasting going from 2010 to 2030, the data used in this study is made up of electrical energy consumption and socio-economic indicators. In their results it is proved that using historical data of socio-economic indicators brings more precision in energy consumption forecasting.
Other forecasting methods are presented by Aghay-Kaboli et al. (2017), in their paper they performed long-term formulation and prediction of electrical energy consumption through geneticoptimized programming. This genetic programming is applied to precisely formulate the relationship between historical data and electricity consumption. The authors compared their method with other methods such as the neural network, Support Vector Machine (SVM), Adaptive Neuro-Fuzzy Inference System (ANFIS), and cuckoo search algorithm. The Artificial Neural Network (ANN) approach was presented by Nasr et al. (2002) for energy consumption forecasting in Lebanon. Thus, four models of neural networks are presented and implemented on the real data of electrical energy consumption. Each of these models is characterized by error indexes such as Mean Square Error (MSE), mean percentage square errors (MPSE) and Mean Absolute Percentage Error (MAPE). Likewise, Zhang et al. (2020) explored forecasting of electrical load by recurrent support vector regression model with variational decomposition mode and the cuckoo search algorithm. This model has the advantage of being applicable to real data. Predicting electrical load by data mining techniques has also been studied by Abubaker et al. (2021) who proposed a combination of these data mining techniques such as K-Means, K-Nearest Neighbours (KNN) and Autoregressive Integrated Moving Average (ARIMA). Other authors have also worked on conventional models for time series (Dritsaki1 et al., 2021;Sutthichaimethee and Wahab, 2021;Billah et al., 2021). Regarding the ARIMA, Vector Autoregressive (VAR) and Grey Models (GM), various works have been proposed with the aim of energy forecasting (Xu et al., 2015;Chaoqing et al., 2016;Feng et al., 2020;Yuan et al., 2016). Similarly,  worked on forecasting electricity consumption in the Cameroonian residential sector using Grey and vector autoregressive models. These authors have also projected on forecasting consumption using the multilinear regression model .
Other hybrid models have been developed, Hafeez et al. (2020) proposed a fast and accurate machine learning model for predicting electrical energy consumption in a smart grid. This hybrid electrical power consumption forecasting algorithm proposed is being based on deep learning using linear rectified unit. This hybrid model is then tested and evaluated on data from the United States power grid on three performance factors: the average percentage deviation, the variance, the correlation coefficient and the convergence rate. Likewise, Li et al. (2018) presented a hybrid learning neural network for electrical energy consumption forecasting in buildings. This combined algorithm is made up of neural networks and applied for the hourly electrical prediction of two buildings in the United States and China. A hybrid random drill model combined with a multilayer perceptron is also proposed by Moon et al. (2018) for forecasting daily energy demand in a university campus. Also, Yang et al. (2021) proposed a hybrid model for time series forecasting. The final results show that the precision of this model is good compared to linear models. In this logic, Farsi et al. (2021) presented a short-term forecast of the electric charge using artificial intelligence techniques and a new deep parallel approach.
Optimized models are also used to improve accuracy in the analysis of consumption data. Kumaran and Ravi (2015) presented a hybrid model of artificial neural network and a biogeography-based optimization for long-term forecasting of electric power demand in India. This model considers socio-economic factors such as the population and uses two artificial neural networks which are trained by an optimization algorithm with the objective of making a perfect mapping of the input and output data in nonlinear space in order to obtain the best overall weight parameters.
In recent years, other optimized models have been developed resulting from a combination of several artificial intelligence models. Thus, Bahrami et al. (2014) proposed a short-term prediction of the electrical load by a wavelet transform and a Grey model improved by a PSO algorithm. In this optimized model, the input data considered are the average temperature, average humidity, average wind speed and data from the previous load. In this case, the wavelet transform is used to remove the high frequency component from the previous load data to improve the accuracy of the forecast. The effectiveness of the model is verified by implementing it on the forecast in New York and Iran. Kyung et al. (2005) predicted holiday energy consumption using a linear fuzzy regression method. Recently, hybrid models have been used in particular by Kavousi-Fard et al. (2014) who proposed a forecasting algorithm composed of SVM and Firefly optimization algorithm. In addition to this, Selakov et al. (2014) proposed a new hybrid model for short-term demand forecasting based on particle swarm optimization and SVM. This model takes temperature into account in forecasting consumption. The model architecture consists of three modules including pre-processing module, PSO module and SVM module.
Recently, ANFIS model has spread in the scientific world for control systems, image processing and time series forecasting. For example, Mollaiy-Berneti (2016) developed an ANFIS model through a hybridization technique with Genetic Algorithm (GA) and applied it for the consumption forecast of the Iranian industrial sector. In this work, genetic algorithm ensures searching of optimal value guaranteeing a minimum number of rules and errors. A hybrid PSO-ANFIS approach for short-term forecasting of consumption in Portugal was made by Pousinho et al. (2011). Using the same PSO-ANFIS model and the GA-ANFIS model, Kasule (2020) show a forecast of electricity consumption in Uganda. In addition, other fairly efficient models have been developed in particular by Kazemi et al. (2014) who have developed a new short-term prediction based on a genetic algorithm for adaptive neuro-fuzzy inference system (ANFIS). Here, GA makes it possible to find the most suitable position of the inputs in order to build the model and subsequently this algorithm optimizes the weights of the rules.
Also, a combination of conventional statistical models and artificial intelligence models as ANFIS can be useful for forecasting energy consumption in the smart grid. Therefore, Shaikh et al. (2017) applied a method of forecasting power consumption using a linear fuzzy regression model. Shu and Luonan (2006) proposed a short-term load prediction model based on adaptive hybrid method. Barak and Sadegh (2016), authors implemented an ARIMA-ANFIS algorithm for forecasting energy consumption. This hybrid model improves the accuracy of single ARIMA and ANFIS models in forecasting energy consumption. Jadidi et al. (2019) presented a short-term forecast of energy demand using a Non-Dominated Sorting Genetic Algorithm II (NSGA II) and ANFIS model. NSGA II is used to select the input vector which is the input to the ANFIS model which will demonstrate the improved accuracy of the forecast. Through another similar model, Panapakidis and Dagoumas (2017) adopted ted a wavelet-ANFIS-GA-neural network transform for consumption forecasting. Another combined method by models SARIMA, neural network, ANFIS and Differential Evolution (DE) is proposed by Yang et al. (2016) in order to make a short term forecasting of electrical energy demand in South West Wales and Australia. Laouafi et al. (2015) developed three models for forecasting consumption using an ANFIS method of linear loads. Their results show the effectiveness of this combined approach of artificial intelligence models.  improved the ARIMA model by incorporating a particle swarm optimization algorithm that reduces residual error.
As the results obtained from all these hybrid, combined or optimized models are not enough precise, other new methods must be implemented in order to improve the performance of the final model. Thus, it would be necessary to develop a model that would consider a multitude of inherent parameters which can integrate the objective capacities of consumers and smart producers. In this paper, we have set up a Grey-ANFIS-PSO hybrid model. These three associated models provide better results compared to those in the literature. When the forecast is not precise, the optimization makes it possible to find the optimal point of the activation function.
This paper is structured as follows: section 2 presents the material and method, we present the dataset, Matlab software and the computer used. We also explain the operation of each model taken individually. Then, the proposed hybrid model combining the three methods is developed and implemented on the consumption data obtained from smart meters in Cameroon over 24 years period. Section 3 presents the simulation results and the forecast obtained from the training data and the validation data. These results show the unique capacity of the hybrid model proposed in this paper. Finally, a conclusion is given in section 4.

Dataset
Several factors such as socioeconomic and demographic context, climatic and meteorological factor can affect the behaviour of electricity consumption. Smart meters make it possible to assess the consumption of each customer in the network, which will make it possible to forecast consumption in the future in order to adapt production to consumption. This electricity consumption depends on several variables such as socioeconomic variables, in particular the growth of the population, the number of consumers and suppliers, the type of consumers who can be residential, industrial, or commercial, the billing price of electricity consumption and the Gross Domestic Product (GDP) of the population. The data used in this paper was obtained from the Electricity Distribution Agency, the Cameroon Electricity Sector Regulatory Agency and the World Bank (https://data. worldbank.org). Table 1 shows the evolution of the data between 1994 and 2017. In this table, it is observed data of consumers during 24 years from 1994 to 2017. For each year, there is value of GDP, population, subscribers and households.

Matlab
Matlab (Matrix Laboratory) is a software that was originally designed by Cleve Moler at the end of the 1970s, the company MathWorks ensures until today its continuous development. It is used for matrix and numeric calculations to analyze data. Matlab also allows programming for the intelligent resolution of complex problems. All our simulations were made using the Matlab R2020b 64 bit version.

Computer
All the simulations of this work were done on a computer with following characteristics: icore 5, 3.1 GHz processor, 8 GB RAM, Windows 10/64 bits.

Grey model
Grey model was introduced by Deng Julong in 1982 for complex problems (Wang, 2009). Grey model has shown its effectiveness in the field of forecasting, in particular for forecasting of electricity consumption. In this paper, we use the Grey model of the form GM(1,1) whose procedure is described in four steps as follows: (a) Initialization of the data series defined by equation (1): With: i=1,2,…,n and x (0) (i) ≥0 (b) Subsequently, the generated data series is given by equation (2): With: x t x i i k 1 0 1 ¦ and k= 1,2,…n (c) Knowing that x (1) (t) is defined by the first order differential equation: With α and β the model development and control parameters.
(d) Using the least squares method and differential equations, we obtain equation (4) which describes the parameterˆ: With B and y n the matrices of the form system.

PSO algorithm PSO is a meta-heuristic technique introduced by Kennedy and Eberhart in 1995. It is based on behavior of birds and insects.
In the PSO, the population is called a swarm and is made up of individuals called particles. The PSO algorithm is initialized with a number of iterations and particles. The moving of each particle consists in converging towards the region having the best potentials having optimal solutions. Each particle has a memory function and gradually adjusts its path based on its own experiences and the experience of other particles. The path taken by each particle is based on the best particular position p best and the best global position g best of the swarm. Each particle has two vectors, in particular the position vector X i and the velocity vector V i . Each iteration of the PSO consists of moving the particle through space in order to find the optimal solution. The velocity vector and the position vector can be expressed by equations (5) and (6): With: V i t +1 : speed of the particle to the next position V i t : speed of the particle on the previous position p best : best particular position g best : best global position X i t : previous position of the particle X i t +1 : next particle position c 1 and c 2 : positive acceleration constants to maintain the balance between individual and social behavior r 1 and r 2 : are the numbers generated in a loop in the interval 0 and 1. w: weight of inertia to maintain the balance between exploration and exploitation. Figure 2 shows the flowchart of the PSO algorithm.

ANFIS model ANFIS (Neuro-Fuzzy Adaptive Inference System) is a combination
of neural networks and fuzzy systems. This neuro-fuzzy system was introduced in 1993 based on the "if-then" condition to build the space from input to output for the appropriate functions.
The fuzzy rules also make it possible to define various inherent relationships between the parameters of ANFIS. Each fuzzy rule ensures behavior description. The fuzzy system element is used to define functions of a member of inference system. The neural network element provides for the continuous and automatic extraction of the built-in rules from the fuzzy system based on the digital data in order to adapt the parameters of the limb functions through the learning process.  In Sugeno's ANFIS model, a fuzzy rule is represented by: If x 1 is b 1 and x 2 is b 2 and x 3 is b 3 and x 4 is b 4 then y = f(x 1 , x 2 , x 3 , x 4 ) With: x 1 , x 2 , x 3 and x 4 : fuzzy parameters from previous inputs.
y: output function which in our case represents the power consumption.
Inputs and output are considered member functions. These member functions and fuzzy rules provide the optimization parameters through the learning process.
In our paper we implement the ANFIS method in order to partition the data to reduce the complexity and the number of fuzzy parameters to optimize. Figure 3 gives the structure of the ANFIS model. Figure 4 shows the flowchart of forecasting electrical energy consumption using the Grey -ANFIS -PSO model. The ANFIS framework generates a single output from the Sugeno inference system and improves system parameters using input/output training data. The training algorithm uses a combination of the least squares gradient and back propagation methods to model the training database.

Hybrid approach proposed Grey -ANFIS -PSO
The proposed model is a combination of the Grey model, the PSO algorithm and the Adaptive Neuro-Fuzzy Inference System (ANFIS). Grey model makes it possible to generate the forecast with a limited amount of consumption data. This model is very useful when you do not have complete training data. The PSO makes it possible to update the parameters of the model by searching for the optimum parameters for an accurate forecasting. ANFIS model or Sugeno-type neuro-fuzzy inference system allows forecasting to be made based on training data and testing on validation data. The parameters of the proposed model are optimized by the PSO algorithm. They are determined by trial and error simulations. The RMSE and MAPE parameters are used to verify the accuracy of the model. If the accuracy is not suitable, the PSO algorithm can change the parameters of the model and start the optimization procedure. These parameters can be changed consecutively. This model is applied to the electricity consumption data of Cameroon in order to generate the electricity consumption forecasting data. Using this model allows to obtain an accurate graphical representation of forecasting electrical energy consumption.

RESULTS AND DISCUSSION
Consumption data for 24 years  for Cameroon are recorded by meters and are available at the level of the distribution Figure 3: Structure of the ANFIS model company. Figure 5 shows the evolution of this consumption during these years.
These data are available online from the Electricity Distribution Agency for the verification and validation of the model.
Considering input data including socio-economic parameters and data from smart meters in particular, we propose an ANFIS model as shown in Figure 6 We can first train the ANFIS model.
For this model, each fuzzy rule considers the number of consumers, the GDP per customer and the number of households to provide power consumption output. The epoch number was set to 1000, for each iteration we get the values of RMSE, MAPE, MAE and R. This paper aim to minimize these errors using optimization algorithms. Training data is 90% of input data, and test data is 10%. Figure 7 shows the training data and the output data of the fuzzy model on Matlab.
The validation of the model is carried out using test data. Figure 8 shows the test data and the data from the model.
Applying ANFIS model requires incorporating fuzzy rules that depend on the overall functioning of the model. Thus, the fuzzy rules of the ANFIS model are given by Figure 9. The number of fuzzy rules 243, which is related to the number of data of the input layer.
From the ANFIS model, it results error coefficients, in particular 1.2401 RMSE and 6.20% MAPE. The training procedure using the model training algorithm optimizes the parameters of the member function in order to build an adequate relationship between inputs and outputs. In this work, the PSO algorithm optimizes the input parameters of the member function as well as the correlation factors of the output of the ANFIS model. In the hybridization of ANFIS-PSO model, ANFIS is considered as an individual or a particle positioning itself as a possible solution to the optimization problem. The input data was randomly subdivided around the model's training base. Regarding the PSO, it considered in this paper, the size of the population being 120 particles for 1000 iterations knowing that the factors C1 and C2 are 1.5 and 1.2 respectively.
The ANFIS model optimized by the PSO is given in Figure 10.     Figure 11 shows the editor for the ANFIS-PSO model. We can observe a gradual decrease in the training error for the continuous evolution of the iteration.
We observe small reduction of errors, the RMSE is 0.32576 and the MAPE is 3.0817%.
The evolution of the training error of the ANFIS-PSO model shows the limit of this model in increasing the accuracy of the system in forecasting consumption. In order to optimize the input and output parameters and make a perpetual adjustment of the random values of the model following the gradient of the second-limb differential equation and considering the least squares method, we have also implemented the Grey method in the ANFIS model optimized by the PSO. Figure 12 shows the Grey-ANFIS-PSO model.
Configuring ANFIS-PSO editor by integrating the Grey method for the control value of the model, we obtain Figure 13 showing the training error for the global Grey-ANFIS-PSO model.
For this model, the RMSE and MAPE coefficients are respectively 0.20158 and 0.62917%.
In order to make a better representation of the accuracy of the model, the error indications and the correlations of the models are given in Figure 14.
As can be seen, the Grey-ANFIS-PSO model gives better correlation and low error coefficients as RMSE and MAPE. The actual consumption, and forecasting consumption results according to different models implemented in our paper for 24 years are presented in Figure 15.
It is noted that Grey-ANFIS-PSO model presents better results of forecast with a very weak error compared to the other models implemented in our method. Figure 16 shows the predicted evolution using the Grey-ANFIS-PSO model. The demand for electric power is growing over the next 10 years. Consumption increases from 1305 GWH in 2017 to 1867 GWH in 2028.
A summary of the results of the forecast models from our paper is given in Table 3.   At the end, comparison tests were carried out to assess the efficiency of our hybrid model compared to hybrid models that already exist in the literature. The new model that is proposed inn this paper satisfy the requirements and presents better results in terms of accuracy coefficients. It can be seen in Table 3 that our model presents better results in terms of precision. This model, which has never been made before, therefore shows an incredible precision never equaled.
We conclude that our hybrid model therefore offers better precision and more reliable forecasting capabilities. Therefore these interesting results that we obtain are due to the fact that our hybrid model includes determining components which makes it c b a perfectly operational and allowing to characterize the evolution of the electricity consumption.

CONCLUSION
This work proposed a new optimized hybrid model based on the neuro-fuzzy inference system. In this paper, the input data considered consist of GDP in millions, GDP per capita, population, number of subscribers and number of households. The evolution of these parameters is considered between 1994 and 2017. The proposed algorithm can be used for estimating future electrical demand by optimizing the input parameters. The ANFIS model applied makes it possible to classify, train and validate data. The PSO algorithm ensures the optimization of the model parameters. The accuracy of these models is evaluated by errors such as RMSE, MAPE, MAE and R. The combination of ANFIS model and PSO algorithm makes it possible to obtain 0.32576 RMSE, 3.0817% MAPE, 29.4241 MAE and 0.9883 R. In order to improve these values as much as possible, we have also implemented the Grey model to obtain a hybrid model