1 Introduction

The use of renewable energy sources (RESs) has been increased in the past few years due to the depletion of traditional resources and the harmful impact of greenhouse gases on our planet. Also, the increasing demand for energy has led to the large-scale use of RESs. In fact, various RESs can be incorporated together to form a power system. RESs can be also integrated into existing non-renewable power system to improve its reliability [1]. The photovoltaic (PV) technology is the most attractive solution among RESs. The PV power generation is highly dependent on environmental conditions, such as sun irradiation and temperature [2]. Hence, it is required to integrate energy storage systems (ESSs) (e.g., batteries, supercapacitors, hydrogen storage systems, flywheels) [3, 4]. The integration of these ESSs with RESs systems is required to overcome the intermittency nature of solar energy and wind energy, especially in standalone applications [5, 6].

The distributed structure of the traditional electrical networks requires the use of AC (alternating current) buses to transport the electricity for long distances from the energy sources to the end consumers. However, several devices operate with DC (direct current) power necessitating then the use of AC/DC converters. In addition, there are various applications with DC equipment such as light-emitting diode (LED) illumination, and electric vehicles (EVs). In this direction, DC microgrid (MG) has recently gained more attention due to its benefits over AC microgrid. Since PV generators and batteries are DC power sources, it is easier to integrate these sources in DC microgrids. Therefore, unlike AC MG, DC MG, significantly reduces the number of power converters, which are generally used to adapt the power for the end consumer. Furthermore, the DC microgrid presents high efficiency comparing to the AC MG as demonstrated in [7]. PV/Battery systems are the basic form of DC microgrid, and are widely used in several applications, such as telecommunication, smart buildings, and electric vehicles. The evolution of power converters has facilitated the integration of RESs together to form a microgrid. Considering the number of power converters used in a PV/Battery system, various configurations are possible. The ideal configuration is to use a DC-DC power converter to connect the PV module and another DC-DC power converter to connect the battery to a DC bus. The DC load can be connected to the DC bus with or without an additional DC-DC power converter. Moreover, in the case of AC loads, other power converters are required, like the voltage source inverter (VSI) in this case.

Several issues need, however, to be addressed in PV/Battery systems. Mainly, it is important to extract the maximum power available from the PV generator using maximum power point tracking (MPPT) techniques. Nowadays, various MPPT algorithms have been proposed in the literature in order to track the maximum power point (MPP) for PV modules. The proposed MPPT algorithms have the same purpose, but differ among them concerning efficiency, design complexity, and hardware implementation. Authors in [8] have conducted a study about various MPPT algorithms with recommendations for suitable embedded boards for each method. They showed that the choice of a low cost and powerful microcontroller for MPPT implementation is desirable in order to minimize the cost of the overall system [9, 10]. The most popular MPPT algorithms are the perturb and observe (P&O) algorithm and the incremental conductance (IC) algorithm [11]. Other advanced algorithms have been proposed, such as particle swarm optimization, fuzzy logic control, and artificial neural networks [12].

In some applications, such as standalone applications where the injection of the excess power into the grid is not allowable, the system is not intended to track all the time the maximum power point. Therefore, the system must be able to limit the power generated by the PV source in order to satisfy the supply/demand balance. For instance, a technique for PV power limitation is proposed in [13]. Since the battery is an expensive element in a PV/Battery system, the charge/discharging cycle of the battery must be adapted properly in order to enhance its lifetime by preventing its overcharging and deep discharging [14]. The different operations of the MG must be supervised autonomously through an energy management and control system (EMCS). Therefore, information and communication technologies will enhance the performance of the system and allow the user to track different measurements of the system. For instance, an energy management platform for MG systems using the internet of things (IoT) and big-data technologies has been proposed in [15] for building applications.

In [16] authors proposed a power management strategy for PV/Battery hybrid system in islanded MG. The PV/Battery system operates as a voltage source using an adaptive droop control strategy in order to satisfy the load demand while managing the operations of charging/discharging of the battery. Another control strategy for a standalone PV system was proposed in [17]. The main objective of this control strategy is to enhance the lifetime of the battery while satisfying the DC load demand. A similar system was presented in [18]. The system comprises a solar PV array with dual ESSs (a battery energy storage system and a supercapacitor).

