You are currently viewing a new version of our website. To view the old version click .
Energies
  • Article
  • Open Access

13 March 2025

Renewable Electricity Management Cloud System for Smart Communities Using Advanced Machine Learning

,
,
,
,
,
and
1
Department of Applied Data Science, San Jose State University, 1 Washington Sq, San Jose, CA 95192, USA
2
Smart City Research Lab, San Jose State University, 1 Washington Sq, San Jose, CA 95192, USA
3
ALPS Touchstone Inc., San Jose, CA 95134, USA
4
Department of Computer Engineering, San Jose State University, 1 Washington Sq, San Jose, CA 95192, USA
This article belongs to the Special Issue Machine Learning in Renewable Energy Resource Assessment

Abstract

Based on the renewable energy assessment in 2023, it was found that only 21% of total electricity is generated using renewable sources. As the global demand for electricity rises in the AI world, the need for electricity management will increase and must be optimized. Based on research, many companies are working on green AI electricity management, but few companies are working on predicting shortages. To identify the rising electricity demand, predict the shortage, and to bring attention to consumption, this study focuses on the optimization of solar electricity generation, tracking its consumption, and forecasting the electricity shortages well in advance. This system demonstrates a novel approach using advanced machine learning, deep learning, and reinforcement learning to maximize solar energy utilization. This paper proposes and develops a community-based model that manages and analyzes multiple buildings’ energy usage, allowing the model to perform both distributed and aggregated decision-making, achieving an accuracy of 98.2% using stacking results of models with reinforcement learning. Concerning the real-world problem, this paper provides a sustainable solution by combining data-driven models with reinforcement learning, contributing to the current market need.

1. Introduction

According to a PRNewswire report, the green energy market is expected to expand at an 8.9% compound annual growth rate (CAGR) between 2023 and 2032, from USD 1 trillion in 2022 to USD 2.4 trillion by 2032 [1]. Based on the current US market in 2023, there is 4000 terawatt/hours of electricity demand, and the numbers are only expected to increase. This increasing demand for electricity calls for an advanced management system of green AI services. Despite recent advancements, solar and wind energy are still sporadic and unpredictable, making it difficult to balance supply and demand and store energy. Traditional energy management systems have a propensity to employ rule-based strategies or static heuristics that are unable to adjust to dynamic and actual energy swings. This inadequate forecasting causes blackouts, ineffective energy trading, and resource waste in local communities. Thus, developing a system that manages green energy resources for electricity presents challenges like data storage, data collection, robust model development, and selecting appropriate parameters. To address these challenges, this paper focuses on solar energy, which contributes to 27% of the total generation of renewable resources. Using collected solar data, this paper develops models to predict the short-term electricity generation, consumption, and shortage.
Data from three different sources at intervals of 30 min for 3 years were collected and stored on the AWS cloud. The designed system uses various machine learning, deep learning, and reinforcement learning methods to design models that are robust in analyzing demand. Using existing methods, this research proposes a model called the Community-Based Model which has been developed through a combination of aggregated and distributed training. The important parameters for developing this model are weather parameters (temperature, humidity, snow, dew, sea level pressure, cloud cover, visibility, precipitation index), solar parameters (solar radiation, beam irradiance, diffuse irradiance, reflected irradiance, and historical solar data), and seasonal parameters (date and time). The system also takes into consideration the concept of the duck curve, which graphically represents electricity demand from the grid on days when solar energy production is high and demand is low. This curve illustrates the challenge of balancing electricity supply and demand when renewable energy sources like solar, which are intermittent and weather-dependent, have a significant impact on energy consumption [2].
To showcase the models’ results, a data-driven decision-making system was designed to analyze and monitor electricity trends, patterns, and demands. To support the Renewable Electricity Management Cloud System for shortage forecasting, this research uses a robust database to store input data and results generated by various models. This research focuses on the short-term to mid-term forecasting, and analyzes data at three different time intervals: hourly, daily, and weekly.
The system can be seamlessly integrated with any energy provider and expanded to mobile applications, providing users with dependable real-time forecasts and the ability to automate procedures related to shortage detection. In addition, the system is lightweight and portable, requiring less than 1 GB of source code, which makes it perfect for towns, colleges, and small enterprises looking to monitor energy use effectively. This paper is arranged as follows: Section 2 discusses previous AI and green energy cloud research with different solar components, paper contribution, and research gaps; Section 3 delves into the system design; Section 4 examines the system’s uses cases; Section 5 outlines the data engineering process of data collection and data pre-processing; Section 6 explains the model development process for forecasting consumption, generation, and shortage; Section 7 presents the system’s decision-making process of obtaining the final output; and Section 8 shows the model results. Lastly, Section 9 concludes the paper and suggests potential future research directions regarding a green energy AI cloud system.

3. Electricity Management System Design

After model development, researchers also developed a system on AWS cloud, initiated deployment process, and developed a web interface to visualize the data. This system was divided into several components: server maintenance, supporting frameworks, hardware management, database management, model development, and user interface.

3.1. System Architecture

Figure 1 illustrates the system architecture, which comprises major components from both hardware and the cloud user. The major components of the system architecture include hardware elements, such as servers and storage devices, which form the infrastructure for data processing and storage. Additionally, the cloud component of the system architecture provides scalability, flexibility, and accessibility for the data-driven green energy model. It allows for the seamless integration of diverse models and facilitates system deployment across multiple locations.
Figure 1. System architecture.
Hardware management focuses on smart meter configuration and solar device management. Cloud-based management of hardware devices helps manage operations and configurations. Hardware devices are connected to the cloud using edge internet services. Edge internet services enable remote access to the data and allow for remote monitoring and system analytics. Additionally, edge internet services provide a secure connection to hardware devices.
The two components, meters and solar devices, are monitored using dashboards deployed on the cloud. Users can access various components of the system, such as admin-based control of solar devices, meters, and AI models for predicting short-term shortages, consumption, and power generation.

