Next Article in Journal
Characteristics of Growth and Metabolism for Methane-Oxidizing Bacterial Communities in Different Coal Samples
Previous Article in Journal
Innovative Ultrasound-Assisted Extraction for Phenolic and Antioxidant Evaluation of Brazilian Green Propolis
Previous Article in Special Issue
Small-Signal Stability Analysis of Grid-Connected System for Renewable Energy Based on Network Node Impedance Modelling
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Real-Time Capable MPC-Based Energy Management of Hybrid Microgrid

by
Abdellfatah Amar
* and
Ziyodulla Yusupov
Department of Electrical and Electronics Engineering, Karabuk University, Karabük 78100, Türkiye
*
Author to whom correspondence should be addressed.
Processes 2025, 13(9), 2883; https://doi.org/10.3390/pr13092883
Submission received: 4 August 2025 / Revised: 3 September 2025 / Accepted: 4 September 2025 / Published: 9 September 2025

Abstract

As hybrid microgrids become increasingly widespread in real-world applications, the need for intelligent energy management strategies that ensure reliability, economic efficiency, and robustness to uncertainties is growing. This study presents a real-time capable model predictive control (MPC)-based energy management for a medium-sized hybrid microgrid at the Karabuk University Demir Çelik campus. The system comprises 100 kW photovoltaic (PV) panels, a 500 Ah battery energy storage system (BESS), a 440 kW diesel generator, and a 75 MVA utility connection. The proposed MPC approach is evaluated under ten realistic operating scenarios, incorporating dynamic pricing and fault conditions. Simulation results show up to 43% reduction in operational costs and 35% decrease in grid dependency, while keeping unserved critical loads below 3%. Compared to conventional rule-based methods, the proposed strategy offers improved scalability, adaptability, and resilience, highlighting its practical potential for deployment in smart energy systems.

1. Introduction

1.1. Importance and Motivation

The widespread adoption of distributed energy resources (DERs), such as PV panels, wind turbines, battery energy storage systems (BESSs), and diesel generators, has significantly transformed modern electrical power systems [1,2,3,4]. Microgrids (MGs) are increasingly considered a valuable solution for delivering local energy autonomy, resilience, and sustainability. However, their stochastic, dynamic, and multi-source nature presents significant challenges to efficient energy management of microgrids [5,6].
With uncertain energy prices and the changing nature of renewable energy sources, advanced control systems are necessary to ensure system stability while reducing operational costs. Among different control approaches, model predictive control (MPC) stands out for its ability to handle multivariable constrained optimization problems [7]. This paper investigates the use of MPC for real-time energy management in a hybrid MG at the Karabuk University (KBU) Demir Çelik campus.
Although the controller is evaluated by simulation, it has been designed with prediction, control horizons, and computational requirements suitable for real-time implementation on real microgrid hardware. To clarify the contribution, the novelty of this paper lies in the real-time economic MPC implementation and its extensive testing on a ten-scenario, realistic, stress-tested, medium-scale real microgrid. The forecasting modules (load, PV, and price forecasting) employ conventional and standard inputs; this paper does not propose a new forecasting algorithm. Instead, the contribution is in the MPC optimization framework, which addresses multi-source constraints, economic objectives, battery aging effects, and real-time computational constraints to enable practical deployment.

1.2. Research Background

MPC has proven to be an effective and flexible approach for optimizing energy management in a microgrid. Its ability to predict future system behavior and optimize control actions in real-time under dynamic and uncertain conditions makes it a leading choice. Unlike traditional rule-based or proportional-integral (PI) controllers, MPC can handle multivariable interactions, operational constraints, and time-varying system parameters. These features make it particularly well-suited for controlling a hybrid upstream microgrid that integrates PV panels, a BESS, and diesel generation [7,8].
Several MPC-based implementations for microgrids have been reported in the literature. For instance, Finite-Control-Set MPC (FCS-MPC) has shown better performance in voltage and frequency control of islanded AC microgrids, improving transient and steady-state responses, while reducing switching losses [9,10,11]. In terms of power quality improvement, MPC has shown better efficiency compared to conventional control methods in reducing total harmonic distortion (THD) in unbalanced and harmonically distorted three-phase systems [12]. Additionally, predictive power control (PPC) and predictive current control (PCC) schemes have proven more effective than PI-based controllers in improving dynamic response and frequency stability in converter and battery control applications [8].
Moreover, MPC has been used in stochastic optimization and economic dispatch, ensuring cost-effective energy scheduling and mitigating the complexity of resources such as PV and hydropower [13,14]. Distributed MPC and multi-agent systems have supported scalable, cooperative control in interconnected microgrid clusters, resulting in improved resilience and operational autonomy [15]. A decentralized MPC (DMPC) framework for DC microgrids replaces traditional primary control layers with a single optimal controller. This approach ensures accurate current sharing and optimal state switching, achieving superior control performance, as validated through hardware-in-the-loop experiments [16]. An economic MPC (EMPC) framework has been developed for microgrids with renewable energy sources. This framework integrates the costs of storage systems, generation sources, and potential energy exchange with the main grid, optimizing energy flow and reducing operational expenses [17]. Recently, MPC has been integrated with artificial intelligence (AI) techniques, specifically evolutionary algorithms and adaptive cost functions, to enhance robustness against uncertainties in load demand and wind generation [18,19].
Although significant advancements have been made, most current studies are still limited to simulation environments using synthetic or lab-scale data. Real-world implementations of medium-scale hybrid microgrids remain uncommon. Moreover, few studies examine MPC performance under multiple simultaneous real-world disturbances such as PV variability, battery fault, diesel generator failures, grid disconnection, and real-time electricity price uncertainty.
To clearly highlight the difference in system scale, energy source, control strategies, and operational outcomes among recent real-world MPC implementation studies, a comparison summary is presented in Table 1. The table summarizes three representative studies alongside the current real-world implementation at Karabuk University, illustrating how this research extends beyond simulation by demonstrating the economic performance of real-time MPC in various complex operating scenarios.
This growing body of research highlights the vast potential of MPC for intelligent energy management in smart microgrids. Also, it emphasizes the need for real-world validation, economic performance analysis, and resilience tests under actual operational conditions. This paper addresses these gaps through a real-case application of an MPC-based energy management system on the KBU Demir Çelik campus MG, providing new insights into the practicality and applicability of MPC in highly dynamic and constrained environments.

1.3. Research Gap

In spite of the extensive literature on MPC of microgrids, several research gaps remain:
  • Practical implementation: Few studies applied MPC in a real-world microgrid involving several DERs.
  • Limited scenario testing: Most prior research tests controllers under ideal or static conditions, with little consideration for real-world disturbances such as grid outages, generator failures, or sudden price fluctuations.
  • Lack of economic evaluation: Some research does not provide measurable evidence of the cost-effectiveness of MPC.

1.4. Contributions

