Measurement and Performance Evaluation of Load Control in Renewable-Rich Microgrids: A Forecast-Driven PSO Approach for Maximizing PV Self-Consumption and Reducing Grid Dependency
Abstract:
The increasing integration of distributed renewable resources such as photovoltaic (PV), wind, and battery energy storage systems (BESS) introduces both opportunities and challenges in managing hybrid microgrids. This study develops a forecast-integrated load control framework for a six-classroom microgrid supplied by PV, wind, BESS, diesel generator, and the utility grid. Short-term forecasts of renewable generation and building load are embedded in a Particle Swarm Optimization (PSO) model to generate 15-minute scheduling decisions. The objective function minimizes grid import, peak demand, and operating cost while maintaining comfort and technical constraints. The framework was experimentally validated using IoT-enabled sensing and Supervisory Control and Data Acquisition (SCADA)-based control at an educational facility. Results demonstrate forecasting accuracy above 92%, a 31% reduction in peak demand, a 28% increase in PV self-consumption, and a 21.5% reduction in energy costs compared with rule-based and GA-based strategies. Sensitivity and robustness analyses confirm stable performance under ±15% forecast deviation. The proposed framework provides a scalable, adaptive, and cost-effective strategy for renewable-rich microgrids, offering direct implications for smart campus and commercial energy management.
1. Introduction
The increasing penetration of distributed renewable energy resources (DERs), including photovoltaic (PV) and wind generation, together with battery energy storage systems (BESS), has fundamentally transformed the operation of modern microgrids [1], [2]. While these technologies offer substantial opportunities to decarbonize power systems and enhance local energy autonomy, their inherent intermittency and stochastic behavior pose significant challenges for load balancing, peak demand management, and grid dependency reduction, particularly in building-scale microgrids [3].
In Thailand, buildings account for approximately 35% of total electricity consumption, with air-conditioning systems contributing between 40% and 60% of daytime peak demand [4]. Such demand characteristics, when combined with highly variable renewable generation, often result in inefficient load profiles and elevated electricity costs under time-of-use (TOU) tariff structures. These challenges are especially pronounced in educational and commercial buildings, where HVAC and lighting loads dominate and operational schedules are relatively rigid. Recent advances in predictive and optimization-based energy management have demonstrated that integrating short-term forecasting with intelligent control strategies can significantly improve microgrid performance. Model Predictive Control (MPC) [5], Genetic Algorithms (GA) [6], and Particle Swarm Optimization (PSO) [7], [8], have been widely applied to enhance dispatch efficiency, increase renewable utilization, and reduce operating costs.
Forecast-driven scheduling approaches, in particular, enable proactive coordination of energy resources by anticipating variations in both renewable generation and load demand [9], [10]. Despite these developments, several important research gaps remain. First, many existing studies consider a limited set of energy resources and often neglect the coordinated operation of heterogeneous DERs, such as PV, wind, BESS, diesel generators, and grid supply, within a unified control framework [11].
Second, a large proportion of published work relies on simulation-based analysis, with limited experimental validation in real-world operational microgrids [12]. Third, the practical integration of forecast-based optimization with fine-grained load control such as 15-minute scheduling across multi-zone buildings remains insufficiently investigated and validated under actual operating conditions [13]. In addition, renewable energy curtailment is frequently overlooked, leading to suboptimal utilization of available clean energy resources [14].
To address these gaps, this study proposes a forecast-driven, PSO-based load control framework for a renewable-rich educational microgrid. The proposed system integrates short-term forecasting of renewable generation and building load with multi-objective optimization and IoT-enabled SCADA control to enable predictive, real-time operation. The framework is experimentally implemented and validated in a six-classroom facility at Pathumwan Institute of Technology, Thailand, supplied by PV, wind, BESS, a diesel generator, and the utility grid. Through closed-loop coordination between forecasted energy availability, load demand, and real-time actuation, the system aims to reduce grid dependency while maintaining operational reliability and occupant comfort.
The main contributions of this study are summarized as follows:
(1) Development of a forecast-integrated PSO-based scheduling framework for coordinated operation of heterogeneous DERs in a building-scale microgrid;
(2) Experimental validation in a real six-classroom educational microgrid using IoT-enabled sensing and Supervisory Control and Data Acquisition (SCADA)-based control; and
(3) Comprehensive performance evaluation in terms of peak demand reduction, grid dependency mitigation, renewable self-consumption enhancement, and operating cost savings.
The primary objective of this study is to develop and experimentally validate a forecast-driven PSO-based load control system capable of optimizing the coordinated operation of multiple DERs in a renewable-rich educational microgrid. Specifically, the proposed system aims to:
(1) Maximize PV self-consumption by aligning load schedules with forecasted renewable generation;
(2) Minimize grid electricity import and peak demand during high-tariff periods; and
(3) Maintain indoor thermal comfort and operational constraints while improving overall energy efficiency.
To guide the experimental validation, the following hypotheses are formulated:
H1: The forecast-driven PSO load control system significantly reduces grid import during peak hours compared with rule-based operation.
H2: Reductions in grid import and peak demand directly lower total electricity costs under the TOU tariff structure.
H3: Enhanced PV self-consumption increases renewable utilization and improves overall microgrid economic performance.
2. Methodology
The proposed methodology establishes a direct linkage between technical energy management decisions and their associated economic outcomes. Short-term forecasts of PV generation, wind power output, and building load demand were integrated into a PSO based scheduling framework to enable predictive and cost-aware microgrid operation [15], [16].
By aligning demand-side control actions with forecasted renewable availability, the framework minimized grid electricity import during TOU periods and utilized surplus renewable energy for battery charging and HVAC pre-cooling. As a result, both operating cost and peak demand exposure were reduced while maintaining occupant comfort and system reliability.
The technical-economic relationship can be expressed as:
where,
$\Delta C_{o p}$ = operating cost reduction (Bath/day),
$\Delta P_{g r i d}$ = decrease in grid import (kWh),
$\Delta P_{p e a k}$ = peak demand reduction (kW),
$\Delta P_{P V,{ self }}$ = increase in PV self-consumption (kWh).
This formulation explicitly links technical performance improvements achieved through PSO-based optimization to measurable economic benefits in building-scale microgrids.
To enable intelligent and demand-responsive operation of microgrid-connected buildings, it is essential to define both a load scheduling framework and a corresponding control sequence tailored to the building’s functional use. In educational buildings, energy usage must align with class timetables while avoiding excessive peak electricity demand under TOU tariff structures [17]. The proposed methodology decomposes the system logic into two interdependent layers: the Load Scheduling Table and the Load Operating Sequence.
The Load Scheduling Table serves as a foundational planning mechanism that pre-assigns the on/off status of key electrical loads across six classrooms in 15-minute intervals throughout the day. These schedules are derived from academic timetables, expected occupancy patterns, and building zoning constraints, together with forecasted renewable generation from PV and wind sources and predicted grid electricity tariffs. The primary objective is to satisfy cooling and lighting requirements during occupied periods while avoiding excessive demand clustering. By staggering the startup of high-consumption appliances such as wall-mounted air conditioners and leveraging daylight availability for natural illumination, the proposed approach ensures that peak demand remains within predefined contractual limits and demand charge thresholds.
Short-term forecasting was employed to predict renewable generation and building load at 15-minute intervals, which is consistent with common practice in smart energy management systems [18]. A hybrid forecasting model, referred to as ForecastRS, was implemented by combining a Long Short-Term Memory (LSTM) network with a Random Forest (RF) ensemble to improve prediction accuracy and robustness under nonlinear and nonstationary operating conditions.
The forecasted grid import requirement, termed GridFIE, was derived as the net difference between predicted load demand and forecasted renewable supply, Grid = Load-(PV+Wind), which is equivalent to:
It is a derived forecasting variable computed from the balance between the forecasted load demand and the available internal renewable generation estimated by the hybrid forecasting model (ForecastRS). In the proposed Smart Energy Management System (SEMS), multiple energy flows coexist, where ForecastRS predicts the available local supply from renewable and distributed energy sources, including PV generation, wind power, and BESS discharge.
The overall structure of the ForecastRS model is illustrated in Figure 1. By combining temporal feature extraction from LSTM with nonlinear residual correction from RF, the hybrid approach enhances forecasting stability and accuracy, which are critical for reliable predictive scheduling in renewable-rich microgrids.
The overall structure of the proposed ForecastRS model, which integrates a LSTM network with a RF ensemble for hybrid time-series forecasting, is illustrated in Figure 1.

The diagram illustrates how the ForecastRS framework integrates two complementary learning mechanisms for time-series prediction. The LSTM Memory Cell on the left captures long-term temporal dependencies through its forget, input, and output gates, generating hidden states $(h_t)$ and memory updates $(c_t)$. These sequential features are then passed to the Random Forest ensemble, shown on the right, which performs residual learning using multiple decision trees trained on bootstrap samples. The RF layer aggregates tree predictions to refine the LSTM output and generate the final forecast $\left(\hat{y}_t\right)$. This hybrid approach enhances forecasting accuracy and robustness by combining temporal pattern recognition from LSTM with nonlinear residual correction from Random Forest, suitable for predicting renewable generation and building load in SEMS applications.
3. Proposed System
The proposed system integrates renewable energy forecasting, optimization-based scheduling, and real-time control into a unified hierarchical architecture for Pathumwan Institute of Technology, Bangkok, Thailand hybrid microgrid as showed in Figure 2.
Figure 3 proposed system establishes an integrated smart energy management framework that combines renewable energy forecasting, optimization, and real-time control. The forecasting module provides short-term predictions of PV generation, wind power, and building load demand, which are utilized by the PSO algorithm to generate optimal scheduling commands for DERs. The SCADA layer, together with the Internet of Things (IoT) communication layer, executes these commands by coordinating sensors, controllers, and smart plugs to regulate the actual power flow among energy sources (PV, wind, battery energy storage system, and grid) and load devices, including HVAC systems, lighting, and plug loads.
This closed-loop interaction ensures efficient energy utilization, peak demand reduction, and operating cost minimization while maintaining user comfort and system reliability.


