1. Introduction
The Internet of Things (IoT) has become increasingly prevalent across various application domains, such as smart cities and Industry 4.0, leading to a heightened emphasis on the design and development of distributed cyber-physical systems (DCPSs). These systems’ behavior is significantly influenced by their context, encompassing the external physical environment and the internal states of the IT components and networked infrastructure. In recent years, DCPSs have been proposed to facilitate renewable energy communities (RECs), which promote sustainable development within local communities by adopting renewable energy sources. RECs consist of individuals, organizations, and businesses collaborating to produce and consume renewable energy, such as solar or wind power. Integrating DCPSs in RECs can enhance energy usage efficiency by monitoring and controlling energy flow within the community. DCPSs provide the essential infrastructure for RECs to supervise and regulate the production and consumption of renewable energy sources. In this context, IoT devices collect energy production and consumption data, which is then analyzed by cloud-based platforms to optimize the energy management system. By harnessing these technologies, RECs can establish a more decentralized and democratized energy system, empowering local communities to manage their energy resources actively. Numerous global initiatives have successfully integrated DCPSs and RECs. For example, in Germany, the “EnergieWendeBauen” project (
energiewendebauen.de, accessed on 1 March 2023) has implemented a DCPS-based platform for energy management in residential communities. This platform enables residents to monitor and control their energy usage and share excess renewable energy within the community. Similarly, the “Solar Share” project in Italy (
lifegate.it, accessed on 1 March 2023)has introduced a DCPS-based platform that allows individuals and small businesses to share surplus solar energy with their neighbors. Integrating DCPSs and RECs offers a promising opportunity to promote sustainable development and transform the energy landscape. By leveraging the power of IoT and cloud computing technologies, these systems can enable more efficient, sustainable, and decentralized energy management. Future research in this area should focus on developing scalable and secure DCPS-based platforms to support the widespread adoption of renewable energy sources in local communities worldwide.
To enable the creation of DCPSs, an overlay-based distinction between the physical environment and the digital infrastructure is considered a cornerstone of the whole scenario. IoT devices’ sensing and actuation capabilities facilitate this interaction between the two layers, which collect data to send to the cloud for processing according to various scopes, such as latency reduction, privacy-preserving, or security purposes. Data processing in the cloud typically involves logic units adapting their models based on observed data and providing dynamic and queryable run time models for a pipeline of services. Until now, the design of DCPSs has primarily focused on performance-related, non-functional requirements. However, sustainability has become critical due to the growing power consumption and associated computing expenses at different levels in these systems. The increasing sophistication of DCPSs requires more computational resources, which leads to increased energy costs. To address the sustainability challenge, integrating energy-aware digital components in DCPSs is an essential activity to create sustainable systems where IoT devices and server-based infrastructures can make autonomous decisions based on the outcomes of self-learning algorithms. DCPSs are becoming increasingly complex and consist of multiple interacting subsystems and environments. The aggregation of subsystems occurs at different levels, from edge devices to large systems. The proposed solution envisions a future where DCPSs are treated as conscious systems that can respond to internal and external triggers and adapt their operations to achieve predefined goals. These systems will be able to learn from experience through self-learning mechanisms and carry out planned actions and predictive strategies at the overall system level to optimize resources, maximize efficiency, and reduce energy costs.
A renewable energy community realized upon a DCPS is an environment in which two aspects must be combined and orchestrated: energy production and energy consumption. The trade-off has to be realized not only in terms of online orchestration but also by considering historical data related to the two aspects mentioned above. From this perspective, IoT devices are essential to observe physical parameters, such as current consumption and voltage. A distributed infrastructure collects and processes these samples through optimizing self-learning algorithms.
The goal of the envisioned environment is to ensure the optimal behavior of the entire REC by maximizing self-consumed energy and minimizing the delta between the community’s produced and its consumed energy profiles. This way, the presented solution is tailored to a scenario in which the renewable energy community is composed of real estate units agreeing to create a DCPS in which they cooperate with each other through a central entity appointed to act as an energy manager and broker toward the grid. The broker, running on the DCPS server facilities, has three main duties:
Distributing the energy produced among the whole community, avoiding purchasing energy from the grid as much as possible;
Continuously monitoring the energy market to purchase and sell the energy at the best price;
Notifying the REC’s end users, suggesting disconnecting specific submetering or lightening the energy load to comply with the consumption parameters defined by the REC to obtain a better monetary reward. The reward (obtained by the REC concerning the energy available for sale) is shared proportionally to the correct user behavior. The proposed methodology incentivizes efficient energy use and contributes to a more sustainable energy ecosystem.
Of course, these aspects and considerations are not the only elements relevant to cope with this goal. Indeed, REC designers also have to consider other factors, such as:
The placement of the computation entities inside the infrastructure;
IoT and infrastructure management;
Environmental energy predictions: production and consumption;
User data privacy.
In this work, we present a self-conscious system designed to constantly monitor and forecast energy consumption in real estate units under the purview of the REC. This groundbreaking approach facilitates energy management and reduces dependency on external power grids. To highlight the contributions:
- (i)
Our system uses advanced deep learning algorithms to accurately predict energy production and consumption patterns, paving the way for more efficient and eco-friendly energy distribution.
- (ii)
When energy consumption exceeds production, the system proactively dispatches notifications to real estate units, indicating high consumption levels to those estates with elevated projected consumption. This timely communication encourages residents to shorten their energy usage, ultimately reducing the necessity of procuring supplementary energy from the grid.
- (iii)
The system meticulously records and examines the responses to these reduction requests to support community involvement and commitment. These data are later shared with the community, which can then deliberate a reward-based incentive program to recognize those who consistently exhibit responsible energy consumption practices.
This approach favors energy efficiency and sustainable living within the REC by fostering a cooperative atmosphere, providing mutual benefits for all community members.
This paper is organized as follows. In
Section 2, we provide a comprehensive literature review of the existing methods and technologies used in energy management and discuss the advantages and limitations of each.
Section 3 provides the background information necessary to understand the presented work. In
Section 4, we describe the system architecture and the role of each component in detail.
Section 5 presents a case study illustrating the practical application of the proposed solution, while
Section 6 discusses the results and validation of our approach. Finally, in
Section 7, we conclude with our findings and suggest future enhancements to improve the effectiveness and applicability of our solution.
2. Related Works
Distributed cyber-physical systems (DCPSs) can significantly benefit from recent advancements in distributed computing, including architectural elements, algorithms, and models. In [
1], the authors highlight key challenges associated with DCPSs, such as latency, energy consumption, security/privacy, and reliability. Designing a reliable IoT communication infrastructure for DCPSs remains an open challenge, as other researchers in [
2,
3] emphasized. Meanwhile, ref. [
4] formulates the scheduling computation on the cloud continuum as a mixed-integer linear programming problem and proposes an energy-aware deployment and replication scheduling model, considering the capability of edge/fog nodes to harvest “green” energy.
The increased adoption of DCPSs, combined with the need to address emerging climate change issues, has led to renewable energy communities (RECs). In recent years, energy delivery and consumption in DCPSs have gained particular attention due to the increasing number of users (producers and consumers) involved in generating and sharing renewable energy [
5,
6]. Research on energy management and optimization through energy exchange, sharing, and storage mechanisms, along with the characterization of user behaviors, is crucial for achieving sustainability in RECs [
7,
8,
9]. In this context, ref. [
10] proposes a distributed energy management system (EMS) for optimal microgrid operation, considering power distribution constraints. The EMS demonstrates effectiveness in both islanded and grid-connected modes, with future work focusing on its implementation in real systems and performance analysis. Cloud computing has emerged as a popular solution for managing, storing, and processing data in energy systems. As outlined by [
11], it offers a scalable, on-demand, and cost-effective model for delivering IT resources via the Internet. Numerous researchers have investigated the application of cloud computing for energy management and optimization. In [
12], the authors explore the new challenges that smart grid technology introduces for comprehensive data management and examine how cloud computing can address these issues. Their survey encompasses smart grid and energy management methods, investigating the use of cloud computing in various domains, such as energy management, demand-side management, building energy management, energy hubs, and power dispatching systems.
Smart grids represent a modernized electrical grid infrastructure that employs cutting-edge technologies to monitor, control, and optimize electrical power generation, distribution, and consumption. The authors in [
13] present a detailed overview of smart grid technologies, including advanced metering infrastructure, demand response, and distributed energy resources. Furthermore, ref. [
14] reviews demand-side management techniques in smart grids, emphasizing the importance of load forecasting, demand response, and energy storage systems in achieving energy efficiency and grid reliability. Integrating the Internet of Things (IoT) and cloud computing has shown immense potential in enhancing the efficiency of energy management systems. IoT provides a platform for connecting and collecting data from various devices and sensors, while cloud computing enables the processing and analysis of these data. In [
15], the authors discuss how incorporating IoT technologies into smart grids can improve monitoring, communication, and data processing across various devices. They propose a layered approach for classifying IoT applications in smart grids and explore recent research efforts along with future directions. On the other hand, the authors in [
16] investigate the benefits of combining IoT and cloud computing for smart grid applications, particularly in demand response, fault detection, and renewable energy integration. This synergistic approach holds promise for further energy management and optimization advancements, paving the way for more sustainable and efficient energy systems. Ref. [
17] investigates the correlation between solar irradiance and harmonic distortion in grid-tied photovoltaic distributed energy resource (PV-DERs) systems. Understanding this relationship can help develop effective grid-to-grid power-sharing arrangements and mitigate harmonics in bidirectional power-transfer community-grid structures.
The self-management processes that govern the operation of RECs are based on machine learning (ML) techniques to improve their effectiveness, autonomy, and efficiency. Energy demand and supply forecasting, self-consumption, characterization of power consumption behaviors, efficient scheduling of energy resources, and appliance obsolescence are some tasks involving ML and deep learning (DL) techniques [
18,
19,
20,
21].
Some studies have been conducted using both statistical approaches [
22,
23,
24] and ML models for predicting individual household loads, predominantly the latter, due to their ability to capture complex patterns in the data and provide accurate predictions [
25,
26,
27,
28]. On the other hand, despite other works that have been conducted to improve the accuracy of household load forecasting using the advantages of DL models, and thus of the use of the neural network (NN)-based algorithms [
29,
30,
31], other investigations have focused on improving the accuracy of household load forecasting by taking advantage of DL architectures for time series prediction, including the highly effective long short-term memory neural networks (LSTMs) [
32,
33]. The latter have demonstrated remarkable advancements in recent times, despite the volatility of predictions caused by the heterogeneity and randomness of household behavior; however, they are out-performed by the more accurate Bi-LSTM networks [
34,
35,
36]. In this context, modeling user profiles to meet energy demand while optimizing overall consumption is crucial [
37]. Thus, DL models are a must to identify users’ lifestyles based on their daily energy consumption. In addition, the meteorological forecast data must also be considered when modeling energy profiles, as renewable energy sources are often intermittent. Research on developing planning strategies for smart load distribution and integrating renewable energy resources is ongoing, and federated learning (FL) approaches are being investigated for this purpose [
38,
39].
Energy awareness must be incorporated at every layer (models, data, algorithms, hardware components, etc.) and tier (cloud, edge/fog, IoT) of the IT infrastructure of DCPSs, and in every phase (design, deployment, execution, etc.). To address this problem, the scientific community has begun to define methodologies and approaches to evaluate the energy consumption of models and algorithms based on structural and behavioral parameters [
40]. For example, ref. [
41] proposes an energy-efficient IoT data compression algorithm to optimize the execution of ML algorithms at the edge. At the same time, ref. [
42,
43] focuses on the energy optimization of the deployment and distributed training of ML models at the edge, respectively. The processing capabilities of IoT devices represent both a resource and a constraint. Thus, designing a suitable infrastructure is both a requirement and a challenge. The trend towards offloading data analytics tasks from edge devices to the cloud has been increasing. However, existing offloading approaches face the challenge of being static and needing help to adjust to changing workloads and network conditions.
Moreover, in [
44], an energy-aware workload allocation framework for distributed deep neural networks (DNNs) in the edge-cloud continuum was presented to minimize energy cost for inference. This framework considers energy consumption and computation performance to optimize the allocation of workloads in a distributed computing environment. Offloading data analytics tasks from edge devices to the cloud has great potential for improving the efficiency and performance of DCPSs. However, existing offloading approaches have limitations, and researchers continue to develop more dynamic and energy-efficient solutions to overcome these challenges.
The advancements in DCPS research make significant progress on latency, energy consumption, security/privacy, reliability, and computation allocation challenges, improving their effectiveness, autonomy, and efficiency while contributing to sustainability and addressing emerging problems related to climate change. For these reasons, the solution proposed in this study aims to define an optimal implementation/architecture of an energy-aware DCPS, providing a smart and flexible power system while enabling the integration of renewable energy sources and facilitating the integration of microgrids and other distributed energy resources. Ref. [
45] presents an asymmetrical single-phase eleven-level inverter for the grid integration of distributed power generation sources, contributing to improved power quality and cost effectiveness in grid-connected systems. Moreover, ref. [
46] introduces a distributed-variable flow-variable temperature (VF-VT) approach for integrated energy and heating systems, offering privacy preservation, feasibility, and scalability. The study identifies future research directions, including global optimization, model development, and improved thermal dynamics modeling, which can further enhance the performance and efficiency of energy-aware DCPSs.
Our proposed solution employs a combined approach for managing both the production and consumption aspects of RECs, which sets it apart from other systems. In addition to this comprehensive approach, our solution provides three key contributions that, although present in some existing solutions, are not typically found together in a single framework. Specifically, our approach integrates all three contributions, enhancing the overall effectiveness and efficiency of the system. In comparison, the papers from references [
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37] primarily focus on applying AI techniques to individual households rather than entire communities. While these studies offer valuable insights into AI-based energy management, they may not fully capture the complexity and interconnectednessof energy production and consumption in broader communities. By addressing energy management at the community level, our solution aims to achieve a more comprehensive understanding and optimization of energy distribution and utilization in RECs. Moreover, the works from references [
5,
6,
7,
8,
9] do not explicitly mention the use of AI techniques in their proposed solutions. Although these studies contribute to advancing energy-aware DCPSs, they may not fully leverage the potential of AI and ML in improving energy management, forecasting, and optimization in RECs. By incorporating AI and, more specifically, DL techniques in our solution, we seek to further enhance the performance, efficiency, and adaptability of our proposed energy-aware DCPS architecture.
4. Architecture
The REC envisioned is a DCPS in which it is possible to consider an architecture composed of three parts by design: (i) the REC production sites, (ii) the REC real estate units, and (iii) the centralized computation facilities.
The “REC production sites” may be realized in several ways, spanning from a dedicated community’s solar panel field to a distributed production system in which the panels are installed on the properties belonging to the REC. Indeed, the ownership of energy production systems is not a key point in the scenario; this is because the only essential element is that all the sources are connected together and are able to deliver some operative information enabling the DL model to predict and monitor the energy production.
The “REC real estate units”, considered one by one, are no more than a sub-CPS composed of several IoT devices (smart meters or powerful devices with metering capability). This way, a building in this category is continuously monitored by a DL model running on site (essential to preserve the owner’s privacy, e.g., the owner’s habits), producing aggregated data to the central coordinator (referring to the whole building). The data monitored in a real estate unit may refer to a section or simply to a particular device (i.e., the washing machine). Furthermore, the data gathered are stored locally and processed by the DL model to predict consumption, considering the seasonality.
The centralized computing facilities can run the DCPS orchestration modules managing the whole REC. The data coming from the DCPS to the orchestrator arrive in the form of real-time and predicted data; these contributions are processed to compute the amount of energy available to the community at the computation time and in the following time window. This way, the orchestrator can evaluate the community energy needs and, if needed, notifies to REC members that have, both real-time and predicted, higher consumption, to reduce the energy request in their real estate units. The acceptance or lack thereof of community members receiving a notification is stored for administrative duties (e.g., to reward deserving members with discounts or benefits). Centralized computing facilities also have computed DL-based monitoring and prediction estimation related to “REC production sites”.
The REC’s energy orchestrator, as shown in
Figure 4, is composed of three main modules. The first two (respectively, named ECEM, Energy Consumption Estimation Module, and EPREM, Energy Production Estimation Module) are meant to evaluate both real-time data and predicted data to produce an approximated value of consumption (or production); the third (called TEANS, Threshold Evaluator and Notification System) uses the previous approximation to understand if the energy requests are greater than available energy in the community, and tries to find a solution pattern to avoid it (i.e., in the case of unexpected consumption, one or more notifications may be delivered to the community members with higher consumption).
4.1. REC Subsystems at the Edge: Real Estate Units and Production Sites
Both the real estate units elements and the production sites, as stated above, may be considered as sub-DCPSs composed of a series of IoT devices configured and managed by the exploitation of the principles (and the IoT platform S4T) described in
Section 3 and
Section 3.1, which enable the system owner (and, of course, the manager) to inject portions of code in the form of plugins to customize the IoT’s behavior. Furthermore, thanks to the software-defined approach (as described in [
49]), it is possible to orchestrate the environments as configurable DCPS contained inside the community’s DCPS. The two edge elements of the REC are monitored (in terms of energy consumption and energy production) by a DL model trained on the historical data collected on the system itself (indeed, the model is trained on the historical data year by year to increase its accuracy in prediction, also in relation to the environmental modification such as the increment or replacing of devices). The monitoring DL model can predict the system behavior (energy consumption or production) by advancing a time slot
. According to
Figure 4, the real estate units and the production sites present a different management approach: the former runs its monitoring model in each estate unit, providing data (real-time and prediction) to the opportune orchestrator sub-module (ECEM). Conversely, the latter runs only one model on cloud computing facilities that can process and gather the data coming from each production site and predict the energy produced. Data obtained from the aggregation and prediction duties are sent to the orchestrator sub-module (EPREM). Furthermore, this approach avoids privacy disclosure by processing the data about energy consumption directly on the real estate units and pushing only the aggregated data towards the REC energy orchestrator. From the security point of view, the architecture also increases the security degree by decoupling the home energy management system and REC energy management system.
4.2. The REC Energy Orchestrator
The energy orchestrator is a system meant to compare energy consumption and production, aiming to avoid the necessity to buy energy from the grid. To reach this goal, the contributions related to real-time data and predicted data are computed by specific sub-modules (e.g., ECEM and EPREM) to produce an estimated value of both energy requests and energy available for the community. The EPREM (Energy Production Estimation Module) and the ECEM (Energy Consumption Estimation Module) deliver their estimation to the TEANS (Threshold Evaluator and Notification System) which, if needed, sends notifications to the members of the community with higher consumption.
The estimations are based on an assumption of linear behavior among data from the monitoring and prediction, both for consumption and production. This assumption is supported in [
53], where a linear model based on electricity consumption data was sufficient to forecast industrial production. The investigation mainly focused on forecasting Italian industrial production, where results implied that linear behavior is a valid assumption for short-term forecasting, 50 min forecasts in this case (see
Section 5.1 related to the datasets). Based on the previous assumption, the estimation modules use Equation (
1) to compute the
as a point on a straight line passing through two points, real-time data (
) and predicted data (
), computed at time
, as reported in
Figure 5. The
is configurable by the orchestrator value narrow to the real-time data.
The two modules, ECEM and EPREM, have a dual behavior because the estimation process is used only in cases with positive (see Equation (
2)) and negative (see Equation (
3)) slopes. This way, the estimated values may not underestimate the consumption or overestimate the production.
The job performed by ECEM and EPREM is essential to enable the orchestration process so that we can consider their job as a pre-processing of the inputs from the edge part of the DPCS.
The estimated values become inputs of the TEANS (Threshold Evaluator and Notification System) module which, after evaluation of the inputs received, is able to:
Identify when consumption is exceeding production;
Identify which community members exhibit higher consumption; and
Send notifications to the owner of a real estate unit and, at the same time, to the environment itself, that suggest which internal line is requesting more energy.
The function shown in Algorithm 1 is used in the first and third tasks listed above. Indeed, the function
EvaluateInput is used by TEANS firstly to evaluate the inputs coming from ECEM and EPREM to understand if an intervention is necessary (the intervention procedure is contained in the else condition). When a reduction in energy requests is identified, the energy consumption that exceeds the energy available in the REC is computed (the
value), and it is used to select the REC members who will be the recipients of notifications of power reduction. The quantity of requested power reduction notifications is split equally among the selected members, corresponding to the
value. The second function to consider is shown in Algorithm 2. It is invoked by Algorithm 1 to obtain a list of members requesting high energy. To this aim, the input of this function is the
mentioned above; the ECEM module uses it to understand how many members to select; the higher the value of
, the lower the threshold used to mark and add a member to the list becomes. In any case, the ECEM also identifies a list of unusual consumers who generally do not request much power from the REC. In that case, they are excluded from the “powerAbsorbingConsumer” list. Furthermore, the REC energy orchestrator considers each time a reduction in energy consumption request is satisfied, which may be used for rewarding purposes in administrative processes.
Algorithm 1: Pseudocodeof the function used to evaluate inputs from estimation modules aiming to identify the necessity of reducing the REC’s energy requests. |
|
Algorithm 2: Pseudocode of the function used to identify the list of REC members that will receive the request for power reduction. |
|
5. Use Case/Reference Scenario
This section describes the use case and a detailed analysis of the dataset, followed by an explanation of the preprocessing methods employed and, finally, an overview of the DL models used in the implementation of the system.
The use case and experiments conducted to analyze the behavior and feasibility of a REC implemented as described above are presented in the following. The REC community consists of numerous real estate units, enough to justify the production line realized in the REC. Each unit is equipped with a general smart meter, and the electrical systems within these buildings are intentionally designed to be divided into multiple subsections. These subsections are connected to specific sub-meters, allowing for more granular monitoring and management of energy consumption. The smart meters operate alongside IoT devices, such as Raspberry Pi 3, Arancino, and other CPU- and MCU-based edge devices, which are powerful enough to manage the edge component of S4T (Lightning-Rod, see
Section 3.1.3). The DL models are deployed as plugins injected via S4T on these edge devices. Another aspect of the REC community involves the production sites, which consist of solar panels connected to an inverter to establish a production line. Generally, each production line may be located on a real estate unit (e.g., on a building’s roof) or in a designated area within the REC reserved for energy production. In this use case, we consider a few powerful production lines set up in specific areas of the REC. Each line has its dedicated inverter, which measures the produced DC and other parameters, as discussed in more detail in
Section 5.1 and
Section 6. These measurements are then transmitted to the DL model running in centralized computing facilities directly managed by the community. This setup allows for efficient monitoring and management of energy production within the REC community. A comprehensive understanding of the entire architecture, including the interconnections and interactions among all its components, can be obtained by referring to
Figure 6. This chart offers a high-level overview of the relationships between the various elements within the system.
5.1. Dataset Description
For the use case, we used two different public datasets: (i) The household electricity load diagrams 2011–2014 dataset, designed by the University of California, School of Information and Computer Science, and shared in the UCI ML repository [
54], and (ii) The solar power generation dataset [
55]. The first dataset comprises 2,075,259 instances of
electricity consumption samples (KW) of a household in Paris from December 2006 to November 2010 that were captured at 1 min intervals. It contains observations on household
global active power (GAP) (in kilowatt),
global reactive power (in kilowatt),
voltage (in volts),
global current intensity (in ampere), and information on three sub-rooms (in kilowatt/h) on global energy consumption (in kilowatt/h). Specifically,
Sub metering 1 monitors the active electricity usage of the kitchen appliances, including the dishwasher, oven, and microwave.
Sub metering 2 measures the active energy consumption of laundry room appliances such as washing machines, tumble dryers, and lights.
Sub metering 3 records the active power of the electric water heater and air conditioner.
The second dataset describes data gathered from two solar power plants in India over a 34-day period and includes power generation data and weather sensor readings data gathered every 15 min. For power generation plants, it provides readings on the amount of DC power (in kilowatt), the amount of AC power (kilowatt), and the daily yield and total yield for the inverter until that point. The weather sensor plants provide data on the plant, the sensor panel id, the ambient temperature, the temperature reading for that solar panel module, and finally, the irradiation. The power generation data are collected at the inverter level, where each inverter is connected to multiple lines of solar panels, while the weather sensor data are collected at the plant level, with a single array of sensors optimally placed at the plant.
Figure 7 highlights the seasonality of the GAP feature, used as the output value for the BiLSTM model’s predictions. Upon examining the data, it becomes evident that higher GAP values are concentrated in particular periods. The plot underscores the cyclical nature of the consumption patterns, facilitating the identification of intervals marked by increased energy usage. Data points in the graph display a color gradient from light to dark, representing a 24 h time frame arranged by the color intensity and organized into hourly, monthly, and weekly segments throughout the year. The hourly analysis indicates that consumption peaks predominantly occur during the afternoon, specifically from 17:00 to midnight. Conversely, the monthly overview offers insights into the distribution of consumption hours across the year, revealing a significant decrease in energy use during the summer months due to longer daylight hours. Additionally, a strong correlation between the monthly and weekly charts can be observed, as both show reduced average consumption in their central regions, corresponding to the summer period. This seasonality chart allows for the prediction of consumption patterns across various time frames during the year, assisting in the optimal configuration of the proposed system, aiming to predict the appropriate periods or hours to send notifications to users requesting a reduction in energy consumption. This approach aligns with RECs’ energy efficiency and sustainability policies.
Generally, a REC community consists of numerous real estate units, and they are commonly supported by energy generation sites to support the REC consumption. According to the data from the two datasets used for the experiments, we defined a reasonable scenario with 250 real estate units (as an assumption, we considered buildings with similar behavior and structure). This way, the energy produced by the three production lines from the datasets [
55] used as our REC production site data is justified.
Data Preprocessing
Data preprocessing involved preparing the raw data for our analysis and using it as input for the recurrent models. This process consisted of several tasks, including data interpolation, reduction, normalization, and integration.
Data interpolation: We performed linear interpolation on the data by estimating missing or NaN (Not a Number) values in the consumption dataset and computing the value at each missing point as a linear combination of its neighbors;
Data reduction: We aggregated time-series data into more manageable intervals by using the mean of every 15 min interval. This method facilitated the visualization and analysis of the patterns in the data and association with the production dataset;
Data normalization: We normalized the data so that they fell within a range (0,1), so as to improve the performance of the DL models;
Data integration: We aggregated the data from the production dataset by integrating the power generation and sensor readings data by feeding them as multivariate sequence inputs to the LSTM model.
Finally, we prepared entire time series data for use in a supervised learning approach by scaling the data and transforming them into a format suitable for training and testing the recurrent models. We divided the data into training, validation, and testing datasets to train the model, optimize hyperparameters, prevent overfitting, and test the final models’ performance. We split both datasets to use 70% of the data for training, 10% for validation, and 20% for testing.
5.2. Deep Learning Models
In our use case, we developed two types of DL models, and we tested them on the two datasets described above: long short-term memory (LSTM) and bidirectional long short-term memory (BiLSTM) neural network-based models, useful for processing sequential data and capable of learning long-term dependencies. Specifically, LSTM networks are specialized recurrent neural networks (RNNs) initially designed to overcome the vanishing gradient problem [
56]. LSTM networks can preserve past information in sequential data, which results in precise forecasting for time-series datasets [
57]. The BiLSTM networks, an extension of the LSTM networks, were applied twice to the input data to improve the long-term dependency learning and model accuracy [
58]. The first LSTM was applied to the input data in their original order, while the second LSTM was applied to the input data in reverse order. In this way, the model can better retain information from both the past and future of the input sequence, resulting in improved accuracy. The main task of these networks is to learn potential rules from many samples of time-series data and perform analysis and predictions by constantly correcting the network weights. Both networks have significantly improved in recent years, especially for time series prediction and in analyzing power grid data [
59,
60], where the predictions perform well with both data generated from routine user behavior that exhibits some regularity and data generated from emergent user behavior, such as sudden incidents and anomalies, that show some randomness and variability.
The BiLSTM with an “attention mechanism” (BiLSTM-Attention) is particularly well suited for the analysis of long time series, due to a memory function that allows important feature information to be retained for load prediction [
61,
62]. The “attention mechanism” is used to further explore the relationship between the features of the predicted time points processed by the BiLSTM layer. This way, BiLSTM dynamically weighs the importance of different parts of an input sequence when making predictions, essentially by using a separate neural network to compute a set of weights representing each element’s importance in the input sequence. This is particularly useful in a household electricity consumption prediction at different times, as in cases where some parts of the input sequence are more important than others for making accurate predictions, e.g., in our use case, where the consumption during weekdays is lower than holiday periods, or consumption during spring is lower than summer, and so on. Thus, studying the consumption patterns at different time points can improve the accuracy of predictions. In the presented context, the BiLSTM-Attention networks were used as the proof of concept for the electricity consumption prediction for a REC community. In contrast, we used a simple LSTM network for plant generation data prediction (production), where it was assumed that the production data had constant behavior over time.
To evaluate the effectiveness of our models, we employed classical evaluation metrics, the root mean square error (RMSE), and the mean absolute error (MAE), where lower values represent better forecasting results. The equations for these metrics are given by Formulae (4) and (5), respectively.
where
is the true value,
represents the prediction value,
n is the predicted time step, and
i is the current time step.
In
Section 6, we describe the implementation and training steps of two networks; finally, we show the performance of the proposed DL models.
7. Conclusions
Our proposal enables better energy management and promotes efficient energy use. The solution discussed is meant to manage a renewable energy community by exploiting the energy produced without storing it. The proposed system can be applied to any such scenario without significant architectural modifications. Moreover, the reward system based on user behavior further incentivizes adopting sustainable energy practices, contributing to a more eco-friendly energy ecosystem. In conclusion, our research has successfully demonstrated the effectiveness of the proposed methodology in managing the energy produced among the community while minimizing reliance on the grid. This way, a REC aiming to minimize the fees due to energy obtained from the grid can adopt a complementary tool continuously monitoring the energy market for optimal buying and selling opportunities.
The current implementation of the orchestrator, a kind of complex event processing (CEP) system, has proven its value in sending notifications to users based on data collected and processed by AI models, guiding them to make informed decisions. Using AI in our research, primarily recurrent models, has been effective for short-term forecasting, yielding good energy consumption and production forecasting with the metrics employed, as shown and described in
Section 6. Nevertheless, the system is strongly based on the assumption that users, or at least most of the REC’s members, cooperate and follow the notification received. Some other potential limitations of the proposed solution include the complexities of implementing the method in various RECs, computational requirements, and adaptability to changes in the energy landscape.
We envision several enhancements to our existing methodology for future work. First, we plan to integrate CEP capabilities into IoT devices, enabling more localized and automated decision making based on complex event patterns. Second, we aim to explore the potential of CEPs in automatically reducing power consumption in buildings by managing sub-meters as devices within a software-defined I/O framework, thus extending its capabilities beyond merely sending notifications.
Finally, we intend to investigate other deep learning techniques, such as convolutional neural networks or transformers, to improve anomaly detection in energy consumption patterns, complementing the DL models currently in use. By addressing these areas, we aim to build upon the foundational results laid out in this research, contributing to the ongoing development of sustainable and efficient energy management solutions.