In [16, 19], droop control techniques have been used for microgrids which are composed of PV/Battery systems. The droop control is used because it does not require access to all measurements of the system, especially in large and complex systems. However, the droop control presents a lot of drawbacks such as poor transient performance and low accuracy in power sharing [20]. Additionally, the recent development of sensors, embedded systems, and IoT technologies, has encouraged the use of efficient energy management of microgrid systems [21].

In this paper, an energy management and control strategy (EMCS) is proposed for energy management of DC MG with PV/Battery system feeding a DC load. The control strategy must ensure the following constraints: (i) rely on PV module as the main source to satisfy the load demand, (ii) take into consideration the lifetime of the battery by ensuring its operation within predefined limits, (iii) use the main grid to supply the load when the battery is under a lower limit and the PV power generation is insufficient. In summary, the main contributions of this work are as follows: i) design and implementation of a control strategy for efficient energy management according to the abovementioned constraints, ii) simulations have been conducted and results are reported to assess the performance of the proposed control strategy for DC microgrid systems.

The remainder of this paper is organized as follows. In Sect. 2, an overview of the system configuration and modeling are presented, followed by the control design and energy management strategy in Sect. 3. In Sect. 4, simulation results show different operation modes of the developed system under various conditions. Finally, concluding remarks and some perspectives are presented in Sect. 5.

2 Materials and Methods

The proposed MG is designed to supply DC loads. It is composed, as depicted in Fig. 1, of a PV module of 213 W rated power, a lead-acid battery, and a DC. The solar PV module is connected to the DC bus via a boost converter and the battery is connected to the DC bus via a DC-DC bidirectional buck/boost converter, while the load is connected to the DC bus via a switch. The main objective of the boost converter is to extract the maximum power available from the PV module, which is the main source to supply the load. This converter is controlled using a PWM signal, which controls the gate of the MOSFET of this converter. The duty cycle of the PWM signal is defined by the MPPT algorithm. In fact, the P&O algorithm is used to track the MPP of the PV module. Unlike the structure in which the battery is connected directly to the DC bus [22], the use of the bidirectional converter provides the required protection for the battery. Indeed, the bidirectional converter maintains the DC bus voltage constant. Additionally, it helps to manage the operations of charging and discharging of the battery. Therefore, the battery does not exceed its state of charge (SoC) limits defined by the EMCS.

Fig. 1
figure 1

The structure of the proposed DC microgrid

The proposed MG system can operate in both standalone mode and grid-connected mode using a switch, which defines the operation mode of the MG, as presented in Fig. 1. In some countries, like Morocco, MGs are not yet allowable to sell the excess power to the main grid especially for small-scale installations. As a result, the proposed system can only receive power from the main grid. The power flow between different components of the proposed DC microgrid and the control actions are taken based on the decisions of the proposed EMCS.

2.1 PV Model

A PV module is composed of a group of solar cells associated in parallel and/or in series. These cells convert solar energy into electric power. There are various models of solar cells [23], and the most used consists of a single diode connected to a parallel resistor called shunt resistor \(R_{sh}\) and a serial resistor \(R_{s}\). This model is used in our study for evaluating the performance of the PV panel [5].