3.2. Cloud AI

Cloud AI services provide users with data analysis and visualization capabilities. This allows them to make informed decisions about power usage and generation. Users can also access the system’s customer portal to view their energy usage and manage their bills. The developed models were deployed and used on the server. The staff level has access to the system’s data to monitor and analyze customer energy usage, identify potential issues, and make recommendations for improvements. The AI models help the staff and users to automate processes and optimize energy usage.

3.3. Front End

Frontend services provide an intuitive, user-friendly interface, making it easier for staff to access and use the system. The AI models detect and respond to any abnormalities in the data, providing further insight into the customer’s energy usage. The resultant predictive data are used to develop a user interface using the Flask framework on the frontend. The interface is made accessible to end-users, allowing them to look through the dashboard and make well-informed decisions based on the analysis of predicted generation, consumption trends, and energy shortage projections. The interface also allows customers to set custom alerts and notifications based on their preferred energy usage settings. The interface is regularly updated with the latest data and trends, ensuring that users are always informed and up-to-date.
Figure 2 refers to the user consumption dashboards for meters.
Figure 2. User interface showing meter usage for past 30 days.
A comparison of the meters’ actual and predicted solar generation is shown in Figure 3. The date range can be customized to be able to check the prediction at different levels according to the measurements. The deployed models were used to make the predictions.
Figure 3. User Interface for Meter Solar Generation.
Users can examine the average electricity generation for certain devices in Figure 4, and a comparison of actual and anticipated generation is shown in Figure 5. These visualizations facilitate improved evaluation of solar meter performance by offering a thorough summary in addition to aiding in the monitoring of generation patterns.
Figure 4. User interface for meter solar generation.
Figure 5. User interface for meter solar generation.
Figure 6 shows how to setup the configuration and check the devices’ status using the meter device management page.
Figure 6. User interface for meter management.
Figure 7 illustrates the shortage forecast in which users are informed on whether they should buy, sell, or hold the generated electricity, based on what the model’s shortage prediction tells us. The shortage forecast is based on the current demand, expected demand, and available electricity. The forecast is also adjusted to take into account any changes in weather or other factors that could influence the demand for electricity. Finally, the forecast is updated regularly to ensure that it accurately reflects the situation.
Figure 7. User interface for shortage prediction.

3.4. Database

MongoDB was used in conjunction with Flask to process and display data pertaining to solar generation, energy consumption, and meter statuses as well as handling and displaying other data. It was a perfect fit for this project because of its advanced querying and indexing features, which were vital in managing the large volumes of regularly updated data. Important parameters such as timestamps, energy consumption expressed as kWh, estimated load values, and detailed meteorological information, such as temperature, relative humidity, dew point, cloud cover, and wind speed have all been included in the analysis. In the same way that energy output, anticipated generation, and environmental considerations were examined, solar generating data were also thoroughly analyzed. Using this comprehensive dataset, a detailed data analysis was performed to aid in decision-making. For instance, by correlating energy consumption with meteorological data, it became easier to accurately predict future energy needs and adjust generation strategies accordingly. In Romania, every meter had a unique number, such as “ABR-SG-001” for the solar meter at “Campus Building ABR-SG”. Information about the cloud status, working status, and active status of the meter were included in this report. It provided insight into the environmental conditions that can affect solar energy production by providing information about cloud status. Solar panels can produce less energy when cloud cover reduces the sunlight reaching them. Thus, to maintain optimal performance, energy consumption and generation strategies were adjusted based on cloud status. To facilitate real-time analytics, it kept separate collections for solar generation, meter performance, and consumption. If any abnormalities or discrepancies in the data are identified, the system provides alerts and notifications. By taking prompt action, the operators can avoid any potential losses. Figure 8, Figure 9 and Figure 10 are the samples of the dataset stored in each record.
Figure 8. Solar generation data sample.
Figure 9. Consumption meter data sample.
Figure 10. Shortage prediction after model implementation.

4. System Use Cases

4.1. Use Case 1: Making Data-Driven Decisions

By integrating AI into the cloud, the system can be used to handle emergency situations such as natural disasters, power outage, and blackouts by making data-driven decisions.
The system uses historical disaster records and weather data in order to make data-driven decisions to effectively handle emergencies such as natural disasters, power outages, etc. The shortage model can help the user effectively manage their energy during these emergencies. In the shortage analysis page, the user can use the application to display the predicted shortage produced from the reinforcement model, as well as the actual shortage. The page also shows a graph of predicted shortage versus time; for each hour, the user is able to analyze the predicted shortage values, allowing them to make well-informed decisions to balance generation and consumption. The data from the shortage model give real-time insights into how well the user is storing their energy, making it invaluable for handling emergencies. This leads to the development of a resilient community which can be prepared for emergencies that lead to a severe energy shortage.

4.2. Use Case 2: Managing System Hardware

Staff are able to add/delete meter information in the system, which will be updated in real time in the MongoDB, allowing the system to have a real-time analysis of current meter data. They are able to input different information to each individual meter such as device name, location, deployment date, etc. There is also an option to delete the meter from the system if needed. This system allows for the meter information to stay updated at all times, and for users to continue receiving accurate and live information from the system.

4.3. Use Case 3: Consolidated Dashboard for Generation, Consumption, and Shortage Analysis

The home page shows the user details of the electric meter and solar meter, as well as IoT. It tells the user how many working meters there are, as well as the max usage for each meter in the last 30 days. Additionally, a visualization of the load consumption and solar generation are displayed, with a separate line for each meter. There is also a map of the location of the meters; in this paper’s scenario, the meters are located in Romania. Thus, users can view the consumption and generation data of the campus meters, status of meters, location of meters, etc., all on the same dashboard, giving them a clear overview of the meter usage for the past 30 days. The system allows users to view all relevant meter data through an appealing and coherent dashboard.
Users are also able to analyze their actual and predicted values of load consumption and solar generation for their desired meters on the same page. Once they input the date ranges and meters they want to analyze, the system shows the user two graphs: one depicting the actual values of the solar generation for each meter over time, and another comparing the actual and predicted aggregated values of the solar generation over time. Clicking on each point on the graph gives the numerical values of the consumption/generation, allowing for the user to perform a deeper analysis if needed. The shortage analysis page also allows users to analyze their actual and predicted electricity shortage.
By showing real-time visualizations and detailed data analysis on a consolidated dashboard, users are presented with a centralized overview of critical energy data. Having all these key metrics on a dashboard can help users make faster and well-informed decisions. It also simplifies data access, saving time and reducing the risk of errors from switching between multiple systems.