These predictions provide essential inputs to the PSO Optimization Algorithm, represented as weighting parameters $W_1-W_5$, corresponding respectively to grid import energy, generator fuel cost, battery degradation, comfort deviation, and peak demand. The forecasted data are aggregated into a Forecast Package and transmitted to the optimization layer at 15-minute intervals to enable dynamic, rolling-horizon scheduling updates in forecast-driven energy management systems.
The PSO algorithm (Block 2) serves as the optimization core of the system, enabling multi-objective scheduling under forecast uncertainty [19]. Using inputs from the forecasting layer and weighting parameters ($W_1-W_5$), PSO iteratively searches for the optimal dispatch schedule for all controllable DERs and loads.
The algorithm minimizes the objective function:
where:
$W_1, W_2, W_3, W_4, W_5$ are weight factors of each purpose,
$P_{{grid }}(t)$ is imported grid power,
$P_{g e n}(t)$ is generator power output with cost factor $c_f$,
$P_{{bat }}(t)$ is battery charging/discharging power with degradation cost coefficient $c_{\text {deg}}$,
From Eq. (4), when $W_1, W_2, W_3, W_4, W_5$ are weighted coefficients (normalized to unity) controlling the trade-offs between energy import, generator fuel consumption, battery cycling cost, user comfort, and peak demand. The PSO algorithm iteratively updates each particle’s position and velocity according to the following equations:
where, $V_i$ and $x_i$ denote the velocity and position of particle $i, p_i$ is its best-known position, $g$ is the global best, and $\omega, c_1$, and $c_2$ are the inertia, cognitive, and social comprising the Schedule Package of battery State-of-charge (SOC) trajectory, generator operation, and load setpoints are then transmitted to the control layer through SCADA for real-time implementation. This integrated framework ensures closed-loop operation between forecasting and optimization, enabling predictive decision-making that reduces grid dependency, increases PV self-consumption, and minimizes operational cost.
Weighting Factor Configuration: The weighting factors $W_1, W_2, W_3, W_4, W_5$ were introduced to balance multiple objectives in the PSO optimization process. Each term was normalized to ensure comparable magnitudes before weighting. Preliminary tests indicated that excessive $W_1$ prioritizes grid import minimization at the cost of comfort, while higher $W_3$ leads to frequent battery cycling. After performing 50 iterative tuning runs and Pareto front analysis, the final normalized weights were selected as:
$ W_1=0.35, W_2=0.25, W_3=0.20, W_4=0.10, W_5=0.10 $
These weights provided a balanced trade-off between cost, comfort, and equipment lifetime. The sensitivity analysis (±20% variation) produced less than 3% variation in total cost and peak demand, confirming robustness and reproducibility.
Table 1 summarizes the weighting configuration and the rationale for each factor. If you don’t have exact values, you can state ranges: $W_1, W_2, W_3 \in[ 0.1,0.5]$, normalized such that, Weighting factors were introduced to balance competing operational objectives, including cost minimization, comfort preservation, and asset lifetime protection. Excessive emphasis on grid imports minimization res SOC resulted in comfort degradation, whereas high battery weighting increased cycling stress and degradation risk. After 50 tuning iterations and Pareto front analysis, normalized weights were selected to achieve a balanced trade-off between cost, comfort, and equipment lifetime, subject to:
System constraints included battery SOC limits, charge-discharge power bounds, generator minimum on/off times, HVAC setpoint limits, and grid import capacity imposed by the Metropolitan Electricity Authority (MEA). These constraints ensured feasible, safe, and reliable system operation under real-world microgrid conditions.
Weight | Objective Component | Range | Rationale |
|---|---|---|---|
$W_1$ | Grid import energy | 0.2-0.4 | Emphasize grid reduction |
$W_2$ | Generator fuel cost | 0.2-0.3 | Maintain diesel efficiency |
$W_3$ | Battery degradation | 0.1-0.3 | Limit cycling & extend lifetime |
$W_4$ | Comfort deviation | 0.05-0.15 | Preserve thermal comfort |
$W_5$ | Peak demand | 0.05-0.15 | Enforce demand-limit compliance |
Table 1 the factor $W_2$ represents the economic penalty associated with diesel generator operation, capturing both fuel expenses and environmental concerns. The factor $W_3$ accounts for battery degradation costs, ensuring that the scheduling strategy preserves the long-term health and lifecycle of the storage system by penalizing excessive cycling.
The factor $W_4$ corresponds to occupant comfort, introducing a penalty whenever HVAC setpoints deviate from the prescribed comfort band (24–26°C). Finally, the factor $W_5$ emphasizes peak demand reduction by penalizing the maximum grid import observed within the scheduling horizon. Together, these weight factors establish a hierarchical trade-off, where $W_1 \gg W_2 \gg W_3$, ensuring that grid import minimization remains the dominant objective while still balancing generator usage, battery sustainability, and thermal comfort.
Constraints include: Battery state-of-charge bounds $SOC_{min}$ and $SOC_{max}$ Charge/discharge power limits $P_{b c t}^{ \pm}$, Minimum on/off times and ramp rate limits for the diesel generator and chiller plant, HVAC setpoint limits between 24°C and 26°C, MEA import capacity limits per 15-minute slot.
Dispatch priority follows the hierarchy:
$ PV \rightarrow Wind \rightarrow Battery \rightarrow Generator \rightarrow Grid $
Outputs generated every 15 minutes include: Scheduled power output for each source, Battery charge/discharge commands, Generator on/off status, HVAC temperature setpoints and lighting dimming levels per classroom. The flowchart illustrates the sequential process of forecasting PV, wind, and load demand, optimization using the PSO engine, dispatch scheduling for DERs and loads, and final execution through SCADA/IoT controllers. Surplus Renewable Utilization.
When total renewable generation exceeds instantaneous load plus reserve requirements:
$ P_{P V}+P_{{Wind }}>P_{{Load }}+P_{\text {Re}{serve }} $
Energy Management System (EMS) activates a surplus energy absorption strategy to avoid curtailment and maximize the utilization of renewable resources. The sequence is as follows:
(1) Battery Charging: Surplus power is first directed to charge the BESS, constrained by available SOC headroom and converter power ratings.
(2) Pre-cooling Strategy: For classrooms served by the chiller plant, the EMS lowers setpoints within permissible comfort bounds to pre-cool the space, effectively shifting part of the cooling load from peak to off-peak periods.
(3) Deferrable Load Activation: Non-critical, schedulable loads such as ventilation fans, supplementary circulation pumps, or certain industrial tasks are temporarily activated to absorb excess energy. These loads are selected to provide ancillary benefits (e.g., improved air quality) without disrupting normal operations.
(4) By dynamically redirecting surplus renewable energy, the system increases self-consumption rates, reduces renewable spillage, and enhances the economic and environmental performance of the microgrid.
(5) In combination, the forecasting, optimization, and surplus utilization functions of the EMS enable a fully integrated, forecast-aware load control strategy. This approach not only meets the immediate objectives of cost and peak demand reduction but also strengthens the long-term sustainability and resilience of the energy system.
The Load Scheduling Process (Blocks 2-4) defines the real-time decision-making mechanism of the proposed system. The PSO algorithm determines the optimal operational schedule for each DER including battery charge/discharge, generator output, and controllable HVAC and lighting loads based on forecasted energy data and weighting factors $W_1-W_5$. The PSO generates a Schedule Package, which specifies the optimal control setpoints for each device and transmits them to the SCADA system (Block 3).
The SCADA communicates with the IoT Control Layer (Block 4) for real-time actuation of loads and energy sources. Through this process, the dispatch of DERs and building loads is continuously optimized every 15 minutes to minimize total energy cost and grid dependency while maintaining user comfort and operational constraints.
Figure 3 depicts the workflow of the load scheduling process, highlighting the interaction between optimization, SCADA, and IoT layers for adaptive control.
The Infrastructure Load represents the total controllable and non-controllable electrical demand within the microgrid facility. It includes both fixed and flexible loads connected through IoT-enabled smart plugs, sensors, and controllers. The system under study consists of six classrooms equipped with distributed HVAC units, lighting systems, and general-purpose sockets. as shown in Figure 4.

