A Modular Simulation Testbed for Energy Management in AC / DC Microgrids

: This paper introduces a modular testbed to simulate AC / DC microgrids. The testbed is implemented in Matlab Simulink and is based on the energetic macroscopic representation (EMR) formalism. It is designed to be a tool to evaluate energy management strategies in AC / DC microgrids. The microgrid simulation model includes a photovoltaic generator, a fuel cell system, ultracapacitors, and batteries on the DC side. It includes voltage source converters (VSC) to couple the DC side with the AC side of the microgrid, which includes a variable AC load and a synchronous generator. Two case studies illustrate the use of the testbed. The model is implemented in Matlab Simulink and made openly available for the scientiﬁc community. Using this model, researchers can develop and evaluate energy management strategies in AC / DC microgrids.


Introduction
Electric power systems are progressively evolving from a generation, transmission, and distribution system almost exclusively based on AC, to hybrid configurations, where DC is gaining importance. In a few decades, DC systems could even dominate AC, and many reasons indicate that such a power system can become a reality. The fast development of voltage source converters (VSC) facilitates the interconnection of DC sources, transmission lines, and loads in AC systems. DC power systems are, in theory at least, more straightforward to operate than AC systems, because the synchronization, the phase angles, and the reactive power are not a challenge anymore.
Most electric drives operate in AC because of its simplicity and reduced cost compared with DC. Vast amounts of energy are generated in large power plants using combustion, steam, or hydraulic turbines coupled to synchronous generators. On the other hand, large quantities of renewable energy are generated in small power plants connected all to the network using distributed and intermittent DC generators located near the consumers [1,2]. Storage in batteries or hydrogen-based (electrolyzers and fuel cells) systems is performed in DC. Many recent projects use high voltage direct current (HVDC) to transport energy through very long distances or to connect offshore wind farms [3][4][5]. Most of the residential loads, such as lighting or appliances, operate in DC because of its increased efficiency compared with AC. New isolated power systems could privilege the use of DC over AC, but for now, the electric power system evolves toward a hybrid AC/DC power system with high penetration of renewable energy [6,7].
The design and operation of microgrids require flexible simulation models. These models should allow the consideration of AC/DC generation and consumption simultaneously. They also should allow the user to design and evaluate the effect of the energy management and control algorithms. The present paper does not have the objective of proposing new models for the energy sources. For this reason, we have referenced all the models adopted and adapted from the literature. Nevertheless, the main contribution of this work is to propose a simulation testbed that permits the integration of energy sources, power converters, controllers, and energy management strategies (control references).
Regarding the components of the microgrid, the FC is modeled using polarization curves, as proposed in [22]. The UC model is proposed by Zubieta [36] and the battery model, the one presented by Ceraolo [37]. The droop control architecture is presented in [38]. The synchronous generator and its automatic voltage regulator (AVR) models are adopted from [38] and [39]. A complete simulation testbed, implemented in Matlab Simulink, is provided with this paper and made available to download and distribute from the MDPI repository. With this model, researchers can develop and evaluate control and energy management strategies in AC/DC microgrids.
Very few papers share complete simulation models allowing traceability of the claimed results. To our best knowledge, this is the first ready-to-use energy management-oriented simulation model of an AC/DC microgrid.
Compared with other testbeds and research in the literature, the one introduced in this paper:  Allows the performing of a systematic study of the energy flows in an AC/DC microgrid using the energetic macroscopic representation (EMR) formalism.  Provides simulation models, adopted and adapted from literature, for DC and AC sources, power converters, power controllers, and AC loads.  Provides two ready-to-simulate Matlab Simulink AC/DC microgrid models. All the results presented in this paper can be fully replicated using the files provided in the MDPI repository.
The paper is organized as follows. Section 2 introduces the models of the power sources, the power converters, and control systems. Section 3 introduces the AC/DC testbed microgrid EMR. Section 4 presents two case studies to illustrate the use of the testbed. Section 5 and 6 present a discussion on the testbed and the conclusions. The present paper does not have the objective of proposing new models for the energy sources. For this reason, we have referenced all the models adopted and adapted from the literature. Nevertheless, the main contribution of this work is to propose a simulation testbed that permits the integration of energy sources, power converters, controllers, and energy management strategies (control references).

Modeling of the Microgrid
Regarding the components of the microgrid, the FC is modeled using polarization curves, as proposed in [22]. The UC model is proposed by Zubieta [36] and the battery model, the one presented by Ceraolo [37]. The droop control architecture is presented in [38]. The synchronous generator and its automatic voltage regulator (AVR) models are adopted from [38,39]. A complete simulation testbed, implemented in Matlab Simulink, is provided with this paper and made available to download and distribute from the MDPI repository. With this model, researchers can develop and evaluate control and energy management strategies in AC/DC microgrids.
Very few papers share complete simulation models allowing traceability of the claimed results. To our best knowledge, this is the first ready-to-use energy management-oriented simulation model of an AC/DC microgrid.
Compared with other testbeds and research in the literature, the one introduced in this paper: • Allows the performing of a systematic study of the energy flows in an AC/DC microgrid using the energetic macroscopic representation (EMR) formalism.

•
Provides simulation models, adopted and adapted from literature, for DC and AC sources, power converters, power controllers, and AC loads.

•
Provides two ready-to-simulate Matlab Simulink AC/DC microgrid models. All the results presented in this paper can be fully replicated using the files provided in the MDPI repository.
The paper is organized as follows. Section 2 introduces the models of the power sources, the power converters, and control systems. Section 3 introduces the AC/DC testbed microgrid EMR. Section 4 presents two case studies to illustrate the use of the testbed. Sections 5 and 6 present a discussion on the testbed and the conclusions.

Modeling of the Microgrid
This section introduces the sources' models and control strategy provided with the microgrid testbed. Sections 2.1-2.4 present the PVP, FC, batteries and UC models. Section 2.5 introduces the synchronous generator's model. Section 2.6 presents the topology and model of the power converters.