5. Data Engineering

5.1. Data Collection

The main challenge was choosing the intervals for data collection, and the second challenge was to connect the data to the cloud with APIs to obtain real-time data. The models used data collected from the E-LAND CO2 reduction in the Valahia University of Targoviste (UVTgv) [43], Photovoltaic Geographical Information System (PVGIS) [44], and Open-Meteo [45]. Since the area has heavy rain, winds, and substantial seasonal temperature changes, it is an ideal choice for this research because of the availability of multiple weather and solar radiation factors. There were a total of three solar panels installed at different buildings of the UVTgv green campus, namely Romania, ICSTM, C and ABM buildings, and data were extracted every 60 min. The collected data were stored in Google Cloud Platform (GPC). The data files were housed in a specialized bucket created within Google Cloud Storage (GCS). This bucket was established within the US-Central (Iowa) region, primarily chosen for its accessibility and cost-efficiency.

5.2. Data Pre-Processing

Data cleaning was an important part of data preparation since the data were coming from three different sources and had to be consolidated to be analyzed. After consolidating the data, data sanitization steps such as checking for duplicates, outliers, null values, and aligning the data were performed. The consolidated CSV shows time, generation readings, consumption readings, weather data, and solar parameters. Table 6 shows the time, generation readings, and consumption readings after cleaning from three buildings. Generation readings of “0” indicate it is night time and there is no solar energy generated.
Table 6. Sample data columns 1–10.
Table 7 shows weather data, and the solar parameters were the following:
Table 7. Sample data columns 11–20.
  • Gb(i): Beam irradiance on the inclined plane (plane of the array) ( W/m 2 ).
  • Gd(i): Diffuse irradiance on the inclined plane (plane of the array) ( W/m 2 ).
  • Gr(i): Reflected irradiance on the inclined plane (plane of the array) ( W/m 2 ).
For predictive modeling using historical data, it was important to have the same date format for modeling purposes, which made data standardization an important step. The date and interval column in the dataset were used to create a date timestamp column which replaces both those columns. Moreover, the extraction of details like the day of the week, month, or year from the date is essential; hence, a feature engineering process was conducted. This procedure facilitates the development of new features, enhancing the robustness of the analysis and modeling process by adding a layer of valuable information like day of week, month, and hour of day, which is extracted from the new date timestamp column. Having successfully formatted the data, the distribution of target variables was checked—“Total Consumption” and “Total Generation”—as well as their relationship presented in Figure 11 and Figure 12. In the figures, frequency refers to the amount of times that numerical consumption and generation values appeared in the datasets. In Figure 11, the histogram is smoothed to make the data’s underlying distribution easier to visualize. Kernel Density Estimation (KDE) curves appear in blue in the histograms.
Figure 11. Target variables’ data distribution.
Figure 12. Target.
In Figure 12, an overall correlation between Total_Generation (on the x-axis) and Total_Consumption (on the y-axis) is illustrated by a red line in the graph that illustrates a non-linear regression trendline. With an increase in Total_Generation, Total_Consumption tends to decrease slightly, but there is considerable variability.

5.3. Training Data Preparation

Data analysis was conducted on 17,520 rows and 22 columns after pre-processing and cleaning two years’ worth of data. The dataset was split 80:10:10 into training, testing, and validation, respectively, during the model development process. Using the validation data, the hyperparameters of the models developed were finetuned using the training data.
Table 8 shows the summary of the size of the dataset after every stage in the data engineering process.
Table 8. Size of dataset after every stage in data engineering process.

6. Model Development

The system forecasts consumption, generation, and shortage using three different approaches. The first approach uses various traditional and novel ML model approaches to predict electricity consumption, generation, and shortage values. As a second approach, this research aggregated data from all three buildings to forecast the total energy consumption and generation for the entire campus. As a third approach, a distributed training approach was employed, in which the best models found from Approach 1 are used to train the distributed data coming from each source. This research aims to develop a robust decision-making model for the campus that combines the results from energy generation machine learning, consumption machine learning, and shortage decision-making models so that users can make well-informed decisions to balance energy usage. Working with the various models described above required the use of a computer that has sufficient hardware to handle the processing needs of training and testing these models. Specifically, a local desktop/laptop with 16 GB RAM, multi-core processor, 29 graphic card of 1 GB, and SSD storage for the dataset was used. This project implementation also required Google Cloud Platform to keep the data in the cloud and for the execution, and it required a laptop/desktop with a multi-core processor with at least 8 or 16 GB RAM to speed up the training execution. For the data analysis preparation, a local Python Jupyter Notebook: v3.11 was used and in the Google Cloud Platform, and Big Query was used. It required Pandas, NumPy, matplotlib SciKit-learn, and seaborn libraries to perform data analysis and data visualization. In addition to this, the implementation of the deep learning models required the Tensor Flow, Keras, and PyTorch libraries.
Figure 13 shows the detail flow and overview of the model’s operation.
Figure 13. Overview of campus-oriented hierarchical model.

6.1. Approach 1: Traditional Models

6.1.1. Long Short-Term Memory (LSTM)