In Figure 4, infrastructure layout of the six-classroom facility illustrating IoT-enabled HVAC, lighting, and metering systems used in load scheduling. The layout facilitates a comparative analysis of energy consumption behaviors among rooms under different load control strategies and environmental conditions.
The controllable loads such as air-conditioning compressors and lighting circuits are prioritized in the scheduling algorithm, allowing the system to adjust their operating setpoints based on forecasted renewable availability and room occupancy. Meanwhile, non-controllable loads, including essential electrical outlets and IT equipment, remain in constant operation and serve as the base load. Load data are collected in real time via IoT sensors (temperature, humidity, occupancy, and power meters) and transmitted to the SCADA platform every 15 minutes. These measurements form part of the feedback mechanism that validates the effectiveness of the PSO-based scheduling decisions.
The infrastructure layout is designed for modular expansion, enabling integration of additional classroom zones or laboratory spaces without major system modifications. This flexibility supports scalability for campus-wide smart building deployment.
The Scheduling Strategy defines how forecasted data and system constraints are translated into optimal dispatch decisions by the PSO scheduler. The optimization process minimizes the multi-objective cost function, which considers grid import energy $(W_1)$, generator fuel cost $(W_2)$, battery degradation $(W_3)$, comfort deviation $(W_4)$, and peak demand $(W_5)$.
The PSO algorithm operates within predefined operating modes, depending on real-time system conditions and energy availability:
(1) Normal Mode: During periods of balanced renewable generation and load demand, the system maintains regular operation with minimal grid interaction.
(2) Renewable Priority Mode: When PV or wind generation exceeds the load demand, the surplus energy is directed to battery charging, prioritizing local renewable utilization.
(3) Peak Reduction Mode: During high-tariff or high-load periods, the scheduler reduces grid import by discharging the battery and temporarily adjusting HVAC or lighting loads.
(4) Backup Mode: When renewable resources are insufficient and battery SOC is low, the diesel generator (DG) is activated to maintain power reliability.
(5) Recovery Mode: After peak hours or generator operation, the system restores battery SOC to optimal levels while rebalancing load comfort parameters.
Each operating mode is dynamically selected based on the forecasted PV output, SOC level, and current load demand. This adaptive control strategy enables predictive decision-making rather than reactive control, ensuring the system responds proactively to forecast variations.
The resulting control signals are transmitted through the SCADA–IoT interface, updating DER and load commands in real time. This dynamic scheduling mechanism enhances overall system resilience, reduces operating cost, and improves renewable self-consumption efficiency.
The Overall Proposed System connects all computational and control layers into a closed-loop structure, enabling predictive and adaptive energy management.
As shown in Figure 3, the control commands generated by the optimization layer are executed through the IoT-based infrastructure, directly interacting with the energy sources (Block 5) including PV, wind, battery energy storage, diesel generator, and grid supply and with load devices (Block 6), such as air conditioning units, lighting systems, and other flexible loads.
This architecture ensures bidirectional data exchange: measurement and forecast information flow upward from the IoT layer to the forecasting module, while optimized control signals flow downward for execution. The loop operates at 15-minute intervals, forming an adaptive, self-correcting control cycle that aligns real-time operation with forecasted renewable availability and load requirements.
In summary, Block 1-6 represent the complete logical workflow of the proposed system:
(1) Forecasting inputs, weighting parameters $W_1-W_5$;
(2) PSO-based optimization for load scheduling;
(3) SCADA interface for supervisory control;
(4) IoT layer for local actuation and data collection;
(5) Energy sources (PV, wind, BESS, DG, grid);
(6) Controlled load devices.
The combined operation of these six blocks enables forecast-integrated optimization that enhances renewable utilization, reduces operational cost, and maintains stable energy balance in the microgrid. This architecture establishes a closed-loop operational structure that links forecasting data, optimization decisions, and real-time actuation.
The system continuously updates its operation every 15 minutes, ensuring that forecasted renewable generation and actual energy consumption remain synchronized under varying environmental and load conditions.
The system begins with five weighting factors $W_1$ through $W_5$ which define the multi-objective priorities within the optimization process. These factors represent the key operational and economic criteria of the microgrid:
$W_1$: Grid import energy minimizing electricity drawn from the utility grid.
$W_2$: Generator fuel cost reducing fuel consumption in the diesel generator.
$W_3$: Battery degradation limiting deep charge-discharge cycles to extend battery life.
$W_4$: Comfort deviation maintaining indoor comfort by regulating HVAC temperature and air quality.
$W_5$: Peak demand reducing maximum power demand to lower TOU demand charges.
The normalized weighting vector ensures that the optimization achieves balanced trade-offs among technical performance, operational cost, and user comfort.
The SCADA layer (Block 3) functions as the supervisory interface between the optimization layer and field devices, enabling bidirectional information exchange between the PSO optimization module and physical components of the microgrid. Real-time electrical parameters, including voltage, current, active and reactive power, energy consumption, and battery SOC, are continuously acquired from distributed sensors and metering devices.
Optimized setpoints generated by the PSO scheduler are transmitted through the SCADA network to IoT controllers, ensuring coordinated operation of DERs and controllable building loads. Beyond data exchange, the SCADA layer provides essential supervisory functions, including system monitoring, alarm handling, fault diagnosis, and historical data logging for performance assessment and predictive maintenance.
Operational constraints and safety thresholds are enforced to maintain stable, reliable, and compliant dispatch under varying operating conditions. The sensing and communication subsystem supports high-resolution acquisition of operational and environmental data, combining advanced metering infrastructure (AMI) with temperature, humidity, illuminance, and occupancy sensors. Communication is implemented through a hybrid architecture using Modbus RTU/TCP and BACnet at the field level, and MQTT and HTTPS for higher-level data exchange with the EMS.
Time synchronization via Network Time Protocol (NTP) or Precision Time Protocol (PTP) ensures alignment among measurements, forecasts, and control actions within the 15-minute scheduling horizon.
Overall, this integrated sensing and communication framework enables the SCADA system to operate as a reliable, latency-aware, and cyber-resilient backbone for the proposed forecast-driven load control architecture.
The IoT control layer (Block 4) serves as the real-time execution interface of the proposed forecast-driven load control framework. It manages bidirectional communication and distributed data acquisition between the SCADA system and field devices using lightweight communication protocols, such as MQTT and Modbus/TCP, to ensure reliable and low-latency data exchange across the microgrid. Each IoT node governs end-use equipment, including HVAC units, lighting systems, and smart plugs, enabling adaptive operation in accordance with PSO-optimized schedules and real-time environmental conditions.
As illustrated in Figure 5. the developed IoT controller integrates relay modules, power supply units, circuit protection devices, and an ESP8266-based sensing module for monitoring temperature, humidity, and occupancy-related motion. Real-time measurements are transmitted via Wi-Fi to the central SCADA platform, where they are synchronized with forecast outputs and optimization results to support closed-loop control and time-aligned decision execution. This tight integration allows the system to respond promptly to changes in occupancy patterns and indoor environmental conditions, thereby enhancing demand responsiveness while maintaining acceptable thermal comfort levels for occupants.
In addition to executing optimized control commands, the IoT layer provides continuous feedback on device status, power consumption, and environmental parameters, enabling real-time validation of scheduling decisions, performance assessment, and early-stage fault detection at the device level. Localized control logic embedded within IoT nodes ensures safe fallback operation in the event of communication delays or temporary SCADA unavailability, thereby improving system resilience, operational reliability, and continuity of critical load control functions.
This configuration supports automated load scheduling, energy optimization, and remote supervision of classroom energy consumption under dynamic operating conditions. Furthermore, the coordinated interaction between distributed IoT nodes and centralized supervisory control enables the framework to accommodate short-term disturbances, user-driven variability, and stochastic fluctuations in renewable generation. By combining localized IoT-based control with centralized optimization and supervisory coordination, the proposed framework achieves high adaptability, operational efficiency, and seamless integration between hardware and software layers. These characteristics are essential for scalable deployment in smart campus environments and intelligent building energy management systems with high penetration of distributed energy resources, where real-time responsiveness and system robustness are critical performance requirements.

In Figure 5, IoT controller integrating an ESP8266 microcontroller with environmental and occupancy sensing modules for real-time data acquisition, wireless communication, and automated load actuation within the forecast-integrated classroom energy management system. The controller interfaces with relay, power supply, and protection components to enable safe and reliable switching of HVAC units, lighting systems, and smart plug loads. Real-time measurements of temperature, humidity, and occupancy are transmitted via Wi-Fi using lightweight communication protocols to the SCADA platform, where they are synchronized with forecast outputs and PSO-optimized control commands. The adopted SCADA-IoT architecture follows widely accepted design practices for smart buildings and microgrids, ensuring reliable communication, scalability, and real-time responsiveness [20], [21], [22], [23].
This configuration supports closed-loop, demand-responsive load control, enabling adaptive energy management, peak demand mitigation, and scalable deployment in smart classroom and campus-scale microgrid environments.
In Figure 6, split-type air conditioner integrated with a smart plug and IoT controller for automated, PSO-driven load scheduling and adaptive comfort control within the SEMS framework. The experimental setup employs a high-efficiency split-type HVAC unit interfaced with a smart plug and an IoT controller to enable automated demand-side management in building energy systems. The smart plug continuously measures real-time power consumption and transmits the data to the central control platform, while the IoT controller dynamically adjusts the air conditioner’s operating conditions in response to forecasted comfort indices and demand response signals.

This integrated configuration supports predictive, PSO-based control strategies that maintain indoor thermal comfort, reduce peak electrical load, and enhance overall energy utilization efficiency in smart building and microgrid applications.

In Figure 7, AI-based computer vision system performing real-time occupancy detection for adaptive HVAC scheduling and energy-efficient control within the SEMS framework. The detection model employs deep learning–based computer vision techniques to identify and classify occupants and surrounding objects in classroom environments using bounding boxes and confidence scores.
By accurately estimating occupancy levels, the system provides real-time feedback to the SEMS for dynamic adjustment of HVAC setpoints and operating modes in response to actual space utilization. This integration enables demand-responsive and comfort-adaptive control, reducing unnecessary energy consumption while preserving occupant comfort and overall system reliability.

In Figure 8, Real six-classroom test facility used for experimental validation of the forecast-integrated, PSO-based load control strategy and adaptive SEMS operation under actual occupancy and scheduling conditions. The SEMS was deployed in an operational educational building at the Smart Electrical Engineering Energy Laboratory, where each classroom was equipped with IoT-based sensors, smart plugs, and HVAC control modules for monitoring energy consumption, occupancy, and environmental conditions.
This real-world experimental setup enables comprehensive validation of the proposed forecasting and optimization framework, demonstrating its capability to reduce peak demand, enhance overall energy efficiency, and maintain occupant comfort under practical operating conditions.
The energy source layer (Block 5) integrates multiple DERs to form a hybrid microgrid capable of autonomous, resilient, and efficient operation. This layer represents the core physical energy infrastructure of the proposed forecast-driven PSO-based control framework within the SEMS, directly interfacing renewable generation, energy storage, and backup supply with higher-level optimization and control layers.
The hybrid microgrid consists of five coordinated energy sources, each fulfilling a distinct operational role to ensure reliability, flexibility, and optimal energy utilization under varying environmental and load conditions.
PV array serves as the primary renewable energy source, supplying daytime electricity generation under normal irradiance conditions. The PV system contributes significantly to reducing grid dependency and carbon emissions by maximizing on-site renewable energy utilization.
Wind turbines provide complementary renewable generation, particularly during nighttime hours or periods of low solar irradiance. By exploiting wind availability that is often asynchronous with solar generation, the wind subsystem enhances renewable supply continuity and mitigates the intermittency inherent in single-source renewable system.
BESS functions as both an energy buffer and a system stabilizer. It stores surplus renewable energy during periods of excess generation and discharges power during peak demand intervals, renewable shortfalls, or grid disturbances. Through controlled charge-discharge scheduling, the BESS supports peak shaving, load balancing, and resilience enhancement, while also enabling more flexible and predictive energy management.
Diesel generator (DG) operates as a standby and emergency backup source, ensuring power reliability when renewable generation and energy storage are insufficient to meet demand. Although its operation is minimized under normal conditions to reduce fuel consumption and emissions, the DG provides a critical layer of operational security during extreme events, prolonged renewable deficits, or islanded operation.
Utility grid acts as an external balancing and backup source, maintaining overall system stability and supply continuity. Grid interaction enables energy import during severe shortages and, where permitted, energy export during surplus generation, thereby enhancing economic performance and operational robustness.
To coordinate these heterogeneous energy sources, the PSO algorithm dynamically allocates energy flows based on real-time forecasts of renewable generation and load demand. Using forecasted inputs, the optimization process generates a Schedule Package that specifies optimal power setpoints for each energy source and controllable load at 15-minute intervals. These setpoints are transmitted to the SCADA layer for real-time execution, ensuring synchronized, efficient, and stable microgrid operation under continuously changing operating conditions.
Consequently, the power and DER layer constitutes the physical foundation of the proposed forecast-integrated load control system. It integrates energy conversion, protection, and communication subsystems into a cohesive hybrid AC/DC microgrid architecture capable of reliable, flexible, and efficient operation under fluctuating renewable generation and load demand. This layered design supports both real-time control and predictive optimization, effectively bridging the gap between physical energy assets and intelligent decision-making mechanisms. PV Generation Subsystem:
The PV generation subsystem consists of an array of solar panels operating in direct current (DC) mode and interfaced with a high-efficiency maximum power point tracking (MPPT) DC/DC converter. This configuration enables continuous extraction of maximum available power under varying solar irradiance and ambient temperature conditions. By maintaining operation at the optimal voltage-current operating point, the MPPT unit enhances overall system efficiency and ensures stable integration of PV power into the hybrid microgrid.