Photovoltaic Generator
Electrical energy generation using photovoltaic panels (PVP) has increased significantly during the last few years. PVP are one of the most used energy sources for isolated microgrids. Most of the PVP models are based on equivalent electrical circuits, composed of a controlled current source, a set of diodes, and a set of series and shunt resistance. Some PVP models based on Matlab Simulink are presented in [40][41][42][43][44].
The model implemented in the testbed is the model presented in [45]. It is composed of one diode and one series resistance, as illustrated in Figure 2. Equation (1) presents the relations between the current I, the voltage V, the temperature T, and the irradiance G.
where I pv is the photon current, I 0 the diode saturation current, a the diode ideality factor, and R s the series resistance. Figure 3, generated with this simulation model, presents the I-V curves of an available commercial Shell SM55 photovoltaic panel for a standard 25 • C temperature and different irradiance levels [46]. This section introduces the sources' models and control strategy provided with the microgrid testbed. Sections 2.1 to 2.4 present the PVP, FC, batteries and UC models. Section 2.5 introduces the synchronous generator's model. Section 2.6 presents the topology and model of the power converters.

Photovoltaic Generator
Electrical energy generation using photovoltaic panels (PVP) has increased significantly during the last few years. PVP are one of the most used energy sources for isolated microgrids. Most of the PVP models are based on equivalent electrical circuits, composed of a controlled current source, a set of diodes, and a set of series and shunt resistance. Some PVP models based on Matlab Simulink are presented in [40][41][42][43][44].
The model implemented in the testbed is the model presented in [45]. It is composed of one diode and one series resistance, as illustrated in Figure 2. Equation (1) presents the relations between the current , the voltage , the temperature , and the irradiance .
where is the photon current, 0 the diode saturation current, the diode ideality factor, and the series resistance. Figure 3, generated with this simulation model, presents the I-V curves of an available commercial Shell SM55 photovoltaic panel for a standard 25 °C temperature and different irradiance levels [46]. This section introduces the sources' models and control strategy provided with the microgrid testbed. Sections 2.1 to 2.4 present the PVP, FC, batteries and UC models. Section 2.5 introduces the synchronous generator's model. Section 2.6 presents the topology and model of the power converters.

Photovoltaic Generator
Electrical energy generation using photovoltaic panels (PVP) has increased significantly during the last few years. PVP are one of the most used energy sources for isolated microgrids. Most of the PVP models are based on equivalent electrical circuits, composed of a controlled current source, a set of diodes, and a set of series and shunt resistance. Some PVP models based on Matlab Simulink are presented in [40][41][42][43][44].
The model implemented in the testbed is the model presented in [45]. It is composed of one diode and one series resistance, as illustrated in Figure 2. Equation (1) presents the relations between the current , the voltage , the temperature , and the irradiance .
where is the photon current, 0 the diode saturation current, the diode ideality factor, and the series resistance. Figure 3, generated with this simulation model, presents the I-V curves of an available commercial Shell SM55 photovoltaic panel for a standard 25 °C temperature and different irradiance levels [46].

Fuel Cells
Hydrogen is a promising energy vector with great potential for energy storage on bigger scales than in batteries. It is characterized by a high energy density, compared to classical energy storage

Fuel Cells
Hydrogen is a promising energy vector with great potential for energy storage on bigger scales than in batteries. It is characterized by a high energy density, compared to classical energy storage devices such as batteries. Hydrogen can supply fuel cells (FCs) for generating electricity, and in the energy storage process, hydrogen can be generated using electrolyzers (ELs).
FC and EL models are more complex than other DC sources because of the multi-physics system. A complete FC dynamic model will consider electrochemical, fluid, thermal, and electrical models [47,48]. However, for energy management purposes, a static model can be adopted.
The FC provided in this testbed is modeled as a current-controlled voltage source. A polarization curve is considered as in previous works on FC energy management strategy (EMS) [20][21][22]49]. Figure 4a illustrates a third-order model polarization curve and its corresponding power curve for a typical 5 kW FC. Figure 4b illustrates the efficiency and hydrogen flow of the same FC.
Energies 2020, 13, x FOR PEER REVIEW 5 of 23 devices such as batteries. Hydrogen can supply fuel cells (FCs) for generating electricity, and in the energy storage process, hydrogen can be generated using electrolyzers (ELs). FC and EL models are more complex than other DC sources because of the multi-physics system. A complete FC dynamic model will consider electrochemical, fluid, thermal, and electrical models [47,48]. However, for energy management purposes, a static model can be adopted.
The FC provided in this testbed is modeled as a current-controlled voltage source. A polarization curve is considered as in previous works on FC energy management strategy (EMS) [20][21][22]49]. Figure  4a illustrates a third-order model polarization curve and its corresponding power curve for a typical 5 kW FC. Figure 4b illustrates the efficiency and hydrogen flow of the same FC.

Batteries
Electric batteries are certainly the most used energy storage source in power systems. They have a good compromise between energy and power density. Many models adapted for static or dynamic studies of the multiple available technologies are found in the literature. In this testbed, the dynamic model proposed by Ceraolo is implemented [37]. This model is adapted for lead-acid batteries, which is still the most used technology in isolated microgrids. The equivalent circuit is illustrated in Figure  5. The parameters of the batteries used in the provided files are adapted from [50].

Ultracapacitors
Ultracapacitors (UC) are characterized by high efficiency and offer a high speed of access to electrical energy. They are an excellent complement to hybridize with FC, given their high-power density and efficiency. UC are used in applications as diverse as the integration of renewable energy in electricity networks [51][52][53], regenerative braking in hybrid vehicles [54], and uninterrupted power supply sources [55]. Several models have been proposed for studying UC. In this testbed, the model proposed by Zubieta is implemented [36]. The parameters of the UC implemented in the provided files are adapted from [56]. The equivalent circuit is illustrated in Figure 6.