Unlike previous real-world studies, which typically validate MPC under one or two categories of disturbances, this paper presents ten simultaneous and diverse stress-test scenarios, providing a more rigorous and extensive validation. The main contributions of this work are as follows:
  • Real-time demonstration of an MPC-based energy management system on a medium-scale hybrid microgrid including 100 kW PV panels, 500 Ah batteries, 440 kW diesel generator, and 75 MVA utility connection.
  • Detailed MPC formulation incorporating operating constraints such as classification of critical and non-critical load (400 kW + 41 kW), fuel economy, and battery aging effect.
  • Testing under ten realistic stress conditions, including PV power loss, battery faults, diesel generator faults, grid price fluctuations, and multi-step load changes or generation adjustments.
  • Demonstration of enhanced performance, in terms of cost saving, power balancing, and robustness, compared to conventional rule-based control methods.
An economically aware MPC framework is designed and implemented for a real hybrid microgrid at the KBU Demir Çelik campus, Türkiye. PV panels, a BESS, diesel generation, and the main grid are integrated into the developed controller, which is thoroughly simulated under realistic operational scenarios to bridge the gap between theoretical MPC models and practical implementation in real microgrid environments. The Karabuk University hybrid microgrid is primarily operated in grid-connected mode, with seamless switching to islanded mode operation during grid faults or power outages. This proposed MPC controller is designed to dynamically adjust for both operating modes. This framework optimizes low-cost grid power purchases when connected to the utility and optimally allocates distributed generations (DGs) and the BESS in islanded mode. Many scenarios are modeled and simulated to evaluate the robustness of the controller.
The methodology and conceptual model are presented in Section 2, followed by problem formulation and detailed modeling of DGs in Section 3. Section 4 provides an overview of the Karabuk University microgrid, while Section 5 discusses the simulation setup and analyzes the results. Finally, Section 6 summarizes the key findings of this study

2. Proposed Methods

An economically aware MPC strategy is designed and implemented for a real hybrid MG at the KBU Demir Çelik campus, Türkiye. MPC, known as Receding Horizon Control (RHC), is an advanced control strategy that optimizes control actions by solving a constrained optimization problem at each control step. The controller uses a predictive model of the system to forecast future behavior over a finite prediction horizon. At each interval, MPC computes a trajectory of future control actions aimed at minimizing a predefined cost function, while satisfying system constraints such as operating limits, energy consumption, and economic objectives. Only the first control action in the computed trajectory is applied, and the process is repeated at the next interval using updated system measurements. This feedback mechanism improves the robustness of the system against disturbances and model uncertainties.
MPC is well-suited for regulating highly sophisticated multi-input, multi-output systems like microgrids, where control decisions must simultaneously satisfy dynamic operating constraints and techno-economic objectives. In this context, the proposed strategy of the microgrid of KBU Demir Çelik campus involves four primary DGs, including PV panels, a BESS, a diesel generator, and the utility. The connected loads are classified into critical and non-critical, requiring smart prioritization to ensure reliable and efficient energy management.
As shown in Figure 1, the MPC controller continuously receives forecasted inputs such as load demand, PV generation, electricity market prices, and system constraints (i.e., battery SoC and generator output capacity). Figure 1 has been annotated to clearly indicate the measured/estimated signals and control outputs used in the simulations: (i) P S : solar panels power (kW), (ii) P g r i d : grid import/export power (kW), (iii) P G : diesel generator power (kW), (iv) P B : charge and discharge power (kW), (v) Cost: electricity market price (USD/kWh). These labeled signals are the ones plotted and discussed in the simulation results. Based on these inputs, the proposed strategy calculates the optimal power dispatch at each time step. The microgrid is capable of operating in both grid-connected and island modes, with automatic mode switching depending on grid availability and reliability conditions. This adaptive capacity ensures a reliable power supply and optimal energy utilization under varying operational scenarios.

3. Problem Formulation

This section formulates the real-time energy management problem of a hybrid microgrid as a constrained optimization problem designed using MPC. The primary objective is to minimize the total operating cost over a 24 h prediction horizon, while accounting for system dynamics, component limitations, and the critical loads. The total operational cost includes the following components:
  • The operational cost of the diesel generator.
  • The cost of financial benefits associated with power import/export through trading with the utility.
  • Penalty terms for deviations from desired operation, including
    Unserved power demand (load shedding);
    Deviation from the target battery SoC;
    Unused available solar energy.

3.1. PV Generation Model

The power output of the PV array is determined by solar irradiance and ambient temperature as follows [5,7]:
P S ( t ) = N P V   F F × V t × I t
F F = V M P P   ×   I M P P V O C × I S C
where N P V is the number of PV modules. F F is the fill factor. V t is the voltage and I t is the current adjusted based on irradiance and temperature. V M P P and I M P P are the voltage and current at the maximum power point. The open-circuit voltage is given by V O C and the short-circuit current is represented by I S C .
The temperature-adjusted voltage and current are
V t = V O C × 1 K v × T t 25 I t = I S C + K i × ( T t 25 )
where K v and K i are voltage and current temperature coefficients, respectively. T t is ambient temperature (°C).

3.2. Battery Energy Storage System Model

Battery net power is defined as [5,7]
P B ( t ) = P D i s ( t ) P C h ( t )
where the charging power is denoted by P C h ( t ) , and P D i s ( t ) is the discharging power.
The battery’s state of charge evolves as
E B t + 1 = E B t + η C h t × P C h t × Δ t 1 η D i s P D i s t × Δ t
with the following constraints:
E B , m i n E B ( t ) E B , m a x
0 P C h t P C h , m a x
0 P D i s ( t ) P D i s , m a x
To prevent simultaneous charging and discharging, binary variables are employed:
I C h ( t ) + I D i s ( t ) 1
where I C h t I D i s t 0 , 1 indicate the charging/discharging status.

3.3. Grid Power Model

The microgrid operates in a grid-connected mode and is capable of both importing and exporting power, subject to the following constraint [5,7]:
P g r i d , m i n P g r i d ( t ) P g r i d , m a x
The electricity price from the utility is both scenario-dependent and time-variant, and is defined as follows:
C g r i d ( t ) = U S D 0.15 k W h ,   in   normal   scenarious   1.5   × USD 0.15 ,     in   surge   scenarios
The network cost resulting from power exchange with the utility is expressed as
G r i d Cos t t = C g r i d b u y t × P g r i d i n ( t ) C g r i d s e l l t × P g r i d o u t ( t )

3.4. Diesel Generator Model

The diesel generator is modeled to supply active power P G ( t ) , concentrated by its operational generation limits, expressed as [5,7]
0 P G ( t ) P G , m a x
The operational cost is expressed as a linear function:
C f u e l t = a + b × P G t + c × P G t 2
where a is the startup cost, b is the fuel cost per kWh, and c captures the nonlinear increase in fuel consumption at low or partial loads. Alternatively, fuel consumption can be represented by using a partial load efficiency curve, mapping P G t P G , m a x to fuel consumption rate, providing a more realistic representation of generator performance.

3.5. Objective Function

