Prediction Models for Short-Term Load and Production Forecasting in Smart Electrical Grids

. The scheduling of household smart load devices play a key role in microgrid ecosystems, and particularly in underpowered grids. The management and sustainability of these microgrids could beneﬁt from the application of short-term prediction for the energy production and demand, which have been successfully applied and matured in larger scale systems, namely national power grids. However, the dynamic change of energy demand, due to the necessary adjustments aiming to render the microgrid self-sustainability, makes the forecasting process harder. This paper analyses some prediction techniques to be embedded in intelligent and distributed agents responsible to manage electrical microgrids, and especially increase their self-sustainability. These prediction techniques are implemented in R language and compared according to diﬀerent prediction and historical data horizons. The experimental re-sults shows that none is the optimal solution for all criteria, but allow to identify the best prediction techniques for each scenario and time scope.


Introduction
The recent "green power trend" propelled by the commitment signed in the Treaty of Lisbon, pushed the development of more sustainable models compatible with environmental protection. This change in the power generation paradigm allied to the resilience and robustness requirements, triggered the transition from the traditional power grids towards smart grids. This change in the power grid paradigm is also aligned with the Distributed Renewable Energy Generation (DREG), Distributed Energy Resources (DER), smart appliances, storage facilities, and Electric Vehicles (EVs). This evolution also stimulates the use of decentralization, where the components of the network are spread across the grid and are able to operate autonomously.
Electrical microgrids are small-scale power systems comprising DERs [1], both related to energy consumption (e.g., factories and households) and energy generation (e.g., photovoltaic panels (PV), wind turbines, fuel cells and diesel generators. These microgrids have suitable control systems that allow to work in both grid-connected and islanded operating modes.
In islanded microgrids, the achievement of self-sustainability is a challenging topic, being defined as "the ability to the degree at which the system can sustain itself without external support" [2]. This issue is especially hard in microgrids comprising RES and limited resources, where important loads have to be attended with the addition of the users momentary will. Table 1 characterizes the assumptions, requirements and challenges related to the self-sustainability in electrical microgrids, considering the two operating modes: permanent stand alone and temporary stand alone. Table 1. Characterization of the Self-Sustainability Problem in Smart Electrical Microgrids Operating in permanent standalone mode Operating in temporary standalone mode Assumptions -Forced islanding due to geographical isolation or to community will -Always disconnected from the main utility -In case of failure in the supply from the main utility -Works temporarily disconnected from the main utility to keep its full functionalities Requirements -Continuously optimize the balancing between production and demand -Minimize the utilization of nonrenewable generation sources -Ensure high levels of QoS -Optimize the production resources to ensure the full operation of priority loads -Maintain the QoS Under the permanent stand-alone operation, the microgrid is isolated, e.g., due to geographical reasons, with the need to attend the maximum number of loads maintaining the high levels of QoS. This requirement imposes the need to have a proper classification and selection of the momentary priority loads, the efficient management of the available storage devices and the accurate prediction of demand, production and weather profiles. On the other hand, the temporary islanding, e.g., due to a failure in the main utility grid, needs to ensure the full operation during the failure period through the optimization of the available resources with minimum impact in the QoS. This process will imply an adjustment of the loads priorities and an accurate short term prediction of the generation and demand profiles. In order to face these challenges, a proper vision of the upcoming events is needed in order to provide schedules for different scenarios and time horizons. Additionally, the unpredictability associated to the weather increases the complexity, requiring a flexible and dynamic control that is able to predict, anticipate, regulated and control the microgrid in order to extend its sustainability.
In this scenario, a decentralized and intelligent approach is required to cope with inherent complexity required to manage dynamic, heterogeneous and distributed electrical components. Multi-Agent System (MAS) [3] is a good candidate to implement such approach, providing important features, namely modularity, decentralization, flexibility, robustness, autonomy and adaptability. The distributed agents, along with their reasoning, communication and intelligence capabilities, can be enriched with prediction capabilities to forecast the energy demand and generation. Additionally, these prediction models can contribute to mitigate the unpredictability introduced by the use of some renewable energy sources, which are strongly dependent of the weather uncertainty.
Having this in mind, this paper studies the existing prediction algorithms that will fit the requirements imposed by the dynamic characteristics of demand and production profiles in microgrids operating conditions. The study will evaluate these algorithms based on the accuracy for both very short and short term, as well as considering the computation time across different scenarios. The selected prediction algorithms were implemented in R language and evaluated under several scenarios created using the Gridlab-D tool. At the end, the best prediction techniques for the prediction of demand and prediction of production, and for the permanent and temporary operation situations, were identified. This paper is organized as follows. Section 2 overviews the multi-agent system approach for self-sustainable electrical micro grids, and Section 3 describes the related work related to the use of prediction techniques for forecasting the energy production and demand in electrical microgrids. Section 4 presents the experimental case study and Section 5 analysis the achieved results. Finally, Section 6 rounds up the paper with the conclusions and states the future work.
2 Multi-Agent System Approach for the Self-Sustainable Electrical Microgrids MAS have already proven its capabilities across several application domains, namely manufacturing control, dynamic product routing, production planning, logistics, aerospace, and many others [4]. In terms of electrical power grid systems, MAS have being applied in a wide range of areas, such as diagnosis, market simulation, power grid monitoring and power systems automation [5]. The distributed capabilities of MAS enables the high performance required to prevent or contain rapidly evolving adverse conditions. In [6], a MAS based architecture focusing the self-sustainability in electrical smart microgrids is de-scribed. This architecture considers 3 types of agents that represent the different types of entities presented within the electrical microgrid, namely: -Consumer agent (CA): representing the controllable loads and responsible for the management of their consumption according to their needs, priorities and state of the grid. -Producer agent (PA): representing the producers of energy, e.g., photovoltaic panels and wind generators, and responsible to manage the produced power. -Storage agent (SA): representing the storage units and electric vehicles, and responsible to manage their charging and discharging cycles.
The global system behavior emerges from the interaction among the distributed agents, sharing and combining knowledge and skills in order to achieve the local and global optimums. Figure 1 illustrates the MAS architecture, and particularly represents the interactions among the agents in order to accomplish their individual goals. This exchange of information, according to different cooperation patterns, assumes critical importance under stressed moment where the global optimum arises. Therefore, each agent is endowed with local autonomy and intelligence required to dynamically adapt to changes in the system. Additionally, each agent is endowed with prediction models that allows to forecast the energy production and demands for the future, which is a crucial issue in microgrids operating in isolated mode, and particularly relevant when the objective is to improve its sustainability. In fact, the agents are able to dynamically anticipate upcoming events that could affect the sustainability of the microgrid.
For this purpose, the prediction methods embedded in each agent are dependent of their performance regarding the following aspects: i) type of prediction, i.e. prediction of energy production or energy demand, and ii) forecasting horizon, which can vary from hours to months, and iii) the computational time to execute the prediction. These aspects are also constrains that are used as selector for the prediction method, meaning that in some particular cases a less accurate but faster technique is more adequate than a more accurate but slower technique. This means that a study of the available prediction techniques that better matches the requirements of the several agents in the microgrid management is required.