Batteries
Electric batteries are certainly the most used energy storage source in power systems. They have a good compromise between energy and power density. Many models adapted for static or dynamic studies of the multiple available technologies are found in the literature. In this testbed, the dynamic model proposed by Ceraolo is implemented [37]. This model is adapted for lead-acid batteries, which is still the most used technology in isolated microgrids. The equivalent circuit is illustrated in Figure 5. The parameters of the batteries used in the provided files are adapted from [50].
Energies 2020, 13, x FOR PEER REVIEW 5 of 23 devices such as batteries. Hydrogen can supply fuel cells (FCs) for generating electricity, and in the energy storage process, hydrogen can be generated using electrolyzers (ELs). FC and EL models are more complex than other DC sources because of the multi-physics system. A complete FC dynamic model will consider electrochemical, fluid, thermal, and electrical models [47,48]. However, for energy management purposes, a static model can be adopted.
The FC provided in this testbed is modeled as a current-controlled voltage source. A polarization curve is considered as in previous works on FC energy management strategy (EMS) [20][21][22]49]. Figure  4a illustrates a third-order model polarization curve and its corresponding power curve for a typical 5 kW FC. Figure 4b illustrates the efficiency and hydrogen flow of the same FC.

Batteries
Electric batteries are certainly the most used energy storage source in power systems. They have a good compromise between energy and power density. Many models adapted for static or dynamic studies of the multiple available technologies are found in the literature. In this testbed, the dynamic model proposed by Ceraolo is implemented [37]. This model is adapted for lead-acid batteries, which is still the most used technology in isolated microgrids. The equivalent circuit is illustrated in Figure  5. The parameters of the batteries used in the provided files are adapted from [50].

Ultracapacitors
Ultracapacitors (UC) are characterized by high efficiency and offer a high speed of access to electrical energy. They are an excellent complement to hybridize with FC, given their high-power density and efficiency. UC are used in applications as diverse as the integration of renewable energy in electricity networks [51][52][53], regenerative braking in hybrid vehicles [54], and uninterrupted power supply sources [55]. Several models have been proposed for studying UC. In this testbed, the model proposed by Zubieta is implemented [36]. The parameters of the UC implemented in the provided files are adapted from [56]. The equivalent circuit is illustrated in Figure 6.

Ultracapacitors
Ultracapacitors (UC) are characterized by high efficiency and offer a high speed of access to electrical energy. They are an excellent complement to hybridize with FC, given their high-power density and efficiency. UC are used in applications as diverse as the integration of renewable energy in electricity networks [51][52][53], regenerative braking in hybrid vehicles [54], and uninterrupted power Energies 2020, 13, 4049 6 of 23 supply sources [55]. Several models have been proposed for studying UC. In this testbed, the model proposed by Zubieta is implemented [36]. The parameters of the UC implemented in the provided files are adapted from [56]. The equivalent circuit is illustrated in Figure 6.

Synchronous Generator
Synchronous generators (SG) have been for a long time the base of electric power systems. They are coupled to steam or combustion turbines in big power plants and coupled to diesel generators in isolated microgrids. They can be coupled to wind turbines, but most of the new wind plants are coupled to doubly-fed induction generators (DFIG), of which the operating principle is similar to SG. The SG implemented in the testbed is based on the classic SG equivalent circuit presented in Figure  7. The SG is coupled to an ideal mechanical source. For this reason, the frequency does not depend on the power provided to the AC bus. The terminal voltage is controlled by an automatic voltage regulator (AVR). In a real generator, the AVR will control the field current, but the AVR implemented in the testbed acts directly on the electromotive force . Figure 8 illustrates the operation of the SG when a sudden change of load is applied. It can be observed that the AVR will maintain the reference voltage even after a change of the load connected to its terminals.

Synchronous Generator
Synchronous generators (SG) have been for a long time the base of electric power systems. They are coupled to steam or combustion turbines in big power plants and coupled to diesel generators in isolated microgrids. They can be coupled to wind turbines, but most of the new wind plants are coupled to doubly-fed induction generators (DFIG), of which the operating principle is similar to SG. The SG implemented in the testbed is based on the classic SG equivalent circuit presented in Figure 7.

Synchronous Generator
Synchronous generators (SG) have been for a long time the base of electric power systems. They are coupled to steam or combustion turbines in big power plants and coupled to diesel generators in isolated microgrids. They can be coupled to wind turbines, but most of the new wind plants are coupled to doubly-fed induction generators (DFIG), of which the operating principle is similar to SG. The SG implemented in the testbed is based on the classic SG equivalent circuit presented in Figure  7. The SG is coupled to an ideal mechanical source. For this reason, the frequency does not depend on the power provided to the AC bus. The terminal voltage is controlled by an automatic voltage regulator (AVR). In a real generator, the AVR will control the field current, but the AVR implemented in the testbed acts directly on the electromotive force . Figure 8 illustrates the operation of the SG when a sudden change of load is applied. It can be observed that the AVR will maintain the reference voltage even after a change of the load connected to its terminals.
(a) Synchronous generator (SG) current. The SG is coupled to an ideal mechanical source. For this reason, the frequency does not depend on the power provided to the AC bus. The terminal voltage is controlled by an automatic voltage regulator (AVR). In a real generator, the AVR will control the field current, but the AVR implemented in the testbed acts directly on the electromotive force e SG . Figure 8 illustrates the operation of the SG when a sudden change of load is applied. It can be observed that the AVR will maintain the reference voltage even after a change of the load connected to its terminals. The SG is coupled to an ideal mechanical source. For this reason, the frequency does not depend on the power provided to the AC bus. The terminal voltage is controlled by an automatic voltage regulator (AVR). In a real generator, the AVR will control the field current, but the AVR implemented in the testbed acts directly on the electromotive force . Figure 8 illustrates the operation of the SG when a sudden change of load is applied. It can be observed that the AVR will maintain the reference voltage even after a change of the load connected to its terminals.

Power Converters and Control Strategies
The power converters are at the heart of the microgrids. They allow interconnecting sources with different characteristics while controlling the energy flow in the power network. There are multiple topologies and model techniques for power converters. However, as the main interest of this work is the energy management strategy (EMS) study, simple models are convenient. All the converters are modeled as an ideal power converter connected in cascade with L or LC filters. The circuit dynamics are modeled in the abc frame, but the control of the power converters is performed in the dq frame. For this reason, the Park and inverse Park transformation are performed in the VSC controllers. A phase-locked loop (PLL) is used to estimate the point of common coupling (PCC) voltage and frequency used to generate the control references of the power converters.

