Next Article in Journal
Design of a Test Section for the Experimental Investigation of the WCLL Manifold Hydraulic Features
Next Article in Special Issue
Optimal Cooperative Power Management Framework for Smart Buildings Using Bidirectional Electric Vehicle Modes
Previous Article in Journal
Productivity and Characterization of Biomass Obtained from Pruning of Walnut Orchards in México
Previous Article in Special Issue
A MIMO–ANFIS-Controlled Solar-Fuel-Cell-Based Switched Capacitor Z-Source Converter for an Off-Board EV Charger
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Real-Time Fuzzy Logic Based Energy Management System for Microgrid Using Hardware in the Loop

by
Abdallah El Zerk
and
Mohammed Ouassaid
*
Engineering for Smart and Sustainable Systems Research Centre, Mohammadia School of Engineers, Mohammed V University in Rabat, Rabat 10090, Morocco
*
Author to whom correspondence should be addressed.
Energies 2023, 16(5), 2244; https://doi.org/10.3390/en16052244
Submission received: 30 December 2022 / Revised: 17 February 2023 / Accepted: 20 February 2023 / Published: 26 February 2023
(This article belongs to the Special Issue Towards Intelligent, Reliable and Flexible Stand-Alone Microgrids)

Abstract

:
This research presents a hierarchical energy management strategy for isolated microgrids (MG). The strategy’s objectives are achieved through a master-slave topology where local controllers are managed and controlled through a central controller. This can provide many technical advantages, particularly regarding the microgrid’s performance and the supply of energy. The local controller is designed to meet the local objectives of the microgrid, such as stabilization of DC voltage and maximization of sources’ extracted power. The objectives of the central controller are achieved through a centralized approach based on fuzzy logic to preserve battery life and manage the energy balance between generation and consumption. The microgrid’s performances were investigated under a steady-state and faulty regime. A Hardware in the Loop (HIL) test based on the Simulink platform is established by RT-LAB real-time simulator. Results are presented to validate the proposed hierarchical control. The OP1400 test bench, based on the OP4150 digital simulator, is utilized to test and validate the proposed hierarchical control strategy. The results are compared to international standards IEEE 1547 and IEC 61727, which demonstrate excellent consistency.

1. Introduction

1.1. General Context and Motivation

Renewable energy has gained significant attention in recent years due to growing concerns about the environment. The International Energy Agency (IEA) has projected that conventional energy sources will soon be unable to meet the increasing demand for energy, making renewable energy systems (RESs) a key solution to the current global energy crisis [1]. To address this, research community are focusing on improving the efficiency and reliability of renewable energy systems. RESs such as solar and wind power are pollution-free and environmentally friendly, making them an attractive alternative to fossil fuels. In addition to environmental concerns, there are also issues related to the ability of the traditional power grid to meet the energy needs of the world [2,3]. In rural areas, it is often not cost-effective or technically feasible to connect households to the utility grid. Microgrids (MGs) powered by renewable energy can provide a solution to this problem by supplying electricity in either connected or standalone mode. As the transformation towards cleaner and more efficient energy systems, the development of microgrids becomes increasingly important.
Overall, the increasing attention on distributed generation (DG) and renewable energy systems (RESs) is driven by the need to address environmental concerns and the growing demand for energy. Improving the efficiency and reliability of renewable energy systems, and the development of microgrids, are key ways to address these challenges and provide sustainable energy solutions for the future.
Microgrids, which are small-scale power systems that can operate independently or in conjunction with the main power grid, are a promising solution for providing energy in rural areas. However, they are complex systems that require intelligent control mechanisms to manage the unpredictable nature of renewable energy sources. An energy management system (EMS) is essential for ensuring optimal performance of a microgrid.
An EMS controls the flow of energy within a microgrid, making decisions based on real-time data and predefined objectives. The EMS must be able to adapt to unpredictable changes in weather, energy consumption, and technical constraints to ensure that the microgrid is able to meet its overall objectives. For the implementation of an effective EMS, several key factors must be taken into account (i) Heterogeneity, which refers to the integration of different types of energy sources and loads within the microgrid, is crucial for ensuring reliability and stability; (ii) Intelligence, which allows the system to make decisions based on real-time data; and (iii) Scalability and autonomy, which enable the microgrid to adapt to changes in demand and supply, are also important considerations. Additionally, the system dynamics, which include the interactions between the different components of the microgrid, must be carefully considered.
Various concepts of management approaches employing intelligent techniques, including genetic algorithms, model predictive control, neural networks (NN), and fuzzy logic (FL), deep learning [4] have been introduced in the literature. Recently, various studies have implemented FL to maintain a continuous energy supply in either grid-connected or island-based MGs [5]. There are many remarkable upsides to using FL. First, the adaptability to complex systems and the high efficiency and robustness regarding modeling uncertainties. Then, the ability to operate seamlessly without the need for a historical database, unlike artificial NN [6]. Classical logic is extremely rigorous, requiring a thorough comprehension of the system and a complete mastery of the mathematical models. On the other hand, the FL integrates an alternative thinking model to quickly and effectively develop complex systems. The fuzzy logic approach is based on rules describing the relationships between different inputs and outputs [7]. A set of rules (if-then) based on the designer’s expertise are considered when developing the fuzzy logic controller (FLC).
Real-time simulation is a vital tool in the domain of microgrid control systems, as it allows for the safe and efficient testing of new control strategies before their implementation in a real-world setting. The use of real-time simulations (RTS) has gained popularity in recent years due to their ability to provide practical and cost-effective solutions.
The incorporation of an Energy Management System (EMS) into a microgrid’s control system can pose significant difficulties. The high-power levels and high DC bus voltage present in microgrids make testing on real hardware risky. Through the use of simulations, researchers can test new ideas and strategies without incurring the high risk and cost associated with testing on real hardware. Furthermore, real-time simulation allows researchers to investigate the behavior of the system in a safe and controlled environment, without the risk of damage or injury [8]. Additionally, it allows researchers to evaluate the performance of the microgrid under different scenarios.
RTS based on automated code generation is often used in several engineering disciplines and applications, which offers several advantages such as:
  • Generating a defined set of criteria and specifications that can be used by the researchers involved;
  • The ability to simulate complex systems under normal operating conditions as well as under extreme conditions;
  • Investigating the behavior of a system with regard to faults and defects in a simulated model, which is much safer and less expensive than testing on real hardware.