LSTM is highly suitable for the green energy project due to its proficiency in handling time-series data, such as energy consumption patterns and solar production. LSTM’s ability to learn from historical data enables accurate forecasting of energy demand and supply. The architecture of the LSTM model consists of 50 units with a ReLU function, followed by a Dense layer with one unit for regression. Training the LSTM model involved 50 epochs, a batch size of 32, and parameter tuning using validation data. The model was monitored for improvement using the validation loss, with early stopping activated after 10 patience epochs to prevent overfitting. After training was completed, predictions were generated for the test set, and the model’s performance was evaluated. LSTM was used for short-term consumption forecasting and short-term generation forecasting on an hourly basis in this study based on the existing research by [6,7,30] to forecast electricity consumption and [19,20,22,25,27,28,30] to forecast solar generation. However, in this study, it was found that LSTM performed poorly with consumption and generation predictions, with MAEs of 22.20 and 82.17 for consumption and generation predictions, respectively. This poor performance could be attributed to the complex and nonlinear nature of the data, which LSTM may struggle to model accurately.

6.1.2. Convolutional Neural Network (CNN)

CNNs are specifically designed for processing and analyzing structured grid-like data as well as sequential data, making them applicable to energy consumption analysis. The key operations within a CNN include convolution, activation, pooling, and fully connected layers. The convolution layer applies filters (kernels) to the input data. After each convolutional operation, an activation function is applied to introduce nonlinearity to the model. This is followed by applying a pooling layer to reduce the spatial dimensions of the data. The network ends with one or more fully connected layers, making predictions based on learned features. In the context of time series data, the architecture can be adapted to 1D or 2D structures to process the sequential data effectively. CNNs automatically extract relevant features from the sequential energy data and identify complex patterns and relationships between various factors impacting energy consumption, such as time, weather conditions, community events, and historical usage patterns. It also excels at recognizing localized patterns within the data, which could represent specific trends or events influencing energy usage within the campus. A CNN was used in this study as a similar technique to LSTM for predicting short-term consumption and short-term generation based on existing research by [8,10] to forecast load consumption and [22,28] to forecast solar generation. Surprisingly, the results were worse than LSTM when predicting both short-term consumption and short-term generation. The MAE for consumption was 24.76, and the MAE for generation was 94.97.

6.1.3. Support Vector Regressor (SVR)

After experimenting with popular deep learning models, SVR was tested. Support vector regression is a form of support vector machines, and applies the principles of SVM, a machine learning method used for classification and regression, to predict continuous outcomes. Electric consumption data often exhibit nonlinear patterns due to various factors like weather, time of day, and economic activities. Thus, SVR is good for this task due to its ability to handle nonlinear data. To predict the continuous values, it aims to find the best fitting line. SVR is distinguished using an epsilon margin of tolerance, and it works especially well with nonlinear data due to the work of kernel functions. By attempting to be as flat as feasible and minimizing error within this margin, the method strikes a balance between the model’s predicted accuracy and complexity. Emphasizing the optimization of hyperparameters, a grid search was conducted to explore the ‘C’ (regularization parameter) and ‘epsilon’ (insensitivity parameter) space. The grid search process revealed the best hyperparameters for SVR to be ‘C’: 10, ‘epsilon’: 0.1. Existing research by [12] used SVR to forecast load consumption and [19,21] used SVR to forecast solar generation. Aligning to the existing research, this research also used SVR to forecast short-term consumption and generation. As compared to LSTM and CNN, the MAE of SVR for consumption was worse than 29.39, whereas the MAE for generation was improved to 52.84.

6.1.4. Random Forest Regressor (RFR)

RFR was also experimented with in this research. The Random Forest Regressor operates within the domain of ensemble models, integrating the outcomes of numerous decision trees, thereby enhancing the overall accuracy of predictions. Each decision tree is constructed using a random subset of the training data and a bootstrapped subset of features. This diversification diminishes the correlation between individual trees and decreases the variance in predictions, resulting in higher accuracy and mitigating the risks of overfitting. In the pursuit of optimizing the Random Forest model for short-term energy consumption prediction, an exhaustive hyperparameter tuning process was conducted. The grid search spanned various combinations of ‘n_estimators’ (number of trees in the forest) and ‘max_depth’ (maximum depth of each tree). The best-performing hyperparameters, as determined by the negative mean squared error on a 5-fold cross-validation, were found to be ‘max_depth’: 10 and ‘n_estimators’: 150.
Existing research by [19,21] used RFR to forecast solar generation. But this research used RFR to forecast both short-term consumption and generation. It was found that, with the help of RFR, the performance of the models was significantly improved, and the models were able to achieve an MAE of 14.33 for consumption and 39.54 for generation after using RFR. This improvement can be attributed to the Random Forest Regressor’s ability to handle nonlinear relationships and interactions between variables more effectively.

6.1.5. Extreme Gradient Boosting (XGBOOST)

This paper also experiments with XGBoost based on existing research by [25] to forecast solar generation. With XGBoost, it is possible to capture generation patterns of solar panels due to its ability to handle complex nonlinear relationships and interactions between features. By combining multiple weak models into a strong predictive model, boosting is an ensemble learning technique. As a result, XGBoost is able to capture intricate patterns and dependencies in the data, thereby allowing it to accurately predict the solar panel generation and the load consumption as a result. In the same way as SVR and RFR, XGBOOST was used to forecast short-term consumption, and generation.As compared to all the models in all the sections, the model in this section performed the best. The MAE was 11.67 for consumption and 39.12 for generation, which is close to Random Forest. XGBoost performed the best in this experiment due to its robust handling of nonlinear relationships and interactions between features, which are critical in accurately modeling solar panel generation and load consumption. Its ability to effectively minimize overfitting while maintaining high predictive accuracy contributed to its superior performance. Additionally, its efficient computational speed allowed for quicker model training and evaluation. A hyperparameter tuning process was conducted using a predefined grid for ‘n_estimators’ (number of trees), ‘max_depth’ (maximum depth of each tree), and ‘learning_rate’ (step size shrinkage). Following a comprehensive grid search, the optimal hyperparameters for XGBoost were identified as ‘learning_rate’: 0.05, ‘max_depth’: 5, ‘n_estimators’: 100.