Power Converters
The first DC/DC ideal converter supplies energy from the PVP to the first DC bus using an LC filter. The batteries impose the DC bus voltage. The connection of the PVP to the DC bus 1 is illustrated in Figure 9. The first VSC allows the coupling of the first DC bus to the point of common coupling (PCC) at the microgrid's AC side. The connection of the PVP battery DC source to the AC bus is illustrated in Figure 10.

Power Converters and Control Strategies
The power converters are at the heart of the microgrids. They allow interconnecting sources with different characteristics while controlling the energy flow in the power network. There are multiple topologies and model techniques for power converters. However, as the main interest of this work is the energy management strategy (EMS) study, simple models are convenient. All the converters are modeled as an ideal power converter connected in cascade with L or LC filters. The circuit dynamics are modeled in the abc frame, but the control of the power converters is performed in the dq frame. For this reason, the Park and inverse Park transformation are performed in the VSC controllers. A phase-locked loop (PLL) is used to estimate the point of common coupling (PCC) voltage and frequency used to generate the control references of the power converters.

Power Converters
The first DC/DC ideal converter supplies energy from the PVP to the first DC bus using an LC filter. The batteries impose the DC bus voltage. The connection of the PVP to the DC bus 1 is illustrated in Figure 9. The first VSC allows the coupling of the first DC bus to the point of common coupling (PCC) at the microgrid's AC side. The connection of the PVP battery DC source to the AC bus is illustrated in Figure 10.
The second DC/DC ideal converter supplies energy from the FC to the second DC bus using an L filter. In this DC bus, the voltage is imposed by the ultracapacitors, as illustrated in Figure 11. The second VSC allows the connecting of the second DC bus to the PCC, as illustrated in Figure 12. The first DC/DC ideal converter supplies energy from the PVP to the first DC bus using an LC filter. The batteries impose the DC bus voltage. The connection of the PVP to the DC bus 1 is illustrated in Figure 9. The first VSC allows the coupling of the first DC bus to the point of common coupling (PCC) at the microgrid's AC side. The connection of the PVP battery DC source to the AC bus is illustrated in Figure 10.   The first DC/DC ideal converter supplies energy from the PVP to the first DC bus using an LC filter. The batteries impose the DC bus voltage. The connection of the PVP to the DC bus 1 is illustrated in Figure 9. The first VSC allows the coupling of the first DC bus to the point of common coupling (PCC) at the microgrid's AC side. The connection of the PVP battery DC source to the AC bus is illustrated in Figure 10.    The second DC/DC ideal converter supplies energy from the FC to the second DC bus using an L filter. In this DC bus, the voltage is imposed by the ultracapacitors, as illustrated in Figure 11. The second VSC allows the connecting of the second DC bus to the PCC, as illustrated in Figure 12.

Maximum Power Point Tracker
A PVP generation system is an intermittent energy source. The power provided by a PVP mainly depends on the solar irradiance and the temperature. The EMS intends to maximize the energy supplied by this source. This task is frequently executed using a maximum power point tracker (MPPT) algorithm, which operates the PVP close to its maximal power operation point. Many MPPT algorithms have been proposed in the literature, using techniques such as incremental conductance (IC), fuzzy logic, and perturb and observe (P&O). For the proposed testbed, the variable perturbation size of P&O MPPT presented in [57] is implemented.
This MPPT algorithm is illustrated in Figure 13. Figure 14 illustrates the MPPT algorithm's operation when the PVP is connected and illustrates the operation after a sudden change of irradiance. The second DC/DC ideal converter supplies energy from the FC to the second DC bus using an L filter. In this DC bus, the voltage is imposed by the ultracapacitors, as illustrated in Figure 11. The second VSC allows the connecting of the second DC bus to the PCC, as illustrated in Figure 12.

Maximum Power Point Tracker
A PVP generation system is an intermittent energy source. The power provided by a PVP mainly depends on the solar irradiance and the temperature. The EMS intends to maximize the energy supplied by this source. This task is frequently executed using a maximum power point tracker (MPPT) algorithm, which operates the PVP close to its maximal power operation point. Many MPPT algorithms have been proposed in the literature, using techniques such as incremental conductance (IC), fuzzy logic, and perturb and observe (P&O). For the proposed testbed, the variable perturbation size of P&O MPPT presented in [57] is implemented.
This MPPT algorithm is illustrated in Figure 13. Figure 14 illustrates the MPPT algorithm's operation when the PVP is connected and illustrates the operation after a sudden change of irradiance.

Maximum Power Point Tracker
A PVP generation system is an intermittent energy source. The power provided by a PVP mainly depends on the solar irradiance and the temperature. The EMS intends to maximize the energy supplied by this source. This task is frequently executed using a maximum power point tracker (MPPT) algorithm, which operates the PVP close to its maximal power operation point. Many MPPT algorithms have been proposed in the literature, using techniques such as incremental conductance Energies 2020, 13, 4049 9 of 23 (IC), fuzzy logic, and perturb and observe (P&O). For the proposed testbed, the variable perturbation size of P&O MPPT presented in [57] is implemented.
This MPPT algorithm is illustrated in Figure 13. Figure 14 illustrates the MPPT algorithm's operation when the PVP is connected and illustrates the operation after a sudden change of irradiance.

Phase-Locked Loop
A phase-locked loop (PLL) is used to estimate the phase angle and frequency of the AC bus voltage. The PLL implemented in this paper is the one presented in [38]. The input to the PLL is the bus voltage in the abc frame. This voltage is transformed to the dq frame using the Park transformation and an estimated phase angle. A feedback PI controller is used to force the q-axis voltage zero. The abc voltage is then aligned to the d-axis of the reference frame based on the estimated angle. Figure 15 illustrates the structure of the PLL.

Phase-Locked Loop
A phase-locked loop (PLL) is used to estimate the phase angle and frequency of the AC bus voltage. The PLL implemented in this paper is the one presented in [38]. The input to the PLL is the bus voltage in the abc frame. This voltage is transformed to the dq frame using the Park transformation and an estimated phase angle. A feedback PI controller is used to force the q-axis voltage zero. The abc voltage is then aligned to the d-axis of the reference frame based on the estimated angle. Figure 15 illustrates the structure of the PLL.