The MPC controller minimizes the following cost function over the prediction horizon T p :
min t = 0 T p [ C f u e l t × P G ( t ) + C g r i d ( t ) + 1 2 x ( t ) T Q x ( t ) ]
x ( t ) is the state deviation vector. Q is a positive semi-definite weighting matrix.
The state deviation vector x ( t ) is defined as
x ( t ) = P C L ( t ) D C L ( t ) P N L ( t ) D N L ( t ) E B ( t + 1 ) E B t a r g e t ( t + 1 ) P S ( t ) P S , m a x
where P C L t is power supplied to critical loads and P N L ( t ) is power supplied to non-critical loads, while D C L ( t ) represents the demand of critical loads and D N L ( t ) is used for the demand of non-critical loads. E B ( t + 1 ) is the battery SoC at the next time step, and the desired battery SoC at the next time step is presented by E B t a r g e t ( t + 1 ) . P S , m a x is the maximum possible value of PV panels.
The optimization is subject to the following constraints for all t [ 0 , T p ] .
The total power generated within the microgrid, combined with the power imported from the utility, must satisfy the total load demand, including both critical and non-critical loads. This constraint is expressed as
P G ( t ) + P B ( t ) + P g r i d ( t ) + P S ( t ) = P C L ( t ) + P N L ( t )
Both critical and non-critical loads have to receive power allocations no less than their respective demand levels, with priority given to critical loads. This can be formulated as
P N L t P C L t D N L ( t ) D C L ( t )

3.6. Implementation Strategy

The control process follows a standard MPC:
  • Solve the optimal problem for the 24 h prediction horizon ( T p = 24   h );
  • Implement only the first control action corresponding to the immediate 1 h control horizon ( T c = 1   h );
  • Update system states based on real-time measurements and repeat the procedure at the next step.
This rolling optimization framework enables adaptive real-time control by continuously incorporating updated system conditions and forecast data.
Table 2 summarizes the major MPC parameters and tuning rationale, including the prediction and control time horizons, operating constraints, and weighting factors used to enable realistic, reliable, and efficient hybrid microgrid operation.
The selected prediction and control horizons, together with the computational efficiency of MPC, ensure that the controller is real-time capable for implementation on actual microgrid hardware.

4. Overview of the System: KBU Demir Çelik Campus Microgrid

4.1. System Architecture and Components

The Karabük University Demir Çelik campus’s electricity distribution network is supplied by the medium-voltage (MV) network of BEDAŞ Electricity Distribution Corporation. The MV line enters the university, passes through busbars in the MV distribution building, and is then transmitted to the campus’s MV distribution lines before connecting to its low-voltage network. The single-line diagram of the KBU Demir Çelik campus is illustrated in Figure 2.
It is noteworthy that the ‘75 MVA utility grid’ refers to the rating of the entire campus substation transformer (154/34.5 kV), rather than the contracted demand of the engineering faculty microgrid. The hybrid microgrid analyzed in this study represents only a subset (≤1 MW) of the overall campus network.
Nowadays, PV panels are installed in six of the eight main buildings of the KBU Demir Çelik campus. The buildings with installed solar panels and their corresponding power capacities are listed in Table 3 [23,24].
The engineering faculty building of KBU Demir Çelik campus is chosen as a case study for the hybrid MG. This MG is a hybrid power system that integrates multiple DGs. The parameters of the hybrid KBU MG system are presented in Table 4. The structure of the KBU engineering faculty’s MG in grid-connected mode is shown in Figure 3 [23].
The MG configuration supports the supply of both critical and non-critical loads across the university campus. This configuration architecture is designed to operate independently during grid blackouts, enhancing the resilience and reliability of the local power supply.

4.2. Operational Challenges

While the integration of PV panels contributes to improved reliability and lower operating costs, high penetration levels can introduce several operational issues, including voltage rise, reverse power flows, and harmonic distortion. To reduce these challenges, the PV penetration is limited to 75% of the peak load, ensuring system stability and protection.
Under these constraints, advanced control strategies are essential for maintaining a dynamic power balance between power generation, energy storage, and load demand. MPC enables coordinated operation of system components while respecting technical and operational limits.

5. Simulation and Results

To analyze the robustness and flexibility of the proposed MPC-based energy management system, ten practical operation scenarios are defined. Figure 4, Figure 5, Figure 6, Figure 7, Figure 8, Figure 9, Figure 10, Figure 11, Figure 12, Figure 13, Figure 14, Figure 15, Figure 16, Figure 17, Figure 18, Figure 19, Figure 20 and Figure 21 follow a consistent plotting convention: Pgrid (kW), PPV (kW), Pdiesel (kW), PBESS (kW), and Cost (USD/kWh) are shown on the left axis. The scenarios represent various disturbances and contingencies that could occur in real-world environments for a hybrid microgrid. In the following, each scenario is described.
The scenarios were selected based on actual historical events in the KBU campus grid (such as winter grid outages, PV output reductions during cloudy days, and diesel generator malfunctions), combined with anticipated market-based disturbances (dynamic price fluctuations). Although some combined events (like diesel generator failure with simultaneous price fluctuations) represent worst-case conditions, they were included to test the controller’s resilience against low-probability high-impact disturbances. The PV generation and load profiles were obtained from real records of the Karabuk University engineering faculty microgrid with a 30 min sampling resolution, and the dynamic electricity price series was obtained from the Turkish day-ahead market data.

5.1. Scenario 1 (Baseline)

In this scenario, all system components operate as expected without any faults or anomalies, providing a baseline reference for performance comparison.
Figure 4 illustrates the behavior of the system under these normal operating conditions. The electricity price dynamically varies between USD 0.2 and USD 0.4 per/kWh, reflecting a typical market-based price range. The MPC framework responds by adjusting grid power usage, accordingly, initially drawing nearly 800 kW from the grid, and then gradually reducing consumption to almost 600 kW after time step 50 as DGs and the BESSs become more active. The BESSs (Battery 1 and Battery 2) have a synchronized role, with repeated charge–discharge operations of around −20 kW to +20 kW. This reflects the strategy of MPC to optimize load support and energy costs during the period of high grid prices. The diesel generator operates steadily at approximately 60 kW throughout the duration, indicating its role as a base load or necessary load support unit. PV panels generate about 40 kW of power, but their output reduces significantly after time step 50, reflecting natural irradiance fluctuations from the real-world data profile. Despite this reduction, MPC maintains overall system balance through adaptive BESS management and grid power dispatching. This scenario shows the effectiveness of the controller in maintaining techno-economic efficiency and operating stability when all subsystems function normally.
Figure 4. MPC-based energy management in baseline scenario (Scenario 1), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Figure 4. MPC-based energy management in baseline scenario (Scenario 1), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Processes 13 02883 g004

5.2. Scenario 2 (Load Increased to 150%)

As seen in Figure 5, the diesel generator remains consistently at zero kW, confirming the system’s strategic choice to bypass this expensive resource despite a significantly huge load demand. Instead, the system utilizes a synergistic approach by utilizing the available PV panels during daylight hours (intervals 0–50), which provides substantial generation before decreasing to nearly zero. Meanwhile, the BESS illustrates that the batteries charge and discharge in cycles, saving excess PV or low grid power and exporting it during high-cost periods or in the absence of PV panels. Finally, the utility acts as the primary support, supplying the power balance needed for the increased 150% load, with the system intelligently optimizing grid interactions according to the dynamic electricity price to minimize overall operating costs.
Figure 5. MPC-based energy management in load increased to 150% (Scenario 2), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Figure 5. MPC-based energy management in load increased to 150% (Scenario 2), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Processes 13 02883 g005

5.3. Scenario 3 (Increased Price of Grid Power, Cost Increased to 150%)