6.1.6. Shortage Forecasting Model Development

The campus model is developed for communities from various sectors and locations. The shortage forecasting model, or campus model, helps users make the decision to buy/sell or hold the electricity based on an analysis from consumption and generation forecast. This research experiments with three methods: prediction, classification, and a novel mathematical approach. The background models used are SVR, RFR, CNN, and XGBOOST.
To predict shortages, this research used the SVR, XGBoost, and Random Forest models. The prediction model forecasts future shortage values based on using historical shortage values to train the model.
To classify shortages, the models consist of Neural Networks, SVM, and Random Forest based on the features of the data. The classification model uses historical shortage values to predict the severity of the future shortages (i.e., low severity, high severity).
Using the novel mathematical approach to predict the value of shortage units, the predicted solar generation is subtracted from the solar consumption for each sequential hour as presented in Equation (1).
M = i = 1 n ( S G i S C i )
where n represents the number of hours, S G represents solar generation value, and S C represents solar consumption value.
By subtracting the most accurate predicted generation values from the most accurate predicted consumption values, the model is expected to predict the most accurate shortage value.
Reinforcement learning was used to enhance the models via Q-learning and state-action-reward-state-action (SARSA). Q-learning involves estimating the value of taking specific actions in given states, and updating these values using the action that maximizes future rewards, while SARSA directly evaluates the actions the agent takes, and the subsequent actions it takes. At each time step, the agent observes the current state, which corresponds to a specific data point in the dataset, and selects an action that predicts the shortage value for that data point. The action is chosen based on the agent’s policy, which is learned through Q-learning. The predicted generation value is obtained from the XGBoost model trained on the dataset. The environment provides feedback to the agent in the form of rewards, which are based on the accuracy of the predicted generation values compared to the true values. The agent’s objective is to maximize cumulative rewards over time by learning an optimal policy that guides its actions towards accurate generation predictions. Through trial and error, the agent learns to improve its predictions by adjusting its policy based on the observed rewards and experiences in the environment.

6.2. Approach 2: Aggregated Training Learning Models

The primary focus of the project was to accurately predict energy consumption and generation for the entire green campus. Thus, by utilizing the robust XGBoost algorithm, which was selected for its superior performance, an aggregate model was first constructed. Utilizing the mathematical approach described above, this model synthesized data from the entire campus, encompassing all three buildings to forecast the total shortage, as seen in Equation (2).
T o t a l S h o r t a g e = i = 1 n ( S h o r t a g e V a l u e )
Table 9 shows a snippet of the predicted values based on hourly basis of consumption, generation, and shortage using the aggregated approach.
Table 9. Predicted values from aggregated approach.

6.3. Approach 3: Distributed Training Learning Models

Following the creation of the aggregate model, individual predictive models for each building were developed to gain a more granular understanding of energy dynamics within the community. These models were tailored to account for the unique consumption and generation patterns of each building.

7. Decision-Making

Once accurate shortage prediction values were obtained, consolidated results were found using Equation (3) to form a decision on what the user should do.
D 1 = S B 1 S total D 2 = S B 2 S total D 3 = S B 3 S total
where S B 1 , S B 2 , S B 3 represent the predicted shortage of each building, S total is the sum S B 1 + S B 2 + S B 3 , and D 1 , D 2 , D 3 represent the fraction of the total campus shortage that Building 1, 2, and 3, contribute to, respectively. Using these fractions, the model outputs a cohesive decision (buy, sell, or hold). After obtaining decisions for each building, distributed and aggregated training were implemented to further enhance the community-based model in forming a final decision.

7.1. Distributed Decision-Making

The individual components of the distributed decision model system operate independently, but are part of a larger centralized system. Each of these local energy management systems (EMSs) processes data and produces outputs locally. Specifically, each meter used a machine learning model to forecast load consumption and solar generation for each meter based on historical data and various weather conditions. Then, each building produces a distinct decision based on the values of D 1 , D 2 , D 3 , as calculated in Equation (3). Figure 14 gives a detailed flow of a working distributed model.
Figure 14. Distributed model for community-level decision-making.

7.2. Aggregated Decision-Making

In an aggregated decision model, data from multiple communities are consolidated into a unified system. The proposed campus model utilizes this, combining data from multiple meters, allowing users to view consolidated output data for multiple meters on campus. The aggregated model structure is useful to users when they want to look at the campus on a large scale and ensure overall campus energy stability. Figure 15 gives a detailed flow of a working aggregated model.
Figure 15. Aggregated model for community-level decision-making.
To obtain aggregated model results, the results of D 1 , D 2 , D 3 obtained from Equation (3) were added and divided by 3. Using the aggregated decision obtained from Equation (4), the system is able to come to a final decision for the whole campus.
A g g r e g a t e d D e c i s i o n = D 1 + D 2 + D 3 3

8. Results