Phase-Locked Loop
A phase-locked loop (PLL) is used to estimate the phase angle and frequency of the AC bus voltage. The PLL implemented in this paper is the one presented in [38]. The input to the PLL is the bus voltage in the abc frame. This voltage is transformed to the dq frame using the Park transformation and an estimated phase angle. A feedback PI controller is used to force the q-axis voltage zero. The abc voltage is then aligned to the d-axis of the reference frame based on the estimated angle. Figure 15 illustrates the structure of the PLL.
A phase-locked loop (PLL) is used to estimate the phase angle and frequency of the AC bus voltage. The PLL implemented in this paper is the one presented in [38]. The input to the PLL is the bus voltage in the abc frame. This voltage is transformed to the dq frame using the Park transformation and an estimated phase angle. A feedback PI controller is used to force the q-axis voltage zero. The abc voltage is then aligned to the d-axis of the reference frame based on the estimated angle. Figure 15 illustrates the structure of the PLL.

Droop Control
Droop control is widely employed for active and reactive power sharing in inverters connected in parallel [38,58,59]. The distribution of the active and reactive power among the inverters depend

Droop Control
Droop control is widely employed for active and reactive power sharing in inverters connected in parallel [38,58,59]. The distribution of the active and reactive power among the inverters depend on the two coefficients of the droop controller (m for P-ω and n for Q-E) as illustrated in Figure 16. The droop control equations are presented below: where ω * and E * are the angular frequency and the magnitude references for the grid voltage, and P and Q are the active and reactive powers, respectively. P * is the set-point of real power in P-ω droop control, and Q * is the set-point of reactive power in Q-E droop control.
Energies 2020, 13, x FOR PEER REVIEW 10 of 23 on the two coefficients of the droop controller (m for P-and n for Q-E) as illustrated in Figure 16.
The droop control equations are presented below: where * and * are the angular frequency and the magnitude references for the grid voltage, and P and Q are the active and reactive powers, respectively. * is the set-point of real power in Pdroop control, and * is the set-point of reactive power in Q-E droop control.

Energetic Macroscopic Representation (EMR) of the Microgrid
The study of the energy management in multi-source/multi-physics complex systems such as microgrids requires defining an adapted tool. This section introduces the EMR as a powerful formalism to perform this task, introduces the EMR methodology, and presents the EMR and control structure of the considered AC/DC microgrid. Section 3.1 introduces the advantages of the EMR formalism to study the power flows in a multisource/multi-physics system. Section 3.2 presents the EMR of a generic power converter, Sections 3.3 and 3.4, respectively, introduce the EMR of the DC source 1 and the DC source 2. Section 3.5 presents the EMR of two VSC supplying a load, and Section 3.6 presents the EMR of the microgrid.

Energetic Macroscopic Representation (EMR)
Different approaches have been proposed to study energy management in multi-source systems: bond graphs [60], power flow diagrams [61] or energetic macroscopic representation (EMR) [62] among others. The EMR is a graphical tool, oriented to the analysis of the interactions between subsystems in a multi-physics system. This formalism was originally proposed to study electromechanical systems such as electrical machines and hybrid electric vehicles [62]. Since then, this formalism has been actualized to enable an extension to other physical fields.
The EMR formalism is characterized by offering various benefits that make it an excellent tool to study the energy flows in multi-source and multi-physics systems such as AC/DC microgrids. It allows a systematic deduction of control structures, and its implementation can be achieved using software environments such as Matlab Simulink or 20-sim. Identifying control loops using the EMR formalism is done straightforwardly following four steps, as illustrated in Figure 17:

Energetic Macroscopic Representation (EMR) of the Microgrid
The study of the energy management in multi-source/multi-physics complex systems such as microgrids requires defining an adapted tool. This section introduces the EMR as a powerful formalism to perform this task, introduces the EMR methodology, and presents the EMR and control structure of the considered AC/DC microgrid. Section 3.1 introduces the advantages of the EMR formalism to study the power flows in a multi-source/multi-physics system. Section 3.2 presents the EMR of a generic power converter, Sections 3.3 and 3.4, respectively, introduce the EMR of the DC source 1 and the DC source 2. Section 3.5 presents the EMR of two VSC supplying a load, and Section 3.6 presents the EMR of the microgrid.

Energetic Macroscopic Representation (EMR)
Different approaches have been proposed to study energy management in multi-source systems: bond graphs [60], power flow diagrams [61] or energetic macroscopic representation (EMR) [62] among others. The EMR is a graphical tool, oriented to the analysis of the interactions between subsystems in a multi-physics system. This formalism was originally proposed to study electromechanical systems such as electrical machines and hybrid electric vehicles [62]. Since then, this formalism has been actualized to enable an extension to other physical fields. The EMR formalism is characterized by offering various benefits that make it an excellent tool to study the energy flows in multi-source and multi-physics systems such as AC/DC microgrids. It allows a systematic deduction of control structures, and its implementation can be achieved using software environments such as Matlab Simulink or 20-sim. Identifying control loops using the EMR formalism is done straightforwardly following four steps, as illustrated in Figure 17: Organization of the system model in subsystems.