In Figure 9, rooftop photovoltaic arrays (5.4 kWp) serving as the primary renewable source for the hybrid microgrid test facility, providing real-time data for forecasting and PSO-based load control validation. The physical infrastructure provides the energy backbone for the system’s operation:
PV Subsystem: 5.4 kWp rooftop array (18 $\times$ 300 W panels, south-facing, 15° tilt) with MPPT DC/DC converters feeding the DC bus.
Wind Turbines: Two 1 kW horizontal-axis turbines at 12 m height, supplying variable-frequency AC power rectified to DC.
BESS: 10 kWh LiFePO$_4$ battery (48 V $\times$ 200 Ah) with ±3 kW converter. SOC range: 20–90%. Used for both peak shaving and renewable buffering.
Diesel Generator: 5 kVA generator used for emergency operation and grid backup, optimized for minimum runtime.
Utility Grid: MEA low-voltage feeder (15 kW limit, TOU tariff) integrated with import capacity control. All DERs and loads are monitored through ESP8266-based IoT nodes communicating via MQTT to the SCADA server. The rooftop solar PV system is installed on the academic building to supply renewable energy to the microgrid testbed. The PV arrays are configured to capture maximum solar irradiance throughout the day and deliver power to classroom loads, battery energy storage, and auxiliary systems, supporting experimental investigations on renewable energy integration, real-time forecasting, and load control strategies aimed at reducing grid dependency and promoting sustainable energy management in educational facilities. MPPT continuously adjusts the operating voltage and current of the PV system to maximize energy harvest under varying irradiance and temperature conditions.
The conditioned DC output is injected into a common DC bus, enabling direct coupling with other DC sources and storage devices. This configuration reduces unnecessary power conversion stages, minimizes conversion losses, and enhances the prioritization of PV generation within the overall dispatch strategy of the microgrid. BESS:
The BESS functions as both an energy buffer and a peak-shaving resource, interfaced with the DC bus through a bidirectional DC/DC converter. This power electronic interface enables precise control of charging and discharging processes, allowing the EMS to store surplus renewable energy during periods of high PV and wind generation and to discharge energy strategically during peak demand or high-tariff periods. SOC limits and charge-discharge rate constraints are rigorously enforced to mitigate battery degradation, prevent overcharging or deep discharging, and extend the operational lifespan of the storage system. These constraints ensure that the BESS operates within a safe and efficient region, balancing short-term operational objectives with long-term asset preservation. The BESS functions as both an energy buffer and a peak-shaving resource, interfaced with the DC bus through a bidirectional DC/DC converter. This interface enables precise charging and discharging control, allowing the EMS to store surplus renewable energy during periods of high PV and wind generation and to discharge energy strategically during peak demand or high-tariff periods. SOC limits and charge-discharge rate constraints are enforced to mitigate battery degradation and extend battery lifetime [24]. prevent overcharging or deep discharging, and extend the operational lifespan of the storage system, ensuring safe and efficient operation. Beyond energy arbitrage and peak demand reduction, the BESS provides fast-response balancing services that enhance system stability by compensating for short-term fluctuations in PV and wind generation. Through rapid power injection or absorption, the storage system smooths net load profiles, supports frequency regulation, and improves the reliability of the hybrid microgrid. Within the proposed forecast-driven control framework, BESS operation is coordinated with short-term renewable and load forecasts, enabling anticipatory scheduling that improves renewable self-consumption, reduces reliance on grid import and diesel generation, and enhances economic performance.
Wind Energy Conversion Subsystem (WECS): The wind turbine subsystem generates variable-frequency AC power, which is rectified via an AC/DC converter before coupling to the DC bus. In alternative AC-coupled configurations, an AC/DC/DC/AC interface supports bidirectional power exchange and enhanced control flexibility. The integration of wind energy diversifies the renewable portfolio, complementing solar generation and improving energy availability during nighttime or low-solar conditions, thereby enhancing the robustness of the hybrid microgrid.

In Figure 10, rooftop small-scale wind turbines integrated into the hybrid microgrid to complement PV generation, providing additional renewable input and supporting PSO-based forecast-driven optimization within the SEMS framework. The figure illustrates a set of small-scale horizontal-axis wind turbines installed on the rooftop of the academic building. These turbines operate in parallel with the PV system to provide hybrid renewable energy generation for the microgrid testbed. The coordinated integration of wind and solar resources enhances system reliability and supports continuous power supply under varying weather and irradiance conditions. Real-time power output data from the wind turbines are monitored through the IoT-based SCADA system, enabling performance assessment and optimization of renewable energy contribution to the smart building network.
DC/AC Interface: A voltage-source inverter (VSI) operates as a bidirectional interlinking converter between the DC and AC buses of the hybrid microgrid. This three-phase inverter enables controlled power exchange between the two domains, allowing PV and battery resources connected to the DC bus to supply AC loads or feed power back into the AC grid. In addition, the inverter provides essential grid-support functionalities, including voltage regulation, reactive power compensation, and harmonic mitigation, thereby improving overall power quality and system stability.
DG: The diesel generator functions as a dispatchable backup power source interfaced with the AC bus through an automatic transfer switch (ATS) and protective relay system. It is primarily activated during emergency events, prolonged periods of low renewable generation, or when the BESS reaches a critically low state of charge. Within the EMS, generator operation is governed by an optimization-based dispatch strategy that minimizes fuel consumption and operating costs while ensuring supply reliability. The control algorithm determines economically optimal generator dispatch intervals by coordinating DG operation with forecasted renewable output and available battery capacity, thereby enhancing fuel efficiency and overall system resilience under uncertain renewable conditions.
Utility Grid (MEA): The utility grid provided by the MEA is connected to the hybrid microgrid through a dedicated feeder linked to the AC bus, incorporating energy metering, circuit breakers, and import capacity control modules. This grid interface facilitates controlled import of electricity during periods of renewable shortfall or high load demand, while adhering to contractual limits and demand charge constraints. The system prioritizes self-sufficiency by leveraging renewable and stored energy resources before drawing power from the grid.
Through this controlled interaction, the proposed SEMS minimizes grid dependency, optimizes energy cost under the TOU tariff, and contributes to a more sustainable and economically efficient microgrid operation.
The load device layer (Block 6) comprises all electrical appliances and subsystems within the facility that are actively managed by the optimization algorithm. These include split-type air-conditioning units, lighting systems, and general-purpose electrical outlets distributed across six classrooms. Through IoT-enabled controllers, the system dynamically adjusts temperature setpoints, lighting intensity, and equipment operating schedules based on forecasted renewable generation and real-time load conditions, thereby enabling comfort-compliant demand response and efficient energy utilization throughout the day.
Load Configuration: The load side is divided into six classrooms, each with distinct characteristics to facilitate targeted demand-side control strategies.
Rooms 1–3: Lighting systems combined with wall-mounted air-conditioning units equipped with both compressor and fan-level control, allowing fine-grained thermal and electrical load modulation.
Rooms 4–6: Lighting systems integrated with a centralized chiller plant, including a variable-speed chilled water pump and a cooling tower fan, enabling coordinated HVAC load control and improved system-level efficiency.