Related Work
This section provides an overview of the prediction methods as well as their classification within the forecasting horizon. The application of these prediction methods within the smart grid paradigm is also discussed.

Prediction Techniques
With the integration of intelligence at the various levels of the electrical system (e.g., transportation and more recently distribution), allied with emergent decentralized paradigms (e.g., smart grids and smart buildings), the new generation of electrical power system are more complex and unpredictable.
Nevertheless, forecasting is a deeply investigated field across the different sectors from electric power systems to logistics and factory plants. Several review papers provide a good overview on prediction methods, namely [7][8][9][10]. In this field, and dependent of the prediction horizon, three sub-fields can be identified [11]: -Very Short-Term Load Forecasting (VSTLF): ranging from seconds or minutes to hours, and used to control the power flow. -Short-Term Load Forecasting (STLF): ranging from hours to weeks, and usually used to predict upcoming generation and demand, aiming to update the market prices accordingly. -Medium-Term and Long-term Load Forecasting (MTLF/LTLF): ranging from months to years, and usually used to predict the plant asset utilities.
Regardless of the model the main difference among them is the range of the input variables, which ranges from minutes or hours in the VSTLF models up to weeks or months in the MTLF/LTLF models. In our work, the focus is in VSTLF and STLF models, which algorithms have been widely used over the past decades with a myriad of approaches. Kyriakides and Polycarpou compiled the VSTLF and STLF prediction methods as follows [9]: (i) Regression models such as the Seasonal Decomposition of Time Series by Loess (STL) that uses local regression to remove irregularities from data. The STL method is very versatile method that handles any type of seasonality, not only monthly and quarterly data, that allows to control the seasonal component and rate of change over time. (ii) Linear time time series models, namely auto-regressive moving average (ARMA) [12] and auto-regressive integrated moving average (ARIMA) that is a generalization of an ARMA model, that can be viewed as a filter that aims at separate the signal from the noise, then extrapolating the signal into the future to obtain forecasts. (iii) State-space models (SSMs), that are filtering-based techniques such as the Holt-Winters (HWT) that is also known as Triple Exponential Smoothing seasonal method, recursively applying as many as three low-pass filters with exponential window functions. (iv) Nonlinear models namely machine learning approaches, such as neural networks that are based on simple mathematical models of the brain, they can be thought of as an organized network of neurons. The predictors/inputs form the bottom layer, and the forecasts/outputs form the top layer, the intermediate layers contain the hidden neurons. Simpler networks do not contain hidden layers, being these equivalent to linear regression.