For this scenario, where the cost of the electricity grid increased by 150%, the microgrid operates optimally by not using the diesel generator at all due to its high operating cost. As seen in Figure 6, the PV panels operate at nearly 40 kW during the early time intervals, playing a significant role in meeting the load demand. Nevertheless, after an interval of 50, PV output drops sharply due to sunset and cloudy weather conditions, remarkably decreasing its contribution to the system. Then, the BESS actively manages the load by performing charge and discharge operations. During periods of low grid prices and high PV generation, the batteries are charged; during peak electricity price hours, they are discharged to minimize grid dependency. This behavior is reflected in the oscillating BESS power curve and the clear jumps towards the end, indicating a final charging cycle. Although grid power is initially high (~900 kW), it drops sharply after PV output decreases, suggesting that the system makes up for the loss by drawing more from the batteries rather than increasing grid usage. Therefore, the microgrid takes advantage of coordinated operation of the PV panel, BESS, and utility to ensure power supply at a lower cost, while purposely excluding the diesel generator because of its economic inefficiency under the high-price scenario.
Figure 6. MPC-based energy management in load increased to 150% (Scenario 3), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Figure 6. MPC-based energy management in load increased to 150% (Scenario 3), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Processes 13 02883 g006

5.4. Scenario 4 (Diesel Generator Fails, Battery and Solar Compensate)

In Figure 7, the diesel generator completely fails, and the MPC controller has to redistribute energy supply only among PV panels, the utility, and BESS units. The electricity price profile shows cyclic variations, and the controller responds by shifting grid imports to the cheaper periods of the day. The PV plant operates at full capacity (~40 kW) during the early stages but drops dramatically past the midpoint of the simulation, due to declining solar irradiance. This drop heavily impacts the energy balance, leading to increased reliance on grid imports and BESSs. The BESS units exhibit cyclical charge–discharge behavior, serving as a principal stabilizing component, especially after the drop in PV output. In the absence of the diesel generator, the main grid becomes the dominant supply source, with its usage carefully regulated in alignment with price fluctuations. This scenario illustrates how the proposed strategy effectively maintains operational resilience and minimizes costs during periods of extreme generation stress by using flexible energy resources and time-based pricing.
Figure 7. MPC-based energy management in diesel generator failure (Scenario 4), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Figure 7. MPC-based energy management in diesel generator failure (Scenario 4), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Processes 13 02883 g007

5.5. Scenario 5 (Diesel Generator Failure)

Figure 8 depicts the flexibility and resilience of the energy management system under two constraints: the complete unavailability of the diesel generator and a 50% increase in the price of electricity from the grid. The diesel generator remaining at zero kW confirms its failure, with the system relying only on PV panels, batteries, and the utility. In response to the higher grid prices, the BESS plot illustrates high charge and discharge cycles, reflecting the batteries’ major role in cost-saving operation, charging when PV power is available or when grid prices are relatively low and discharging to meet demand, especially during non-PV hours (after interval 50), to reduce dependence on the now considerably more expensive grid. This smart BESS usage directly influences the grid curve, which indicates a sharp decline in grid power consumption after PV generation stops, proving the system’s intelligence in reducing costs by maximizing local resource utilization as external prices rise.
Figure 8. System performance under diesel generator failure and 50% higher grid prices (Scenario 5), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Figure 8. System performance under diesel generator failure and 50% higher grid prices (Scenario 5), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Processes 13 02883 g008
Figure 9 depicts the adaptive response of the energy management system to a dramatic 75% increase in grid electricity prices, compounded by the complete failure of the diesel generator. The diesel generator chart, consistently showing zero kW, confirms its unavailability, leaving the system to rely solely on PV panels, batteries, and the more expensive utility grid. With the electricity price profile reflecting these high costs, the system actively takes advantage of the free power provided by the PV panels during sunny periods. Notably, the most important plot is the BESS curve, which shows intensive and symmetrical charging and discharging activity throughout both day and night, highlighting the central role of batteries in maintaining supply-demand balance. This high BESS discharge becomes particularly important during periods when PV panels are unavailable (after-interval 50), as the batteries release significant power to minimize reliance on the grid, which is now 75% more costly. This strategic energy release is further confirmed in the grid graph, which shows a notable initial inrush upon startup but then significantly reduces grid usage once the PV supply drops. This behavior highlights the system’s intelligent and cost-conscious response to curtail expensive grid imports under these challenging operating and budgetary conditions.
Figure 9. Energy management with diesel generator failure and 75% grid cost increase (Scenario 5), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Figure 9. Energy management with diesel generator failure and 75% grid cost increase (Scenario 5), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Processes 13 02883 g009
Figure 10 illustrates the energy management system’s response to a record 100% increase in grid electricity price, combined with the ongoing failure of the diesel generator. Since significantly higher prices are shown in the electricity price curve, the control strategy prioritizes the maximum self-sufficiency and minimizes reliance on the grid. The diesel generator remaining at zero kW confirms its absence, placing the entire burden of supplementary power supply on the PV panels, which are used to their maximum availability, and the BESS. The BESS demonstrates highly active charge and discharge behavior, acting as a vital buffer by storing excess solar energy and supplying power during peak demand or when grid electricity is expensive, particularly during times when the PV panels are unavailable. This strategic BESS utilization is clearly reflected in the grid power curve, which provides only a minimal amount of power while drastically reducing consumption after the drop in PV output, highlighting the system’s effort to limit expensive grid imports and maintain economic viability under very challenging conditions.
Figure 10. Energy management under diesel generator failure and 100% grid cost increase (Scenario 5), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Figure 10. Energy management under diesel generator failure and 100% grid cost increase (Scenario 5), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Processes 13 02883 g010
Figure 11 represents the most critical operating scenario, characterized by a record 125% increase in grid electricity price and the continued unavailability of the diesel generator. With the electricity price profile peaking near USD 0.5/kWh, the energy management system operates under extreme pressure to minimize reliance on the grid. The diesel generator remaining at zero kW indicates its technical unavailability, compelling the system to maximize the output from the PV panels during daytime by using this free energy directly and for intensive battery charging. Most significantly, the BESS plot displays highly dynamic and full-capacity charging and discharging cycles during the day and night, respectively, showing the batteries’ key role as the primary flexible resource in reducing the impact of high grid prices. This careful battery utilization directly leads to the strategic control of grid power, which supplies a high percentage of the overall load, but clearly declines when PV panels are not available, reflecting the system’s requirement to reduce purchases from the extremely costly utility. This scenario shows the system operating at the boundaries of efficiency, illustrating how renewable energy and storage systems, when combined, are pushed to their limits to maintain stability and minimize costs under extreme external constraints.
Figure 11. Energy management under diesel generator failure and 125% grid cost increase (Scenario 5), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Figure 11. Energy management under diesel generator failure and 125% grid cost increase (Scenario 5), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Processes 13 02883 g011
Figure 12 displays the most stressed operation condition for the energy management system, characterized by complete failure of the diesel generator and a record 150% increase in grid electricity prices. With the electricity price profile reaching near USD 0.6/kWh, the economic incentive to minimize grid dependence is at its greatest. The diesel generator remaining at zero kW determines its technical unavailability, forcing the system to rely heavily on PV panels during daylight hours, which are used to their maximum capacity for direct consumption and battery charging. The BESS plot is the most illustrative, presenting the batteries operating at their maximum capacity, with consistent, high-amplitude charging and discharging cycles throughout the entire period. This peak BESS utilization becomes important when the PV panels are not available because it serves as the primary means of meeting the supply-demand gap and significantly reducing reliance on the now economically unfeasible grid. Thus, the grid power curve indicates a steady decline in power drawn during nighttime hours, demonstrating the system’s focused approach to limit costly grid imports and maintain balance through the optimal use of all the available local sources under these highly constrained and economically challenging conditions.
Figure 12. Energy management under diesel generator failure and 150% grid cost increase (Scenario 5), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Figure 12. Energy management under diesel generator failure and 150% grid cost increase (Scenario 5), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Processes 13 02883 g012