2.
Inversion of the model using EMR rules.
Design of energy management strategies. In the EMR formalism, each element or subsystem has a graphic representation according to its function on the system: energy conversion, energy storage, or energy generation and consumption.
These pictograms are interconnected following the action-reaction principle and the integral causality. The arrows that interconnect the pictograms represent the instantaneous power exchange between subsystems. The EMR pictograms are presented in Figure 18. In order to identify the control structure, the maximal control structure methodology is performed. This methodology is based on classic model-inversion control. The EMR blocks are inverted following the EMR formalism rules. The conversion blocks are directly inverted, and the accumulation blocks are inverted using controllers to respect physical causality. The last step is to define the control strategy.
A complete guide to understanding the EMR rules, a Matlab Simulink EMR Simulink library, In the EMR formalism, each element or subsystem has a graphic representation according to its function on the system: energy conversion, energy storage, or energy generation and consumption.
These pictograms are interconnected following the action-reaction principle and the integral causality. The arrows that interconnect the pictograms represent the instantaneous power exchange between subsystems. The EMR pictograms are presented in Figure 18. In the EMR formalism, each element or subsystem has a graphic representation according to its function on the system: energy conversion, energy storage, or energy generation and consumption.
These pictograms are interconnected following the action-reaction principle and the integral causality. The arrows that interconnect the pictograms represent the instantaneous power exchange between subsystems. The EMR pictograms are presented in Figure 18. In order to identify the control structure, the maximal control structure methodology is performed. This methodology is based on classic model-inversion control. The EMR blocks are inverted following the EMR formalism rules. The conversion blocks are directly inverted, and the accumulation blocks are inverted using controllers to respect physical causality. The last step is to define the control strategy.
A complete guide to understanding the EMR rules, a Matlab Simulink EMR Simulink library, and an actualized list of references on the EMR can be downloaded from the EMR website developed In order to identify the control structure, the maximal control structure methodology is performed. This methodology is based on classic model-inversion control. The EMR blocks are inverted following the EMR formalism rules. The conversion blocks are directly inverted, and the accumulation blocks are inverted using controllers to respect physical causality. The last step is to define the control strategy.
A complete guide to understanding the EMR rules, a Matlab Simulink EMR Simulink library, and an actualized list of references on the EMR can be downloaded from the EMR website developed and maintained by the L2EP laboratory Lille, France [64].

EMR of a Power Converter
The power converters (DC/DC and VSC) allow the coupling of two sources. They are composed of an ideal conversion element and an accumulation element to model the converter filter. Figure 19a illustrates the EMR, and Figure 19b shows in detail the control structure of a generic power converter.

EMR of the DC Source 1
This DC bus includes a PVP and a battery, as illustrated in Figure 10. A source pictogram represents the PVP. It is connected to the DC bus via a power converter, composed of an LC filter (two accumulation elements) and an ideal DC/DC converter (conversion element). The battery is represented by a source element, is directly connected to the DC bus, and imposes the bus voltage. The DC bus is connected to the AC bus using an L filter (accumulation element) and an ideal DC/AC converter (conversion element). The EMR of the DC source 1 is presented in Figure 20.

EMR of the Voltage Source Converter (VSC)2
The VSC2 allows the coupling of the second DC bus to the PCC. This DC bus gets its energy from the fuel cell and the ultracapacitors (UCs), as illustrated in Figure 12. The FC is represented using a source pictogram. It is connected to the DC bus via a power converter, composed of an L filter (accumulation element) and an ideal DC/DC converter (conversion element).
The UCs, represented by a source pictogram, are directly connected to the DC bus and imposes the bus voltage. The DC bus is connected to the AC bus using an L filter (accumulation element) and an ideal DC/AC converter (conversion element). The EMR of the DC source 2 is presented in Figure  21.

EMR of the DC Source 1
This DC bus includes a PVP and a battery, as illustrated in Figure 10. A source pictogram represents the PVP. It is connected to the DC bus via a power converter, composed of an LC filter (two accumulation elements) and an ideal DC/DC converter (conversion element). The battery is represented by a source element, is directly connected to the DC bus, and imposes the bus voltage. The DC bus is connected to the AC bus using an L filter (accumulation element) and an ideal DC/AC converter (conversion element). The EMR of the DC source 1 is presented in Figure 20.

EMR of the DC Source 1
This DC bus includes a PVP and a battery, as illustrated in Figure 10. A source pictogram represents the PVP. It is connected to the DC bus via a power converter, composed of an LC filter (two accumulation elements) and an ideal DC/DC converter (conversion element). The battery is represented by a source element, is directly connected to the DC bus, and imposes the bus voltage. The DC bus is connected to the AC bus using an L filter (accumulation element) and an ideal DC/AC converter (conversion element). The EMR of the DC source 1 is presented in Figure 20.

EMR of the Voltage Source Converter (VSC)2
The VSC2 allows the coupling of the second DC bus to the PCC. This DC bus gets its energy from the fuel cell and the ultracapacitors (UCs), as illustrated in Figure 12. The FC is represented using a source pictogram. It is connected to the DC bus via a power converter, composed of an L filter (accumulation element) and an ideal DC/DC converter (conversion element).
The UCs, represented by a source pictogram, are directly connected to the DC bus and imposes the bus voltage. The DC bus is connected to the AC bus using an L filter (accumulation element) and an ideal DC/AC converter (conversion element). The EMR of the DC source 2 is presented in Figure  21.

EMR of the Voltage Source Converter (VSC)2
The VSC2 allows the coupling of the second DC bus to the PCC. This DC bus gets its energy from the fuel cell and the ultracapacitors (UCs), as illustrated in Figure 12. The FC is represented using a source pictogram. It is connected to the DC bus via a power converter, composed of an L filter (accumulation element) and an ideal DC/DC converter (conversion element). The UCs, represented by a source pictogram, are directly connected to the DC bus and imposes the bus voltage. The DC bus is connected to the AC bus using an L filter (accumulation element) and an ideal DC/AC converter (conversion element). The EMR of the DC source 2 is presented in Figure 21.

EMR of Two VSC Supplying a Load
The first microgrid includes two VSC supplying energy from two ideal DC sources to a resistive load, as illustrated in Figure 22a. The EMR is constructed from the DC bus (coupling element). The sources and the loads are represented by source elements, the power converters as conversion pictograms, and the L filters by accumulation elements. The EMR is presented in Figure 22b.   Figure 23 presents the circuit representation of the microgrid introduced in Figure 1. The microgrid's EMR is constructed from its point of common coupling (PCC), which distributes energy from all the sources to the variable load at the AC side of the converters.

EMR of the AC/DC Microgrid
The two DC sources are connected to the PCC through their VSC. The SG is directly connected to the PCC, as well as the AC load. Here, the synchronous generator imposes the PCC voltage, and the two VSC act as current sources.

EMR of Two VSC Supplying a Load
The first microgrid includes two VSC supplying energy from two ideal DC sources to a resistive load, as illustrated in Figure 22a. The EMR is constructed from the DC bus (coupling element). The sources and the loads are represented by source elements, the power converters as conversion pictograms, and the L filters by accumulation elements. The EMR is presented in Figure 22b.