The output current of a solar cell is given by Eq. 1, where \(I_{ph}\) denotes the photocurrent, it depends on the insolation (i.e., the degree of its exposure to the sun's rays) and cell’s temperature. \(I_{0}\) denotes the reserve saturation current of the diode, it depends mainly on the temperature. \(I_{ph}\) and \(I_{0}\) can be expressed by Eqs. 2 and 3 respectively, where \(V\) and \(I\) denote respectively the output voltage, and the output current of the PV cell, \(I_{SCR}\) represents the short-circuit current at the reference condition, \(G\) and \(T\) denote the irradiation (\({\text{w}}/{\text{m}}^{2}\)) and the temperature (\(K\)) respectively, \(I_{sr}\) represents the saturation current at the reference temperature, \(K_{r}\) is the short-circuit temperature coefficient, \(T_{r}\) represents the reference temperature (K), \(a\) is the diode ideality factor, \(E_{g}\) represents the band gap energy, \(k\) is the Boltzmann’s constant, which is \(1.38 \times 10^{ - 23} \,{\text{J}}/{\text{K}}\), and q is the electron charge \((1.6 \times 10^{ - 19} \,{\text{C}})\).

$$I = I_{{{\text{ph}}}} - I_{0} \left( {\exp \left( {\left( \frac{q}{akt} \right)*(V + I*R_{s} )} \right) - 1} \right) - \left( {\frac{{V + I*R_{s} }}{{R_{{{\text{sh}}}} }}} \right)$$
(1)
$$I_{{{\text{ph}}}} = (I_{{{\text{SCR}}}} + K_{i} (T - T_{r} ))*(0.001*G)$$
(2)
$$I_{o} = I_{rs} \left( {\frac{T}{{T_{r} }}} \right)^{3} \exp \left( {\left( {\frac{{qE_{g} }}{ak}} \right)\left( {\frac{1}{{T_{r} }} - \frac{1}{T}} \right)} \right)$$
(3)

For a PV module composed of \(N_{s}\) cells in series and \(N_{p}\) cells in parallel, the mathematical model can be then expressed as follow:

$$I = N_{p} I_{ph} - N_{p} I_{0} \left( {\exp \left( {\left( {\frac{a}{{N_{s} akT}}} \right)\left( {V + I\frac{{N_{s} }}{{N_{p} }}R_{s} } \right)} \right) - 1} \right) - \left( {\frac{{V + I\frac{{N_{s} }}{{N_{p} }}R_{s} }}{{\frac{{N_{s} }}{{N_{p} }}R_{sh} }}} \right)$$
(4)

The characteristics of the PV module used in this study are listed in Table 1.

Table 1 PV panel specifications (\({\text{kW}}/{\text{m}}^{2} ,\,25\,^{^\circ } {\text{C}}\))

The characteristics of the PV module under various values of temperature and solar irradiation are illustrated in Figs. 2 and 3.

Fig. 2
figure 2

a I-V characteristic curves of the PV module for different temperatures at G = 1 kW/m2; b P–V characteristic curves of the PV module for the same conditions

Fig. 3
figure 3

a I-V curves for different irradiation conditions at T = 25 °C; b P–V curves for the same conditions

2.2 Boost Converter Model

A DC-DC boost converter is a power converter that steps voltage from a low voltage to a high voltage. It is composed of a switch, a diode, an output capacitor, and an inductor. The architecture of a boost converter is illustrated in Fig. 4. This converter is used to connect the PV module to the DC bus. Its main objective is to extract the maximum power from the PV module by means of an MPPT algorithm. Averaged small-signal state-space representation (Eq. 5) has been proposed in [24] for boost converter in PV application, where \(r_{pv}\) represents the dynamic resistance of the PV module. It has a negative value, which can be obtained from the I-V characteristic. As a result, it has different values depending on the operating point which is highly affected by environmental conditions.

Fig. 4
figure 4

Circuit diagram of the boost DC–DC converter

In this model, \(\hat{v}_{pv}\), \(\hat{i}_{L}\), and \(\hat{d}\) are respectively small perturbations of \(v_{pv}\), \(i_{L}\) and \(d\) around the operating point and are expressed in Eq. 6

$$\left\{ \begin{gathered} \frac{d}{dt}\hat{x} = \frac{d}{dt}\left[ \begin{gathered} \hat{i}_{L} \hfill \\ \hat{v}_{pv} \hfill \\ \end{gathered} \right] = \left[ {\begin{array}{*{20}c} 0 & \frac{1}{L} \\ { - \frac{1}{{C_{pv} }}} & {\frac{1}{{r_{pv} C_{pv} }}} \\ \end{array} } \right]\left[ \begin{gathered} \hat{i}_{L} \hfill \\ \hat{v}_{pv} \hfill \\ \end{gathered} \right] + \left[ {\frac{{V_{dc} }}{L}} \right]\hat{d} \hfill \\ \hat{y} = \left[ {\begin{array}{*{20}c} 0 & 1 \\ \end{array} } \right]\left[ \begin{gathered} \hat{i}_{L} \hfill \\ \hat{v}_{pv} \hfill \\ \end{gathered} \right] \hfill \\ \end{gathered} \right.$$
(5)

where \(C_{pv}\) and \(L\) are respectively the input capacitor and the inductor of the converter:

$$\begin{gathered} v_{pv} = V_{pv} + \hat{v}_{pv} \hfill \\ i_{L} = I_{L} + \hat{i}_{L} \hfill \\ d = D + \hat{d} \hfill \\ \end{gathered}$$
(6)

By applying the Laplace transformation to Eq. 5, the following transfer function is obtained.

$$G(s) = \frac{{\hat{i}_{L} (s)}}{{\hat{d}(s)}} = \frac{{(C_{pv} r_{pv} - 1)V_{dc} }}{{LC_{pv} r_{pv} s^{2} - Ls + r_{pv} }}$$
(7)

2.3 Battery Modeling

In MG applications, batteries are essential elements to store high amount of energy in order to overcome the intermittency of the RESs generation. The lead-acid battery is the most used type in MGs due to its robustness and low price. The model of a lead acid battery is considered in this study. This model is consisting of a controlled voltage source in series with internal resistance \(R\). Different models (e.g., electrochemical, electrical-circuit) of the battery have been proposed in the literature depending on its application [25, 26]. Electrical-circuit models (e.g., the first order RC model, the second order RC model) are commonly used for batteries’ behavior estimation. For instance, in [27] an easy-to-use battery dynamic model is proposed. In this model, the internal resistance of the battery is supposed constant and the affection of the temperature on the model’s behavior is neglected. For a battery with a capacity \(Q\)(in \(Ah\)) and a current \(i\), the battery voltage \(V_{bat}\) for both charge and discharge are described in Eqs. 8 and 9 respectively, where, \(E_{0}\) refers to the battery constant voltage,\(\lambda\) represents the polarization constant \(\left( {V \, /\left( {Ah} \right)} \right)\), \(it\) is the actual battery charge, \(i^{*}\) is the filtered current and \(Exp\left( t \right)\) represents the exponential zone voltage (V).

$$V_{bat} = E_{bat} - R.i = E_{0} - R.i - \lambda \frac{Q}{Q - it}(it + i^{*} ) + Exp(t)$$
(8)
$$V_{bat} = E_{bat} - R.i = E_{0} - R.i - \lambda \frac{Q}{it - 0.1Q}i^{*} - \frac{Q}{Q - it}it + Exp(t)$$
(9)

A battery characterization methodology have been proposed in [28]. Also, the parameters of the model were extracted for a lead-acid battery in the EEBLab (Energy Efficient Building Laboratory) in our university [28]. Regarding the SoC estimation, a complete study about online battery state-of-charge estimation methods in micro-grid systems was presented in [3]. In fact, four methods for SoC estimation were presented such as, Artificial Neural Network, Luenberger observer and Kalman Filter combined with Coulomb counting.

2.4 Bidirectional Converter Model

A half bridge non-isolated bidirectional buck–boost converter is chosen to connect the battery with the DC bus as depicted in Fig. 5. The bidirectional DC-DC converter consists of two power MOSFETs with anti-parallel diodes, an inductor, and two capacitors. This converter is bidirectional, which means that the power can flow from the DC bus to the battery, the converter steps-down the DC bus voltage. Similarly, the power can flow from the battery to the DC bus, the converter steps-up the battery voltage in order to achieve the desired DC voltage.

Fig. 5
figure 5

Circuit diagram of the bidirectional half-bridge DC–DC converter

By applying Kirchhoff’s law Eq. 10 is obtained when the switch \(S_{2}\) is OFF and the switch \(S_{3}\) is ON. Similarly, when the switch \(S_{2}\) is ON and the switch \(S_{3}\) is OFF, Eq. 11 is obtained.

$$\left\{ \begin{gathered} L_{b} \frac{{di_{Lb} }}{dt} = V_{b} \hfill \\ C_{eq} \frac{{dv_{dc} }}{dt} = - \frac{{v_{dc} }}{R} \hfill \\ \end{gathered} \right. \Rightarrow \frac{d}{dt}\left[ \begin{gathered} i_{Lb} \hfill \\ v_{dc} \hfill \\ \end{gathered} \right] = \left[ {\begin{array}{*{20}c} 0 & 0 \\ 0 & { - \frac{1}{{RC_{eq} }}} \\ \end{array} } \right]\left[ \begin{gathered} i_{Lb} \hfill \\ v_{dc} \hfill \\ \end{gathered} \right] + \left[ \begin{gathered} \frac{1}{{L_{b} }} \hfill \\ 0 \hfill \\ \end{gathered} \right]V_{b}$$
(10)
$$\left\{ \begin{gathered} L_{b} \frac{{di_{Lb} }}{dt} = (V_{b} - v_{dc} ) \hfill \\ C_{eq} \frac{{dv_{dc} }}{dt} = i_{Lb} - \frac{{v_{dc} }}{R} \hfill \\ \end{gathered} \right. \Rightarrow \frac{d}{dt}\left[ \begin{gathered} i_{Lb} \hfill \\ v_{dc} \hfill \\ \end{gathered} \right] = \left[ {\begin{array}{*{20}c} 0 & {\frac{ - 1}{{L_{b} }}} \\ \frac{1}{{C_{eq}}} & { - \frac{1}{{RC_{eq} }}} \\ \end{array} } \right]\left[ \begin{gathered} i_{Lb} \hfill \\ v_{dc} \hfill \\ \end{gathered} \right] + \left[ \begin{gathered} \frac{1}{{L_{b} }} \hfill \\ 0 \hfill \\ \end{gathered} \right]V_{b}$$
(11)

The state-space averaged model for the above equations is represented by Eq. 12. The perturbations \(\hat{v}_{dc}\),\(\hat{i}_{Lb}\), and \(\hat{d}\) are considered around the operating point as shown in Eq. 13, where \(V_{dc}\), \(I_{Lb}\), and \(D\) are the DC-link voltage, the inductor current, and the duty cycle at the operating point.

$$\frac{d}{dt}\left[ \begin{gathered} i_{Lb} \hfill \\ v_{dc} \hfill \\ \end{gathered} \right] = \left[ {\begin{array}{*{20}c} 0 & {\frac{ - 1}{{L_{b} }}(1 - d)} \\ {\frac{(1 - d)}{{C_{eq}}}} & { - \frac{1}{{RC_{eq} }}} \\ \end{array} } \right]\left[ \begin{gathered} i_{Lb} \hfill \\ v_{dc} \hfill \\ \end{gathered} \right] + \left[ \begin{gathered} \frac{1}{{L_{b} }} \hfill \\ 0 \hfill \\ \end{gathered} \right]V_{b}$$
(12)
$$\begin{gathered} v_{dc} = V_{dc} + \hat{v}_{dc} \hfill \\ i_{Lb} = I_{Lb} + \hat{i}_{Lb} \hfill \\ d = D + \hat{d} \hfill \\ \end{gathered}$$
(13)

By introducing these perturbations into the averaged model of the bidirectional converter (Eq. 12), the following small-signal averaged model is obtained (Eq. 14).

$$\frac{d}{dt}\left[ \begin{gathered} \hat{i}_{Lb} \hfill \\ \hat{v}_{dc} \hfill \\ \end{gathered} \right] = \left[ {\begin{array}{*{20}c} 0 & { - \frac{(1 - D)}{{L_{b} }}} \\ {\frac{(1 - D)}{{C_{eq} }}} & { - \frac{1}{{RC_{eq} }}} \\ \end{array} } \right]\left[ \begin{gathered} \hat{i}_{Lb} \hfill \\ \hat{v}_{dc} \hfill \\ \end{gathered} \right] + \left[ \begin{gathered} \frac{{V_{dc} }}{{L_{b} }} \hfill \\ \frac{{I_{Lb} }}{{C_{eq} }} \hfill \\ \end{gathered} \right]\hat{d}$$
(14)

3 Energy Management and Control System

3.1 Boost Converter Controller

The PV module in the studied DC microgrid can operate in two modes according to the PV power production and the SoC of the battery. These modes are the MPPT mode and the limited power mode (LPM) as depicted in Fig. 6. To satisfy the proper operation of the PV module in these two modes, a suitable control strategy is designed for the boost converter. In the MPPT mode, a modified P&O algorithm with a fixed perturbation step is used as shown in Fig. 7. In fact, the tracking controller measures the actual PV power, and then perturbs the operating point. The next perturbation of the operating point should be in the same direction if the power increases. Otherwise, the perturbation should be in the opposite direction. The controller continues applying the perturbation until the MPP is reached. Unlike the conventional P&O algorithm, the duty ratio of the PWM signal is used as the perturbed signal. Consequently, there is no need to use a PI controller in this mode. When the PV module is operating in the limited power mode, a PI controller is used to track the current reference deduced from the predefined power \(P_{LPM}\)[13]. The switching between the MPPT mode and the limited power mode is decided by the EMCS according to the state of charge of the battery.

Fig. 6
figure 6

Boost converter controller

Fig. 7
figure 7

Flowchart of the modified P&O algorithm

3.2 Bidirectional Converter Controller

The transfer functions of the bidirectional converter can be calculated from Eq. 14 using Laplace transformation as follows:

$$G_{{v_{dc} }} (s) = \frac{{\hat{v}_{dc} (s)}}{{\hat{i}_{Lb} (s)}} = \frac{{ - I_{Lb} RL_{b} s + V_{dc} R(1 - D)}}{{V_{dc} RC_{eq} s + \left( {V_{dc} + (1 - D)I_{Lb} R} \right)}}$$
(15)
$$G_{{i_{Lb} }} (s) = \frac{{\hat{i}_{Lb} (s)}}{{\hat{d}(s)}} = \frac{{RC_{eq} V_{dc} s + \left( {(1 - D)RI_{Lb} + V_{dc} } \right)}}{{RC_{eq} L_{b} s^{2} + L_{b} s + R(1 - D)^{2} }}$$
(16)

Since the main objective of the bidirectional converter is to maintain the DC bus voltage constant, two closed loops are considered as depicted in Fig. 8. The outer loop is for the DC bus voltage regulation, which generates the reference current for the inner loop. This later tracks the reference current of the inductor by changing the duty cycle of the PWM signals, which control the gates of the power MOSFETs of the bidirectional converter.

Fig. 8
figure 8

Control of the DC-DC bidirectional converter

To design the PI controller for the outer loop, the term \(- I_{Lb} RL_{b}\) in Eq. 15 is neglected. Equation 15 can be written in the following form.

$$G_{{v_{dc} }} (s) = \frac{a}{bs + c}$$
(17)

The considered PI transfer function is given by:

$$C_{{v_{dc} }} = \frac{{Kp_{1} s + Ki_{1} }}{s}$$
(18)

The closed loop transfer function is then written as follows:

$$H_{{v_{dc} }} = \frac{1}{{\frac{(bs + c)s}{{a(Kp_{1} s + Ki_{1} )}} + 1}}$$
(19)

By identifying Eq. 19 with the transfer function of a first order system, we obtain:

$$\left\{ \begin{gathered} \frac{{Kp_{1} }}{{Ki_{1} }} = \frac{b}{c} \hfill \\ \tau = \frac{c}{{a*Ki_{1} }} \hfill \\ \end{gathered} \right.$$
(20)

where \(\tau\) represent the desired system closed-loop constant time. By choosing \(\tau = 40\,{\text{ms}}\), the transfer function of the PI controller is:

$$C_{{v_{dc} }} = \frac{0.02s + 25}{s}$$
(21)

For the inner loop, the controller must ensure a fast response comparing to the outer loop. Equation 16 can be rewritten as follow:

$$G_{{i_{Lb} }} (s) = \frac{{b_{1} s + b_{2} }}{{s^{2} + a_{1} s + a_{2} }}$$
(22)

The considered PI transfer function is given by:

$$C_{{i_{Lb} }} = \frac{{Kp_{2} s + Ki_{2} }}{s}$$
(23)
$$G_{{i_{Lb} }} C_{{i_{Lb} }} = \frac{N(s)}{{D(s)}}$$
(24)

The characteristic polynomial is:

$$N(s) + D(s) = s^{3} + (a_{1} + b_{1} Kp_{2} )s^{2} + (a_{2} + b_{2} Kp_{2} + b_{1} Ki_{2} )s + b_{2} Ki_{2}$$
(25)

By identifying the coefficients of Eq. 25 with the desired characteristic polynomial:

$$(s^{2} + 2\xi \omega_{0} s + \omega_{0}^{2} )(s + \alpha \omega_{0} ) = s^{3} + (\alpha + 2\xi )\omega_{0} s^{2} + (1 + 2\alpha \xi )\omega_{0}^{2} s + \alpha \omega_{0}^{3}$$
(26)

we obtain:

$$\left\{ \begin{aligned} Kp_{2} & = \frac{{(\alpha + 2\xi )\omega_{0} - a_{1} }}{{b_{1} }} \\ Ki_{2} & = \frac{{\alpha \omega_{0}^{3} }}{{b_{2} }} \\ \end{aligned} \right.$$
(27)

where \(\xi = 0.707\) is the damping factor, and \(\omega_{0}\) the natural frequency.\(\omega_{0}\) is chosen to guarantee a fast response of the system (\(\omega_{0} = 600\,{\text{rad}}/{\text{s}}\)), and the pole \(p = - \alpha \omega_{0}\) is chosen far from the other poles of the system in order to eliminate its effect on the system.

Finally, the PI controller for the inner loop is:

$$C_{{i_{Lb} }} = \frac{0.5s + 150}{s}$$
(28)

3.3 Energy Management System

The energy management system is the unit that takes decisions regarding the operation of the system as depicted in Fig. 9. The unit takes as inputs the PV power production, the load demand and the SoC, and then decides to operate the PV module either in MPPT mode or LPM mode. Also, it decides to connect the load with the PV/Battery system or with the grid.

Fig. 9
figure 9

Diagram block of the energy management system

Figure 10 presents the operating modes of the DC MG defined by the energy management system. These operating modes should take into account the different modes of PV module (MPPT and LPM) and the battery (charging/discharging) and the load connection according to the requirements of each operating mode. Hence, the power flow within the system can be classified into three operating scenarios based on the SoC of the battery.

Fig. 10
figure 10

Flowchart of the energy management strategy

In order to enhance the battery lifetime physical constraints must be applied. The state of charge must be within a lower limit and an upper limit as in Eq. 29, [29]. The relation between the maximum SoC and the minimum SoC is defined by the depth of discharge (DoD) as in Eq. 30, [29]. In fact, the DoD has a great influence on the number of battery’s charge/discharge cycles [14].

$$SoC_{\min } < SoC < SoC_{\max }$$
(29)
$$SoC_{\min } = (1 - DoD).SoC_{\max }$$
(30)

During the first operating mode (\(SoC_{\min } < SoC < SoC_{\max }\)), the PV module operates in the MPPT mode to extract the maximum power from the PV module. The extracted power is used to charge the battery and to satisfy the load demand. Therefore, the total power generated by the PV module is injected into the DC bus. According to the amount of power injected in the DC bus, the battery in charging mode or discharging mode. In charging mode, if the power generated by the PV module is more than the load demand (Ppv > PLoad), then the battery absorbs the excess power in the DC bus. Conversely, if the PV module is not able to satisfy the load demand (Ppv > PLoad), the battery can then assist in responding to the load demand. During the first operating mode, the load is connected to the DC bus. The operation in this region is conditioned by the following constraint: the state-of-charge of the battery is between an upper limit and a lower limit. The bidirectional converter is keeping the DC bus voltage constant at the predefined value. When the battery reaches the maximum allowable SoC, it stops charging to prevent its overcharging (SoC > SoCmax). For this reason, the PV module is forced to provide the limited power needed by the load. During this mode, if the power generated by the PV module is insufficient to supply the load, the battery starts discharging. During the third mode (SoC > SoCmin), the battery should stop discharging in order to prevent its deep discharging. Hence, the load must be disconnected from the DC bus using the switch S4 (as shown in Fig. 9). Since the load is critical, it is connected to the grid. The battery, in this case, starts charging using the power delivered by the PV module.

4 Simulation Results

In order to verify and validate the control strategy proposed in this study, this section describes the simulation results obtained for each operating mode. The simulation is done using the PV module described in Table 1. A lead acid battery model is used with a capacity of 50Ah. Additionally, a constant power load (CPL) model is used to simulate the load behavior. This load model is accurate compared to the constant impedance load (CIL) model [30]. Also, the CPL model is very used to simulate the load consumption in microgrids [31]. The irradiation profile used to simulate the system in this mode is illustrated in Fig. 11. The irradiation starts at 700 w/m2 at the beginning of the simulation and continues to increase until it reaches 1000/m2. After 2 s (i.e., at 6 s) the irradiation decreases until the end of the simulation. The temperature is fixed at 25 °C.

Fig. 11
figure 11

Irradiation profile

Figure 12a shows the behavior of the first operating mode. It is clear, as expected, that the power produced by the PV module is dependent on the irradiation variations. The load demand is satisfied. Hence, the difference between the power generated by the PV module and the load consumption is stored in the battery. Starting from t = 8 s, the PV module was not able to satisfy the load demand. As a result, the battery starts discharging to meet the load demand. Figure 12b shows the state of charge of the battery during the simulation time. The DC bus voltage is maintained at the desired value as depicted in Fig. 12c.

Fig. 12
figure 12

a PV power, load power and battery power; b The state of charge of the battery; c The DC bus voltage for the 1st operating mode

Figure 13a depicts the obtained results of the second operating mode. This figure shows that the PV production is limited at around 126 Watts despite the changes in the irradiation. In fact, with the available irradiation the PV module can produce more power, but the boost converter forces the PV module to provide a limited power in order to achieve the system’s balance. The difference between the power generated by the PV module and the load power is due to the power losses in the system. Figure 13a shows also that the battery is not charging in order to prevent its overcharging. Furthermore, the DC bus voltage was kept at 48 V as depicted in Fig. 13b. In the third operating mode, the SoC is under the allowable limit. Hence it should be stopped from discharging. The PV generation was able to meet the load demand until t = 8 s where the PV power is less than the load demand as shown in Fig. 14a. As a result, the DC load is switched to the grid using the switch as depicted in Fig. 14c. The PV power is transferred to the battery. Figure 14b shows the DC bus voltage during this operating mode.

Fig. 13
figure 13

a PV power, load power and battery power; b The DC bus voltage for the 2nd operating mode

Fig. 14
figure 14

a PV power, load power and battery power; b The DC bus voltage; c The switch S4 state during the 3rd operating mode

The transient response of the DC bus voltage for the three operating modes is shown in Fig. 15. It is clear that the DC bus voltage in the three cases reaches its steady sate before with minimal overshoot. Table 2 shows the overshoot for each operating mode, the power losses, and the power ripples.

Fig. 15
figure 15

DC bus voltage transient response for: a The 1st operating mode; b The 2nd operating mode; c The 3rd operating mode

Table 2 Comparison of the three operating modes

5 Conclusions and Perspectives

In this paper, a simple energy management strategy is proposed for DC microgrids composed of PV/Battery systems feeding DC loads. Firstly, the complete modeling of the system (e.g., PV, battery, DC-DC boost converter and DC-DC bidirectional converter) has been introduced. Then, the obtained models were used to design suitable controllers for the power converters. The proposed control strategy for the boost converter was then validated. In fact, the PV module was able to track the maximum power from the PV module when the SoC is under the maximum limit and operates in the LPM mode when the SoC is higher than the predefined maximum SoC. Moreover, the double control loop used for the control of the bidirectional converter is effective. The bidirectional converter was able to maintain the DC bus voltage at the desired value of 48 V in the three operating modes by adjusting the charging/discharging battery current. The obtained simulation results show good performances and stability of the system. Moreover, the load was supplied at any time. This work is under implementation for being integrated and experimentally evaluated using our deployed microgrid system.