5.6. Scenario 6 (Load Increase from 50% to 150% Beyond Grid Limits from 50% to 150%)

Figure 13 illustrates the operational response of a microgrid when the active power load increases to 50% of its nominal. Despite the rapid load increase, the system effectively manages the demand through the combined operation of its DGs. The variable electricity price plays a central role in determining the optimal dispatching strategy. Under high solar irradiance conditions, the PV panels contribute actively, and the BESS charges by storing the excess power from the PV panels. When solar generation declines, the BESS supplies power to the load, reducing reliance on the grid. Notably, the diesel generator is not operating during this period. This validates the system’s excellent ability to manage the 50% load increase through a coordinated strategy involving grid supply, photovoltaic, and smart battery dispatch. The system often relies on the main grid; even with help from DGs, the 50% load still puts pressure on the main grid. This high-performance operation at 50% load serves as a benchmark for evaluating system behavior as the load continues to increase towards, and potentially beyond, the grid capacity limits outlined.
Figure 13. Optimal power dispatch at 50% active power load (Scenario 6), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Figure 13. Optimal power dispatch at 50% active power load (Scenario 6), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Processes 13 02883 g013
Figure 14 illustrates the microgrid’s operational response when the active power load increases to 75% of the nominal or maximum capacity. This represents an increased load compared to the previously tested 50% case. The system continues to effectively utilize dynamic electricity price signals to optimize its performance. The PV arrays maintain consistent daytime generation, contributing a stable amount of renewable energy. The BESS charges dynamically when there is high PV generation or low electricity prices and discharges to meet demand or benefit from higher prices, demonstrating its ongoing role in energy cost saving and load balancing. In this case, the complete absence of diesel generator usage validates the system’s potential to operate without relying on fossil fuels, even under higher load conditions. But the most significant change is the sharp increase in the optimal grid power utilization. The system draws considerably more power from the grid, both during peak PV generation hours (approximately 650–670 kW) and low PV periods (approximately 500–550 kW), than in the 50% load case. This figure shows that as the load increases to 75%, the main way the system meets the additional demand is by importing more power from the main grid, even though PV and batteries still contribute. This issue indicates the role of the grid as the primary supplier when DGs are not sufficient to meet the total demand on their own.
Figure 14. Optimal power dispatch at 75% active power load (Scenario 6), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Figure 14. Optimal power dispatch at 75% active power load (Scenario 6), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Processes 13 02883 g014
Figure 15 indicates the performance of the microgrid as the active power load reaches 100% of its nominal or peak capacity in Scenario 6. Even under such high demand, the dynamic electricity price profile continues to guide optimal dispatch decisions. The PV panels operate at their full maximum available power output during daylight hours, while the BESS actively charges and discharges to smooth out demand fluctuations and potentially reduce energy expenditure. A notable result observed across all load levels (50%, 75%, and 100%) is the complete absence of diesel generator operation. This issue clearly shows that the system, including integrated PV panels, BESSs, and main grid connectivity, is stable enough to operate without relying on fossil fuels, even under 100% load conditions. The system draws over 900 kW from the main grid during peak PV generation hours and more than 700 kW when PV generation is low. While PV panels and BESSs play a critical role in optimization and provide valuable flexibility, the primary way of meeting the 100% load demand is by importing sub-stational power from the external grid. Basically, the main grid acts as the central backbone that absorbs most of the excess demand and ensures reliable system operation.
Figure 15. Optimal power dispatch at 100% active power load (Scenario 6), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Figure 15. Optimal power dispatch at 100% active power load (Scenario 6), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Processes 13 02883 g015
Figure 16 shows the significance of monitoring microgrid performance as active power consumption increases to 125%. At this significantly higher load demand, the system operates within the dynamic electricity price framework, which continues to dictate its optimal dispatch policy. The steady power output from the PV panels throughout the day, combined with continuous charging and discharging of the BESS, highlights their essential role in energy supply and optimization. The diesel generator does not operate at all during the entire 100-time steps. This issue shows that even when the load demand exceeds 100% and reaches 125%, the system can effectively avoid using fossil fuels, providing its strong capacity to meet demand with alternative energy sources. In order to balance this significant increase in load demand, the system shows significantly greater reliance on the utility. Main grid peaks near 1200 kW during high PV generation periods and remains comfortably above 850 kW when the PV output is low. This figure indicates that although renewable generation and BESS are well managed by MPC, the system depends heavily on a significantly larger supply from the utility to meet the 125% load demand.
Figure 16. Optimal power dispatch at 125% active power load (Scenario 6), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Figure 16. Optimal power dispatch at 125% active power load (Scenario 6), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Processes 13 02883 g016
Figure 17 depicts the dynamics of the microgrid at the maximum active power consumption considered, 150% of its nominal rating. The PV panels keep a steady supply of renewable energy during daylight hours, and the BESS regularly charges and discharges, providing flexibility, helping to balance demand, and reducing costs. The diesel generator does not operate at all during the entire 100-time steps. This issue provides strong evidence of the system’s exponential robustness and ability to completely eliminate fossil fuel reliance, even under maximum load, through efficient integration of renewable energy sources and storage. However, at 150% load demand, the system demonstrates unprecedented and overwhelming dependence on the utility. The main grid reaches peak levels of nearly 1400 kW during periods of high PV array availability and remains above 1000 kW when PV generation is low. Although the microgrid components contribute effectively, the main grid remains the vital source of generation to keep system stability under such high load demand.
Figure 17. Optimal power dispatch at 150% active power load (Scenario 6), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Figure 17. Optimal power dispatch at 150% active power load (Scenario 6), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Processes 13 02883 g017

5.7. Scenario 7 (Sudden Increase in Grid Price)

Figure 18 effectively illustrates a comprehensive energy management strategy designed to optimize power flow in response to variable electricity prices and fluctuating renewable energy generation. The system maximizes the utilization of PV panels throughout the day, supplements it with the main grid, and strategically dispatches the diesel generator during periods of peak demand and low solar irradiance. The BESS operates optimally by charging when electricity prices are low and discharging when electricity prices are high, effectively using price differences to reduce overall operational cost. The coordinated behavior among PV generation, diesel generation, the BESS, and main grid interaction demonstrates an efficient approach to maintaining power supply continuity, reducing dependence on the main grid during high-price hours, and increasing self-consumption of DGs.
Figure 18. Optimal power dispatch in sudden increase in grid price (Scenario 7), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Figure 18. Optimal power dispatch in sudden increase in grid price (Scenario 7), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Processes 13 02883 g018