Application of Forecasting in Smart Grids
Regarding the application of the afore mentioned methods and techniques there are several techniques aiming to address different issues in the demand and production forecasting applied to the smart grid domain.
Ricardo Bessa et al. presented a spatialtemporal forecasting method that combines observation of the solar generation retrieved from the smart meters and distribution transformer controllers to forecast 6-h-ahead residential solar photovoltaic and medium-voltage substation levels [13]. An ARMA model was used in [14] to predict the future solar generation in a laboratory-level microgrid. Charytoniuk and Chen presented an VSTLF prediction model based on Artificial Neural Networks (ANNs) to model the load dynamics in changing environments using five different networks that calculated five time intervals with 10 minute spacing [15]. A Wavelet Artificial Neural Network (WANN) with pre-data filtering was used to forecast the consumption values for the horizons of up to one hour [16]. Asber et al. investigated methods to forecast MTLF models and demonstrated how one can utilize a general load-modeling framework to extract the essence of specific modeling problems and achieve practical models [17].
Kandil et al. [18] presented an approach that implements a knowledge-based system to perform decision support of the most suitable forecasting model for M/LTLF power system planning. The system knowledge-base consists on static historical data (e.g., load patterns, economics and weather) and dynamic data (e.g., load and energy attributes, losses and estimation errors). A regression ANN was used in [19] and [20] by Zhang and Ye for STLF and LTLF respectively, using historical data from the previous years to train the model and predict into the future. Two models for LTLF were presented by Daneshi et al. [21], where the first applies a linear regression method to obtain the regression model equation, and the second model applies fuzzy sets to ANN to model long-term uncertainties and compare the enhanced forecasting results with those of traditional methods.
Enel the Italian energy company monitor over 32 million smart meters and use the recovered data predict upcoming demand values and use this forecast to to leverage customized hourly-based tariffs [22]. Carlee Joe-Wong et al. presented an algorithm to estimate day-ahead and device usages prices based upon historical data,l allowing the service provider to adjust the offered electricity prices based on users behavior [23]. Borges et al. [24] present a methodology that sums the forecasts on the compounding individual loads to perform load forecasting in large power systems.
A Plug-in Hybrid Vehicles (PHEVs) charging scheme based upon price prediction is presented in [25]. The proposed scheme uses generation and demand forecast to predict the upcoming price schemes, avoiding avoiding peak hours that would a severe impact in the price.
All the previously referred techniques address specific challenges, applying the same technique to static forecasting and historical data horizons. A combination of the best suited prediction techniques allied with the intelligence of MAS provides the necessary reasoning capacity to perform the selection of the ideal prediction method. This selection is impacted by the precision and calculation times of each prediction method, this way a study of available prediction method is needed in order to selected the most suitable ones.