1.2. Related Works

In [9], authors present the development of an islanding control strategy for a Photovoltaic (PV) based microgrid using a fuzzy logic controller. The algorithm uses the estimated power generated by the photovoltaic panel, which is used to decide when the switches can be connected or disconnected using a fuzzy-rules algorithm. The research presented in [10] introduces a supervisory control to fulfill the load power demand and monitor the batteries’ State of Charge (SoC) to preserve their lifetime. In this study, the MG response under fault conditions was not examined. Based on the same strategy in [11], authors evaluated the power flow within a microgrid comprised of a PV generator, a Wind Turbine (WT) generator, and a storage system. Multiple components of the energy storage system make the control strategy more challenging. Indeed, the adopted EMS shows fluctuations and AC voltage drops. The aforementioned studies propose different energy management approaches that are based, in most cases, on fuzzy logic. Since they have been validated through simulation, it will be very interesting to see how they perform in real-time using simulators such as Opal-RT, National Instruments’ RTDS, or Typhoon’s Hardware in the Loop (HIL) Simulator, among others.
A real-time examination using the RT-LAB simulator is performed in [12] to enhance a PV generator’s performance and efficiency within a microgrid. The PV local controller is studied and developed in order to achieve an optimum operating mode of the PV arrays. This is accomplished by lowering the DC-DC converters’ output ripple, which impacts and stresses sensible electronic loads. However, the development of the central controller is not reported in this study. To identify a feasible solution to the challenge of power dispatching within a microgrid without overloading one DG, authors in [13] establish a battery local controller. The proposed approach is based on a fuzzy logic controller, which is considered an effective technology in this study. Applying the same approach, the authors in [14] demonstrate that combining multiple energy storage systems, such as supercapacitors and batteries, improves the energy flow and batteries’ lifetime. The authors of [15] propose a vector control design to manage the power exchange within a microgrid. The behavior of the developed algorithm is investigated in real-time using OPAL-RT (OP 4510) simulator. Relying on a well-structured control strategy, an optimal design layout and a hierarchical energy management strategy for a DC microgrid are presented in [16]. This study schedules a hierarchical level of EMS, including local and system control layers, to enhance the robustness and economy of DC-MG in steady-state mode. The strategy is tested using an HIL simulation. Based on the same approach and emphasizing the analysis of the microgrid’s performance under fault conditions, an effective energy management system implemented on a FLC is presented in [17]. Under both normal and fault regimes, the suggested strategy’s robustness and effectiveness are evaluated. Findings confirm that the proposed energy management technique performs efficiently under the simulation conditions, although the study lacks validation using real-time simulators.

1.3. Contribution and Paper Organization

An enhanced energy management system based hierarchical control is presented in this paper. The dynamic performances of the MG are improved and assessed in both fault and steady-state modes. Furthermore, the proposed EMS is validated through real-time simulation using an OP1400 test bench. While there is a significant amount of research on MG’s Energy Management Systems, it is typically limited to the permanent mode. The performance of the MG under fault circumstances is a less explored topic. The primary focus of this paper is to address this gap in the literature by investigating the performance of the proposed EMS under fault conditions. Indeed, the objectives of this research are as follows:
  • Develop Local Controllers (LCs), each of which is associated with an energy source or a storage system. The PV LC is responsible for maximizing the power extracted using Maximum Power Point Tracking (MPPT) techniques. The battery’s LC maintains the voltage at the load bus, regardless of fluctuations in weather conditions or consumption.
  • Design a Central Controller (CC) to ensure coordination between the various LCs, while implementing adequate communication. Fuzzy logic is employed to provide quality voltage and frequency and guarantee the load and power supply balance within the microgrid.
  • Stabilize the microgrid under all possible operating conditions (normal and faulty)
  • Establish HIL test based on the Simulink platform and RT-LAB real-time simulator to validate the hierarchical control. OP4150 is used as a digital simulator in this study.
  • Check the HIL results for compliance with IEEE 1547 and ICE 617227 standards, which regulate the performance of the microgrid.
The rest of this paper is structured as follows. The energy sources and storage system of the studied microgrid are modeled in Section 2. The system’s electrical layout is extensively discussed in Section 2. The microgrid fuzzy logic-based control design and implementation is carried out. In Section 4, the strategy validation and results discussion are illustrated. The conclusion is outlined in Section 5.

2. Microgrid Model

2.1. PV Model

Numerous electrical models are reported in the literature to model a PV cell [18]. The one- and two-diode circuits are the most commonly adopted model to represent crystalline cells. Figure 1 exhibits the one diode electrical circuit of the PV cell and its current-voltage characteristic is expressed as follows:
  I p v = I G C I 0 e q V d k T c 1 V d R p