5.8. Scenario 8 (Grid Failure)

Figure 19 clearly illustrates the islanded microgrid during a grid failure, where the DGs have to independently supply the power demand. The complete absence of electricity grid costs and grid power transfer indicate that the main grid is unavailable. In this scenario, the diesel generator serves as the primary and steady power source, replacing the fluctuating solar PV output. The diesel generator increased output after interval 50, when the power of PV panels is low, underscoring its vital contribution in maintaining system stability. Although before interval 50, the batteries dramatically discharge to keep the stability of the system, after interval 50, the BESS plays a crucial role in maintaining the system since the PV panels are no longer available. This condition highlights the importance of resilient DGs and sufficient BESS capacity to maintain energy resilience during main grid outages.
Figure 19. System operation during grid failure (Scenario 8), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Figure 19. System operation during grid failure (Scenario 8), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Processes 13 02883 g019

5.9. Scenario 9 (Battery Failure)

Figure 20 clearly shows the operational impact of a battery failure in an energy system with dynamic electricity pricing. The flat zero line in the BESS plot provides definitive evidence of the battery system’s failure, eliminating its ability to buy electricity at low prices, use it during high-price periods, and help balance the load. This failure directly impacts the main grid power, which indicates more and larger unstable power exchanges with the main grid, as the system can no longer store excess electricity during low-price periods and reduce load during peak demand. The increased and more frequent use of the diesel generator highlights a higher reliance on dispatchable generation sources to compensate for the loss of battery support. As a result, the system faces higher operational costs and reduced efficiency in managing fluctuating electricity prices and PV generation.
Figure 20. System operation during battery energy storage system failure (Scenario 9), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Figure 20. System operation during battery energy storage system failure (Scenario 9), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Processes 13 02883 g020

5.10. Scenario 10 (PV Generation Drop)

Figure 21 clearly shows how the energy management system adjusts its operation during a PV generation drop, representing a complete loss of solar power. The system loses its major source of renewable energy and has to rely more than ever on the utility and the dispatchable diesel generator to meet the demand. The higher activity of the diesel generator underscores its critical role in responding to the lost PV generation. In spite of the absence of solar power, the BESS remains very active, continuing its charge and discharge cycles. This figure indicates that even without PV, the batteries remain crucial for optimizing energy costs by taking advantage of price differences, charging during off-peak periods, and discharging during peak price hours. Ultimately, the absence of PV generation leads to greater dependence on the main grid and potentially higher operating costs, even with strategic use of diesel generation and the BESS.
Figure 21. System operation during PV generation failure (Scenario 10), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Figure 21. System operation during PV generation failure (Scenario 10), including electricity price, PV panel output, diesel generator power, BESS charging/discharging, and grid power.
Processes 13 02883 g021
To provide a clear and concise comparison of the performance of the system under various stress conditions, Table 5 summarizes the key quantitative results, including reductions in grid dependency, operational costs, and the percentage of unserved critical loads. These metrics are referenced against the baseline case (Scenario 1) and reflect the effectiveness and robustness of the proposed MPC-based energy management approach.
To more effectively illustrate the relative performance, Figure 22 summarizes the cost reduction, grid dependency reduction, and unserved load across all ten scenarios. These bar charts highlight a clear visualization of the novelty of this research.
To provide a clear and quantitative comparison, the performance of the proposed real-time capable MPC is compared using the same performance metrics, such as reduction in operational cost, reduction in grid dependency, and unserved critical load, against representative stochastic optimization, distributed MPC, and AI-based controllers implemented under similar conditions, as shown in Table 6. This direct comparison highlights the competitive or superior performance of the proposed method across various realistic scenarios. According to Table 6, in [25], operational costs were reduced by 25–35% and grid dependence was reduced by 30–55% using a stochastic MPC approach. Similarly, research [26] applied a distributed MPC approach for frequency regulation, achieving cost reduction of 20–40% and grid dependency reductions of 35–60%. Furthermore, [27] demonstrated cost savings of 30–38% and grid dependency savings of 32–58% using deep reinforcement learning. In comparison, the proposed method gains a 43% cost reduction, 40–70% reduction in grid dependency, and less than 5% unserved critical load, highlighting better performance in a medium-scale hybrid microgrid.

6. Conclusions

This study proposed and validated a real-time, cost-aware MPC framework for optimal energy management in both a grid-connected and islanded hybrid microgrids. The system is implemented at the Karabuk University campus, emphasizing real-world feasibility and resilience beyond simulation-based studies. In order to comprehensively assess the controller’s effectiveness, ten operation scenarios are simulated. These scenarios represented real-world disturbances such as dynamic electricity prices, diesel generator failure, battery faults, PV outages, sudden load increases, and complete grid disconnection. The results demonstrated the improved performance of the MPC strategy compared to baseline rule-based control methods.
The key findings of this study are as follows:
Up to 43% reduction in operational cost compared to baseline control strategies.
Less than 5% critical load is unsupplied in all scenarios, maintaining high system reliability.
Grid dependency reduced by 40–70% during periods of high electricity prices.
The system-maintained stability and feasibility even under combined stress conditions.
The MPC controller dynamically adjusted to uncertainty and changing operational constraints while optimizing cost and reliability metrics. Its ability to switch flexibly between grid-connected and islanded modes ensured smooth operation during power outages, while the BESS played a critical role in mitigating the variability of renewable generation and electricity price peaks.
These findings highlight the practical scalability and robustness of the proposed framework to real-world smart microgrids. They suggest that an MPC-based energy management system can significantly reduce operating costs and environmental impact without compromising on power quality and reliability. Unlike previous MPC studies, which largely remain limited to single disturbance validating or short-term case studies, the proposed strategy demonstrates robustness across ten simultaneous real-world stress scenarios, addressing the overlooked areas in prior work.
Furthermore, by reducing reliance on fossil-fuel-based generation and enhancing energy efficiency, the proposed approach contributes to environmental sustainability and supports global efforts toward net-zero emissions. Moreover, the results from the Karabuk University campus microgrid can inform regional and national energy policies by demonstrating the techno-economic benefits of predictive control and its potential applicability to university- and community-scale energy systems. This issue ensures continuity of power supply for critical facilities such as hospitals, laboratories, and education centers, highlighting the social reliability benefits of the proposed approach.

7. Future Work

Building on the success of this framework, future research directions include
  • Integration of electric vehicle (EV) charging infrastructure into the MPC framework to enable vehicle-to-grid (V2G) interaction, including investigations of real-world EV charging profiles, peak/off-peak usage, and controlled charging/discharging strategies.
  • Development of stochastic MPC with renewable forecasting to improve performance under uncertainty, using scenario-based simulations that consider multiple renewable energy sources integration and load variations.
  • Enhancement of cyber-physical security to ensure resilience against data tampering and communication-based attacks, including testing against defined attack scenarios such as false data injection, denial-of-service, and delayed measurements.
  • Hardware-in-the-loop (HIL) implementation for controller performance testing in near real-time, using physical prototypes and realistic operational conditions to validate system responses.
  • Investigating lifecycle costs, long-term battery degradation, and carbon emission reductions to provide a better economic evaluation.
However, limitations remain, such as reliance on simulated validation, the need for extended real-world datasets, and the absence of comprehensive cybersecurity testing beyond theoretical analysis.