In Figure 11, water-cooled chiller integrated into the SEMS to enable pre-cooling and load shifting based on forecasted renewable generation, thereby improving energy efficiency and peak demand management in the hybrid microgrid.
The chiller system illustrated in the figure is a centralized cooling unit supplying conditioned air to multiple classrooms within the experimental facility. It is equipped with programmable control interfaces and sensors for monitoring temperature, pressure, and flow rate. Integrated with the SEMS platform, the chiller operates under predictive load management schemes, including load shifting and pre-cooling strategies, to reduce peak electricity demand and enhance overall system efficiency. Real-time operational data from the chiller are utilized to optimize energy consumption while maintaining thermal comfort across multiple building zones. Both controllable load types support advanced demand-side control measures such as pre-cooling, which shifts cooling demand away from peak grid periods, and daylight-responsive dimming, which reduces lighting energy consumption when sufficient natural illumination is available.
Protection and Safety Systems: To ensure operational safety and compliance with electrical standards, the power and load layers incorporate a comprehensive protection scheme, including miniature circuit breakers (MCBs), residual current devices (RCDs), over and under-voltage relays, over-frequency protection, and anti-islanding functions for grid-connected operation. Current and voltage transformers (CTs/VTs) are deployed for accurate metering and monitoring, while proper earthing and bonding arrangements ensure effective fault current dissipation and personnel safety. These protection measures safeguard both distributed energy resources and connected loads from electrical faults, transient disturbances, and abnormal operating conditions.
This multi-source, multi-bus configuration maximizes renewable energy capture and utilization while providing the operational flexibility required to implement the PSO-based forecast-integrated control strategies described in this chapter. By structurally combining generation diversity, efficient power conversion, storage flexibility, and robust safety mechanisms, the power and DER layer forms the foundational platform upon which the proposed smart energy management framework operates.
Parameters and Equipment Specifications: Experimental validation was conducted in a six-classroom educational facility at Pathumwan Institute of Technology, Bangkok, Thailand. The hybrid microgrid comprises five distributed energy resources: PV arrays, wind turbines, a BESS, a DG, and the utility grid. Table 2 summarizes the electrical and control specifications of all subsystems. The PV subsystem consists of a 5.4 kWp rooftop array (18 $\times$ 300 W modules) connected to a 5 kW hybrid inverter. The wind subsystem includes two 1.0 kW horizontal-axis turbines installed at a height of 12 m. The BESS is rated at 10 kWh (48 V LiFePO$_4$) with an operational state-of-charge range of 20-90% and a charge/discharge power limit of ±3 kW. A 5 kVA diesel generator provides backup power during periods of low renewable availability.
The aggregated daytime load of the six classrooms typically ranges from 12 to 15 kW, dominated by split-type air-conditioning units, lighting systems, and computer equipment. All DERs and loads are monitored through IoT-enabled power meters and ESP8266-based nodes communicating via Wi-Fi using the MQTT protocol to a centralized SCADA server implemented on the Wonderware platform.
The control signals generated from the PSO optimizer are transmitted every 15 minutes through the PLC network to actuate relays, BESS inverters, and HVAC controllers. Real-time data are logged at 15-minute intervals with ±0.5% metering accuracy. Experimental testbed of the six-classroom facility, consisting of PV array (5.4 kWp), wind turbines (2 kW), BESS (10 kWh), diesel generator (5 kVA), and grid connection integrated via IoT-based SCADA and PSO control system show in Table 2.
Subsystem | Type / Model | Rated Capacity | Interface | Notes |
|---|---|---|---|---|
PV Array | 18 × 300 W panels | 5.4 kWp | 5 kW inverter | Rooftop south-facing, tilt $15^{\circ}$ |
Wind Turbine | 2 × 1 kW HAWT | 2 kW | Charge controller | 12 m tower height |
BESS | LiFePO₄ battery (48 V × 200 Ah) | 10 kWh / ±3 kW | Hybrid inverter | SOC 20–90% |
Diesel Generator | 5 kVA | 4 kW | AC coupling | Backup only |
Grid Supply | MEA low-voltage line | 15 kW limit | TOU tariff | Main supply |
Load (6 classrooms) | HVAC, lighting, PC | 12–15 kW peak | Smart meters | 15-mins data logging |
Communication | ESP8266 IoT + PLC | - | MQTT + Modbus | Connected to SCADA server |
The proposed forecast-integrated load control framework employs a multi-timescale scheduling strategy to ensure both operational efficiency and adaptability to dynamic conditions. The system operates across three primary modes day-ahead, intra-day, and real-time each leveraging progressively refined data inputs and control horizons. This hierarchical structure enables the EMS to balance long-term optimization with short-term corrective actions, thereby maximizing renewable energy utilization, minimizing grid dependency, and ensuring compliance with operational constraints.
The day-ahead mode serves as the baseline operational plan, generating a complete 15-minute dispatch schedule for the upcoming 24-hour period. This schedule is computed using the latest available forecasts of PV generation, wind output, building load demand, and battery SOC, derived from time-series and machine learning models. The optimization engine employs the PSO algorithm to determine the optimal sequence of battery charging and discharging actions and load allocation events.
The resulting schedule specifies DER dispatch levels, HVAC and lighting setpoints for each zone, and generator commitment windows, while complying with grid import capacity constraints imposed by the MEA. This day-ahead plan is transmitted to the control and actuation layer for implementation, with subsequent intra-day and real-time stages providing corrective adjustments in response to forecast updates and operating condition changes.
Recognizing the inherent uncertainty in renewable generation forecasts and load demand predictions, the Energy Management System (EMS) performs rolling-horizon re-optimization during the operating day to adapt to evolving conditions. These intra-day updates are executed at 30 or 60 minute intervals, depending on forecast volatility and real-time system states.
Intra-day adjustments are triggered by significant deviations in:
(1) renewable generation forecasts, such as rapid cloud cover changes reducing expected PV output;
(2) load demand projections, including unexpected occupancy-driven variations; and
(3) SOC thresholds, for example, faster-than-anticipated discharge rates.
During each re-optimization cycle, dispatch decisions are recalculated for the remaining scheduling horizon while preserving the feasibility of previously committed actions, such as minimum generator on/off times and operational constraints. This rolling corrective mechanism ensures agile system operation, enabling the EMS to exploit surplus renewable availability when present and to mitigate the operational impact of unforeseen generation shortfalls or demand spikes.
At the fastest control layer, real-time adjustments occur on a 1–5minute cycle. These actions focus on immediate system stability, peak load shaving, and protection enforcement.
Key real-time control functions include:
(1) Battery-Assisted Peak Shaving: Rapid discharge from the battery storage system to prevent grid import from exceeding contractual limits or EMS-defined thresholds.
(2) Compressor Staggering: Temporally offsetting the startup of HVAC compressors to avoid simultaneous inrush currents and demand spikes.
(3) Fast Dimming and Load Curtailment: Instantaneous reduction of lighting output or deferrable loads during transient peak events, without compromising occupant safety.
(4) Safety Interlocks via SCADA: Continuous monitoring of voltage, frequency, and protection signals to initiate automatic shutdown or load shedding in abnormal conditions, ensuring compliance with interconnection and safety regulations.
The seamless interaction among these three operating modes is critical to the effectiveness of the proposed energy management framework. The day-ahead schedule establishes a stable baseline plan, intra-day updates compensate for forecast errors and resource fluctuations, and real-time control actions address transient events and operational contingencies. This layered, multi-timescale control strategy ensures that the system not only achieves its primary objectives of energy cost minimization and peak demand reduction but also remains robust under high renewable energy penetration and dynamically varying load conditions. In practical deployment, this methodology has demonstrated the capability to achieve high forecasting accuracy (exceeding 92%), reduce daily peak demand by more than 30%, and increase renewable self-consumption without compromising occupant comfort or system reliability.
The EMS maintains a comprehensive logging framework to monitor operational performance, compliance with technical constraints, and overall system health. Logged parameters include both raw measurements and derived KPIs, as summarized below:
Grid kWh / Peak kW: Total imported electrical energy and the maximum 15-minute average demand observed over the evaluation period, which are critical for assessing grid dependency and demand charge exposure.
PV Self-Consumption (%): The ratio of on-site PV generation directly consumed by local loads to the total PV generation, serving as a key indicator of renewable utilization efficiency.
Curtailment (kWh): The amount of potential renewable energy that remains unused due to system or operational constraints, reflecting inefficiencies in renewable integration.
Fuel Use (L or kWh): Total fuel consumption of the diesel generator, enabling subsequent evaluation of operating cost and greenhouse gas emissions.
Battery Throughput (kWh): The cumulative energy charged to and discharged from the battery energy storage system over the reporting period, which is relevant for battery degradation assessment and lifecycle management.
Comfort Score: A quantitative metric representing the percentage of time during which indoor environmental conditions, including temperature and lighting levels, remain within predefined comfort bands, thereby capturing the quality of demand-side control.
These KPIs support continuous performance improvement by enabling post-operational analysis, forecasting model recalibration, and long-term asset management and maintenance strategies within the proposed forecast-integrated EMS framework.
The following sequence outlines a representative daily operational profile for the forecast-integrated load control system. The schedule is driven by forecasted renewable generation, TOU tariffs, and operational constraints, ensuring optimal utilization of on-site energy resources while minimizing dependency on the utility grid. Each time block reflects coordinated interaction among the forecasting, optimization, and control layers, with dispatch decisions dynamically adjusted by the PSO engine.
(1) 08:00–10:00 Staggered Start-Up and Renewable-First Operation:
At the beginning of the operational day, major loads such as HVAC units are activated using staggered start sequences to prevent simultaneous inrush currents and mitigate initial demand spikes. The control system prioritizes locally available renewable generation from PV and wind sources, thereby minimizing early grid imports. When renewable output exceeds instantaneous load demand, partial battery charging is initiated to prepare for mid-day operation and peak-period demand management. This strategy ensures a smooth system ramp-up while maintaining operational efficiency and reliability.
(2) 10:30–12:00 Peak PV Generation and Pre-Cooling Phase:
During late morning hours, PV generation typically reaches high output levels. The EMS exploits this surplus by initiating a pre-cooling strategy in chiller-served zones (Rooms 4–6), lowering indoor temperatures in anticipation of the afternoon TOU peak. Simultaneously, the BESS is charged toward a higher SOC, establishing an electrical reserve for subsequent peak shaving. The combined use of thermal storage through pre-cooled spaces and electrical storage through the BESS maximizes renewable utilization while reducing curtailment risk.
(3) 13:00–15:00 TOU Peak Period and Demand Capping:
The early afternoon coincides with TOU peak pricing and elevated cooling demand. During this period, the control system enforces the MEA import capacity constraint by discharging the battery according to an optimized profile generated by the PSO engine. HVAC temperature setpoints in occupied zones are temporarily adjusted upward by 0.5-1.0 °C as a demand-response measure that balances energy savings with occupant comfort. Due to the earlier pre-cooling action, chiller loads can be reduced without significant thermal comfort penalties, contributing to effective peak demand mitigation.
(4) 15:00-17:00 Load Reduction and Reserve Preservation:
In the late afternoon, discretionary loads are gradually reduced to maintain total demand within predefined operational limits. Battery operation is managed to ensure that the SOC remains above the reserve threshold, preserving flexibility to respond to potential evening peaks or unexpected supply shortfalls. The diesel generator is activated only under exceptional conditions, such as rapid renewable generation drop-off or unforeseen demand surges, thereby minimizing fuel consumption and associated emissions while ensuring system reliability.
(5) Integrated Operational Logic:
The daily control sequence highlights the layered decision-making strategy of the proposed framework:
$\bullet$ Renewable-first operation during morning hours to minimize early grid dependency.
$\bullet$ Coordinated utilization of thermal and electrical energy storage during renewable surplus periods.
$\bullet$ Targeted demand capping during peak TOU tariff windows.
$\bullet$ Resource preservation toward the end of the operating day to enhance system resilience.
In practical deployment, the integrated operational strategy reduces daily peak demand by over 30%, enhances PV self-consumption, and decreases grid electricity purchases without compromising occupant comfort or operational reliability.
In modern forecast-integrated energy management systems, the convergence of DERs, IoT devices, and supervisory control platforms significantly increases the potential cyberattack surface and operational risks. To mitigate these vulnerabilities, the proposed system adopts a comprehensive cybersecurity and reliability framework that safeguards confidentiality, integrity, availability, and resilience across all operational layers. The communication infrastructure is structured according to a multi-zone security model to minimize lateral movement in the event of a security breach. At the field layer, sensors and actuators communicate through industrial protocols such as Modbus RTU/TCP and BACnet, which are widely adopted in building automation and microgrid applications. The control layer encompasses SCADA systems, programmable logic controllers (PLCs), and edge controllers responsible for executing real-time energy management commands. Between the operational and enterprise domains, a demilitarized zone (DMZ) serves as a secure buffer that regulates data exchange between operational technology (OT) and information technology (IT) systems. The enterprise IT layer hosts administrative dashboards, data analytics services, and historical data repositories for system monitoring and decision support. All inter-zone communications are protected using Transport Layer Security (TLS) with mutual authentication, while application-layer protocols such as MQTT over TLS and OPC Unified Architecture (OPC-UA) with encryption ensure end-to-end confidentiality and message integrity. Access to system resources is managed through role-based access control (RBAC), ensuring that operators, engineers, and administrators are granted only the minimum privileges required for their responsibilities. Multi-factor authentication (MFA) is enforced where applicable, and all access attempts successful or denied are recorded in tamper-evident audit logs to support forensic analysis and accountability. System reliability is further reinforced through multiple fail-safe and fallback mechanisms that maintain operational continuity during unexpected disruptions. In the event of central EMS unavailability, edge controllers automatically revert to preconfigured local rule-based control strategies based on time-of-day schedules and demand thresholds, enabling autonomous operation at the field level. During prolonged renewable shortfalls or critical load conditions, standby generation is automatically dispatched to sustain supply reliability. Hardware-based grid imports limiters provided by the MEA enforce contractual import constraints independently of higher-level optimization functions, preserving baseline operational capability under fault conditions. Accurate time synchronization and data integrity are maintained using Network Time Protocol (NTP) for general devices and Precision Time Protocol (PTP) for high-resolution control loops, ensuring that forecasting, optimization, and control actions remain aligned with the 15-minute scheduling horizon. Redundant logging mechanisms implemented at both local and central levels guarantee data continuity during temporary network disruptions. Beyond cybersecurity, the overall architecture follows a reliability-centric design philosophy in which communication links and computing resources are provisioned with redundancy, allowing graceful degradation rather than abrupt failure. Through this integrated approach combining layered cybersecurity defenses, synchronized data handling, and resilient system design, the proposed framework achieves robust protection against cyber threats while maintaining dependable performance under adverse operational conditions.
4. Results
The forecasting performance of three models ARIMA, RF, and LSTM was evaluated using 15-minute resolution datasets of solar irradiance, wind speed, ambient temperature, and building load. All models were trained using 30 days of historical data and tested over a five-day horizon to ensure consistent comparison across methods. Table 3 summarizes the statistical error metrics, including root mean square error (RMSE), mean absolute percentage error (MAPE), and coefficient of determination $(R^2)$. Across all forecasting targets, the LSTM model achieved the lowest RMSE and MAPE values, indicating superior capability in capturing nonlinear temporal dependencies in renewable generation and building load profiles. The RF model demonstrated moderate accuracy with improved robustness relative to ARIMA, while ARIMA exhibited higher errors, particularly for wind power forecasting, reflecting its limitations under nonstationary and highly variable conditions. Figure 12. shows the distribution of forecasting errors for the three models. The LSTM model presents the lowest median MAPE with minimal variance, whereas the RF model offers a favorable balance between accuracy and stability. These results confirm that the selected hybrid forecasting strategy is suitable for real-time energy management applications requiring reliable short-term predictions.
Forecasted | Model | RMSE (kW) | MAPE (%) | $\mathbf{R}^{\mathbf{2}}$ |
|---|---|---|---|---|
PV Generation | ARIMA | 0.142 | 9.63 | 0.893 |
RF | 0.109 | 7.24 | 0.911 | |
LSTM | 0.085 | 5.71 | 0.923 | |
Wind Power | ARIMA | 0.064 | 12.45 | 0.874 |
RF | 0.058 | 9.82 | 0.896 | |
LSTM | 0.045 | 7.33 | 0.915 | |
Building Load | ARIMA | 0.231 | 8.96 | 0.901 |
RF | 0.194 | 7.12 | 0.918 | |
LSTM | 0.165 | 6.48 | 0.928 |
Table 3 summarizes the statistical error metrics, including RMSE and MAPE, for PV, wind, and load forecasting models. Among the evaluated approaches, the LSTM model consistently achieves the lowest error values across all forecasting targets, confirming its superior predictive accuracy for nonlinear and time-dependent energy data. The predicted versus actual profiles for PV generation and building load are illustrated in Figure 12 and Figure 13, respectively.