where I p v   is the photovoltaic current, V d is the diode voltage, I G c   is the generated current, I 0 is the saturation current of the solar cell, T c is the cell’s absolute temperature, R p is the parallel resistance, q is the absolute value of electron’s charge, and k is the Boltzmann constant.
As the output power of a single solar cell is low, several solar cells need to be connected in series and/or parallel depending on the desired output voltage range. The equivalent model of a PV panel comprising a set of N s of solar cells in series in one branch and N p in parallel is illustrated in Figure 2. The series connection of solar cells expands the output voltage, while the parallel connection of solar cells expands the output current dimension. The series-parallel connection, on the other hand, allows for more power from the solar panel [19].

2.2. WT Model

There are several types of electrical machines that can act as generators in a wind power system. Technical and economical factors determine the type of machine for each application. The simplicity and low cost of the Permanent Magnet Synchronous Generator (PMSG) explain their dominance. According to research conducted in [20,21], the mechanical power of a wind turbine can be expressed as follows (2):
P m = 1 2 C p λ , β ρ A 2 V w i n d 3
where P m   is the mechanical output power, λ is the tip speed ratio of the rotor blade, C p is the performance coefficient, β is the blade pitch angle, ρ is the air density, A is the turbine spin area, and V w i n d   is the wind speed.
The ratio between the power extracted from the wind and the total power theoretically available is, therefore:
C p = 1 2 116 4 0.4 β 5 e 21 λ
The characteristic representing the performance coefficient C p from Equation (3) is shown in Figure 3.

2.3. Battery Model

The most commonly used battery model is shown in Figure 4 [14,22]. It consists of an ideal voltage source E b and a constant equivalent internal resistance R b a t . The voltage across the battery and the capacity model are given by (4) and (5), respectively.
V b a t = n b E b ± n b R b a t I b a t
where V b a t represents the voltage across the battery and I b a t   represents the battery current, respectively, E b   is the electromotive force of a cell, R b a t is the internal resistance, and n b represents the number of cells in series.
C b a t = 1.67   C 10 1 + 0.67 I d i s I 10 0.9   1 + 0.005 Δ T
where I 10   is the nominal battery current, C b a t is the nominal capacity of the battery (Ah) in a constant current discharge regime for 10 h ( C 10 = 10   I 10 ) , and ΔT is the battery heating compared to the ambient temperature.

3. MG Hierarchical Control

Hierarchical control is performed through two control layers–local and central–to optimize microgrid operation in diverse conditions, as shown in Figure 5. The fluctuating profile of the PV and WT sources affects the stability of the microgrid. As a result, the frequency and voltage may diverge, requiring appropriate control. DC/DC converters in distributed power generation are managed at the local control layer using a wide variety of control strategies, each designed for the specific characteristics of the converters in question.
The proposed LC is developed according to the following objectives:
  • Control the boost converter to extract the maximum of power from DGs using the perturb-and-observe (P&O) algorithm.
  • Limit the WT speed using a PI regulator.
  • Regulate the AC voltage and frequency.
  • Extend the longevity of the batteries by avoiding repeated cycles of deep charging and discharging.
  • Control the bidirectional converter in order to maintain the desired voltage on the DC bus.
To increase microgrid stability and energy flow, EMS-based fuzzy logic distributes power between sources, batteries, and dump load. The central controller is in charge of this process.

3.1. Local Control

3.1.1. PV Local Controller

As depicted in Figure 5, the MPPT control approach is utilized to harvest the maximum power from the PV system under various operating scenarios. Typically, the DC/DC converter of a PV system operates in MPPT mode to maximize the amount of energy produced by the source. There are several MPPT methods to locate the maximum power point (MPP). The P&O method is the most popular. The P&O method can be implemented in low-cost digital devices while still providing high robustness and performance [23]. The circuit diagram in Figure 6 shows the boost converter that allows the PV generator to operate at maximum power through an MPPT controller.
Figure 7 shows that the connected loads severely impact the PV generator’s operation. For distinct R i values, the best adaptation occurs at one operational point called MPP. Consequently, for the same irradiance, the power delivered by the PV generator will be different depending on the power requested on the DC bus.

3.1.2. WT Local Controller

Figure 8 depicts the WT generator power curve as a function of the rotor speed. It can be noted that, for each wind speed, there is a single rotor speed allowing to have maximum power.
As with the PV generator, the MPPT technique allows the maximum power to be delivered to the DC bus, which corresponds to the maximum voltage for each irradiation and temperature level. Similarly, the wind power, at a given wind speed, is directly related to the rotation speed imposed by the mechanical load. Thus, the speed control of the WT allows for controlling wind power. It remains to define the speed setpoint according to an MPPT function. Therefore, in order to deliver the optimal power to the load, a speed regulation corresponding to the optimal wind speed must be performed. The optimal point of a WT is characterized by the pair ( C p o p t , λ o p t ). Once the optimal point is reached, it is possible to calculate the optimal speed from the value of the optimal power. More details on the algorithm applied in this study are reviewed in [24].

3.1.3. Battery Local Controller

The power delivered or consumed by each of the MG’s elements must be controlled to maintain the power flow balance. Indeed, if the current delivered by each element on the DC bus is controlled, the power will be maintained. The power share between the batteries and DC bus is stabilized using a cascade structure, as reported in [25]. Indeed, an inner control loop regulates the battery current, and an outer control loop regulates the DC bus energy. The current regulation loop, using the duty cycle as a reference, generates control signals to the bidirectional converter. There are two possible options for the current reference:
  • Either the reference is derived from a voltage regulation loop,
  • Or it is provided by a central controller (EMS).
In the proposed architecture illustrated in Figure 9, the bi-directional converter connecting MG’s component to the DC bus is assumed to be voltage-controlled. The role of the central controller is to select the DG or batteries as a source of energy according to several parameters detailed later.

3.2. Central Control

3.2.1. FLC Design

The main reason for using FLC instead of traditional mathematical methods is its ability to deal with knowledge represented in a linguistic form. FLC development is generally based on the designer’s experience rather than the mathematical modeling of the system, which requires solving complex equations as researchers used to do conventionally. The fuzzy logic concept was first developed and established by Pr. Lotfi Zadeh in his paper entitled ‘Fuzzy sets’ in 1965 [26]. An intelligent EMS based on Mamdani’s Fuzzy Inference System (FIS) is adopted for designing the central controller.
To guarantee the MG’s performance, EMS regulates the flow of power between generators and loads, protects the batteries from deep charge/discharge, and stabilizes the DC bus voltage. The suggested FLC, presented in Figure 10, is based on the following criteria and objectives:
  • The priority is to supply loads through DGs.
  • Battery life can be preserved by keeping the SoC between 20% and 80% and avoiding overcharging or overdischarging.
  • Both the frequency and the voltage have to be kept within a margin that is equivalent to ± 10   V and ± 0.05   Hz , respectively.

3.2.2. Management Algorithm

The central controller is responsible for managing the various functional modes and regulating the flow of power throughout the MG. The management algorithm is represented in Figure 11.
  • If the DGs are producing more power than is being used ( P n e t > 0 ), and batteries are charged ( S o C S o C m a x ), the reference power of the batteries must be zero. In this case, the dump load will be turned on. Otherwise, the batteries would have already started charging with an amount of energy equal to P b a t = P n e t   < 0.
  • If the energy supplied by the DGs is insufficient to meet demand and the batteries are empty, the loads are immediately disconnected, and the reference power of the batteries is set to zero. In any other case, batteries would have begun discharging ( P b a t = P n e t > 0).
  • Batteries are disconnected when the DGs can individually supply the load.
Through the switch K d u m p , the dump load is connected to the DC link and absorbs extra power under failure or overgeneration conditions. The surplus energy can be transformed into a heat load, which acts as a dump load.
The rules of the FLC are based on the consideration of the batteries’ SoC and the MG’s stabilization.
In the following the steps involved in designing a fuzzy inference system using Mamdani’s method are presented. These steps include the process of fuzzification of inputs, defuzzification of outputs, utilizing fuzzy operators, and creating if-then rules. The rules shown in Figure 12 serve as the foundation of the FLC and are based on factors such as the state of charge of batteries and the stabilization of the MG. The proposed FLC system is composed of four inputs, three outputs, and five rules. Input 1 pertains to the state of charge of the batteries, input 2 relates to the net power, input 3 concerns the load power, and input 4 relates to the power source. The outputs control the signal for the switches, such as K b a t , K d u m p and K l o a d s .
Step 1: Fuzzification of Inputs
In this step, inputs such as the SoC and net power are transformed into fuzzy sets through the use of membership functions. Prior to this transformation, the SoC input ranges from 0 to 100%, and the net power input ranges from −8000 to 8000 W. After the fuzzification process, the SoC parameter is represented with three fuzzy sets: “High”, “Medium”, and “Low”, while the power input is represented with two fuzzy sets: “negative” and “positive”.
Step 2: Application of fuzzy operator
The initial step in this process involves creating three fuzzy values for the SoC and two fuzzy values for the net power, all of which range from 0 to 1. These values are then used in the second step, where fuzzy operators are applied using a set of five rules. For instance, the first rule states that “if the SoC is low and the net power is positive, the batteries should be charged”. In other words, the fuzzy values generated in the first step are used to determine appropriate actions through a series of logical statements known as “if-then” rules.
Step 3: Aggregation of rules output
The process of making decisions in Mamdani’s FIS is based on the evaluation of all the rules. The rules must be combined in some way to reach a final decision. This combination is achieved through a process called aggregation, which involves merging the outputs of all the rules. The list of truncated output functions returned by each rule’s implication process serves as the input for the aggregation process. In the proposed design, this process can result in five inputs corresponding to five rules.
Step 4: Defuzzification
The final step in the decision-making process is the defuzzification, which begins by merging the outputs of the fuzzy rules from the aggregation process. In this implementation, the aggregation is carried out by summing up the output trigger weights for each membership function across all the rules that affect the function. One of the most commonly used methods for defuzzification is the calculation of the centroid, which returns the center point of the area under the curve. In the proposed design, the centroid calculation method is chosen because it is an effective and efficient way to obtain an accurate value from a fuzzy set, while maintaining consistency in the results.
Figure 13 illustrates the outcome of the defuzzification process. The FLC creates three control signals, K b a t , K d u m p and K l o a d , which are based on four inputs: load power, source power, net power ( P n e t ), and SoC of the batteries. These control signals are the final output of the FLC, and they are used to control the system.

3.2.3. Functioning Modes

To achieve MG’s stability, the power difference must be determined. The net power is equal to the difference between the surplus and the deficit. Equations (6) and (7) are used to obtain P n e t and P S , respectively.
P n e t = P S P l o a d
P S = P p v + P w i n d
Table 1 lists the different switching combinations, where:
  • M1 (000): all relays are turned off if there is no energy demand, or if there is a power shortage and the batteries are completely drained ( S o C < 25 %   a n d   P S = 0   a n d   P L = 0   o r   P L 0 ) .
  • M2 (010): energy is dissipated through the dump load if there is a substantial amount of surplus energy and the batteries are fully charged, but instead, there is no energy demand.
  • M3 (011): loads are first supplied then the energy surplus is dissipated if the production is high and batteries are fully charged ( ( S o C > 85 %   a n d   P S 0   a n d   P L 0 ) .
  • M4 (100): batteries are partially charged if the consumption is weak but the production is high. Midnight, when wind resources are at their peak but demand is low, is an appropriate moment to switch to this mode.
  • M5 (101): batteries supplement DGs to supply loads, when demand exceeds generation.

4. Results and HIL Test

To test the hierarchical control, an MG HIL platform based on RT-LAB real-time simulation system is designed in this study. As depicted in Figure 14, the HIL platform consists of an OP1400 simulator, an FPGA controller, and a work-station assisting as a monitoring interface. A precise mathematical model of the isolated MG is compiled and converted to C-code, which can then be uploaded into an OP4510 simulator. Kintex-7 FPGA is a suitable platform on which the proposed control algorithm can be executed. Some information about operating frequencies of used FPGA and converters is highlighted in Table 2.
The Xilinx FPGA KintexTM-7 325T, in particular, has advanced PWM generation capabilities, with a high operating frequency of up to 200 kHz and a resolution of 5 ns, making it more than capable of controlling converters with lower operating frequencies such as the PV converter at 20 kHz and the battery converter at 10 kHz.
The OP1400 is a real-time digital simulator that allows users to simulate and test control systems, power electronics systems, and other real-time embedded systems. In the present study, the simulator contains both electrical model of the microgrid being simulated, as well as local and central controllers. The electrical model represents the electrical behavior of the system and its components, while the controllers are responsible for controlling the system and implementing the control strategy.
The SimPowerSystems model needs to be partitioned into many sub-systems so that it may be simulated in real-time using the OPAL-RT platform. As shown in Figure 15, the MG’s components are organized into two distinct subsystems, namely the Master Subsystem (SM) and the Console Subsystem (SC). The SM includes the entire electrical models of the microgrid, while the blocks responsible for data communication from/to the simulator are located in the SC.

4.1. Scenario Description

Three experimental cases have been chosen to demonstrate the effectiveness of the proposed hierarchical control approach. The first case involves testing of local controllers under various weather conditions, such as wind, irradiation, and temperature, and under extreme load profiles. In the second case, the central controller based on fuzzy logic, which is used to balance the power between sources, batteries, and dump load, is evaluated. Lastly, the microgrid control is evaluated under failure scenarios, including different types of faults such as short-circuits and overvoltages. The results are also compared to international standards, namely IEEE 1547 and IEC 61727, to determine their compliance.
The view depicted in Figure 16 was elaborated using data obtained from the various MG sensors. The wind is blowing at a speed of 7 m/s while the temperature is set at 8 °C throughout the test.
Datasets used in this study were retrieved from an original publication made in 2018 [27]. The microgrid being studied is located in a remote area in Morocco, and meteorological data such as solar radiation, wind speed, and ambient temperature were obtained from NASA’s Surface Meteorology and Solar Energy programs.
Figure 17 represents the solar irradiance and wind speed profiles considered during the test. To accurately estimate daily load consumption, the daytime hourly average consumption was evaluated, and then some randomization was applied for different hours to achieve a moderate profile.

4.2. Test 1—Local Controllers

Figure 18a depicts the energy generated by solar panels, while Figure 18b depicts the energy gained from the wind generator. It is worth noting that, despite the extreme weather changes and unpredictable load demand, the Microgrid (MG) was able to respond accurately.
As shown in Figure 19 and throughout the entirety of the real-time simulation, the voltage on the DC bus remains constant at a fixed value of 500 V and matches the reference voltage flawlessly with an overshoot of +/−1 V.

4.3. Test 2—Central Controller

As seen in Figure 20a, the AC voltage remains constant despite changes in the levels of irradiance and wind speed. The voltage and frequency of the load respond rapidly to changes in the DC bus, which is connected directly to the inverter. The proposed EMS can ensure a consistent and high-quality voltage and current to the load, meeting the requirements for waveform and harmonic distortion. Figure 20b illustrates that the SoC of the batteries stays consistently within a safe range, between 20% and 80%. This means that the objectives outlined in Figure 10, such as maintaining the SoC within a safe range, have been successfully met by the control system. Additionally, this shows that the microgrid is able to effectively manage the energy produced by the renewable sources, and supply the load with stable and high-quality power, despite the weather changes and unpredictable load demand.
Figure 21 shows different microgrid data including battery’s SoC, battery’s power and DC voltage.
The load power and its reference are identical, as can be seen in Figure 22a, which indicates that the microgrid is able to maintain a steady flow of power even when there is a shortage of energy from the DGs. This is possible due to the use of energy storage systems such as batteries, which can supply power to the load during shortages, as shown in Figure 22b. The power of the batteries is positive when they are charging and negative when they are discharging. This means that the MG is able to effectively balance the power flow between the DGs and the load, by storing excess energy in the batteries during periods of surplus, and releasing it during periods of shortage.

4.4. Test 3—Microgrid Performances under Faulty Conditions

In the final test, the proposed hierarchical control strategy is evaluated for its effectiveness in handling short circuits. Figure 23a illustrates two potential scenarios. The Point of Common Coupling (PCC) experiences a three-phase short circuit at around 10–10.1 s, followed by a breakdown on the DG-side at around 15–15.1 s. The goal of this test is to examine the behavior and response of the central controller in regard to these failures. Even though faults were emulated, the system was able to stabilize after the fault was cleared. As the short circuit occurs, the DC bus voltage drops significantly and experiences a notable fluctuation, as seen in Figure 23b. However, it returns to normal after the fault is cleared at 12.2 s, which proves the robustness and efficacy of the proposed hierarchical control approach in handling short circuits.
The frequency remains stable, with a fluctuation of only 0.2% when the fault occurs. As can be seen in Figure 24a, after the problem has been fixed, the frequency maintains its original value of 50 Hz. As shown in Figure 24b, THD variation over time can reach 2.5 during 100 ms, which remains relatively low in the faulty regime.
Results must comply with international guidelines to evaluate the approach’s effectiveness in the fault regime. IEEE 1547 [28] and IEC 61727 [29] specify recommendations for voltage overshoots and response time. Overvoltage at the PCC for a prolonged period of time reduces system safety. IEC 61727 states that the overvoltage in an isolated microgrid falls within four ranges:
  • When V o l t a g e < 50 % , the maximum allowable trip time is 0.1 s.
  • When 50 % < V o l t a g e < 85 % , the maximum allowable trip time is 2 s.
  • When 110 % < V o l t a g e < 120 % , the maximum allowable trip time is 2 s.
  • When 120 % < V o l t a g e , the maximum allowable trip time is 0.16 s.
Additionally, the MG should be able to endure a frequency range of ±1 Hz at the PCC while maintaining a THD that is less than 5%.
Table 3 provides a concise summary of the power and frequency quality provided to the load within the investigated microgrid. A total of five parameters are examined, and they all compare favorably to the standards set out by IEEE 1547 and IEC 61727

5. Conclusions

This study addresses the issues of power continuity and battery management in microgrids, specifically focusing on frequency and voltage stability in both steady-state and fault conditions. This is achieved through the implementation of a hierarchical controller with a master-slave topology, where local controllers are managed and controlled by a central controller. The local controllers are designed to meet the specific needs of the microgrid, such as stabilizing the microgrid and maximizing the power generated from renewable energy sources. The central controller, on the other hand, uses a fuzzy logic-based approach to regulate power supply and demand equilibrium, and preserve the lifespan of the batteries. The performance of the microgrid was evaluated under both steady-state and fault conditions using a hardware-in-the-loop simulation platform based on RT-LAB and an OP1400 test bench. The results showed that the PCC’s voltage and frequency remained stable even under a wide range of disturbances in both conditions. Furthermore, even with significant fluctuations in system parameters during fault conditions, the voltage, power, and frequency all quickly recovered once the fault was cleared. These results were compared with the international standards IEEE 1547 and IEC 61727, both of which display an exceptional level of consistency.

Author Contributions

Conceptualization, A.E.Z. and M.O.; methodology, A.E.Z. and M.O.; software, A.E.Z.; validation, M.O.; writing—original draft preparation, A.E.Z.; writing—review and editing, A.E.Z.; M.O; supervision, M.O.; project administration, M.O. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. IEA—International Energy Agency. Available online: https://www.iea.org/ (accessed on 25 January 2022).
  2. A Sense of Units and Scale for Electrical Energy Production and Consumption. Available online: https://ourworldindata.org/scale-for-electricity (accessed on 25 January 2022).
  3. WHO—World Health Organization. Available online: https://www.who.int/ (accessed on 25 January 2022).
  4. Rouzbahani, H.M.; Karimipour, H.; Lei, L. Optimizing scheduling policy in smart grids using probabilistic Delayed Double Deep Q-Learning (P3DQL) algorithm. Sustain. Energy Technol. Assess. 2022, 53, 102712. [Google Scholar] [CrossRef]
  5. Olatomiwa, L.; Mekhilef, S.; Ismail, M.S.; Moghavvemi, M. Energy management strategies in hybrid renewable energy systems: A review. Renew. Sustain. Energy Rev. 2016, 62, 821–835. [Google Scholar] [CrossRef]
  6. Kalogirou, S.A. Artificial neural networks in renewable energy systems applications: A review. Renew. Sustain. Energy Rev. 2001, 5, 373–401. [Google Scholar] [CrossRef]
  7. Zadeh, L.A.; Aliev, R.A. Fuzzy Logic Theory and Applications: Part I and Part II; World Scientific: Singapore, 2018; ISBN 978-981-323-817-6. [Google Scholar]
  8. Li, F.; Wang, Y.; Wu, F.; Huang, Y.; Liu, Y.; Zhang, X.; Ma, M. Review of Real-time Simulation of Power Electronics. J. Mod. Power Syst. Clean Energy 2020, 8, 796–808. [Google Scholar] [CrossRef]
  9. Yahyaoui, I.; Sallem, S.; Kamoun, M.B.A.; Tadeo, F. A proposal for off-grid photovoltaic systems with non-controllable loads using fuzzy logic. Energy Convers. Manag. 2014, 78, 835–842. [Google Scholar] [CrossRef]
  10. El Zerk, A.; Ouassaid, M.; Zidani, Y. Energy management based fuzzy logic control of hybrid system wind/photovoltaic with batteries. In Proceedings of the 2018 Renewable Energies, Power Systems Green Inclusive Economy (REPS-GIE), Casablanca, Morocco, 23–24 April 2018; pp. 1–6. [Google Scholar]
  11. Roumila, Z.; Rekioua, D.; Rekioua, T. Energy management based fuzzy logic controller of hybrid system wind/photovoltaic/diesel with storage battery. Int. J. Hydrogen Energy 2017, 42, 19525–19535. [Google Scholar] [CrossRef]
  12. Chellakhi, A.; El Beid, S.; Abouelmahjoub, Y. An Advanced MPPT Scheme for PV Systems Application with Less Output Ripple Magnitude of the Boost Converter. Int. J. Photoenergy 2022, 2022, e2133294. [Google Scholar] [CrossRef]
  13. Kraiem, H.; Flah, A.; Mohamed, N.; Messaoud, M.H.B.; Al-Ammar, E.A.; Althobaiti, A.; Alotaibi, A.A.; Jasiński, M.; Suresh, V.; Leonowicz, Z.; et al. Decreasing the Battery Recharge Time if Using a Fuzzy Based Power Management Loop for an Isolated Micro-Grid Farm. Sustainability 2022, 14, 2870. [Google Scholar] [CrossRef]
  14. Cabrane, Z.; Ouassaid, M.; Maaroufi, M. Analysis and evaluation of battery-supercapacitor hybrid energy storage system for photovoltaic installation. Int. J. Hydrogen Energy 2016, 41, 20897–20907. [Google Scholar] [CrossRef]
  15. Roy, B.; Adhikari, S.; Datta, S.; Lalngaihawma, S.; Samanta, S. Real-Time Simulation of a Wind-Solar-Battery Based Microgrid System. J. Electr. Eng. Technol. 2022. [Google Scholar] [CrossRef]
  16. Han, Y.; Zhang, G.; Li, Q.; You, Z.; Chen, W.; Liu, H. Hierarchical energy management for PV/hydrogen/battery island DC microgrid. Int. J. Hydrogen Energy 2019, 44, 5507–5516. [Google Scholar] [CrossRef]
  17. EL ZERK, A.; Ouassaid, M.; Zidani, Y. An Energy Management Strategy for Isolated Microgrids and Performance Analysis under Steady-State and Fault Conditions. Int. J. Renew. Energy Res. (IJRER) 2021, 11, 1892–1904. [Google Scholar]
  18. Bellia, H.; Youcef, R.; Fatima, M. A detailed modeling of photovoltaic module using MATLAB. NRIAG J. Astron. Geophys. 2014, 3, 53–61. [Google Scholar] [CrossRef] [Green Version]
  19. Tsai, H.-L.; Tu, C.-S.; Su, Y.-J. Development of Generalized Photovoltaic Model Using MATLAB/SIMULINK. In Proceedings of the World Congress on Engineering and Computer Science, San Francisco, CA, USA, 22–24 October 2008; pp. 1–6. [Google Scholar]
  20. Errami, Y.; Ouassaid, M.; Maaroufi, M. Control of a PMSG based Wind Energy Generation System for Power Maximization and Grid Fault Conditions. Energy Procedia 2013, 42, 220–229. [Google Scholar] [CrossRef] [Green Version]
  21. Petru, T.; Thiringer, T. Modeling of wind turbines for power system studies. IEEE Trans. Power Syst. 2002, 17, 1132–1139. [Google Scholar] [CrossRef] [Green Version]
  22. Cavallo, A.; Canciello, G.; Guida, B. Energy Storage System Control for Energy Management in Advanced Aeronautic Applications. Math. Probl. Eng. 2017, 2017, e4083132. [Google Scholar] [CrossRef] [Green Version]
  23. Hlaili, M.; Mechergui, H. Comparison of Different MPPT Algorithms with a Proposed One Using a Power Estimator for Grid Connected PV Systems. Int. J. Photoenergy 2016, 2016, e1728398. [Google Scholar] [CrossRef] [Green Version]
  24. Kumar, D.; Chatterjee, K. A review of conventional and advanced MPPT algorithms for wind energy systems. Renew. Sustain. Energy Rev. 2016, 55, 957–970. [Google Scholar] [CrossRef]
  25. Serna-Garcés, S.I.; González Montoya, D.; Ramos-Paja, C.A. Control of a Charger/Discharger DC/DC Converter with Improved Disturbance Rejection for Bus Regulation. Energies 2018, 11, 594. [Google Scholar] [CrossRef] [Green Version]
  26. Zadeh, L.A. Fuzzy sets. Inf. Control 1965, 8, 338–353. [Google Scholar] [CrossRef] [Green Version]
  27. Zerk, A.E.; Ouassaid, M.; Zidani, Y. Feasibility Study and Optimization of a Standalone Hybrid System for Remote Area: A Case Study of High Atlas Mountains in Morocco. In Proceedings of the 2018 IEEE 5th International Congress on Information Science and Technology (CiSt), Marrakech, Morocco, 21–27 October 2018; pp. 606–611. [Google Scholar]
  28. 1547-2018—IEEE Standard for Interconnection and Interoperability of Distributed Energy Resources with Associated Electric Power Systems Interfaces|IEEE Standard|IEEE Xplore. Available online: https://ieeexplore.ieee.org/document/8332112 (accessed on 25 January 2022).
  29. IEC 61727:2004|IEC Webstore|Invertor, Smart City, LVDC. Available online: https://webstore.iec.ch/publication/5736 (accessed on 25 January 2022).
Figure 1. Equivalent circuit of a solar cell.
Figure 1. Equivalent circuit of a solar cell.
Energies 16 02244 g001
Figure 2. Series and parallel connection of solar cells.
Figure 2. Series and parallel connection of solar cells.
Energies 16 02244 g002
Figure 3. Power coefficient versus the ratio of speed.
Figure 3. Power coefficient versus the ratio of speed.
Energies 16 02244 g003
Figure 4. Electrical model of the battery.
Figure 4. Electrical model of the battery.
Energies 16 02244 g004
Figure 5. Hierarchical control of the microgrid.
Figure 5. Hierarchical control of the microgrid.
Energies 16 02244 g005
Figure 6. Schematic diagram of the Boost converter associated with the PV generator.
Figure 6. Schematic diagram of the Boost converter associated with the PV generator.
Energies 16 02244 g006
Figure 7. Influence of the load on the operating point.
Figure 7. Influence of the load on the operating point.
Energies 16 02244 g007
Figure 8. Power curve of the wind turbine for different wind speeds.
Figure 8. Power curve of the wind turbine for different wind speeds.
Energies 16 02244 g008
Figure 9. Bi-directional converter associated with the battery.
Figure 9. Bi-directional converter associated with the battery.
Energies 16 02244 g009
Figure 10. Objectives and criteria of the central controller.
Figure 10. Objectives and criteria of the central controller.
Energies 16 02244 g010
Figure 11. Flowchart of the energy management algorithm.
Figure 11. Flowchart of the energy management algorithm.
Energies 16 02244 g011
Figure 12. Rules of the proposed FLC.
Figure 12. Rules of the proposed FLC.
Energies 16 02244 g012
Figure 13. Variables’ evolution of the defuzzification process for the SoC (a), net power (b), load and source power (c), and switches (d).
Figure 13. Variables’ evolution of the defuzzification process for the SoC (a), net power (b), load and source power (c), and switches (d).
Energies 16 02244 g013aEnergies 16 02244 g013b
Figure 14. HIL simulation system of the DC microgrid.
Figure 14. HIL simulation system of the DC microgrid.
Energies 16 02244 g014
Figure 15. Overview of overall modeled Microgrid for real-time simulation.
Figure 15. Overview of overall modeled Microgrid for real-time simulation.
Energies 16 02244 g015
Figure 16. Climate condition view.
Figure 16. Climate condition view.
Energies 16 02244 g016
Figure 17. Irradiance and wind speed profile.
Figure 17. Irradiance and wind speed profile.
Energies 16 02244 g017
Figure 18. Generated power from (a) the PV panels; (b) WT generator.
Figure 18. Generated power from (a) the PV panels; (b) WT generator.
Energies 16 02244 g018
Figure 19. DC bus voltage curve under steady-state regime.
Figure 19. DC bus voltage curve under steady-state regime.
Energies 16 02244 g019
Figure 20. (a) Load voltage under steady-state regime; (b) SoC of the batteries.
Figure 20. (a) Load voltage under steady-state regime; (b) SoC of the batteries.
Energies 16 02244 g020
Figure 21. View of the battery data.
Figure 21. View of the battery data.
Energies 16 02244 g021
Figure 22. (a) Power consumption and its reference; (b) Batteries power.
Figure 22. (a) Power consumption and its reference; (b) Batteries power.
Energies 16 02244 g022
Figure 23. (a) Fault occurrence time; (b) Pre-fault and post-fault DC bus voltage.
Figure 23. (a) Fault occurrence time; (b) Pre-fault and post-fault DC bus voltage.
Energies 16 02244 g023
Figure 24. (a) Frequency response under the faulty regime; (b) THD variation during fault regime.
Figure 24. (a) Frequency response under the faulty regime; (b) THD variation during fault regime.
Energies 16 02244 g024
Table 1. Switching modes of relays.
Table 1. Switching modes of relays.
Mode K b a t K d u m p K l o a d
M 1 000
M 2 010
M 3 100
M 4 101
M 5 011
Table 2. Operating frequencies of the FPGA and converters.
Table 2. Operating frequencies of the FPGA and converters.
Frequency
Xilinx FPGA KintexTM-7 325Tup to 200 kHz, resolution 5 ns
PV converters20 kHz
Battery converter10 kHz
Table 3. Performance of the microgrid.
Table 3. Performance of the microgrid.
Healthy RegimeFaulty Regime
Response time0.06 s0.2 s
Frequency variation±0.005 Hz±0.085 Hz
Voltage variation±0.9%±28%
Clearing time0.03 s0.153 s
THD 0.31%4%
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

El Zerk, A.; Ouassaid, M. Real-Time Fuzzy Logic Based Energy Management System for Microgrid Using Hardware in the Loop. Energies 2023, 16, 2244. https://doi.org/10.3390/en16052244

AMA Style

El Zerk A, Ouassaid M. Real-Time Fuzzy Logic Based Energy Management System for Microgrid Using Hardware in the Loop. Energies. 2023; 16(5):2244. https://doi.org/10.3390/en16052244

Chicago/Turabian Style

El Zerk, Abdallah, and Mohammed Ouassaid. 2023. "Real-Time Fuzzy Logic Based Energy Management System for Microgrid Using Hardware in the Loop" Energies 16, no. 5: 2244. https://doi.org/10.3390/en16052244

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