Author Contributions

A.A., software, data curation, and writing—original draft; Z.Y., supervision, methodology, and writing—reviewing and editing. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The datasets generated and analyzed during the current study are available from the corresponding author upon reasonable request.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Maghami, M.R.; Pasupuleti, J.; Ekanayake, J. Energy storage and demand response as hybrid mitigation technique for photovoltaic grid connection: Challenges and future trends. J. Energy Storage 2024, 88, 111680. [Google Scholar] [CrossRef]
  2. Sasidhar, P.R.S.; Gebremedhin, A.; Norheim, I. Multi-energy microgrid design and the role of coupling components—A review. Renew. Sustain. Energy Rev. 2025, 216, 115540. [Google Scholar] [CrossRef]
  3. Firoozi, A.A.; Firoozi, A.A.; Maghami, M.R. Harnessing photovoltaic innovation: Advancements, challenges, and strategic pathways for sustainable global development. Energy Convers. Manag. X 2025, 27, 101058. [Google Scholar] [CrossRef]
  4. Maghami, M.R. The Role of Solar Energy in Mitigating the Impact of EV Charging Modes on Distribution Networks. Results Eng. 2025, 27, 106009. [Google Scholar] [CrossRef]
  5. Yaghoubi, E.; Yaghoubi, E.; Yusupov, Z.; Maghami, M.R. A Real-Time and Online Dynamic Reconfiguration against Cyber-Attacks to Enhance Security and Cost-Efficiency in Smart Power Microgrids Using Deep Learning. Technologies 2024, 12, 197. [Google Scholar] [CrossRef]
  6. Wazirali, R.; Yaghoubi, E.; Abujazar, M.S.S.; Ahmad, R.; Vakili, A.H. State-of-the-art review on energy and load forecasting in microgrids using artificial neural networks, machine learning, and deep learning techniques. Electr. Power Syst. Res. 2023, 225, 109792. [Google Scholar] [CrossRef]
  7. Yaghoubi, E.; Yaghoubi, E.; Yusupov, Z.; Rahebi, J. Real-time techno-economical operation of preserving microgrids via optimal NLMPC considering uncertainties. Eng. Sci. Technol. Int. J. 2024, 57, 101823. [Google Scholar] [CrossRef]
  8. Nguyen, T.-T.; Yoo, H.-J.; Kim, H.-M. Application of model predictive control to BESS for microgrid control. Energies 2015, 8, 8798–8813. [Google Scholar] [CrossRef]
  9. Babqi, A.J.; Yi, Z.; Etemadi, A.H. Centralized finite control set model predictive control for multiple distributed generator small-scale microgrids. In Proceedings of the 2017 North American Power Symposium (NAPS), Morgantown, WV, USA, 17–19 September 2017; pp. 1–5. [Google Scholar] [CrossRef]
  10. Garayalde, E.; Aizpuru, I.; Iraola, U.; Sanz, I.; Bernal, C.; Oyarbide, E. Finite control set MPC vs continuous control set MPC performance comparison for synchronous buck converter control in energy storage application. In Proceedings of the 2019 International Conference on Clean Electrical Power (ICCEP), Otranto, Italy, 2–4 July 2019; pp. 490–495. [Google Scholar] [CrossRef]
  11. Dragičević, T. Model predictive control of power converters for robust and fast operation of AC microgrids. IEEE Trans. Power Electron. 2017, 33, 6304–6317. [Google Scholar] [CrossRef]
  12. Koushki, M.M.; Ayoubi, E.; Miveh, M.R.; Ghadimi, A.A. A model predictive control for a four-leg inverter in a stand-alone microgrid under unbalanced condition. In Proceedings of the 2021 12th Power Electronics, Drive Systems, and Technologies Conference (PEDSTC), Tabriz, Iran, 2–4 February 2021; pp. 1–5. [Google Scholar] [CrossRef]
  13. Barrios, L.A.; Valerino, J.B.; del Nozal, A.R.; Escano, J.M.; Martinez-Ramos, J.L.; Gonzalez-Longatt, F. Stochastic unit commitment in microgrids based on model predictive control. In Proceedings of the 2018 International Conference on Smart Energy Systems and Technologies (SEST), Seville, Spain, 10–12 September 2018; pp. 1–5. [Google Scholar] [CrossRef]
  14. Pandey, M.; Winkler, D.; Sharma, R.; Lie, B. Using MPC to balance intermittent wind and solar power with hydro power in microgrids. Energies 2021, 14, 874. [Google Scholar] [CrossRef]
  15. Mehmood, F.; Khan, B.; Ali, S.M.; Rossiter, J.A. Distributed MPC for economic dispatch and intermittence control of renewable based autonomous microgrid. Electr. Power Syst. Res. 2021, 195, 107131. [Google Scholar] [CrossRef]
  16. Karami, Z.; Shafiee, Q.; Khayat, Y.; Yaribeygi, M.; Dragičević, T.; Bevrani, H. Decentralized model predictive control of DC microgrids with constant power load. IEEE J. Emerg. Sel. Top. Power Electron. 2019, 9, 451–460. [Google Scholar] [CrossRef]
  17. Alarcón, M.A.; Alarcón, R.G.; González, A.H.; Ferramosca, A. Economic model predictive control for energy management of a microgrid connected to the main electrical grid. J. Process Control 2022, 117, 40–51. [Google Scholar] [CrossRef]
  18. Joshal, K.S.; Gupta, N. Microgrids with model predictive control: A critical review. Energies 2023, 16, 4851. [Google Scholar] [CrossRef]
  19. Hasani, A.; Heydari, H.; Golsorkhi, M.S. Enhancing microgrid performance with AI-based predictive control: Establishing an intelligent distributed control system. IET Gener. Transm. Distrib. 2024, 18, 2499–2508. [Google Scholar] [CrossRef]
  20. Jacob, E.; Farzaneh, H. Decentralized model predictive control of hybrid renewable microgrids for maximizing the power extraction and enhancing system operation, using a novel enumeration based-weighting factor determination method. Results Eng. 2025, 26, 105477. [Google Scholar] [CrossRef]
  21. Thaler, B.; Posch, S.; Wimmer, A.; Pirker, G. Hybrid model predictive control of renewable microgrids and seasonal hydrogen storage. Int. J. Hydrogen Energy 2023, 48, 38125–38142. [Google Scholar] [CrossRef]
  22. Halivor, J.X. Model predictive control–based robust-control strategy of distribution control for a grid-connected AC microgrid. Front. Smart Grids 2023, 2, 1188074. [Google Scholar] [CrossRef]
  23. Yusupov, Z.; Almagrahı, N. Techno-economic and environmental analysis of microgrid: A case study of Karabuk University. Sigma J. Eng. Nat. Sci. 2023, 41, 758–769. [Google Scholar] [CrossRef]
  24. Altınkaya, H. Elektrikli Araç Şarj İstasyonlarının Elektrik Şebekesine Entegrasyonu: OYF, LHÖ ve YSA ile Karabük Üniversitesi Yerleşkesi Durum Çalışması. Fırat Üniversitesi Mühendislik Bilim. Derg. 2025, 37, 15–36. [Google Scholar] [CrossRef]
  25. Parisio, A.; Rikos, E.; Glielmo, L. Stochastic model predictive control for economic/environmental operation management of microgrids: An experimental case study. J. Process Control 2016, 43, 24–37. [Google Scholar] [CrossRef]
  26. Naderi, Y.; Hosseini, S.H.; Savaghebi, M.; Dahidah, M.; Guerrero, J.M. Multi-objective model predictive control for microgrid applications. Int. J. Electr. Power Energy Syst. 2023, 154, 109441. [Google Scholar] [CrossRef]
  27. Kumar, K.; Kwon, S.; Bae, S. Deep reinforcement learning-based control strategy for integration of a hybrid energy storage system in microgrids. J. Energy Storage 2025, 108, 114936. [Google Scholar] [CrossRef]