These results demonstrate strong agreement between forecasted and measured values and confirm the consistency and robustness of the forecasting performance across different models and operating conditions. The observed deviations remain within acceptable error bounds during periods of rapid irradiance fluctuation and load variation, indicating that the forecasting models effectively capture short-term dynamics. In particular, the hybrid forecasting approach maintains stable performance during peak demand intervals, which is critical for reliable forecast-driven optimization and real-time scheduling in smart energy management systems. This level of predictive accuracy provides a dependable foundation for subsequent PSO-based dispatch decisions and load control actions.
The achieved forecasting accuracy and robustness under short-term variability are in line with recent studies employing hybrid machine learning and ensemble-based forecasting models for renewable-rich energy systems [25], [26], [27].
Figure 12 forecasting accuracy comparison of RF, LSTM, and ARIMA models evaluated using MAPE Error on 15-minute test data under identical experimental conditions. The box plots illustrate the interquartile range (25th–75th percentile), median, mean, and data dispersion within 1.5× IQR. The LSTM model achieves the lowest median error (4.2%) with minimal variance, indicating superior capability in capturing nonlinear temporal patterns. The RF model demonstrates moderate error (5.6%) with improved stability over ARIMA, reflecting its robustness for ensemble-based regression. In contrast, ARIMA exhibits the highest median error (8.5%) and the widest dispersion, revealing limitations in handling nonstationary and nonlinear time-series data. Overall, while LSTM delivers the highest forecasting accuracy, RF offers a balanced trade-off between accuracy, stability, and computational efficiency, making it well suited for real-time and edge-based energy management within the proposed EMS framework. Peak demand reduction is defined as the percentage decrease in maximum grid import power between baseline and optimized operation.
Peak Demand Reduction the percentage decrease in maximum grid import power between baseline and optimized operation, calculated as peak demand reduction (%).
Figure 13 shows peak demand reduction performance over a 7-days evaluation period at 15-minutes resolution, highlighting the robustness of the proposed PSO-based scheduling strategy. The bar chart with error bars represents the mean peak demand values and the corresponding standard deviations, capturing performance consistency across varying operating conditions, following standard evaluation practices in energy management studies. Compared with the baseline control strategy, which exhibits higher mean peak demand and greater variability, the PSO-based approach consistently suppresses peak demand below contractual import limits with minimal variance. These results demonstrate the effectiveness and robustness of PSO-driven optimization for peak demand mitigation under dynamic renewable generation and load conditions.
The load control and dispatch performance was evaluated through real-time operation of the six-classroom hybrid microgrid over a continuous five-day experimental period. At each 15-minute control interval, scheduling decisions were generated by the forecast-driven PSO algorithm, which utilized short-term forecasts of PV generation, wind power output, and building load demand as primary inputs. During operation, the PSO scheduler dynamically coordinated controllable loads, renewable energy sources, and the BESS to maintain real-time balance between supply and demand. The optimization strategy prioritized local renewable energy utilization while minimizing grid electricity import and preserving occupant comfort within predefined bounds. This adaptive scheduling enabled pre-cooling of occupied spaces during periods of high solar availability, shifting of non-critical loads to off-peak intervals, and strategic battery discharge during high-demand periods to mitigate peak load impacts. The real-time implementation further demonstrated the system’s responsiveness to changing operating conditions, including fluctuations in solar irradiance, wind speed, and occupancy patterns, by continuously updating dispatch decisions based on the most recent forecast information. Similar performance trends have been reported in recent experimental and campus-scale microgrid studies, where forecast-integrated scheduling and optimization-based EMS significantly improved renewable utilization and peak demand mitigation [28], [29], [30], [31].
As a result, the PSO-based control framework ensured stable microgrid operation, reliable power delivery, and efficient energy utilization throughout the experimental period, thereby confirming its effectiveness and practical applicability for forecast-integrated smart building microgrids.

Figure 14 shows optimized daytime dispatch of DERs, including PV, wind power, BESS, DG, and utility grid power, over the operating period from 08:00 to 17:00. The figure illustrates the coordinated real-time power dispatch achieved by the proposed forecast-driven PSO-based energy management strategy at 15-minute resolution. During the morning period, the gradual increase in PV generation is primarily utilized to supply local loads while simultaneously charging the BESS, with the utility grid compensating for any residual demand. As renewable availability increases toward midday, PV and wind generation collectively satisfy the majority of the building load, resulting in a substantial reduction in grid import and improved renewable self-consumption. During the afternoon peak demand period, the BESS is strategically discharged in accordance with the optimized schedule to mitigate peak grid import and demand charges, thereby maintaining system operation within contractual and technical constraints. The diesel generator is activated only when necessary to ensure supply reliability under extreme or transient conditions, minimizing fuel consumption and emissions. Overall, the observed dispatch hierarchy (PV → Wind → BESS → DG → Grid) reflects a renewable-priority operational philosophy that enhances energy utilization efficiency, reduces reliance on conventional sources, and ensures stable microgrid operation under dynamically varying load and generation conditions. These results clearly demonstrate the effectiveness and practical applicability of the proposed PSO-based energy management framework for renewable-rich microgrids.
Figure 15 shows comparison of energy dispatch performance among the PSO-based, GA-based, and rule-based control strategies in terms of total supplied power versus actual building load over a representative operating day. The PSO-based control closely tracks the building load profile, exhibiting smooth and adaptive dispatch behavior throughout the daytime period as a result of its forecast-driven and iterative optimization mechanism. By accurately incorporating short-term forecasts of renewable generation and load demand, the PSO algorithm effectively coordinates PV, wind, BESS, and grid resources to minimize utility grid import while maintaining supply-demand balance. In contrast, the GA-based control strategy demonstrates moderate power fluctuations due to slower convergence characteristics and reduced responsiveness to short-term forecast updates. The rule-based control approach exhibits the largest deviation between supplied power and actual load, reflecting the limitations of static, threshold-based operation under dynamically changing renewable generation and load conditions. Overall, the PSO-based strategy provides the most stable and balanced energy dispatch, effectively reducing grid dependency while ensuring continuous load supply and reliable system operation in smart building microgrids. Coordinated SOC control and degradation-aware scheduling are essential to preserve battery lifetime and ensure sustainable long-term operation, as emphasized in recent battery management and storage optimization studies [32], [33], [34], [35].

Figure 16 shows battery SOC profile during daytime operation (08:00–17:00) under the forecast-driven PSO-based control strategy. The SOC increases during late morning hours as surplus PV generation is utilized for battery charging, reaching the upper SOC limit around midday, consistent with renewable-priority energy management strategies.
The battery remains at a high SOC level during peak solar availability, enabling energy buffering for subsequent peak demand periods, as commonly adopted in PV-battery microgrid operation. During the afternoon peak, the SOC decreases as the battery is discharged to support building load and reduce grid import, in line with peak-shaving and cost-minimization objectives. The SOC is maintained within the predefined safe operating range (20–100%), demonstrating smooth charge-discharge transitions and effective battery management without excessive cycling, which is essential for preserving battery lifetime and operational reliability.
The SOC trajectories of the BESS under different control strategies indicate that the PSO-based control maintains SOC within the safe operating range of 20–100% while exhibiting smooth and well-timed charge-discharge cycles that are closely aligned with renewable generation availability. Compared with the GA-based and rule-based strategies, the PSO-based approach achieves more stable battery operation with reduced cycling stress, leading to improved renewable energy utilization and extended battery lifetime. The coordinated scheduling enabled by PSO allows the BESS to absorb surplus photovoltaic energy during high-generation periods and discharge strategically during peak demand intervals, thereby enhancing overall system efficiency and reliability.
As demonstrated by the experimental results, the PSO-based control reduces peak demand by 31%, decreases grid energy import by 21.5%, and lowers total operating cost by 21.5%, while increasing PV self-consumption to 76.2% compared with conventional control strategies. These outcomes confirm the effectiveness of forecast-integrated PSO-based battery management for smart building microgrids with high renewable penetration.
Table 4 presents a comparative summary of key performance metrics among the rule-based, GA-based, and PSO-based control strategies, highlighting the quantitative improvements achieved by the proposed forecast-integrated optimization framework. The results clearly demonstrate that the PSO-based control delivers superior overall performance across all evaluated indicators, consistent with prior studies on swarm-based and evolutionary optimization for energy management systems. In terms of PV self-consumption, the PSO-based strategy achieves the highest utilization rate of 76.2%, representing an improvement of approximately 28% compared with the rule-based control. This indicates that the PSO scheduler effectively aligns flexible load operation and battery charging with renewable energy availability, thereby minimizing curtailment and maximizing on-site energy utilization. Peak demand is reduced from 14.2 kW under rule-based control to 9.8 kW with the PSO-based strategy, corresponding to a significant 31% reduction. Such peak demand mitigation directly translates into lower demand charges and improved compliance with contractual grid import limits under TOU tariff structures. Furthermore, the system’s grid energy import decreases by 21.5%, from 1,620 kWh/day to 1,272 kWh/day, confirming that the optimization framework successfully reduces reliance on the utility grid through coordinated scheduling of renewable generation and battery storage. As a result, the daily operating cost is reduced by 21.5%, yielding substantial economic savings under TOU pricing schemes. The battery cycle efficiency also improves slightly from 91.8% to 93.4%, reflecting smoother charge-discharge trajectories and reduced cycling stress on the BESS, which is beneficial for extending battery lifetime and enhancing long-term system reliability. Overall, Table 4 underscores the effectiveness of the forecast-driven PSO-based control strategy in achieving simultaneous gains in energy efficiency, cost reduction, and operational reliability, while enhancing renewable utilization and extending battery lifespan. The proposed approach consistently outperforms both conventional rule-based and GA-based strategies across all evaluated performance metrics. The superior performance of the PSO-based strategy over GA-based and rule-based methods is consistent with previous findings on swarm intelligence and evolutionary optimization applied to energy management problems [36], [37], [38], [39].
The total energy flow balance of the hybrid microgrid, including PV utilization, battery cycling, and grid import/export ratios, is summarized in Table 5, providing further insight into the coordinated operation of distributed energy resources under the proposed optimization framework.

Parameter | Rule-Based | GA-Based | PSO-Based | Improvement (%) |
|---|---|---|---|---|
PV self-consumption (%) | 59.5 | 67.2 | 76.2 | +28.0 |
Peak demand (kW) | 14.2 | 12.0 | 9.8 | -31.0 |
Grid energy import (kWh/day) | 1,620 | 1,400 | 1,272 | -21.5 |
Operating cost (Bath/day) | 28,130 | 23,480 | 22,090 | -21.5 |
Battery cycle efficiency (%) | 91.8 | 92.6 | 93.4 | +1.7 |
Table 5 summarizes the total energy flow balance of the hybrid microgrid during the five-day experimental period, illustrating the contribution of each energy component to overall system operation. The results indicate that PV generation is the dominant energy source, supplying an average power of 5.43 kW, which accounts for approximately 42.1% of the total energy consumption. This is followed by BESS discharge at 2.94 kW (22.8%) and wind generation at 1.12 kW (8.7%), reflecting effective utilization of both renewable generation and stored energy. The DG contributes a relatively modest share of 9.0%, operating primarily during periods of low renewable availability or elevated demand to maintain supply reliability and system stability. Meanwhile, grid import accounts for only 17.4% of total energy use, demonstrating a substantial reduction in grid dependency achieved through the forecast-driven PSO scheduling strategy.
Overall, Table 5 highlights the balanced coordination among distributed energy resources enabled by the proposed optimization framework. By prioritizing renewable generation, strategically leveraging stored energy from the BESS, and minimizing both diesel generator runtime and grid electricity imports, the system maintains a stable energy balance while achieving high renewable self-consumption and operational efficiency throughout the five-day test period.
Energy Component | Average Power (kW) | Contribution (%) |
|---|---|---|
PV generation | 5.43 | 42.1 |
Wind generation | 1.12 | 8.7 |
BESS discharge | 2.94 | 22.8 |
DG output | 1.16 | 9.0 |
Grid import | 2.30 | 17.4 |
The economic performance evaluation was conducted based on the five-day operational data obtained from the six-classroom hybrid microgrid, reflecting real-time operation under practical load and renewable generation conditions. The energy cost assessment follows the TOU tariff structure defined by the MEA, which incorporates both energy charges and demand charges to capture the economic impact of peak demand and electricity consumption patterns.
This tariff-based evaluation framework enables a realistic assessment of the financial benefits achieved through forecast-driven optimization, particularly in terms of peak demand reduction and grid import minimization, which are critical cost drivers in commercial and institutional building microgrids. In addition, the separation of peak-hour, off-peak-hour, and demand charge components allows the analysis to explicitly quantify how load shifting, battery dispatch, and renewable prioritization translate into monetary savings. By evaluating costs under an actual utility tariff rather than a simplified flat-rate model, the proposed framework demonstrates its practical applicability and economic relevance for real-world deployment. This approach also facilitates direct comparison with exist Economic Performance studies and supports decision-making for microgrid operators seeking to balance operational efficiency, cost reduction, and investment justification. The observed reductions in operating cost and demand charges under the TOU tariff structure are consistent with prior economic assessments of forecast-driven demand-side management in commercial and institutional buildings [40], [41], [42].
Table 6 summarizes the daily and monthly operating cost comparisons among the rule-based, GA-based, and PSO-based control strategies. The results clearly indicate that the PSO-based approach achieves the lowest overall operating cost, primarily due to its capability to simultaneously reduce grid energy consumption and peak demand through forecast-integrated optimization. By intelligently scheduling flexible loads and coordinating renewable generation and battery dispatch, the PSO controller minimizes electricity import during high-tariff periods while maximizing on-site renewable self-consumption under the TOU tariff structure.
Control Method | Energy Cost (Bath/day) | Demand Charge (Bath/day) | Total (Bath/day) | Total (Bath/month) |
|---|---|---|---|---|
Rule-based | 24,520 | 3,610 | 28,130 | 843,900 |
GA-based | 20,680 | 2,800 | 23,480 | 704,400 |
PSO-based | 19,320 | 2,770 | 22,090 | 637,200 |
These cost reductions are strongly associated with effective peak demand mitigation and improved alignment between demand and renewable availability. In contrast, the GA-based control strategy achieves moderate cost savings but exhibits longer computation times and less consistent performance, particularly under rapidly changing load and renewable generation conditions. The rule-based control method, constrained by static threshold rules and the absence of predictive capability, incurs the highest daily and monthly operating costs due to inefficient load shifting and limited peak demand control.
Overall, Table 6 highlights how the proposed forecast-driven PSO framework effectively translates technical improvements such as load shifting, demand capping, and renewable prioritization into tangible economic benefits. These results confirm that the integration of forecasting and PSO-based optimization enables superior energy efficiency and cost reduction under real-world operating conditions in smart building microgrids.
Table 7 presents a detailed breakdown of energy consumption and cost distribution under the TOU tariff structure, separating daytime peak-hour and off-peak-hour operating costs. The results demonstrate how the proposed forecast-driven PSO control strategy effectively shifts a substantial portion of the building’s energy consumption away from high-tariff peak periods toward lower-cost off-peak intervals. By coordinating renewable generation, BESS discharge, and flexible load scheduling, the system maximizes on-site renewable self-consumption during peak tariff hours while minimizing electricity import from the utility grid. As a result, the majority of operating costs are incurred during off-peak periods, where electricity prices are significantly lower, leading to overall cost reduction under the TOU pricing scheme.
Time Period | Energy Import (kWh/day) | TOU Tariff (Baht/kWh) | Daily Cost (Baht/day) | Cost Share (%) |
|---|---|---|---|---|
Peak hours (09:00–22:00) | 980 | 5.33 | 5,223 | 70.4 |
Off-peak hours (22:00–09:00) | 292 | 2.63 | 767 | 10.3 |
Demand charge (based on peak kW) | - | - | 3,610 | 19.3 |
Total | 1,272 | - | 9,600 | 100 |
These findings confirm that intelligent, forecast-integrated scheduling not only enhances energy efficiency but also delivers direct economic benefits by aligning power usage with dynamic electricity pricing patterns. Overall, Table 7 illustrates how the proposed PSO-based strategy achieves a balanced energy profile, reduced electricity expenditure, and improved utilization of renewable and stored energy resources within the hybrid microgrid.
Figure 17 shows comparison of total energy cost and renewable energy utilization under different control strategies. The results indicate that the proposed PSO-based framework significantly reduces grid energy cost and demand charges while increasing renewable self-consumption from 55% to 82% through forecast-integrated scheduling. By synchronizing renewable generation with load shifting and battery charging decisions, the PSO controller effectively minimizes renewable curtailment and maximizes local energy utilization.

This coordinated optimization enhances overall system sustainability, reduces reliance on the utility grid, and supports more autonomous and resilient microgrid operation compared with conventional rule-based and GA-based control approaches.
Figure 18 shows comparison of KPIs between the baseline control and the proposed PSO-based optimization strategy across multiple operational dimensions, including peak demand reduction, energy cost savings, fuel savings, battery throughput reduction, and comfort score improvement. The results demonstrate that the forecast-integrated PSO strategy consistently outperforms the baseline control across all evaluated criteria, confirming its effectiveness for multi-objective energy management in smart building microgrids.

Specifically, the PSO-based control achieves a 30.2% reduction in peak demand, effectively limiting grid import during high-tariff periods and reducing demand-related charges under the TOU tariff structure. An overall energy cost reduction of 21.5% is also observed, reflecting improved scheduling efficiency and enhanced utilization of locally available renewable energy. In addition, fuel savings of 18.0% are obtained through reduced reliance on the diesel generator, enabled by coordinated dispatch of renewable generation and battery energy storage. The observed 12.0% reduction in battery throughput indicates smoother charge-discharge cycles, which contribute to reduced degradation stress and extended battery lifespan. Furthermore, the comfort score improves by 15.0%, demonstrating that the PSO-based optimization maintains indoor thermal conditions within acceptable comfort bounds while simultaneously optimizing energy use.
Overall, Figure 18 illustrates that the proposed forecast-integrated PSO control framework achieves balanced technical, economic, and comfort-related benefits, validating its capability to enhance system efficiency and occupant satisfaction under real-world operating conditions.
The aggregated results further indicate that, under forecast-driven PSO control, the total monthly energy cost is reduced by approximately 21.5% compared with the rule-based baseline, while the GA-based strategy achieves intermediate cost savings. This comparison confirms that PSO offers superior convergence, adaptability, and overall performance relative to conventional rule-based and GA-based approaches.
5. Discussion
This section provides an in-depth discussion of the implications of the obtained results, with a particular focus on how the proposed forecast-driven PSO-based control framework advances forecasting accuracy, energy dispatch effectiveness, and overall economic performance when compared with conventional rule-based strategies and evolutionary control methods. Rather than merely reporting numerical improvements, the discussion aims to interpret the results from both technical and economic perspectives, thereby offering a comprehensive understanding of system behavior under realistic operating conditions.
From a technical standpoint, the tight integration of short-term forecasting with PSO-based optimization enables proactive and informed decision-making, allowing the EMS to anticipate variations in renewable generation and building load demand. This predictive capability significantly enhances the coordination of DERs and flexible loads, resulting in smoother power dispatch profiles, reduced ramping requirements, and improved system stability. Moreover, the optimized scheduling strategy effectively mitigates peak demand by strategically shifting energy usage and battery discharge to high-demand periods, while maximizing on-site renewable utilization during periods of abundant PV and wind generation. These outcomes demonstrate the ability of the proposed framework to address the inherent intermittency and uncertainty associated with renewable-rich microgrids.
From an economic perspective, the observed technical improvements directly translate into tangible financial benefits under the TOU tariff structure. By minimizing grid energy imports during high-tariff periods and suppressing peak demand levels, the proposed control strategy significantly reduces both energy charges and demand charges, which are dominant cost components for commercial and institutional buildings. Furthermore, the intelligent coordination of the BESS not only supports peak shaving but also avoids excessive cycling, thereby contributing to long-term cost effectiveness through reduced battery degradation and maintenance requirements.
Overall, the discussion highlights that the synergistic combination of accurate short-term forecasting and adaptive PSO-based optimization serves as a key enabler for achieving simultaneous improvements in energy efficiency, operational reliability, and economic viability. The results underscore the practical value of forecast-driven optimization as a scalable and robust solution for smart building microgrids operating under dynamic load conditions and evolving tariff structures, and they provide strong evidence to support the broader adoption of intelligent, data-driven energy management frameworks in future smart energy systems.
The observed 31% reduction in peak demand and 21.5% decrease in grid energy import confirm that the proposed PSO-based control framework effectively exploits forecasted renewable generation and load demand information to anticipate and mitigate high-demand periods. Unlike conventional rule-based control, which responds only to real-time measurements, the PSO scheduler proactively shifts controllable loads and battery discharge toward periods characterized by high electricity tariffs and low renewable availability, thereby reducing reliance on the utility grid during peak hours. The coordinated operation of PV generation, wind power, and the BESS plays a critical role in minimizing grid dependency, particularly during peak demand intervals. Maintaining the BESS SOC within the safe operating range of 20-100% ensures secure and efficient energy cycling, reducing battery stress while enhancing system responsiveness to rapid changes in load and renewable generation.
Furthermore, the multi-objective optimization structure of the PSO algorithm enables balanced trade-offs among grid import minimization, fuel consumption, and occupant comfort constraints, resulting in smoother operational transitions across all DERs. These findings validate that integrating short-term forecasting with adaptive optimization significantly improves scheduling reliability and overall microgrid stability, particularly under tropical climate conditions where solar irradiance and building load profiles exhibit high variability.
The reduction in grid energy import and peak demand directly contributes to a 21.5% decrease in total operating cost, as reported in Section 5.3. Under the TOU tariff structure of the MEA, this reduction corresponds to an estimated saving of approximately 6,040 THB per month for the six-classroom facility. The proposed PSO-based control effectively reduces both the energy charge and demand charge components simultaneously through forecast-integrated scheduling and coordinated dispatch of renewable generation and battery storage.
In comparison, the GA-based optimization achieves intermediate cost savings but exhibits slower convergence and a greater tendency to settle in local optima, which limits its adaptability under rapidly changing load and renewable conditions. When benchmarked against recent studies, the economic performance obtained in this work is competitive. For example, Zhang et al. Report a 17.2% cost reduction using fuzzy logic control in residential microgrids, while Lim et al. achieve a 19.6% reduction through GA-based scheduling. In contrast, the proposed PSO framework attains a higher cost reduction of 21.5% alongside an increased PV self-consumption rate of 76%, indicating superior adaptability to varying load profiles and weather-driven renewable fluctuations.
These economic gains validate the technical-economic linkage discussed in Section 3.2, demonstrating that enhanced scheduling flexibility and accurate forecasting directly translate into improved system profitability while maintaining occupant comfort and operational reliability.
The experimental results demonstrate that the proposed forecast-driven PSO-based control framework can be effectively applied to both educational and commercial microgrids comprising heterogeneous DERs. The modular system architecture enables seamless integration with existing SCADA platforms through widely adopted IoT communication protocols such as Modbus/TCP and MQTT, facilitating practical deployment without extensive infrastructure modification.
Moreover, the proposed method exhibits strong scalability. The core forecasting and optimization modules can be extended to larger facilities or higher numbers of controllable loads with minimal adjustment to model parameters, making the framework suitable for campus-scale or commercial building applications.
Despite these advantages, several limitations should be acknowledged. First, the current implementation assumes a fixed TOU electricity tariff structure and does not account for dynamic pricing or real-time market participation, which may influence optimal scheduling decisions under future regulatory environments. Second, battery degradation effects are not explicitly modeled beyond the five-day experimental window. Long-term factors such as capacity fade, temperature-dependent SOC drift, and efficiency variation of power electronic converters are neglected in the present study. These aspects may affect optimal dispatch decisions and lifecycle cost assessment when the system operates over extended periods.
Future research will address these limitations by incorporating detailed battery aging models, temperature-dependent performance characteristics, and inverter efficiency curves into the optimization framework to enhance realism and predictive accuracy. In addition, the proposed framework will be extended to multi-building or campus-level microgrid clusters, enabling coordinated energy management across multiple interconnected facilities. Advanced control strategies such as reinforcement learning and MPC will also be explored to enable adaptive multi-day and long-horizon optimization under uncertain load and renewable generation conditions.
Overall, these extensions are expected to further strengthen the robustness, economic viability, and practical relevance of forecast-integrated optimization for next-generation smart building and microgrid energy management systems.
Overall, the forecast-integrated PSO framework demonstrated consistent improvements in both technical and economic aspects compared with rule-based and GA-based methods. The 92.3% forecasting accuracy, 31% peak demand reduction, and 21.5% cost savings collectively confirm the viability of the proposed approach for real-world smart microgrid deployment.
These findings highlight the significance of integrating data-driven forecasting with metaheuristic optimization as a practical pathway toward energy-efficient, renewable-rich smart buildings.
Although the proposed forecast-integrated PSO-based load control framework demonstrates strong technical and economic performance, several limitations should be acknowledged to guide future research and system development.
(1) Forecast Uncertainty and Real-Time Adaptation.
The current framework maintains stable operation under forecast deviations of ±15%, with operating cost variations below 4%. However, larger forecast errors caused by abrupt weather changes or sensor faults may degrade scheduling accuracy and dispatch optimality. Future work will integrate adaptive reforecasting mechanisms and MPC strategies to dynamically recalibrate short-term forecasts and enhance real-time decision-making robustness under uncertainty.
(2) Computational Scalability.
The PSO optimization is executed at 15-minute intervals using a centralized EMS. While this configuration is sufficient for a single microgrid, scaling to larger networks or multi-building campuses may increase computation time and coordination complexity. Future developments will focus on distributed optimization architectures, hierarchical control, and parallel PSO implementations to achieve faster convergence and scalable coordination across interconnected microgrids.
(3) Simplified Comfort and Behavioral Models.
Thermal comfort in this study is maintained within a fixed temperature band (24–26 °C), without explicitly accounting for dynamic occupant behavior, humidity effects, or individual comfort preferences. Incorporating real-time occupant feedback, PMV and PPD indices, as well as AI-based comfort prediction models, could enable more flexible and human-centered demand response strategies in future implementations.
(4) Battery Aging and Environmental Effects.
The BESS model assumes fixed SOC limits (20–90%) and nominal efficiency under ambient temperatures of 25–35 °C. Long-term degradation phenomena, temperature-dependent SOC drift, and aging-related capacity fade are not explicitly modeled within the five-day experimental window. Future work will incorporate temperature-compensated battery degradation models and lifecycle cost analysis to improve long-term economic accuracy and operational reliability.
(5) Cybersecurity and Communication Latency.
Although a multi-layer cybersecurity framework incorporating DMZs and encrypted MQTT communication was implemented, the impacts of communication latency and coordinated cyberattacks were not experimentally evaluated. Ongoing research will explore intrusion detection systems, blockchain-based authentication, and edge-resilient fallback control mechanisms to further strengthen reliability and cyber-resilience in smart grid applications.
(6) Generalization and Policy Integration.
The presented case study focuses on a six-classroom educational facility operating under Thailand’s TOU tariff structure. Broader validation under diverse climatic conditions, tariff schemes, and policy environments such as dynamic pricing, real-time markets, or renewable incentive programs would provide deeper insights into the generalizability and policy relevance of the proposed framework. In summary, while the proposed system successfully demonstrates predictive load control with high accuracy and measurable cost savings, its future evolution will emphasize enhanced adaptability, scalability, and resilience. These improvements will support the deployment of forecast-integrated energy management systems across large-scale smart campuses and commercial facilities, contributing to the transition toward sustainable and intelligent energy ecosystems.
6. Conclusions
This study developed and experimentally validated a forecast-driven PSO-based load control framework for a renewable-rich hybrid microgrid. The proposed system integrates short-term forecasting, multi-objective optimization, and SCADA-based control to coordinate the operation of PV generation, wind turbines, BESS, DG, and grid power exchange within a six-classroom academic facility.
Experimental results demonstrate substantial performance improvements, including a 31% reduction in peak demand and a 21.5% reduction in operating cost, confirming the feasibility and effectiveness of predictive optimization under real-world tropical climate conditions characterized by high solar and load variability. Beyond numerical gains, the results highlight the practical value of coupling data-driven forecasting with optimization-based energy management. The integrated framework enhances operational flexibility, increases renewable energy utilization, and supports cost-efficient grid interaction despite fluctuating weather patterns and dynamic load profiles. From an engineering perspective, the proposed approach contributes to the realization of intelligent and self-adaptive microgrids capable of forecast-based scheduling and dynamic coordination of heterogeneous DERs. Moreover, the modular architecture and reliance on standard SCADA and IoT communication protocols enable scalability and practical applicability to smart campuses and commercial buildings seeking to maximize renewable self-consumption while maintaining system stability and economic efficiency. Time-synchronized data acquisition and lightweight communication protocols such as MQTT and Modbus are widely recognized as key enablers for reliable real-time energy management systems. Despite its demonstrated advantages, several limitations remain. The sensitivity of the system to forecasting errors represents the most critical challenge, particularly under highly variable solar irradiance and load conditions. Inaccurate forecasts may lead to suboptimal dispatch decisions, temporary power imbalance, or excessive cycling of the BESS. A sensitivity analysis incorporating ±15% deviations in PV and load forecasts indicates that the proposed control maintains stable operation, with operating cost variations below 3.8% and SOC deviations under 5%. However, larger deviations exceeding 20% result in oscillatory battery behavior and increased grid import, indicating degradation in control performance. These findings confirm that the PSO-based framework is robust against moderate forecast uncertainty but remains dependent on the accuracy of short-term predictions. To address this limitation, future research will focus on integrating adaptive re-forecasting mechanisms and MPC layers to dynamically compensate for prediction errors and enhance real-time decision reliability. In addition, the framework will be extended to multi-building and campus-scale microgrids, incorporating reinforcement learning techniques and temperature-aware BESS degradation models to improve adaptability, robustness, and long-term economic performance.
Furthermore, robustness testing under ±15% forecast deviation confirms that the proposed control maintains power balance and SOC constraints without operational violations. Nevertheless, performance degradation under larger forecast errors highlights the need for future adaptive scheduling strategies capable of handling extreme uncertainty. Collectively, these advancements are expected to further strengthen the proposed system as a scalable and intelligent solution for next-generation smart grid and microgrid energy management.
The data used to support the findings of this study are available from the corresponding author upon request.
The authors declare that they have no conflicts of interest.
Symbols
$P_{{grid}}(t)$ | Power imported from the utility grid at time $t$ (kW) |
$P_{{gen}}(t)$ | Power output from diesel generator at time $t$ (kW) |
$P_{b c t}(t)$ | Charging or discharging power of the battery (kW) |
$P_{P V}(t)$ | Predicted photovoltaic generation (kW) |
$P_{{Tind }}(t)$ | Predicted wind generation (kW) |
$P_{{Load,} r}(t)$ | Forecasted building load demand (kW) |
$J$ | Objective function (dimensionless) |
$\alpha, \beta, \gamma, \delta, \zeta$ | Weighting coefficients in the objective |
Function
$c_f$ | Fuel cost coefficient (Bath/kWh) |
$c_{\text {deg }}$ | Battery degradation cost coefficient (Bath/kWh) |
$S O C(t)$ | Battery state of charge at time $t$ (fraction) |
$\eta_{b a t}$ | Battery charge-discharge efficiency (%) |
$v_i, x_i$ | Velocity and position of particle $i$ in the PSO |
$\omega, c_1, c_2$ | PSO inertia, cognitive, and social coefficients |
$r_1, r_2$ | Random coefficients uniformly distributed in [0,1] |
Abbreviations
ARIMA | Autoregressive Integrated Moving Average |
BESS | Battery Energy Storage System |
DG | Diesel Generator |
DER | Distributed Energy Resource |
EMS | Energy Management System |
GA | Genetic Algorithm |
HVAC | Heating, Ventilation, and Air Conditioning |
IoT | Internet of Things |
LSTM | Long Short-Term Memory |