EMR of Two VSC Supplying a Load
The first microgrid includes two VSC supplying energy from two ideal DC sources to a resistive load, as illustrated in Figure 22a. The EMR is constructed from the DC bus (coupling element). The sources and the loads are represented by source elements, the power converters as conversion pictograms, and the L filters by accumulation elements. The EMR is presented in Figure 22b.   Figure 23 presents the circuit representation of the microgrid introduced in Figure 1. The microgrid's EMR is constructed from its point of common coupling (PCC), which distributes energy from all the sources to the variable load at the AC side of the converters.

EMR of the AC/DC Microgrid
The two DC sources are connected to the PCC through their VSC. The SG is directly connected to the PCC, as well as the AC load. Here, the synchronous generator imposes the PCC voltage, and the two VSC act as current sources.  Figure 23 presents the circuit representation of the microgrid introduced in Figure 1. The microgrid's EMR is constructed from its point of common coupling (PCC), which distributes energy from all the sources to the variable load at the AC side of the converters.    The two DC sources are connected to the PCC through their VSC. The SG is directly connected to the PCC, as well as the AC load. Here, the synchronous generator imposes the PCC voltage, and the two VSC act as current sources. Figure 24 presents the EMR of the AC/DC microgrid, and Figure 25, its implementation in Matlab Simulink R2019b (Update 2). Matlab Simulink does not allow yet the creation of subsystems with inputs and outputs on the same side of the block as required by the EMR formalism. For this reason, the model in Simulink illustrated in Figure 25 does not seem exactly the same as in the EMR formalism.

Case Studies
This section presents simulation results for two case studies that illustrate some of the capabilities of the testbed. Section 4.1 presents the simulation results for the power distribution with two VSC supplying a resistive load. Section 4.2 presents the second case study with the power distribution in the microgrid illustrated in Figure 23. An extensive list of sources' and control algorithms' parameters is provided with the supplementary material.

Power Distribution between Two VSC in Droop-PQ Control Mode
This section presents simulation results for a microgrid where two ideal DC sources supply energy to a charge through VSC. The active and reactive references are defined using P-and Q-E droops, as shown in Figure 16. A phase-locked loop (PLL) is used to estimate the PCC voltage and frequency used in the Q-E and the P-f droop. As a verification of the control structure's operation, the results provided in Chapter 6 of [38] are replicated. The simulation illustrates the connection of a resistive load 1 p.u. at t = 0. For this condition, each VSC provides 50% of the load. After 1 second, the load changes to 1.2 p.u. Figure 26a,b, respectively, show the active and reactive power distribution among the two VSC. Figure 26c illustrates the frequency, and Figure 26d, the amplitude of the PCC voltage.
(a) Active power distribution.

Case Studies
This section presents simulation results for two case studies that illustrate some of the capabilities of the testbed. Section 4.1 presents the simulation results for the power distribution with two VSC supplying a resistive load. Section 4.2 presents the second case study with the power distribution in the microgrid illustrated in Figure 23. An extensive list of sources' and control algorithms' parameters is provided with the supplementary material.

Power Distribution between Two VSC in Droop-PQ Control Mode
This section presents simulation results for a microgrid where two ideal DC sources supply energy to a charge through VSC. The active and reactive references are defined using P-ω and Q-E droops, as shown in Figure 16. A phase-locked loop (PLL) is used to estimate the PCC voltage and frequency used in the Q-E and the P-f droop. As a verification of the control structure's operation, the results provided in Chapter 6 of [38] are replicated. The simulation illustrates the connection of a resistive load 1 p.u. at t = 0. For this condition, each VSC provides 50% of the load. After 1 second, the load changes to 1.2 p.u. Figure 26a,b, respectively, show the active and reactive power distribution among the two VSC. Figure 26c illustrates the frequency, and Figure 26d, the amplitude of the PCC voltage.

Case Studies
This section presents simulation results for two case studies that illustrate some of the capabilities of the testbed. Section 4.1 presents the simulation results for the power distribution with two VSC supplying a resistive load. Section 4.2 presents the second case study with the power distribution in the microgrid illustrated in Figure 23. An extensive list of sources' and control algorithms' parameters is provided with the supplementary material.

Power Distribution between Two VSC in Droop-PQ Control Mode
This section presents simulation results for a microgrid where two ideal DC sources supply energy to a charge through VSC. The active and reactive references are defined using P-and Q-E droops, as shown in Figure 16. A phase-locked loop (PLL) is used to estimate the PCC voltage and frequency used in the Q-E and the P-f droop. As a verification of the control structure's operation, the results provided in Chapter 6 of [38] are replicated. The simulation illustrates the connection of a resistive load 1 p.u. at t = 0. For this condition, each VSC provides 50% of the load. After 1 second, the load changes to 1.2 p.u. Figure 26a,b, respectively, show the active and reactive power distribution among the two VSC. Figure 26c illustrates the frequency, and Figure 26d, the amplitude of the PCC voltage.
(a) Active power distribution.

Power Distribution among a Synchronous Generator and Two VSC
From the PCC point of view, the microgrid is composed of four components: two DC hybrid sources connected through voltage source converters, the synchronous generator, and the load.

DC Source 1
The first DC source is composed of a PVP generator, a DC/DC uni-directional power converter, and a battery. The PVP is composed of 100 Shell SM 55 panels connected in parallel [46]. In standard test conditions, each panel has a nominal power of 55 W. A peak power around 5 kWp is expected from this source. The PVP is connected to the batteries through a DC/DC converter. The batteries impose the DC voltage to this bus. The batteries are composed of 192 lead-acid cells connected in series. The nominal voltage of the battery is 440 V and its capacity 8640 Ah.

DC Source 2
The second DC hybrid source is composed of a fuel cell, a DC/DC uni-directional power converter, and a UC. The 5 kW FC is connected to the UC through a DC/DC converter. The polarization curve of this source is presented in Figure 4. The FC is connected to the DC bus using a DC/DC converter. The 270 V 16 F ultracapacitors impose the DC bus voltage.

Synchronous Generator
A 240 V-60 Hz synchronous generator (SG) imposes the AC bus voltage. The SG is coupled to an ideal mechanical source, and the generator provides a constant nominal frequency independent