Figure 1. Conceptual model of MPC-based framework for hybrid microgrid.
Figure 1. Conceptual model of MPC-based framework for hybrid microgrid.
Processes 13 02883 g001
Figure 2. Single line diagram of KBU Demir Çelik campus.
Figure 2. Single line diagram of KBU Demir Çelik campus.
Processes 13 02883 g002
Figure 3. Structure of KBU engineering faculty’s MG in grid-connected mode.
Figure 3. Structure of KBU engineering faculty’s MG in grid-connected mode.
Processes 13 02883 g003
Figure 22. Comparative summary of cost reduction, grid dependency reduction, and unserved critical load across ten stress-test scenarios using the proposed MPC strategy.
Figure 22. Comparative summary of cost reduction, grid dependency reduction, and unserved critical load across ten stress-test scenarios using the proposed MPC strategy.
Processes 13 02883 g022
Table 1. Summary of the MPC approach in MG studies and real-time implementation at Karabuk University.
Table 1. Summary of the MPC approach in MG studies and real-time implementation at Karabuk University.
Criteria[20][21][22]This Study
Type of StudySimulation in a DC MG (500 VDC)Data-driven simulation with Digital TwinSimulation in AC MG—MATLABReal implementation in a university microgrid
Main FocusOptimization of DC bus power and voltage control using CCS-MPC + new weighting methodAnnual energy management with seasonal H2 storagePower quality improvement (THD reduction) and robustness against unbalanced loadsReal-time economic and operational management
Energy SourcesPV + Wind + BESS (with DC/DC converters)PV + BESS + H2 + thermal storage + DSM(PV/Wind/Hydro) + unbalanced loadPV + BESS + Diesel + main grid
Control MethodContinuous Control Set MPC (CCS-MPC) + new numerical weighting methodMPC + Digital Twin + heuristic rulesMPC for THD reduction and power quality stabilityReal-time economic MPC (24 h prediction horizon, 1 h control) tested in 10 real scenarios
Optimization GoalsHigh-accuracy power tracking (99.96%), ripple reduction, improved PV/Wind extractionMeet annual load with H2 balance, reduce extra capacityReduce THD, improve voltage/current under dynamic loadsCost reduction, lower grid dependency, ensure critical load supply
Key ResultsImproved power extraction: +2.19% PV, +3.46% Wind; more stable than PI controlAnnual load met with 6% oversizingTHD improvement up to 90% compared to previous methodsCost reduced up to 43%, grid dependency reduced up to 70%, <5% critical load unsupplied
Main InnovationIntroduced new numerical weighting method for CCS-MPC in DC microgridIntroduced seasonal hydrogen storage in MPC frameworkFocus on power quality (THD) in AC microgridReal-world implementation under complex operational scenarios
Scalability/ApplicabilitySuitable for small/medium DC microgridsSuitable for large seasonal systemsSuitable for laboratory/simulation power quality analysisSuitable for real urban/campus microgrids
Table 2. MPC parameters and tuning rationale.
Table 2. MPC parameters and tuning rationale.
ParameterValueRationale
Prediction horizon (TP)24 hTo capture full daily variability of PV, load, and price
Control horizon (TC)1 hEnsures real-time adaptability with updated measurements
Battery SoC limits20–90%Prevent deep discharge and extend battery lifetime
Diesel generator min load20% ratedAvoid low-load inefficiency and wet stacking
Weights on critical load penaltyHight (Q = 1000)Ensure minimum unserved load
Weights on critical load penaltyMedium (Q = 100)Allow flexible curtailment if necessary
Grid import/export limits ± 1 MWBased on feeder and protection constraints
Table 3. Solar PV panel’s location.
Table 3. Solar PV panel’s location.
KBU BuildingPower Capacity of PV (kW)
Gym50
Vocational School of Foreign Languages250
Vocational School of Information Technologies300
Theology Faculty100
Faculty of Economics and Administrative Sciences300
Engineering Faculty100
Table 4. Parameters of KBU engineering faculty’s hybrid MG.
Table 4. Parameters of KBU engineering faculty’s hybrid MG.
ParametersValue
PV generation100 kW
BESS500 Ah
Diesel generator440 kW
Inverter60 kW
Critical and non-critical loads680 kW
Utility grid75 MVA
Table 5. Summary of system performance metrics under different scenarios compared to baseline.
Table 5. Summary of system performance metrics under different scenarios compared to baseline.
ScenarioGrid Dependency Reduction (%)Cost Reduction (%)Unused Critical Load (%)
Scenario 10% (Reference)0%0%
Scenario 2 ~ 20 % ~ 15 % < 3 %
Scenario 3 ~ 40 % ~ 25 % < 3 %
Scenario 4 ~ 35 % ~ 22 % < 3 %
Scenario 5 ~ 55 % ~ 35 % < 3 %
Scenario 6 ~ 70 % (At peak load) ~ 43 % < 4 %
Scenario 7 ~ 50 % ~ 30 % < 3 %
Scenario 8N/A ~ 10 % < 5 %
Scenario 9 ~ 10 % ~ 12 % < 5 %
Scenario 10 ~ 20 % ~ 18 % < 5 %
Table 6. Quantitative comparison of the proposed approach with advanced strategies under comparable conditions.
Table 6. Quantitative comparison of the proposed approach with advanced strategies under comparable conditions.
ApproachCost Reduction (%)Grid Dependency Reduction (%)Unserved Critical Load (%)
Proposed Strategy4340–70<5
Stochastic Optimization [25]25–3530–555–8
Distributed MPC [26]20–4035–605–7
AI-based Controllers [27]30–4032–585–7
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Amar, A.; Yusupov, Z. Real-Time Capable MPC-Based Energy Management of Hybrid Microgrid. Processes 2025, 13, 2883. https://doi.org/10.3390/pr13092883

AMA Style

Amar A, Yusupov Z. Real-Time Capable MPC-Based Energy Management of Hybrid Microgrid. Processes. 2025; 13(9):2883. https://doi.org/10.3390/pr13092883

Chicago/Turabian Style

Amar, Abdellfatah, and Ziyodulla Yusupov. 2025. "Real-Time Capable MPC-Based Energy Management of Hybrid Microgrid" Processes 13, no. 9: 2883. https://doi.org/10.3390/pr13092883

APA Style

Amar, A., & Yusupov, Z. (2025). Real-Time Capable MPC-Based Energy Management of Hybrid Microgrid. Processes, 13(9), 2883. https://doi.org/10.3390/pr13092883

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop