1 Introduction

In recent years, the demand for energy in remote areas is on the increase. To meet this ever-growing demand, energy is supplied using diesel generators (DG) in the framework of off-grid microgrid (MG). However, the production cost of such energy is relatively high; besides, there is a worldwide concern to reduce CO2 emissions being the main cause of global warming. To face these challenges, photovoltaic (PV) systems were introduced and soon became extensively used. With a well-dimensioned PV system, the use of DG fuel can be dramatically decreased. Though, an efficient power management (PM) policy is required to optimally drive any possible energy storage system (ESS) such as electrochemical batteries [1,2,3,4,5,6,7].

PV power fluctuations, which depend highly on weather conditions, push the stability of MG in terms of frequency regulation to the limit. The stochastic nature of power demand can also have an additional effect. Since it is considered as a direct sign of power equilibrium between generation and consumption, frequency deviation from the rated value can reduce the reliability of connected equipment or even damage them. This is probable even when ESS is included due to the fast behavior of insolation fluctuations compared to DG and ESS dynamics. Many works have been proposed to solve such problem [8,9,10,11,12,13,14]; however, simultaneous targeting of MG energy management as a long horizon (hours) with MG frequency regulation as a short horizon (seconds) in one unique controller is a challenging task.

In Ref. [15], authors propose a hierarchical energy management strategy for an island PV/fuel cell/battery hybrid DC microgrid where the optimum structure and sizing scheme composed of PV generator, a battery, a fuel cell (FC) system and an electrolyzer are designed using HOMER pro-software. The proposed hierarchical energy management strategy is based on local control layer which is used to control the inherent operating characteristics; while the power flow between the battery and FC is allocated to minimize the hydrogen consumption using a system control layer. The proposed strategy has been tested and validated on an island DC MG hardware-in-loop Simulink platform established using RT-LAB real-time simulator.

In Ref. [16], authors proposed an adaptive supervisory energy management system to monitor, control, and optimize the performance of the hybrid FC/ESS power system. The proposed approach uses the adaptive Pontryagin’s minimum principle (A-PMP) to adapt the control parameters using the state of charge (SOC) and load power feedback. The proposed method has been investigated using three different load profiles under MATLAB/Simulink environment as well as on experimental platform.

In Ref. [17], authors propose an optimized energy management system of hybrid system composed of FC and gas micro-turbines as backup sources and PV and wind as renewable energy sources. The proposed system uses neural network as well as fuzzy logic controllers in order to minimize the energy production cost and keeping buffer role of the hybrid power system. The proposed approach has been tested and validated using MATLAB/Simulink software for the overall hybrid system during 24-h load variation, proving the performance of the proposed control approach avoiding the problems of unexpected load peaks and/or discontinuous energy production.

In all previous studies, different controllers to manage and supervise MG within different control layers are developed and validated. Those layers are connected to each other, in which the higher layer (PM) manages the power of energy sources and storage in MG based on some economical and technical requirements, while the lower layer (power control) makes sure that the different subsystems follow the sent power references, usually via PI (proportional–integral) controllers. The purpose of this study is to combine power management and power control layers in one structure using fuzzy logic topology, this new control scheme will be able to manage different timescale tasks in MG from few seconds up to 1 day. The proposed FL controller has three objectives, namely DG fuel reduction, ESS SOC supervising, and MG frequency regulation. Various engineering applications of these days include FL to solve some technical problems [18,19,20].

Most of the industrial processes today are characterized by complex multivariable models which makes it hard—sometimes impossible—to use linear controllers. With appropriate logic rules, which should be grounded on a skilled human logic, FL controller can easily and robustly link between inputs and outputs to accomplish regulation, tracking or supervising tasks with only IF–THEN procedure. In the case of control/management, FL can accomplish several missions like optimal power sharing in a hybrid car [21], extracting the maximum of available power in a PV system [22, 23], or optimally manage the power flow in a MG [24]. In Refs [25, 26], similar approaches to the one proposed here have been presented; however, the developed controllers have not been configured when ESS is connected; moreover, they aim just to find a trade-off between maximizing the PV production while controlling the frequency deviation, hence, a real power dispatching between DG, PV, load, and any possible ESS has not been treated.

As mentioned earlier, and unlike previously declared approaches, the contribution of the proposed method is to deal with different targets in different timescales using one controller, which are the DG fuel economy as a long-term management (up to 1 day); SOC supervising as a medium-term management (up to hours) and frequency control as a short-term management (up to seconds). Considering the different situations, FL gives high flexibility, robustness, and performance when applying control.

The remainder of this paper is organized as follows: In Sect. 2, mathematical modeling of MG components, that will be later simulated using the proposed method, is presented. Section 3 explains the topology of MG with the chosen control methods. Section 4 includes the hysteresis PM with conventional frequency regulation as a reference method as well as the proposed FL-based method. Computer simulation performed using the proposed method including an evaluation study versus the reference one is given in Sect. 5. Finally, Sect. 6 states the main conclusions of this work.

2 Modeling of energy sources and storage

In this section, mathematical models for MG components (DG, PV, and ESS) are detailed and simulated. No improvements have been added, since the main goal of this study is to contribute only in MG control and management.

2.1 Diesel generator model

A standard simplified model of DG and speed governor is illustrated in block diagram form (Fig. 1).

Fig. 1
figure 1

DG model with MATLAB/Simulink

This model is widely used and perfectly describes the dynamic behavior of small diesel generator sets, as shown in [27]. The diesel engine and the valve actuator servomechanism are represented by first-order lags, with time constants Td and Tsm, respectively (Fig. 2).

Fig. 2
figure 2

Diesel engine model and the excitation system with Simulink

Parameters of the speed governor are the drop R and the proportional–integral regulator parameters. The objective of the PI control is to eliminate the steady-state frequency error, and in many cases (particularly in small and older units), it may be absent.

The diesel engine must be able to follow the variation in loads power. The frequency control performance indicates how well the diesel and its governor maintain the balance of active power in the system, whereas variation in voltage shows how well the gen-set and its voltage regulator maintain the balance of reactive power via the generator excitation (Fig. 3). Basically, frequency and voltage are not perfectly constants because the load power, and consequently the MG power balance, fluctuates continuously.

Fig. 3
figure 3

Excitation system with Simulink

Thereafter, a numeric simulation with MATLAB/Simulink has been realized for DG for a 10-min scenario. The main parameters of diesel engine model are cited in Table 1.

Table 1 Diesel model parameters

The load power, diesel mechanical power, and voltage excitation variations are presented in Figs. 4, 5, and 6, respectively.

Fig. 4
figure 4

Load power variation

Fig. 5
figure 5

Diesel mechanical power variation

Fig. 6
figure 6

DC excitation voltage variation

Figures 7 and 8 illustrate the DG produced power quality in terms of voltage and current (with no connected PV or ESS).

Fig. 7
figure 7

AC voltage with only diesel generator

Fig. 8
figure 8

AC current with only diesel generator

2.1.1 PV array model

PV cell is the most basic generation part in PV system. Single-diode mathematic model is applicable to simulate silicon PV cells which consist of a photocurrent source Iph, a nonlinear diode, internal resistances Rs and Rsh. The mathematic relationship for the current and voltage in the single-diode equivalent circuit can be described as:

$$I = I_{\text{ph}} - I_{\text{s}} \left( {e^{{q\frac{{V - I \cdot R_{\text{s}} }}{PN \cdot K \cdot T}}} - 1} \right) - \frac{{V - I \cdot R_{\text{s}} }}{{R_{\text{sh}} }}$$
(1)

where Iph is photocurrent; I is diode saturation current; q is coulomb constant (1.602 × 10−19 C); K is Boltzmann’s constant (1.38 × 10−23 J/K); T is cell temperature (K); PN is PN junction ideality factor; Rs and Rsh are intrinsic series and parallel resistances.

The photocurrent is the function of solar radiation and cell temperature, described as:

$$I_{\text{ph}} = \left( {\frac{S}{{S_{\text{ref}} }}} \right)\left[ {I_{\text{ph-ref}} + C_{\text{T}} \left( {T - T_{\text{ref}} } \right)} \right]$$
(2)

where S is the real solar radiation (W/m2); Sref, Tref et Iph-ref are the solar radiation, cell absolute temperature and photocurrent in standard test conditions respectively; CT is the temperature coefficient (A/K).

The diode saturation current varies with the cell temperature:

$$I_{\text{s}} = I_{\text{s-ref}} \left( {\frac{T}{{T_{\text{ref}} }}} \right)^{3} e^{{\left[ {\frac{{qE_{\text{g}} }}{PN \cdot K}\left( {\frac{1}{{T_{\text{ref}} }} - \frac{1}{T}} \right)} \right]}}$$
(3)

where Is-ref is the diode saturation current in standard test conditions; Eg is the band-gap energy of the cell semiconductor (eV), depending on the cell material.

The main physical parameters of the used PV array are cited in Table 2.

Table 2 PV model parameters

2.1.2 Battery model

The equivalent circuit for ESS model is the most suitable for dynamic simulation. Based on Shephred battery model, Ref. [28] presents a generic battery model for dynamic simulation, which assumes that the battery is composed of a controlled-voltage source with series resistance. The equivalent electric circuit is presented in Fig. 9.

Fig. 9
figure 9

Generic battery model with Simulink

The expression of the controlled-voltage source is:

$$E = E_{0} - k\frac{Q}{{Q - \mathop \smallint \nolimits i_{b} {\text{d}}t}} + Ae^{{ - B\mathop \smallint \nolimits i_{b} {\text{d}}t}}$$
(4)

where E is no-load voltage (V); E0 is battery constant voltage (V); k is polarization voltage (V); Q is battery capacity (Ah); A is exponential zone amplitude (V); B is exponential zone time constant inverse (Ah−l).

This model assumes that the internal resistance of the battery is kept constant during both charging and discharging cycles. All parameters are deduced from the discharging profile. Figure 10 shows the discharging characteristics of the battery at different currents.

Fig. 10
figure 10

a Characteristics curve of one lead acid cell at different discharge currents, b zoom-in of interval [0; 2 Ah]

All parameters can be calculated by three points marked on the figure, namely fully charged voltage (Efull), end of exponential zone (Eexp, Qexp), and end of nominal zone (Enom, Qnom) (Table 3).

Table 3 ESS model parameters

Formulas for calculating the model parameters are:

$$\left\{ {\begin{array}{*{20}l} {A = E_{\text{full}} - E_{ \exp } } \hfill \\ {B = {\raise0.7ex\hbox{$3$} \!\mathord{\left/ {\vphantom {3 {Q_{ \exp } }}}\right.\kern-0pt} \!\lower0.7ex\hbox{${Q_{ \exp } }$}}} \hfill \\ {K = \left[ {E_{\text{full}} - E_{\text{nom}} + A\left( {e^{{ - BQ_{\text{nom}} }} - 1} \right)} \right]} \hfill \\ \end{array} } \right.$$
(5)

3 Power topology and control

Figure 11 shows a whole MG system architecture.

Fig. 11
figure 11

Grid-connected hybrid power system

The MG system is composed of a large PV array connected with two power-conditioning stages:

  • DC/DC boost converter to rise up PV voltage and extract the maximum of available PV power thanks to maximum power point tracking (MPPT) technique;

  • The second stage is DC/AC two-level PWM inverter/charger to convert DC current to AC current synchronized with MG;

  • An additional ESS is connected to the DC side of PV inverter through reversible DC/DC buck–boost converter. The ESS DC-coupled topology is chosen since it does not require high complex control and synchronization procedures as AC-coupled one. Various power topologies for hybrid MG with different advantages are clarified in [29].

The addition of ESS gives more autonomy to the hybrid system which makes PV inverter connected to MG even when there is no available PV power (typically during nights or cloudy periods). However, ESS SOC must be permanently supervised and operated within two control limits; fully charged batteries cannot recover sudden PV excess which may then damage them, when frequent deep discharging may well reduce their operational lifetime.

ESS converter is controlled to keep DC voltage at the desired level. The hybrid inverter is controlled to exchange power with MG according to the set point sent manually from the MG operator or automatically from PM layer. In this work, the possibility to manage the power flow in MG by merely controlling the hybrid inverter has been proven, and this will be the main objective of Sects. 3 and 4.

3.1 Inverter control

The active and reactive powers are controlled separately with the help of PWM voltage-controlled inverter. The active power is controlled through the shifting angle φ between MG and inverter voltages using PI controller. The reactive power is controllable using the index modulation, and it is maintained at 1 permanently due to the fact that no need for additional voltage regulation, and consequently, no reactive power exchange is proposed in this work (Fig. 12). The MG voltage is maintained constant only with DG excitation system.

Fig. 12
figure 12

Inverter/charger Simulink diagram control

3.2 Battery control

The DC/DC batteries converter is controlled in order to regulate the DC link voltage at a level in which the inverter can operate properly (700 V). This is feasible using two PI controllers within two combined control loops: the outer loop for voltage control which gives the reference to the inner one: current control. The entire Simulink-based diagram is represented in Fig. 13.

Fig. 13
figure 13

ESS DC/DC converter control

3.3 MPPT control

The PV array is controlled to extract the maximum available power via MPPT. In this work, a simple P&O MPPT tool is chosen to select the PV current reference according to the MPP which depends essentially on solar irradiation (Fig. 14).

Fig. 14
figure 14

Simulink-based P&O MPPT control

4 Power management

4.1 Hysteresis-based PM

The hysteresis-based PM consists of sending two power references (Pmin and Pmax) to the hybrid inverter according to two ESS SOC limits (SOCmin and SOCmax) (Fig. 15).

Fig. 15
figure 15

Hysteresis power management diagram

The purpose is to keep SOC perpetually operating within these two limits regardless of the power flow direction through the inverter (feeding/recovering).

To consider the frequency regulation, the reference power sent from PM layer is then to be passed through the frequency control layer before being sent again to the hybrid inverter control system (Fig. 16).

Fig. 16
figure 16

Hysteresis power management diagram with conventional frequency control

When the MG frequency is between Fmin (minimum frequency value) and Fr (regulation frequency value), the controller injects the entire power sent from hysteresis PM layer without adjustment. When the MG frequency exceeds Fr, the inverter starts the regulation by reducing the amount of power to be fed proportionally to frequency deviation. When the MG frequency is beyond Fmax (maximum allowed frequency value), the controller disconnects the PV inverter from the MG allowing only DG to take the charge of frequency regulation. This whole technique is depicted in Fig. 17.

Fig. 17
figure 17

PV active power control according to frequency regulation

4.2 Fuzzy-based PM

In this section, we describe the proposed fuzzy algorithm to manage the power flow in MG targeting some technical and economical purposes. The proposed controller can simultaneously deal with optimal power sharing and frequency stability in MG. FL controller has as inputs the frequency deviation from rated value (50 Hz), solar insolation, and batteries SOC level as shown in Fig. 18.

Fig. 18
figure 18

Fuzzy membership functions of inputs

The frequency deviation gives FL controller an idea about the power balance in MG: Frequency drop means that the power demand is higher than the supplied power, while the frequency rise means an excess of power generation is detected. The insolation, as a second input, provides information about the available PV power in the DC link. Since the ambient temperature has less influence on PV generation compared to the insolation, it is excluded from the controller scheme for a simplification reason. To take the ESS operational constraints into consideration, SOC is included as a third input, keeping it within two limits whatever is the power flow in MG can preserve enough capacity in ESS to react to any sudden ask for power balance adjustment in MG.

Real-time measurement of input variables gives FL controller enough information about the actual operational point in MG, thus allowing it to take appropriate decisions about what amount of power should be exchanged (injected or recovered) with MG (Fig. 19).

Fig. 19
figure 19

Fuzzy membership functions of output: exchanged power (Pref)

According to the number and form of membership functions of inputs/outputs and the implemented logical rules that are figured within the fuzzy surfaces (Fig. 20), FL controller acts, in real time, upon the power exchanged between MG and the hybrid system to achieve the following objectives:

Fig. 20
figure 20

Fuzzy surfaces that cover all implemented rules

  • Favoring the use of PV power instead of DG power when feeding load or charging batteries.

  • Injecting more power to MG when the frequency drops and absorbing it when the frequency increases.

  • Keeping batteries SOC operating within two predefined control limits.

  • Favoring frequency regulation over power dispatching when managing the power in MG.

5 Results and discussion

This section presents the simulation results for an off-grid MG with the proposed control techniques using Matlab/Simulink environment. DG, PV, and ESS parameters are cited in Tables 1, 2, and 3, respectively. The power converter parameters are cited in Table 4.

Table 4 Power converters parameters

Weather conditions in terms of solar irradiation and temperature are presented in Figs. 21 and 22, respectively. The insolation is a real profile taken in July 9, 2006, in Tamanrasset town (Southern Algeria), and it comprises a deep declining in insolation at nearly 11:15 for less than 1 h due to a cloud movement, which is going to provoke a sudden drop in PV generation. This is considered as an appropriate case to test the robustness of the proposed controller against higher power unbalance in MG between power generation and consumption. Figure 23 shows the chosen load profile which is the residential active power demand of the same town scaled down to 1000.

Fig. 21
figure 21

Solar irradiation variation (W/m2)

Fig. 22
figure 22

Temperature variation (°C)

Fig. 23
figure 23

Load power variation (kW)

The first test has been performed using hysteresis PM, and its parameters are cited in Table 5.

Table 5 Hysteresis management parameters

In hysteresis PM, the only required feedback signal is SOC measurement, and then the controller manages the power between the energy producers and consumers according to this feedback through the hybrid inverter. SOC is kept inside the optimal zone whatever is the power flow in MG. Supplied PV power feedback is not required since it can be simply estimated through SOC evolution thanks to ESS DC-coupled topology. PV power can be fed directly to MG or stored in ESS according to the power demand and the inverter set point control. Despite its simplicity, hysteresis PM is not designed to maximize the use of PV power. On the other hand, the balance between power generation and consumption in MG is the charge of DG (Fig. 24). Consumed DG energy during the testing day with hysteresis PM is 692,100 kWh.

Fig. 24
figure 24

Power dispatching and battery SOC variation with hysteresis management

Since it requires a real-time measurement of insolation, fuzzy PM controller can maximize, as much as possible, the use of PV power when feeding load. SOC, as a second feedback, is necessary for an optimal operation of ESS. Fuzzy rules focus on operating ESS between 50 and 90% as a tolerable operational zone. Contrary to hysteresis PM, FL MP can indirectly follow the power balance in MG using the frequency deviation as feedback. However, the difference between inverter power and load power stills the charge of DG (Fig. 25). In simulation, diesel energy is 608,100 kWh using fuzzy PM.

Fig. 25
figure 25

Powers dispatching and battery SOC variation with fuzzy management

Figure 26 presents the DC bus regulation for both strategies. With small rapid fluctuations caused by the exchanged power between MG and the inverter, DC voltage is well controlled which means a good balance is satisfied between fed PV/ESS power and the injected/recovered inverter power. In fuzzy PM, the DC voltage regulation is soft due to the smooth power profile in which the hybrid inverter is operated with (Fig. 27).

Fig. 26
figure 26

DC bus voltage variation with hysteresis

Fig. 27
figure 27

DC bus voltage variation with fuzzy PM

The MG AC voltage quality in the case of fuzzy-controlled inverter (Fig. 28) is slightly better than hysteresis-controlled inverter (Fig. 29). However, THD levels of the AC voltage using both strategies are acceptable.

Fig. 28
figure 28

a AC voltage (pu) fed with fuzzy PM, b zoom-in [10.5 s; 10.55 s])

Fig. 29
figure 29

a AC voltage (pu) fed with hysteresis PM, b zoom-in [10.5 s; 10.55 s])

Despite that a conventional frequency control is provided, frequency deviation when hysteresis PM is applied (Fig. 30) is significant compared to fuzzy PM (Fig. 31), and this is due to the fact that fast changing in the inverter set points with hysteresis PM disturb temporally the MG power balance (black circles). Moreover, PV generation fluctuations (red circles) have also an additional effect, and in fuzzy PM, implemented rules take into consideration the frequency deviation when exchanging power with MG. PV fluctuations in this case are absorbed by ESS, and consequently, fuzzy controller gives priority to frequency control over maximizing PV power, supervising simultaneously SOC evolution.

Fig. 30
figure 30

MG frequency with hysteresis PM

Fig. 31
figure 31

MG frequency with fuzzy PM

The main contribution in this study is summarized on the fact that the proposed fuzzy PM can take different time scales tasks in one control action, it is able to control frequency and DC voltage unbalances in terms of seconds, ESS SOC evolution in terms of minutes and the PV maximization in terms of hours. Usually, this can be performed using separate controllers within different layers. The proposed fuzzy-based controller reduces the DG fuel consumption by more than 12% compared to classical hysteresis management control.

6 Conclusion

This work proposed a new PM for DG, PV, and ESS-based hybrid MG using Mamdani FL technique. The developed controller aims to accomplish several tasks acting only on the hybrid inverter. It optimizes the power flux in MG maximizing the use of PV power when feeding load and operating efficiently ESS. Transient power unbalances in MG, which are usually translated to frequency deviations, are also corrected. The hybrid inverter injects more power to MG when a frequency drop is detected and recovers it when a frequency rise is detected, in contrast to the classical hysteresis management with a conventional frequency control. Comparative simulation results prove the superiority of the fuzzy controller regarding to the DG fuel economy and MG dynamic stability. The proposed fuzzy-based controller reduces the DG fuel consumption by more than 12% compared to classical hysteresis management control. Moreover, the proposed controller performs well regarding the conventional frequency regulation which is widely used in MGs. As perspective works, the fuzzy controller is to be reconfigured including AC voltage control in MG as an additional feature. With such new pattern, the controller will be able to avoid local overvoltage at the common coupled point while feeding active power which is a typical problem in of low voltage grids. This is feasible by adjusting the reactive power exchange between the hybrid inverter and MG simultaneously with active power feed.