The system gave comparatively better results than most existing research. This paper’s unique mathematical approach for training the models, combined with reinforcement learning, improved results. For final decision-making, better results were gained from aggregated models.
Several metrics were used to assess the performance of the models when forecasting energy generation, consumption, and shortage values. These metrics included mean absolute error (MAE) and root mean square error (RMSE). MAE provides a straightforward measure of the average magnitude of errors in predictions, calculating the average of the absolute differences between predicted and actual values. RMSE also measures the differences between predicted and observed values, calculating the square root of the average of the squared differences between predicted and actual values. Together, these metrics offer a comprehensive evaluation of the model’s performance in accurately forecasting energy trends. In the following are consolidated results from all the phases of model development and system output. In most cases, the model outputted the best results from XGBOOST followed by RF. A common threshold used to decide whether the model is behaving well is an RMSE of under 50 and an MAE of under 25. The Table 10, Table 11 and Table 12 present consolidated results.
Table 10. Traditional model performance for various components (RMSE and MAE are reported in kilowatts).
Table 11. Model performance for shortage classification.
Table 12. Model performance for distributed and aggregated training (RMSE and MAE are reported in kilowatts).
The effectiveness of the classification model was calculated based on the percentage accuracy with which it could predict the severity of the shortage.
Because of the high margins of error in the original shortage model, reinforcement learning was incorporated into the shortage model in order to further improve it. This research calculated the accuracy of the model’s shortage analysis by dividing the total number of correct instances with the total number of instances. To do this, the number of rows with correctly identified positive values (actual shortage and predicted shortage both being positive), correctly identified negative values (actual shortage and predicted shortage both being negative), and mixed counts (actual shortage value and predicted shortage value having different signed values) were counted. This model achieved an accuracy of 98.2% using the following calculation presented in Figure 16.
Figure 16. Reinforcement learning results for shortage analysis with mathematical approach.
Runtime performance was also an important metric, as it is crucial for meeting system response time targets. Regarding consumption load prediction, the system had a runtime of 0.175 s; additionally, the integration timing for UI interaction, including data retrieval from MongoDB and display to the user, is approximately 4 s. Regarding solar generation prediction, the system had a runtime of 0.47 s; the integration timing for UI interaction took approximately 5 s. Finally, regarding shortage prediction, the system had a runtime of 0.5 s; the integration timing for UI interaction took 5 s. Analyzing these runtime factors helps in optimizing system responsiveness and user experience. According to the results, the developed system is robust and takes into account various important parameters and aspects of training. Additionally, this research has implemented advanced techniques for managing emergency situations such as shortages at the community level. It is worth noting that, 98.2% of the time, the campus model is effective at predicting shortages, resulting in higher accuracy. Additionally, any industry working on shortage forecasting can easily use this system.

9. Conclusions

From various aspects, this research has implemented a system that is highly conducive to sustainable development. With this system, it is possible to accurately forecast the three major elements of green AI services: energy consumption, energy generation, and energy shortages. Using this system, a community can efficiently manage its electricity needs. This satisfies the ultimate goal of this system: to improve energy sustainability among smart communities through the use of sophisticated, data-driven insights.
The research used data from three different sources to design the system, and data were fed into machine learning, deep learning, and embedded models for experiments. Two advanced methods (distributed, aggregated) were used to train the data in this system, which produced better results. These aggregated and distributed models were ultimately applied in the system. For developing the models and managing the data, this system used Python v3.11, Flask v3.1.0, and MongoDB v5.3. The system’s frontend was developed using NodeJs and React framework for displaying real-time graphs such as electricity load graphs, metered data, solar generation graphs, and shortage predictions graphs. The system’s backend was primarily developed using Javascript v2.11.0 in Visual Studio Code v1.92. The system was then tested for accuracy and performance. Regarding electricity generation modeling, XGBoost produced an RMSE of 94.4 kW and an MAE of 39.12 kW, which was significantly lower than the other models. Regarding electricity consumption modeling, XGBoost produced an RMSE of 14.65 kW and an MAE of 11.67 kW, which was more accurate than other models. Finally, regarding shortage, XGBoost had an RMSE of 79.08 kW and an MAE of 45.88 kW. However, even with XGBoost, the models had high margins of error; thus, reinforcement learning was implemented into the models. This greatly improved accuracy, and the shortage model improved to an accuracy of 98.2 %. Additionally, the quick runtime, with all models running in less than 5 s, suggests that the system is extremely applicable in real-time applications. The important components of the system like frontend, backend, and models were neatly designed and implemented with reliable technologies. The results were satisfactory and the system is now ready for deployment.
In conclusion, the system’s performance, accuracy, and integration capabilities make it a promising project and a reliable choice for users.

Future Works

Price Prediction Component: In the future, real-time analysis and additional data can be gathered for price prediction. To enhance the accuracy of price-prediction models, the integration of machine learning algorithms that analyze historical price data and market trends should be considered. Additionally, incorporating external factors such as economic indicators, news sentiment analysis, and competitor pricing can provide more comprehensive insights. Regularly updating and validating the models with new data will also help maintain their accuracy over time.
Cyber Green energy System Infrastructure: A stronger and secure cloud-based infrastructure is needed to support big data. In order to manage trading data, it is imperative to collect, monitor, drive, and analyze it. Data on energy consumption and production should be collected, managed, and analyzed using cloud infrastructure. The cloud-connecting infrastructure allows users to connect multiple cloud-based infrastructures. For green AI to be more effective and secure, cloud-based infrastructure must be developed. In this way, green system management will also become more affordable.
Incorporate Real-Time Data: To improve accuracy and responsiveness to changing weather conditions and their effects on solar energy output, enhance the project by integrating real-time data capabilities.
Frequent Model Updates: To keep prediction models current and accurate using the most recent data, it is crucial to establish a mechanism for regular updates and retraining.

Author Contributions

Conceptualization, E.C. and J.G.; methodology, Y.M., V.M., K.A., and C.T.M.; software, Y.M., V.L., V.M., K.A., and C.T.M.; validation, Y.M.; formal analysis, V.M.; investigation, Y.M.; writing—original draft preparation, V.L. and Y.M.; writing—review and editing, J.G.; visualization, Y.M. and V.L.; supervision, E.C. and J.G.; project administration, E.C. and J.G. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The original contributions presented in this study are included in the article. Further inquiries can be directed to the corresponding author.

Conflicts of Interest

Author Eugene Chang was employed by the company ALPS Touchstone Inc. The remaining authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.

Abbreviations

The following abbreviations are used in this manuscript:
MAEMean Absolute Error
RMSERoot Mean Squared Error