Experimental Case Study
This section presents the case study focusing a small electrical microgrid as well as the chosen forecasting and evaluation methods.

Description of the Case Study
The case study scenario considers a small 4 person family house inserted within a small microgrid, with incandescent illumination, electric water heater and other loads (e.g., refrigerators, electric heating and television). Additionally, the house comprises an independent solar panel that can either feed power to the grid or be used as house supplier.
As distributed energy resources are the core part of a microgrid, each profile will be unique and important for the common wealth of the power community. For this purpose, the input dataset was generated using the smart grid simulation tool GRIDLAB-D [26], where the demand and photovoltaic (PV) production profiles were generated with 5 minutes interval, with an entire year corresponding to 105410 samples. Additional simulated samples will serve as validation data serving as an independent measure of the performance of the methods.
The winter demand and production simulated profiles are presented in Fig.2. As it is noticeable from the figure, there are clear consumption peaks near the wake-up times and dinner. The winter season and center-European/ north American longitudes prone shorter periods of sun light and cold temperatures influence the photovoltaic production capabilities resulting less power produced per m 2 of panels installed.

Selection of Prediction Methods to be Analyzed
Depending on the type of models and length of the forecast window, each method will produce faster/slower, more/less accurate results, which means that the case study will need to support the analysis of the prediction techniques for different historical data sets and prediction windows. A total of four methods were evaluated, namely ARIMA, ANN, STL and HWT, these four were picked as they are some of the most used algorithms to VSTLF and STLF. Each one of these methods were used through the existing libraries of the R platform [27] and run in the same machine under certain conditions regarding historical data size and prediction horizons. For the demand forecasting: For the generation forecasting: -Historical data size: 3 days (864 samples).
The prediction accuracy is an important criterion to evaluate the forecasting techniques. In this study, three statistical measures are used to determine the prediction accuracy, namely: root-mean-square error (RMSE), mean absolute error (MAE) and mean absolute percentage error (MAPE). The three measures are, respectively, defined as follows: where A t and F t represent the foretasted and observed values, respectively. Additionally, the calculation time is measured since the speed of the algorithm execution is relevant in dynamic prediction systems as the recalculation and adjustment procedures often need quick response times.
Each prediction method was executed six times to ensure accurate values during the evaluation procedure, being calculated the average of the experiments. In this way, sporadic events were absorbed providing smother and more consistent results.

Analysis of Results
This section presents and discusses the achieved results for the selected prediction methods, considering the energy demand and production curves.

Prediction Models for the Energy Demand
The evaluation of the selected prediction methods using the afore mentioned evaluation methods is summarized in the Table 2.  As it is presented in the table, the precision of the algorithms, shown in the MAPE and RMSE columns, varies with the historical data size and prediction horizon. This variation is depicted in Fig. 3, where it is presented the evolution of MAPE across the historical data and prediction horizon. The statistical model ARIMA, the only auto-regressive method presented, stays accurate during the bigger historical data sets although it starts getting good accuracy when the size of the data set decreases. This usually happens due to underestimation, since the ARIMA model uses past values in the regression equation, the low amount of past values affects the capability to predict future events. Despite the accuracy loss in the smaller horizons with smaller sized historical data, it is a very responsive method capable to provide fast forecasts.
The HWT model performed similarly to the ARIMA model, although with better accuracy with smaller historical data sizes, decreasing the calculation time as the data set size also decreases. These results make this prediction method as a good choice to provide an accurate forecast although it requires longer periods to perform the forecast turning it a second option whenever quicker forecasts are required.
The NN method proves to be the least accurate method where the forecast horizon is bigger, improving its accuracy for shorter horizons. The low values of RMSE can be mistaken as good accuracy when in fact it points to an overfitting problem, related to the size and nature of the training data leading a large numbers of layers containing many neurons. A closer analysis to the achieved results, revealed that the main responsible for the high error values was the undetection of sporadic demand peaks. Although, as the historical data size and prediction horizon decreased the number of sporadic demand peaks decreased, improving this way the accuracy. The STL method provided slightly better accuracy and calculation times when compared with the ARIMA model as it decomposes the time series in three components, trend, seasonal and remainder, providing a better recognition of the seasonal components presented in the household demand data. Therefore, we could say that the STL and ARIMA methods are complementary, providing the first method good results for longer horizons and the second for shorter horizons.
Taking a roundup of the four analyzed methods, the least prone for a dynamic forecast of the demand would be the neural networks as it as long training times and presented the lower overall accuracy turns-it the least usable. The STL prediction method would provide a better overall accuracy as well as quick calculation times. Table 3 shows the simulation results of the four prediction methods for the energy production scenario.Similarly to the prediction of the energy demand, the accuracy tends to improve as the forecasting horizon decreases. As it is noticeable, the lowest accuracy value happens for the biggest prediction period with similar results across all prediction methods. For this particular example, the STL method has the best overall performance with consistent accuracy values with the exception of "Next Day" horizon.  Taking a close look to Fig. 4, which summarizes MAPE error of each method across the forecasting range, it is perceptible that the next day and next morning scenarios present the least accurate periods, which is due to the high miss rate in the non-production hours, being this corrected for the later periods as it possible verify in Table 3. This is especial prone to happen as solar radiation is directly dependent to the weather conditions, which makes the trend analysis of the historical data harder to be identified. In this case, the calculation time is negligible as all the methods present fast prediction performances (under 5 seconds), similarly to the behavior presented in the demand forecasting, the STL method proved to be the most consistent method across the forecasting horizon.

Conclusions
Self-sustained micro grids require an efficient management of the available energy resources to face the energy demands. A particular challenge is to predict the upcoming patterns of demand and generation of energy in order to anticipate unexpected events. This paper described the evaluation of four prediction methods (ARIMA, HWT, NN and STL) running in different scenarios, for both energy production and demand and using simulated data generated by the smart grid simulator Gridalb-D. The programing language R as well as its available libraries were used to implement these simulation tests and run the evaluation procedure.
In the case of the prediction of the energy demand, the achieved results showed that there is no method that clearly outperforms the others. The results are ranging from the average of 7.31 MAPE (STL) to 24.41 (NN) across all scenarios. The accuracy showed to be lower than expected, due to the added noise and influence of users in the overall behavior. The peak estimation is essential as part of a proper estimation of the demand profile, as the demand tend to be more and more a discrete chart instead of a linear curve. In conclusion, a combination of several methods depending on the computational resources and available time to execute the forecast can provide better overall results than using a single algorithm. Combining the STL method for the longer forecasting periods and the HWT method for the shortest would result a better accuracy across the forecasting range.
Analyzing the results for the prediction of the energy generation, it is possible to state a difference across the evaluated prediction methods, where the differences are not related to the performance as they present similar results, but in terms of accuracy. In this field it is clear that the STL method is most consistent showing better accuracy across the different forecasting horizons.
Microgrids in full islanding have fewer resources, translating into higher number of adjustments this way they would benefit from a combination of the STL and HWT as this combination cover with the higher accuracy multiple prediction horizons. Microgrids in temporary islanding run the forecasting algorithm in the islanding moment in order to anticipate the needs until the moment of reconnection, needing this way a quick method and accurate for longer periods such as the STL.
The future work is related to the combination of these results with learning techniques in order to implemented an intelligent selection of the prediction methods according to the forecasting horizons and data size.