Power Distribution among a Synchronous Generator and Two VSC
From the PCC point of view, the microgrid is composed of four components: two DC hybrid sources connected through voltage source converters, the synchronous generator, and the load.

DC Source 1
The first DC source is composed of a PVP generator, a DC/DC uni-directional power converter, and a battery. The PVP is composed of 100 Shell SM 55 panels connected in parallel [46]. In standard test conditions, each panel has a nominal power of 55 W. A peak power around 5 kWp is expected from this source. The PVP is connected to the batteries through a DC/DC converter. The batteries impose the DC voltage to this bus. The batteries are composed of 192 lead-acid cells connected in series. The nominal voltage of the battery is 440 V and its capacity 8640 Ah.

DC Source 2
The second DC hybrid source is composed of a fuel cell, a DC/DC uni-directional power converter, and a UC. The 5 kW FC is connected to the UC through a DC/DC converter. The polarization curve of this source is presented in Figure 4. The FC is connected to the DC bus using a DC/DC converter. The 270 V 16 F ultracapacitors impose the DC bus voltage.

Synchronous Generator
A 240 V-60 Hz synchronous generator (SG) imposes the AC bus voltage. The SG is coupled to an ideal mechanical source, and the generator provides a constant nominal frequency independent of the power provided to the AC bus. The terminal's voltage is controlled using a PI controller, acting as an automatic voltage regulator (AVR).

Load and Solar Profiles
The inputs are the profiles of load consumption and solar irradiance. The solar profiles are obtained from real conditions in Bucaramanga, Colombia, and are illustrated in Figure 27a. The load profiles are typical Colombian rural profiles [65] and illustrated in Figure 27a,b. The second profile is not real but allows the observing of the role of the UC in the power distribution. The reactive power is assumed to be 10% of the active power consumed by the load.
Energies 2020, 13, x FOR PEER REVIEW 17 of 23 of the power provided to the AC bus. The terminal's voltage is controlled using a PI controller, acting as an automatic voltage regulator (AVR).

Load and Solar Profiles
The inputs are the profiles of load consumption and solar irradiance. The solar profiles are obtained from real conditions in Bucaramanga, Colombia, and are illustrated in Figure 27a. The load profiles are typical Colombian rural profiles [65] and illustrated in Figure 27a,b. The second profile is not real but allows the observing of the role of the UC in the power distribution. The reactive power is assumed to be 10% of the active power consumed by the load.

Energy Management
The active and reactive references for each source are defined using simple rules defined below. It is important to highlight that this is not an optimal or performant energy management strategy. It is only an example of the microgrid operation.
The VSC1 active power reference is the power generated by the PVP. The VSC1 supplies a percentage of the reactive power consumed by the load. The VSC2 provides percentages of the active and reactive power consumed by the charge. The power supplied by the FC has an upper bound and a limited increase and decrease rate in the power rates. The SG supplies the active and reactive power that the VSC do not supply. If the battery or UC are close to overcharge/discharge, (state-of-charge (SOC) above/below a reference value), the respective VSC reference is adjusted to permit a constant discharge/charge of these sources. Figures 28 and 29 present simulation results for one day of operation of the microgrid. Here, the main interest is the active and reactive power distribution between the sources. The results illustrate the operation as defined with the rule-based approach. The voltage and SOC remain between the predetermined bounds. The results presented in Figure 28 are obtained using the profile in Figure  27b with a maximal load power of 10 kW. The results presented in Figure 29 are obtained using the profile in Figure 27c with a maximal load power of 15 kW.

Energy Management
The active and reactive references for each source are defined using simple rules defined below. It is important to highlight that this is not an optimal or performant energy management strategy. It is only an example of the microgrid operation.
The VSC1 active power reference is the power generated by the PVP. The VSC1 supplies a percentage of the reactive power consumed by the load. The VSC2 provides percentages of the active and reactive power consumed by the charge. The power supplied by the FC has an upper bound and a limited increase and decrease rate in the power rates. The SG supplies the active and reactive power that the VSC do not supply. If the battery or UC are close to overcharge/discharge, (state-of-charge (SOC) above/below a reference value), the respective VSC reference is adjusted to permit a constant discharge/charge of these sources. Figures 28 and 29 present simulation results for one day of operation of the microgrid. Here, the main interest is the active and reactive power distribution between the sources. The results illustrate the operation as defined with the rule-based approach. The voltage and SOC remain between the predetermined bounds. The results presented in Figure 28 are obtained using the profile in Figure 27b with a maximal load power of 10 kW. The results presented in Figure 29 are obtained using the profile in Figure 27c with a maximal load power of 15 kW.

Discussion
This paper introduces a modular testbed to study the energy management in AC/DC microgrids. Two case studies illustrate some of the results that can be obtained using this testbed. The Simulink model has been created in Matlab R2019b and does not require additional toolboxes. A variable-step solver is selected to perform the simulation. The two provided simulations models are ready to run and configurated to build the figures presented in the paper.
The Simulink accelerator mode is recommended to perform the simulations. It does require installing a MinGW-w64 compiler. This mode is useful in simulations of long timespans. Another fact to speed up the total required simulation is to reduce the data acquisition period. Additionally, to avoid memory problems, the simulation can be divided into several simulations.

Conclusions
This paper introduces a new testbed for the simulation of AC/DC microgrids. It is based on the energetic macroscopic representation formalism. It allows the users to design and evaluate energy management strategies for power distribution in hybrid power sources. It provides simulation models adopted and adapted from the literature for the following sources: photovoltaic panels, ultracapacitors, batteries, fuel cells, and synchronous generators.
It also provides simplified models for the power converters and different controllers: maximum power point tracker for the photovoltaic generator, droop controllers for the voltage source converters, and an automatic voltage regulator for the synchronous generator. Two case studies illustrate how the testbed can be used to evaluate a specific energy management strategy. The simulation files provided with the supplementary materials allow the obtaining of the results presented in this paper.
The model only requires Simulink and no other toolboxes. One of the main interests of using the EMR is the modularity, so different models can be implemented for the microgrid components without modifying the microgrid's EMR.