References

  1. Allied Market Research. Green Energy Market to Reach $2.4 Trillion, Globally, by 2032 at 8.9% CAGR: Allied Market Research. Cision PR Newswire, 11 December 2023. Available online: https://www.prnewswire.com/news-releases/green-energy-market-to-reach-2-4-trillion-globally-by-2032-at-8-9-cagr-allied-market-research-302011705.html (accessed on 11 December 2023).
  2. Calero, I.; Cañizares, C.A.; Bhattacharya, K.; Baldick, R. Duck-Curve Mitigation in Power Grids With High Penetration of PV Generation. IEEE Trans. Smart Grid 2022, 13, 314–329. [Google Scholar] [CrossRef]
  3. Powerwall. Tesla. (n.d.). Available online: https://www.tesla.com/powerwall (accessed on 13 June 2024).
  4. Ahmad, A.; Javaid, N.; Mateen, A.; Awais, M.; Khan, Z.A. Short-term load forecasting in smart grids: An intelligent modular approach. Energies 2019, 12, 164. [Google Scholar] [CrossRef]
  5. Bano, H.; Tahir, A.; Ali, I.; Khan, R.J.U.H.; Haseeb, A.; Javaid, N. Electricity load and price forecasting using enhanced machine learning techniques. In Innovative Mobile and Internet Services in Ubiquitous Computing; Springer International Publishing: Berlin/Heidelberg, Germany, 2020; pp. 255–267. [Google Scholar]
  6. Bouktif, S.; Fiaz, A.; Ouni, A.; Serhani, M. Optimal deep learning LSTM model for electric load forecasting using feature selection and genetic algorithm: Comparison with machine learning approaches. Energies 2018, 11, 1636. [Google Scholar] [CrossRef]
  7. Bouktif, S.; Fiaz, A.; Ouni, A.; Serhani, M.A. Multi-sequence LSTM-RNN deep learning and metaheuristics for electric load forecasting. Energies 2020, 13, 391. [Google Scholar] [CrossRef]
  8. Estebsari, A.; Rajabi, R. Single residential load forecasting using deep learning and image encoding techniques. Electronics 2020, 9, 68. [Google Scholar] [CrossRef]
  9. Guo, N.; Chen, W.; Wang, M.; Tian, Z.; Jin, H. Appling an improved method based on ARIMA model to predict the short-term electricity consumption transmitted by the Internet of Things (IoT). Wirel. Commun. Mob. Comput. 2021, 2021, 6610273. [Google Scholar] [CrossRef]
  10. Kuo, P.-H.; Huang, C.-J. A high precision artificial neural networks model for short-term energy load forecasting. Energies 2018, 11, 213. [Google Scholar] [CrossRef]
  11. Nepal, B.; Yamaha, M.; Yokoe, A.; Yamaji, T. Electricity load forecasting using clustering and ARIMA model for energy management in buildings. Jpn. Archit. Rev. 2020, 3, 62–76. [Google Scholar] [CrossRef]
  12. Rai, S.; De, M. Analysis of classical and machine learning based short-term and mid-term load forecasting for smart grid. Int. J. Sustain. Energy 2021, 40, 821–839. [Google Scholar] [CrossRef]
  13. Tong, C.; Li, J.; Lang, C.; Kong, F.; Niu, J.; Rodrigues, J.J.P.C. An efficient deep model for day-ahead electricity load forecasting with stacked denoising auto-encoders. J. Parallel Distrib. Comput. 2018, 117, 267–273. [Google Scholar] [CrossRef]
  14. Ullah, F.U.M.; Khan, N.; Hussain, T.; Lee, M.Y.; Baik, S.W. Diving deep into short-term electricity load forecasting: Comparative analysis and a novel framework. Mathematics 2021, 9, 611. [Google Scholar] [CrossRef]
  15. Zhang, J.; Wei, Y.-M.; Li, D.; Tan, Z.; Zhou, J. Short term electricity load forecasting using a hybrid model. Energy 2018, 158, 774–781. [Google Scholar] [CrossRef]
  16. Mehta, Y.; Xu, R.; Lim, B.; Wu, J.; Gao, J. A Review for Green Energy Machine Learning and AI Services. Energies 2023, 16, 5718. [Google Scholar] [CrossRef]
  17. BP Statistical Review of World Energy 2018. BP Statistical Review of World Energy 2018: Two Steps Forward, One Step Back,” bp Global. [Online]. Available online: https://www.bp.com/en/global/corporate/news-and-insights/press-releases/bp-statistical-review-of-world-energy-2018.html (accessed on 17 July 2024).
  18. World Energy Outlook 2018. (n.d.). IEA. Paris, France, 2018. Available online: https://www.iea.org/reports/world-energy-outlook-2018 (accessed on 17 July 2024).
  19. Mahmud, K.; Azam, S.; Karim, A.; Zobaed, S.; Shanmugam, B.; Mathur, D. Machine Learning Based PV Power Generation Forecasting in Alice Springs. IEEE Access 2021, 9, 46117–46128. [Google Scholar] [CrossRef]
  20. Liu, C.-H.; Gu, J.-C.; Yang, M.-T. A Simplified LSTM Neural Networks for One Day-Ahead Solar Power Forecasting. IEEE Access 2021, 9, 17174–17195. [Google Scholar] [CrossRef]
  21. Jebli, I.; Belouadha, F.-Z.; Kabbaj, M.I.; Tilioua, A. Prediction of Solar Energy Guided by Pearson Correlation Using Machine Learning. Energy 2021, 224, 120109. [Google Scholar] [CrossRef]
  22. Zhou, H.; Liu, Q.; Yan, K.; Du, Y. Deep Learning Enhanced Solar Energy Forecasting with AI-Driven IoT. Wirel. Commun. Mob. Comput. 2021, 2021, 9249387. [Google Scholar] [CrossRef]
  23. Babbar, S.M.; Lau, C.Y.; Thang, K.F. Long Term Solar Power Generation Prediction Using Adaboost as a Hybrid of Linear and Non-Linear Machine Learning Model. Int. J. Adv. Comput. Sci. Appl. 2021, 12, 536–546. [Google Scholar] [CrossRef]
  24. Chodakowska, E.; Nazarko, J.; Nazarko, Ł.; Rabayah, H.S.; Abendeh, R.M.; Alawneh, R. ARIMA models in solar radiation forecasting in different geographic locations. Energies 2023, 16, 5029. [Google Scholar] [CrossRef]
  25. Khan, W.; Walker, S.; Zeiler, W. Improved solar photovoltaic energy generation forecast using deep learning-based ensemble stacking approach. Energy 2022, 240, 122812. [Google Scholar] [CrossRef]
  26. Atique, S.; Noureen, S.; Roy, V.; Subburaj, V.; Bayne, S.; Macfie, J. Forecasting of total daily solar energy generation using ARIMA: A case study. In Proceedings of the 2019 IEEE 9th Annual Computing and Communication Workshop and Conference (CCWC), Las Vegas, NV, USA, 7–9 January 2019; pp. 0114–0119. [Google Scholar] [CrossRef]
  27. Kim, E.; Akhtar, M.S.; Yang, O.-B. Designing solar power generation output forecasting methods using time series algorithms. Electr. Power Syst. Res. 2023, 216, 109073. [Google Scholar] [CrossRef]
  28. Lim, S.-C.; Huh, J.-H.; Hong, S.-H.; Park, C.-Y.; Kim, J.-C. Solar power forecasting using CNN-LSTM hybrid model. Energies 2022, 15, 8233. [Google Scholar] [CrossRef]
  29. Maciejowska, K.; Nitka, W.; Weron, T. Enhancing load, wind and solar generation for day-ahead forecasting of electricity prices. Energy Econ. 2021, 99, 105273. [Google Scholar] [CrossRef]
  30. Pan, C.; Tan, J.; Feng, D. Prediction intervals estimation of solar generation based on gated recurrent unit and kernel density estimation. Neurocomputing 2021, 453, 552–562. [Google Scholar] [CrossRef]
  31. Kim, S.-G.; Jung, J.-Y.; Sim, M.K. A Two-Step Approach to Solar Power Generation Prediction Based on Weather Data Using Machine Learning. Sustainability 2019, 11, 1501. [Google Scholar] [CrossRef]
  32. Hameed, Z.; Hashemi, S.; Traholt, C. Applications of AI-based forecasts in renewable based electricity balancing markets. In Proceedings of the 2021 22nd IEEE International Conference on Industrial Technology (ICIT), Virtual, 10–12 March 2021; Volume 1, pp. 579–584. [Google Scholar]
  33. Bâra, A.; Oprea, S.-V. Intelligent system to optimally trade at the interference of multiple crises. Appl. Intell. 2023, 53, 25581–25604. [Google Scholar] [CrossRef]
  34. Bottieau, J.; Hubert, L.; De Greve, Z.; Vallee, F.; Toubeau, J.-F. Very-short-term probabilistic forecasting for a risk-aware participation in the single price imbalance settlement. IEEE Trans. Power Syst. Publ. Power Eng. Soc. 2020, 35, 1218–1230. [Google Scholar] [CrossRef]
  35. Essl, A.; Ortner, A.; Haas, R.; Hettegger, P. Machine learning analysis for a flexibility energy approach towards renewable energy integration with dynamic forecasting of electricity balancing power. In Proceedings of the 2017 14th International Conference on the European Energy Market (EEM), Dresden, Germany, 6–9 June 2017; pp. 1–6. [Google Scholar]
  36. Jaehnert, S.; Farahmand, H.; Doorman, G.L. Modelling of prices using the volume in the Norwegian regulating power market. In Proceedings of the 2009 IEEE Bucharest PowerTech, Bucharest, Romania, 28 June–2 July 2009; pp. 1–7. [Google Scholar]
  37. Santos, G.; Pinto, T.; Vale, Z.; Morais, H.; Praca, I. Balancing market integration in MASCEM electricity market simulator. In Proceedings of the 2012 IEEE Power and Energy Society General Meeting, San Diego, CA, USA, 22–26 July 2012; pp. 1–8. [Google Scholar]
  38. Wang, Y.; Wang, J.; Zhao, G.; Dong, Y. Application of residual modification approach in seasonal ARIMA for electricity demand forecasting: A case study of China. Energy Policy 2012, 48, 284–294. [Google Scholar] [CrossRef]
  39. Zhang, S.; Pandey, A.; Luo, X.; Powell, M.; Banerji, R.; Fan, L.; Parchure, A.; Luzcando, E. Practical adoption of cloud computing in power systems—drivers, challenges, guidance, and real-world use cases. IEEE Trans. Smart Grid 2022, 13, 2390–2411. [Google Scholar] [CrossRef]
  40. Hong, T.; Pinson, P.; Wang, Y.; Weron, R.; Yang, D.; Zareipour, H. Energy Forecasting: A Review and Outlook. IEEE Open Access J. Power Energy 2020, 7, 376–388. [Google Scholar] [CrossRef]
  41. Jaramillo, M.; Pavón, W.; Jaramillo, L. Adaptive Forecasting in Energy Consumption: A Bibliometric Analysis and Review. Data 2024, 9, 13. [Google Scholar] [CrossRef]
  42. Diamantoulakis, P.D.; Kapinas, V.M.; Karagiannidis, G.K. Big data analytics for dynamic energy management in smart grids. Big Data Res. 2015, 2, 94–101. [Google Scholar] [CrossRef]
  43. E-Land. CO2 Reduction at the Valahia University of Târgoviște. Available online: Https://Elandh2020.Eu/,2Apr.2020,elandh2020.eu/wp-content/uploads/2020/04/Dorin_CO2_reduction_at_UVTgv_v4.pdf (accessed on 29 July 2024).
  44. Photovoltaic Geographical Information System (PVGIS). (n.d.). EU Science Hub. Available online: https://joint-research-centre.ec.europa.eu/photovoltaic-geographical-information-system-pvgis_en (accessed on 28 July 2024).
  45. Historical Weather API. (n.d.). Open-meteo.com. Available online: https://open-meteo.com/en/docs/historical-weather-api (accessed on 28 July 2024).
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.