PV/Battery Grid Integration Using a Modular Multilevel Isolated SEPIC-Based Converter

: Photovoltaic (PV) plants can be built rapidly when compared with other conventional electrical plants; hence, they are a competent candidate for supplying the electricity grid. The output power of the PV modules can be used in plug-in electric vehicles (PEVs) DC charging stations to reduce the burden on the electricity grid, particularly during peak load hours. To integrate PV modules and electric vehicles (EVs) with the electricity grid, the modular multilevel converters (MMCs) topologies producing staircase voltage waveforms are preferred as they are able to deliver less total harmonic distortion (THD) and higher efﬁciency in addition to lower voltage stress on semiconductor switches. In conventional centralized MMC topologies, a direct connection to a high-DC-link input voltage is required which is not appropriate for PV plants. A new MMC topology for PV/EV/grid integration is proposed in this paper, where the individual PV arrays are directly connected to each phase of the AC grid to harvest the maximum available power point. A current-source converter (CSC) based on a single-stage isolated SEPIC converter is adopted as the submodule (SM) for the proposed MMC topology given its outstanding features, such as low input ripple current, high efﬁciency, high power factor, and ﬂexible output voltage higher or lower than the input voltage. The single-stage SMs can operate in both DC/DC and DC/AC operating modes. Proper controllers for each mode of operation are designed and applied to supply constant current from either the PV modules or the battery cells by eliminating the second-order harmonic component. The performance of the proposed converter is veriﬁed by simulations and a downscaled prototype controlled by TMSF28335 DSP.


Introduction
The transport sector is a principal contributor to greenhouse gas emissions (GHGs) and environmental contamination [1].Aside from GHGs, on-and non-road vehicles emit hazardous pollutants such as oxides of nitrogen (NOx), carbon monoxide (CO), particulate matter, and sulphur, which leads to numerous death-dealing diseases for human beings [1].Electric vehicles (EVs), including plug-in electric vehicles (PEVs), battery electric vehicles (BEVs), and hybrid electric vehicles (HEVs), show a steadily more appealing pathway to alleviate environmental concerns caused by these harmful air pollutant emissions [2].
Usually, the local AC grid typically provides the power demanded by the battery system inside the EV.Nevertheless, the environmental benefits of EVs can be realized only when they are charged by green energy sources such as solar photovoltaic (PV), fuel cell, wind, ultra-capacitor, etc. [3].Solar PV, among all, is the most favoured since it is a truly renewable energy source with low maintenance costs and can be adopted in diverse applications.As the output power of the PV cells is DC, it can be directly employed to Energies 2022, 15, 5462 2 of 25 charge a PHEV through offboard DC fast chargers, thereby decreasing operational cost, reducing the dependency on the AC grid, and increasing energy efficiency and reliability, in addition to further minimizing GHGs [3].Moreover, solar PV energy can be converted and injected into the AC grid [3,4].
Numerous studies on solar PV-based EV chargers and their associated control algorithms are reported in the literature [5,6].The power conversion in PV-based EV chargers generally includes two stages, where the host (PV) and battery sides are separately controlled by the front-and back-end stages [4,7].On the other hand, the grid-tied topology usually utilizes a DC/DC boost (step-up) converter followed by a voltage-source inverter (VSI).The power converters employed can be either non-isolated or galvanically isolated from the AC grid.The isolated converters can step up the voltage in addition to meeting the required safety standards.In [7], a VSI is used to interface a DC distribution system and the AC grid, and bidirectional DC/DC power converters are employed as battery chargers for PHEV.Unidirectional DC/DC converters are also used to regulate the power flow from PV modules to the DC distribution system.A two-stage grid-connected topology controlled by an adaptive neuro-fuzzy inference system (ANFIS) is presented in [4], which manages to obtain the maximum available power from the solar PV system for the AC grid during daylight and provides constant DC voltages at the battery side during peak hours.In [8], a DC-DC boost converter is used at the DC bus to augment the available voltage from the PV modules and charge the battery of the PHEV.A three-level neutral point clamped (NPC) inverter topology is applied to convert the augmented DC voltage and integrate the solar PV system into the medium voltage AC grid.However, the conventional DC-DC boost converter used in these topologies suffers from high voltage stresses on the semiconductor devices, the reverse-recovery problem of the output diode, and high conduction and switching losses since it is needed to operate at a high duty cycle [9].
Several interleaved DC/DC converters have been developed in the literature to achieve a high step-up voltage gain without an extreme duty cycle ratio [9][10][11][12][13][14][15][16][17].Coupled inductor (CI), switched-capacitor, switched-inductor, and built-in transformer (BIT) are the typical components employed in interleaved converters to solve the reverse-recovery problem of diodes and achieve a high-voltage conversion ratio.Furthermore, the turns-ratio of the CI and the BIT can add more degrees of freedom to regulate the voltage gain.An interleaved high step-up DC/DC converter combining CI, BIT, and switched-capacitor was presented in [9], and was used to integrate the PV arrays into an EV DC fast charging station.A non-isolated high step-up DC/DC converter with soft-switching was proposed in [10], in which a Dickson switched-capacitor was used to extend the voltage conversion ratio.To avoid high current spikes, resonant inductors are inserted in the Dickson switched-capacitor circuit.An interleaved boost converter followed by a bifold Dickson voltage multiplier was used in [11] to increase the voltage gain.Another interleaved high step-up converter was presented in [12], which can recycle the leakage energy of CIs and reduce large voltage spikes across the semiconductor devices, thanks to its passive clamp performance.The interleaved converter in [13] recycles the leakage energy of CI without an additional clamp circuit.Active clamp circuits and an integrated regenerative snubber, in addition to dual CIs in series connection, were employed in the non-isolated high step-up DC/DC converter in [14].Interleaved topologies benefit from low current stresses and voltage spikes on the semiconductor devices, soft-switching, the reduced size of the magnetic components, and high efficiency, in addition to low input current ripple.Hence, they are promising candidates for high current and power density solar PV systems [17].Nonetheless, the increased number of components, hence, the high cost and size, and the reduced power conversion efficiency have made them less favoured for EV chargers [18].As an alternative, single-stage charging configurations have been employed in the literature [18,19].Transformer-less bidirectional Z-source inverters have attracted great interest in PV grid-interconnected systems, which can also be modified and applied to EV battery charging infrastructures.These barriers in Z-source-based single-stage structures include increased size of components and voltage stress on the semiconductor devices.
Modularized multi-level converters (MMCs) generating staircase voltage waveforms at the AC side are promising solutions for PV-EV-grid integration [20,21].They are capable of delivering low total harmonic distortion (THD) at the AC side (without applying conventional harmonic reduction techniques [22,23]).Therefore, they will demand smaller electrolytic capacitors (filters) on both the AC and DC sides [24].High efficiency, low current stress, and low voltage spikes across semiconductor devices are remarkable features of these converters.
A new modular grid-connected topology with an energy storage system is proposed in this paper for the EV/PV/integration, in which isolated single-stage SEPIC-based converters are used as submodules (SMs).Low input ripple current, high power factor, and non-inverted flexible output voltage (higher/lower than the input voltage) are the essential features of the SMs.High efficiency at high input voltages is one of the other excellent benefits delivered by an SEPIC-based SM.Moreover, the SEPIC-based SMs can operate in both DC/DC and DC/AC operation modes without adding an extra DC/DC or DC/AC converter.The battery packs of the PEVs are connected to the PV modules in the DC/DC mode, while in DC/AC mode, the AC grid is interfaced with either the PV modules or the battery packs.
The new modular inverter connects the individual PV modules to the medium voltage AC (MVAC) grid to harvest the maximum possible energy.Maximum power point tracking (MPPT) under different conditions is not discussed in detail in this paper; however, more details can be found in [25,26].Unlike centralized configurations, in which the entire DC voltage available from the PV modules at the DC bus is used as the input for single-or two-stage topologies, in this paper, individual PV arrays are connected to each phase.Therefore, harvesting the MPP is much more straightforward [27].Moreover, the whole output power will not be lost if a problem happens in a single PV module, thanks to the modularized structure of the proposed topology.
The SEPIC-based SMs need very small input capacitances at the input side so that the PV modules can operate at the maximum power point efficiently.As the input capacitor is a crucial element affecting the PV system reliability particularly, reducing their values will positively affect the total reliability of the system.The modulation strategy of the employed SEPIC SMs has been modified in this work to allow for storing the second-order energy components inside the SMs to keep the PV modules operating with a constant continuous input current.Embedding battery packs with the PV modules allows for storing their energy when the grid does not need the support for PV modules.The battery charging process is conducted using the same SMs without adding extra components.
The rest of the paper is organized as follows: the proposed MMC topology is introduced in Section 2, and its operation at the system level is illustrated in Section 3. Operation modes and state-space modelling on the SMs' level are provided in Sections 4 and 5, respectively.Simple hysteresis and proportional-resonant (PR) controllers control the input and output voltages in different operation modes in Section 6. Simulations and experiments in Section 7 verify the proposed topology.Finally, this paper is concluded in Section 8.

The Proposed MMC Topology
Figure 1 shows single-and three-phase layouts of the proposed MMC topology for large-scale photovoltaic plants (LSPVs) based on the isolated single-stage SEPIC converter together with battery electric vehicle (BEV) as the energy storage system (EES).To support DC/DC (PV modules to EES) and DC/AC (PV or EES to the AC grid) operation modes, the selected SM must be able to provide (i) flexible voltage higher or lower than the input voltages from the PV modules or battery (ii) galvanic isolation between the input and output sides to meet the safety standards of the grid.The SEPIC-based converter is adopted in this work as the SM has outstanding features, including low input ripple current, high efficiency, high power factor (PF), and flexible output voltage higher or lower than the input voltage.As seen in Figure 1c, the SEPIC SM consists of five semiconductor switches (S o , S 1 → S 4 ), two inductors, L 1 and L 2 , and three capacitors, C 1 , C 2 , and C o .Moreover, a high-frequency transformer (HFT) with turns' ratio N s :N P can be employed, so the input and output sides are galvanically isolated to comply with the grid's codes.In addition, the HFT can provide additional voltage boosting if required.The SM's operation modes and steady state-space representation will be presented in the following subsections.

System-Level Operation
Assuming that the three-phase layout of the proposed MMC topology is connected to the three-phase MV grid through the grid inductors (L ga , L gb , and L gc ) with internal resistances (r ga , r gb , and r gc ), the total voltage delivered per phase at the grid side equals the summation of the individual voltages of the series-connected SMs and can be expressed as with V o and θ being the magnitude of the output voltage of the SMs and the phase-shift with respect to the grid voltage, respectively.If the three-phase MMC delivers the active power P to the AC grid at a power factor cosϕ, then the magnitude of the output voltage V o , the phase-shift θ, and the per-phase magnitude of the output current I g for the grid voltage vg(t) = Vg sin(ωt) can be written as θ = tan −1 r g I g sin(ϕ) + ωL g I g cos(ϕ) V g + r g I g cos(ϕ) − ωL g I g sin(ϕ) (3)

Modes of Operation
For each SM, single-pole-double-through (SPDT) relays S PV and S bj (j = 1, 2, 3) can be used, as shown in Figure 2, to connect the SM to the PV array the battery pack, or the AC grid.Thus, the proposed MMC can operate in two different modes (DC/DC and DC/AC), depending on the connection of the relays.In addition, a pair of SPDT relays, S g, is used to connect the AC grid to the output terminals of the SM.The resulting modes of operations will be discussed in more detail in the following section.

DC/AC Operation (from PV Modules/Batteries to the AC Grid)
The SPDT relays connections when the real power is delivered from the and the battery packs to the AC grid are shown in Figure 3a,b, respective power from the PV modules to the AC grid (Figure 3a), all the SPDT relay except Spv and Sg.Thus, the PV modules will be able to support the AC gr during daylight when the PV arrays are generating their highest attainable power provided by the PV modules is not sufficient to support the AC gr relays Sbj (j = 1, 2) can be switched on instead of the relays Spv (Figure 3b). the SEPIC-based SM operates as a DC/AC converter.It should be mentioned that in the DC/AC mode, the PV modules/the are required to operate at constant voltages and currents, and therefore the to the SM should be constant and continuous.However, as the single-phas are connected to the single-phase AC grid, the output current and voltage a at the grid frequency (50/60 Hz).Consequently, the second-order harmon elected to the input side, causing the input current to have an undesired  The SPDT relays connections when the real power is delivered from the PV modules, and the battery packs to the AC grid are shown in Figure 3a,b, respectively.To deliver power from the PV modules to the AC grid (Figure 3a), all the SPDT relays are opened except Spv and Sg.Thus, the PV modules will be able to support the AC grid, especially during daylight when the PV arrays are generating their highest attainable power.If the power provided by the PV modules is not sufficient to support the AC grid, the SPDT relays S bj (j = 1, 2) can be switched on instead of the relays S pv (Figure 3b).In both cases, the SEPIC-based SM operates as a DC/AC converter.

DC/AC Operation (from PV Modules/Batteries to the AC Grid)
The SPDT relays connections when the real power is delivered from the PV modules, and the battery packs to the AC grid are shown in Figure 3a,b, respectively.To deliver power from the PV modules to the AC grid (Figure 3a), all the SPDT relays are opened except Spv and Sg.Thus, the PV modules will be able to support the AC grid, especially during daylight when the PV arrays are generating their highest attainable power.If the power provided by the PV modules is not sufficient to support the AC grid, the SPDT relays Sbj (j = 1, 2) can be switched on instead of the relays Spv (Figure 3b).In both cases, the SEPIC-based SM operates as a DC/AC converter.It should be mentioned that in the DC/AC mode, the PV modules/the battery packs are required to operate at constant voltages and currents, and therefore the input current to the SM should be constant and continuous.However, as the single-phase SEPIC SMs are connected to the single-phase AC grid, the output current and voltage are sinusoidal at the grid frequency (50/60 Hz).Consequently, the second-order harmonic will be reelected to the input side, causing the input current to have an undesired second-order harmonic which will interrupt the maximum power point tracker (MPPT).Therefore, as shown in Figure 4, the SEPIC-based SM converter should be able to store the second-order voltage or current harmonics in a storage element.To do so, the SM is designed and controlled to operate in three subintervals.In other words, an extra subinterval is considered to store the second-order component in the inductor L2.It should be mentioned that in the DC/AC mode, the PV modules/the battery packs are required to operate at constant voltages and currents, and therefore the input current to the SM should be constant and continuous.However, as the single-phase SEPIC SMs are connected to the single-phase AC grid, the output current and voltage are sinusoidal at the grid frequency (50/60 Hz).Consequently, the second-order harmonic will be re-elected to the input side, causing the input current to have an undesired second-order harmonic which will interrupt the maximum power point tracker (MPPT).Therefore, as shown in Figure 4, the SEPIC-based SM converter should be able to store the second-order voltage or current harmonics in a storage element.To do so, the SM is designed and controlled to operate in three subintervals.In other words, an extra subinterval is considered to store the second-order component in the inductor L 2 .The key output waveforms for the positive half-cycle (vg > 0) 5d, in which for N = NS/NP, the voltage vCeq(t) and the equivalent ca The DC/AC mode includes three subintervals whose equivalent circuits for the positive half-cycle (when v g > 0) are illustrated in Figure 5a-c: daytime.Accordingly, the SPDT relays Sbj (j = 1, 3) and SPV are connected while disconnecting relays Sg, as shown in Figure 6.Therefore, the inductor L1 discharge into the capacitors C1 and C2, leading them to be charged.Switches S1 and S4 are turned ON to mimic the operation of the typical SEPIC converter and provide a path for the current passing the inductor L2 to flow through the output capacitor Co, increasing its voltage (see Figure 7b).

SM voltage or current
The key output waveforms are presented in Figure 7c, where for N = NS/NP, the voltage vceq(t) and the equivalent capacitor Ceq are in (5).
During the first subinterval (see Figure 5a), the switch S o is turned ON, so the inductor L 1 is being charged by the input DC voltage (from either PV modules or the battery packs), and its current i L1 is linearly increasing.The capacitors C 1 and C 2 discharge into the inductor L 2 , increasing its current i L2 in a straight line.The output capacitor C o , on the other hand, discharges into the AC grid.This mode will last for t on1 = d 1 .ts , with d 1 and t s being the duty-cycle ratio and the switching time of the SM.
Energies 2022, x FOR PEER REVIEW 9 of 25 daytime.Accordingly, the SPDT relays Sbj (j = 1, 3) and SPV are connected while disconnecting relays Sg, as shown in Figure 6. and S4 are turned ON to mimic the operation of the typical SEPIC converter and provide a path for the current passing the inductor L2 to flow through the output capacitor Co, increasing its voltage (see Figure 7b).
The key output waveforms are presented in Figure 7c, where for N = NS/NP, the voltage vceq(t) and the equivalent capacitor Ceq are in (5).daytime.Accordingly, the SPDT relays Sbj (j = 1, 3) and SPV are connected while disconnecting relays Sg, as shown in Figure 6.Therefore, the inductor L1 discharge into the capacitors C1 and C2, leading them to be charged.Switches S1 and S4 are turned ON to mimic the operation of the typical SEPIC converter and provide a path for the current passing the inductor L2 to flow through the output capacitor Co, increasing its voltage (see Figure 7b).
The key output waveforms are presented in Figure 7c, where for N = NS/NP, the voltage vceq(t) and the equivalent capacitor Ceq are in ( 5). (a) is kept in the OFF state, so the inductor L 1 is still discharging into the capacitors C 1 , C 2 , and C o , increasing their voltages.For the positive half-cycle (v g > 0), the switches S 1 and S 4 are turned ON.Therefore, the inductor L 2 discharges into the output capacitor C o (see Figure 5c).
The key output waveforms for the positive half-cycle (v g > 0) are presented in Figure 5d, in which for N = N S /N P , the voltage v Ceq (t) and the equivalent capacitor C eq are as below: In addition, D represents the duty-cycle ratio corresponding to the main switch S o, which in this mode is equal to

DC/DC Operation (Batteries Being Charged by the PV Modules)
The active power can be transferred from the PV modules to the battery packs as long as the AC grid does not demand active power support from the PV modules during the

DC/DC Operation (Batteries Being Charged by the PV Modules)
The active power can be transferred from the PV modules to the battery packs as long as the AC grid does not demand active power support from the PV modules during Energies 2022, 15, 5462 9 of 25 the daytime.Accordingly, the SPDT relays S bj (j = 1, 3) and S PV are connected while disconnecting relays S g , as shown in Figure 6.
Energies 2022, x FOR PEER REVIEW 9 of 25 daytime.Accordingly, the SPDT relays Sbj (j = 1, 3) and SPV are connected while disconnecting relays Sg, as shown in Figure 6.This mode includes two subintervals whose equivalent circuits are demonstrated in Figure 7a,b: ▪ Subinterval 1 (0 ≤ t < ton): During the first subinterval (see Figure 7a Therefore, the inductor L1 discharge into the capacitors C1 and C2, leading them to be charged.Switches S1 and S4 are turned ON to mimic the operation of the typical SEPIC converter and provide a path for the current passing the inductor L2 to flow through the output capacitor Co, increasing its voltage (see Figure 7b).
The key output waveforms are presented in Figure 7c, where for N = NS/NP, the voltage vceq(t) and the equivalent capacitor Ceq are in (5).This mode includes two subintervals whose equivalent circuits are demonstrated in Figure 7a,b: daytime.Accordingly, the SPDT relays Sbj (j = 1, 3) and SPV are connected while disconnecting relays Sg, as shown in Figure 6.Therefore, the inductor L1 discharge into the capacitors C1 and C2, leading them to be charged.Switches S1 and S4 are turned ON to mimic the operation of the typical SEPIC converter and provide a path for the current passing the inductor L2 to flow through the output capacitor Co, increasing its voltage (see Figure 7b).
The key output waveforms are presented in Figure 7c, where for N = NS/NP, the voltage vceq(t) and the equivalent capacitor Ceq are in (5).
Subinterval 1 (0 ≤ t < t on ): During the first subinterval (see Figure 7a), the switch S o is turned ON, resulting in the inductor L 1 being charged by the input DC voltage (from the PV module).Concurrently, the capacitors C 1 and C 2 are discharging into the inductor L 2 .Therefore, i L1 and i L2 are linearly increasing.The output capacitor C o , on the other hand, discharges into the battery pack.The duration of this period is t on = d•t s , with and t s being the duty-cycle ratio and the switching time of the SM.
Energies 2022, x FOR PEER REVIEW 9 of 25 daytime.Accordingly, the SPDT relays Sbj (j = 1, 3) and SPV are connected while disconnecting relays Sg, as shown in Figure 6.This mode includes two subintervals whose equivalent circuits are demonstrated in Figure 7a,b:  Subinterval 1 (0 ≤ t < ton): During the first subinterval (see Figure 7a), the switch So is turned ON, resulting in the inductor L1 being charged by the input DC voltage (from the PV module).Concurrently, the capacitors C1 and C2 are discharging into the inductor L2.Therefore, the inductor L1 discharge into the capacitors C1 and C2, leading them to be charged.Switches S1 and S4 are turned ON to mimic the operation of the typical SEPIC converter and provide a path for the current passing the inductor L2 to flow through the output capacitor Co, increasing its voltage (see Figure 7b).
The key output waveforms are presented in Figure 7c, where for N = NS/NP, the voltage vceq(t) and the equivalent capacitor Ceq are in (5).daytime.Accordingly, the SPDT relays Sbj (j = 1, 3) and SPV are connected while disconnecting relays Sg, as shown in Figure 6.Therefore, the inductor L1 discharge into the capacitors C1 and C2, leading them to be charged.Switches S1 and S4 are turned ON to mimic the operation of the typical SEPIC converter and provide a path for the current passing the inductor L2 to flow through the output capacitor Co, increasing its voltage (see Figure 7b).
The key output waveforms are presented in Figure 7c, where for N = NS/NP, the voltage vceq(t) and the equivalent capacitor Ceq are in (5).

State-Space Modelling of the Proposed SEPIC-Based SM
As described in the previous section, the proposed SEPIC-based SM operates in two and three states for DC/DC and DC/AC modes, respectively.The states can be averaged over a switching period to extract the state-space model [28,29].

DC/AC Operation (from PV Modules/Batteries to the AC Grid)
The state-space model of the proposed SEPIC-based SM can be developed over the switching period ts by writing a set of first-order differential equations governing the circuit: where the matrices Ai, Bi, and Ci (where i = 1, 2, 3) represent the system, the input, and the output matrices of the three subintervals in Figure 5, respectively.The state vector x(t) can be expressed as is the output voltage of PV modules or battery packs, and the output y(t) = vCo(t) is the output capacitor voltage.
The three subintervals of the DC/AC operation mode are time-weighted and averaged to extract the nonlinear averaged state-space model as where the matrices A, B, and C are as follows [28]: 1) The key output waveforms are presented in Figure 7c, where for N = N S /N P , the voltage v ceq (t) and the equivalent capacitor C eq are in (5).

State-Space Modelling of the Proposed SEPIC-Based SM
As described in the previous section, the proposed SEPIC-based SM operates in two and three states for DC/DC and DC/AC modes, respectively.The states can be averaged over a switching period to extract the state-space model [28,29].

DC/AC Operation (from PV Modules/Batteries to the AC Grid)
The state-space model of the proposed SEPIC-based SM can be developed over the switching period t s by writing a set of first-order differential equations governing the circuit: .
where the matrices A i , B i , and C i (where i = 1, 2, 3) represent the system, the input, and the output matrices of the three subintervals in Figure 5, respectively.The state vector x(t) can be expressed as is the output voltage of PV modules or battery packs, and the output y(t) = v Co (t) is the output capacitor voltage.The three subintervals of the DC/AC operation mode are time-weighted and averaged to extract the nonlinear averaged state-space model as .
where the matrices A, B, and C are as follows [28]: The nonlinear averaged model in ( 8) can be linearized under the small-signal assumption by finding deviations around steady-state operating points (the roots of . x(t) = Ax(t) + Bu(t) = 0) to derive required transfer functions.After applying Laplace, the small-signal model can be represented as: where the matrices A inv , B inv , and C inv at steady-state operating points are as follows: Finally, the line-to-output (known as the perturbation transfer function) and line-tocontrol transfer functions are derived: where I is the unity matrix.The control transfer functions G d1 and G d2 (derived by neglecting input voltage disturbance) will later be used in the control loops of the input voltage v in (PV or battery voltage) and output voltage v o (grid voltage), respectively.

The Calculated Duty-Cycle Ratios for Second-Order Harmonic Elimination
The duty-cycle ratios d 1 and d 2 can be calculated to eliminate the second-order harmonic component.The instantaneous power equation of the converter can be obtained from Assuming that the current through L 2 has a DC component plus an AC component of 2ω as with I 2nd being the amplitude of the second-order component.Assuming a resistive output load, the desired output voltage and current can be expressed as After substituting ( 19) and ( 20), Equation ( 18) can be rewritten as Assuming that η SM = 100% (i.e., Therefore, the amplitude and phase of the second-order component can be extracted as As the input DC current (battery/PV current) needs to be kept constant, the first row of the average model equations in (8) must be zero: .
with d 1ff and d 2ff being feed-forward duty-cycle ratios.Finally, Equations ( 24) and ( 6) can be solved simultaneously to extract d 1ff and d 2ff as follows:

DC/DC Operation (PV Modules to Batteries)
Using the same procedure as DC/AC operation mode, the two subintervals of the DC/DC operation mode are time-weighted and averaged to extract the nonlinear averaged state-space model as follows [28,29]: .
where the matrices A, B, and C are as follows: The nonlinear averaged model in ( 26) can be linearized under the small-signal assumption by finding deviations around steady-state operating points (the roots of . x(t) = Ax(t) + Bu(t) = 0) to derive required transfer functions.After applying Laplace, the small-signal model can be represented as where the matrices A dc , B dc , and C dc at steady-state operating points are as follows: Finally, the line-to-output and line-to-control transfer functions are derived: The transfer function G d is derived by neglecting input voltage disturbance and will later be used in the control loop of the input voltage v in (the battery voltage).

Controller Design
6.1.DC/AC Operation (from PV Modules/Batteries to the AC Grid) Figure 8 demonstrates the SM control design when the proposed MMC topology operates as a DC/AC converter, and the power flows from the PV modules to the AC grid.The active power P, in this case, is determined by the maximum available power from the PV modules.For simplicity, it is assumed that all the PV modules operate under the same weather conditions (irradiance, temperature, partial shading, etc.).The reference input (PV) voltage v in * is computed from the MPPT controller.Then, a simple hysteresis-based sliding mode controller controls the actual input voltage v in [30].A proportional-resonant (PR) controller tuned at the grid frequency ω o = 2πf is utilized to control the output voltage v o .

DC/AC Operation (from PV Modules/Batteries to the AC Grid)
Figure 8 demonstrates the SM control design when the proposed MMC topology operates as a DC/AC converter, and the power flows from the PV modules to the AC grid.The active power P, in this case, is determined by the maximum available power from the PV modules.For simplicity, it is assumed that all the PV modules operate under the same weather conditions (irradiance, temperature, partial shading, etc.).The reference input (PV) voltage vin* is computed from the MPPT controller.Then, a simple hysteresis-based sliding mode controller controls the actual input voltage vin [30].A proportional-resonant (PR) controller tuned at the grid frequency ωo = 2πf is utilized to control the output voltage vo. Figure 9 depicts the SM control design when the proposed MMC topology operates as an inverter, and the power flows from the battery packs to the AC grid.Again, hysteresis and PR controllers control the input and output voltages, respectively.Compared to the previous case with PV modules as the input power supply, the active power is determined by the optimal discharge current from the batteries to maximize their effective lifetime and capacity.In addition, the batteries' discharging currents are flexible as there is no maximum power point to operate at.Instead, the reference current is chosen based upon the nominal values recommended by the manufacturer to maximize their lifetime.However, the control scheme after the MPPT or the battery voltage calculator will remain unchanged.Figure 9 depicts the SM control design when the proposed MMC topology operates as an inverter, and the power flows from the battery packs to the AC grid.Again, hysteresis and PR controllers control the input and output voltages, respectively.Compared to the previous case with PV modules as the input power supply, the active power is determined by the optimal discharge current from the batteries to maximize their effective lifetime and capacity.In addition, the batteries' discharging currents are flexible as there is no maximum power point to operate at.Instead, the reference current is chosen based upon the nominal values recommended by the manufacturer to maximize their lifetime.However, the control scheme after the MPPT or the battery voltage calculator will remain unchanged.As discussed in Section 4.1, the additional subinterval in DC/AC operation modes (from PV modules/batteries to the AC grid) provides an extra degree of freedom to control input and output sides together.In other words, the second-order harmonic component is trapped; hence, the input current will be kept constant while generating sinusoidal output voltages and currents.
For the output side control, the feed-forward duty-cycle ratio d2ff will generate the output voltage vo depending on the measured grid voltage and the required output power.As discussed in Section 4.1, the additional subinterval in DC/AC operation modes (from PV modules/batteries to the AC grid) provides an extra degree of freedom to control input and output sides together.In other words, the second-order harmonic component is trapped; hence, the input current will be kept constant while generating sinusoidal output voltages and currents.

+ -
For the output side control, the feed-forward duty-cycle ratio d 2ff will generate the output voltage v o depending on the measured grid voltage and the required output power.The closed-loop PR controller will fix the error in calculation due to the parasitic resistances of the passive elements, semiconductor switches, or any other mismatches by adding the closed-loop duty-cycle ratio d 2 .The PR controller is tuned at the grid frequency ω o = 2πf o as: To ease the selection of the proportional gain k p and the resonant gain k r , an average value of d 2 is selected at 1  2 in G d2 with the transfer function values listed in Table 1.The SISOTOOL interactive toolbox in MATLAB/SIMULINK ® is used to select reasonable values for the controller gains by plotting the root loci of the closed-loop system in two different ways.Firstly, the proportional gain k p is kept constant at 1, and the resonant gain k r is increased in the range of [1:10].Secondly, k r is kept constant at 1 while k p is changed from [0.1:2].The resultant root loci are shown in Figure 10.The values of the gains are selected in these ranges to keep the system stable, increase the controller's bandwidth, and reduce the overshoot.Reasonable system performance in terms of compromising bandwidth and stability is chosen when k p = 1.2 and k r = 6.

DC/DC Operation (from PV Modules to Battery Packs)
Figure 11 shows the SM-level control design when the proposed MMC topology is used to charge the PV batteries.The active power P is determined by the maximum available power from the PV modules, and the reference input voltage vin* is calculated from the MPPT controller.Then, the actual input voltage vin is controlled by a simple hysteresis controller.For simplicity, it is assumed that the PV power will not exceed the rated power of the SMs and the batteries, so the output voltage (battery's voltage) can be left uncontrolled.

DC/DC Operation (from PV Modules to Battery Packs)
Figure 11 shows the SM-level control design when the proposed MMC topology is used to charge the PV batteries.The active power P is determined by the maximum available power from the PV modules, and the reference input voltage v in * is calculated from the MPPT controller.Then, the actual input voltage v in is controlled by a simple hysteresis controller.For simplicity, it is assumed that the PV power will not exceed the rated power of the SMs and the batteries, so the output voltage (battery's voltage) can be left uncontrolled.

DC/DC Operation (from PV Modules to Battery Packs)
Figure 11 shows the SM-level control design when the proposed MMC topology is used to charge the PV batteries.The active power P is determined by the maximum available power from the PV modules, and the reference input voltage vin* is calculated from the MPPT controller.Then, the actual input voltage vin is controlled by a simple hysteresis controller.For simplicity, it is assumed that the PV power will not exceed the rated power of the SMs and the batteries, so the output voltage (battery's voltage) can be left uncontrolled.

Simulation Study
The parameters listed in Table 1 are used in MATLAB/Simulink to verify the operation modes of the proposed MMC topology (i.e., DC/AC (from PV modules/batteries to AC grid) and DC/DC (from PV modules to batteries)) in two case studies.
Figure 12 shows the simulation results for the DC/AC operation mode and when the power is transferred from the PV modules to the AC grid.The total output power in Figure 12a increases from zero to the maximum of around 1 MW in 100 ms and then decreases to around 0.6 MW at t = 300 ms because the irradiance dropped to 60% for all PV modules simultaneously at t = 300 ms to simulate the dynamic response.The grid voltage and current are shown in Figure 12b.The output voltage and the input (PV array's) current of the first SMs in the three phases are also plotted together in Figure 12c.Figure 12d shows the input PV current of the first SMs in the three phases where the controller has successfully removed the second-order harmonic components from each PV module.
decreases to around 0.6 MW at t = 300 ms because the irradiance dropped to 60% for all PV modules simultaneously at t = 300 ms to simulate the dynamic response.The grid voltage and current are shown in Figure 12b.The output voltage and the input (PV array's) current of the first SMs in the three phases are also plotted together in Figure 12c.Figure 12d shows the input PV current of the first SMs in the three phases where the controller has successfully removed the second-order harmonic components from each PV module.
(a) ( Figure 13 shows the simulation results to test the operation when the batteries are used to support the grid.As shown in Figure 13a, the power transferred to the grid increases from zero to the maximum of 1 MW in 100 ms.The grid voltage and current are shown in Figure 13b.The output voltage and input (battery's) current of the first SMs in the three phases are plotted in Figure 13c,d, respectively.Figure 13 shows the simulation results to test the operation when the batteries are used to support the grid.As shown in Figure 13a, the power transferred to the grid increases from zero to the maximum of 1 MW in 100 ms.The grid voltage and current are shown in Figure 13b.The output voltage and input (battery's) current of the first SMs in the three phases are plotted in Figure 13c,d, respectively.
Figure 14 shows the simulation results when the SM is controlled to supply the batteries at 200 V by the PV modules at the maximum power of 4.2 kW.To verify the dynamic response of the proposed MMC topology, the output power of the PV modules is dropped to 50% of its maximum at t = 0.3 s. Figure 14a shows the PV module's voltage when it has been increased from 50 V to 60 V as the operational point has been moved from the maximum power point to the right of the current-vs.-voltagecurve.Figure 14b shows the PV module's current.Figure 14c shows the battery's charging current, while Figure 14d shows the power flowing from the PV module to the 200 V battery pack.Figure 14 shows the simulation results when the SM is controlled to supply the batteries at 200 V by the PV modules at the maximum power of 4.2 kW.To verify the dynamic response of the proposed MMC topology, the output power of the PV modules is dropped to 50% of its maximum at t = 0.3 s. Figure 14a shows the PV module's voltage when it has been increased from 50 V to 60 V as the operational point has been moved from the maximum power point to the right of the current-vs.-voltagecurve.Figure 14b shows the PV module's current.Figure 14c shows the battery's charging current, while Figure 14d shows the power flowing from the PV module to the 200 V battery pack.Figure 14 shows the simulation results when the SM is controlled to supply the batteries at 200 V by the PV modules at the maximum power of 4.2 kW.To verify the dynamic response of the proposed MMC topology, the output power of the PV modules is dropped to 50% of its maximum at t = 0.3 s. Figure 14a shows the PV module's voltage when it has been increased from 50 V to 60 V as the operational point has been moved from the maximum power point to the right of the current-vs.-voltagecurve.Figure 14b shows the PV module's current.Figure 14c shows the battery's charging current, while Figure 14d shows the power flowing from the PV module to the 200 V battery pack.

Experimental Study
The experimental setup for the three-phase implementation of the proposed MMC with 12 SMs and the block diagram of the connection of the SMs are shown in Figures 15 and 16, respectively.Each SM is rated at 750 W, and hence the maximum available power from the whole system is rated at 9 kW.The parameters listed in Table 2 are used for the experiments, and a digital signal processor (DSP-TMS320f28335) is used to control the MMC.DC power supplies have been employed to mimic the PV modules.In addition, the system's output is connected to the local grid, and its rated power (approximately 9 kW) is converted to the LV AC grid to verify the operation of the three-phase topology.

Experimental Study
The experimental setup for the three-phase implementation of the proposed MMC with 12 SMs and the block diagram of the connection of the SMs are shown in Figures 15  and 16, respectively.Each SM is rated at 750 W, and hence the maximum available power from the whole system is rated at 9 kW.The parameters listed in Table 2 are used for the experiments, and a digital signal processor (DSP-TMS320f28335) is used to control the MMC.DC power supplies have been employed to mimic the PV modules.In addition, the system's output is connected to the local grid, and its rated power (approximately 9 kW) is converted to the LV AC grid to verify the operation of the three-phase topology.

Experimental Study
The experimental setup for the three-phase implementation of the proposed MMC with 12 SMs and the block diagram of the connection of the SMs are shown in Figures 15  and 16, respectively.Each SM is rated at 750 W, and hence the maximum available power from the whole system is rated at 9 kW.The parameters listed in Table 2 are used for the experiments, and a digital signal processor (DSP-TMS320f28335) is used to control the MMC.DC power supplies have been employed to mimic the PV modules.In addition, the system's output is connected to the local grid, and its rated power (approximately 9 kW) is converted to the LV AC grid to verify the operation of the three-phase topology.The battery pack is shown in Figure 17.Each SM is connected to a battery segment consisting of eight series lithium-ion battery cells rated at nearly 30 V.An EMUS battery management system (BMS) continuously monitors each cell's voltage, temperature, and current through a dedicated cell module circuit that controls the battery packs to ensure safety requirements.The required data, including voltage, current, and temperature measurements of the battery segments, is sent to the central controller using a controller area network (CAN) communication bus.The module-level control shown in Figure 19 is applied in experiments since there might be small mismatches between the SMs, or they might even be supplied from different power supplies.The central controller generates the same duty-cycle ratios for all SMs.The SM controller shown in Figure 20, on the other hand, will generate the smallsignal duty-cycle ratios for the SMs depending on their power share.Because all SMs in each phase share the same output current, the output voltages of the kth SM (i.e., vok) will depend on the ratio of the power generated by this SM (i.e., pk) with respect to the total generated by the full system (i.e., P):  The module-level control shown in Figure 19 is applied in experiments since there might be small mismatches between the SMs, or they might even be supplied from different power supplies.The central controller generates the same duty-cycle ratios for all SMs.The SM controller shown in Figure 20, on the other hand, will generate the smallsignal duty-cycle ratios for the SMs depending on their power share.Because all SMs in each phase share the same output current, the output voltages of the kth SM (i.e., vok) will depend on the ratio of the power generated by this SM (i.e., pk) with respect to the total generated by the full system (i.e., P):  Experimental results during DC/AC operation are displayed in Figure 21, where the measured total output (grid) power of the MMC and the single-phase grid voltage and current are shown in Figure 21a,b, respectively.Further, the output voltages of the first four SMs in phase "a" are shown in Figure 21c.The input currents of the first SMs in the three phases are demonstrated in Figure 21d.The experimental results, in this case, are conducted to validate part of the computer simulations carried out in Figure 13.
To show the DC/DC operation mode of the SMs when the system is used to charge the battery segments through the DC voltage sources (as PV modules), the charging test has been carried out, and the results are shown in Figure 22.The input voltage and current of the first SM are depicted in Figure 22a.Further, the output current (of the first SM) charging the battery segment and the charging power are shown in Figure 22b,c Experimental results during DC/AC operation are displayed in Figure 21, where the measured total output (grid) power of the MMC and the single-phase grid voltage and current are shown in Figure 21a,b, respectively.Further, the output voltages of the first four SMs in phase "a" are shown in Figure 21c.The input currents of the first SMs in the three phases are demonstrated in Figure 21d.The experimental results, in this case, are conducted to validate part of the computer simulations carried out in Figure 13.
conducted to validate part of the computer simulations carried out in Figure 13.
To show the DC/DC operation mode of the SMs when the system is used to charge the battery segments through the DC voltage sources (as PV modules), the charging test has been carried out, and the results are shown in Figure 22.The input voltage and current of the first SM are depicted in Figure 22a.Further, the output current (of the first SM) charging the battery segment and the charging power are shown in Figure 22b,c  To evaluate the stability of the proposed system, the output power Pout is first increased to 3 kW in 100 ms, then after 150 ms, it is suddenly dropped by almost 75% (to roughly 750 W).As shown in Figure 23b, the grid current ig is tracking the variations in the output power Pout, decreasing to 25% of its maximum value after 250 ms.The same is observed for the three-phase input currents of the first SM (PV currents), whilst the output To evaluate the stability of the proposed system, the output power P out is first increased to 3 kW in 100 ms, then after 150 ms, it is suddenly dropped by almost 75% (to roughly 750 W).As shown in Figure 23b, the grid current i g is tracking the variations in the output power P out , decreasing to 25% of its maximum value after 250 ms.The same is observed for the three-phase input currents of the first SM (PV currents), whilst the output voltages of the first four SMs (v 1a , v 2a , v 3a , and v 4a ) remain constant.To evaluate the stability of the proposed system, the output power Pout is first increased to 3 kW in 100 ms, then after 150 ms, it is suddenly dropped by almost 75% (to roughly 750 W).As shown in Figure 23b, the grid current ig is tracking the variations in the output power Pout, decreasing to 25% of its maximum value after 250 ms.The same is observed for the three-phase input currents of the first SM (PV currents), whilst the output voltages of the first four SMs (v1a, v2a, v3a, and v4a) remain constant.

Conclusions
This paper proposes a new MMC topology for PV/EV/grid integration in which isolated single-stage SEPIC-based converters are used as the SMs.The SMs can operate in DC/DC mode (the PV modules charge the batteries) and DC/AC mode (the power is fed into the AC grid by PV modules or batteries).Therefore, there is no need to add an extra DC/DC or DC/AC converter.The main benefits delivered by the isolated SEPIC-based SMs are low input ripple current, high power factor, and non-inverted flexible output voltage (higher/lower than the input voltage).High efficiency at high input voltages is the other excellent benefit of an SEPIC-based SM.They need very small input capacitances at the input side so the PV modules can operate efficiently at the maximum power point.State-space modelling of the proposed MMC topology is presented to obtain the SMs transfer functions and design the control schemes.The proper controller for each mode of operation is designed and applied to supply constant current from either the PV modules or the battery cells and ensure that the second-order harmonic current components that appear in the input voltage and current are eliminated so the PV modules and/or the battery cells can operate efficiently.Simulations using MATLAB/Simulink and experimental results using a scaled-down prototype validate the performance of the proposed MMC topology and show the feasibility of the selected control designs.
nergies 2022, x FOR PEER REVIEW

Figure 2 .
Figure 2. SM equipped with SPDT relays for different operation modes.

Figure 3 .
Figure 3. SPDT relays connections.(a) DC/AC (from PV to the AC grid).(b) (from battery to the AC grid).

Figure 2 .
Figure 2. SM equipped with SPDT relays for different operation modes.

4. 1 .
DC/AC Operation (from PV Modules/Batteries to the AC Grid)

Figure 2 .
Figure 2. SM equipped with SPDT relays for different operation modes.

Figure 3 .
Figure 3. SPDT relays connections.(a) DC/AC (from PV to the AC grid).(b) DC/AC (from battery to the AC grid).

Figure 3 .
Figure 3. SPDT relays connections.(a) DC/AC (from PV to the AC grid).(b) DC/AC (from battery to the AC grid).

Figure 6 .
Figure 6.SPDT relays connections in the DC/DC mode (from the PV modules to the battery packs).This mode includes two subintervals whose equivalent circuits are demonstrated in Figure7a,b: Subinterval 1 (0 ≤ t < ton): During the first subinterval (see Figure7a), the switch So is turned ON, resulting in the inductor L1 being charged by the input DC voltage (from the PV module).Concurrently, the capacitors C1 and C2 are discharging into the inductor L2.Therefore, iL1 and iL2 are linearly increasing.The output capacitor Co, on the other hand, discharges into the battery pack.The duration of this period is ton = d•ts, with and ts being the duty-cycle ratio and the switching time of the SM. Subinterval 2 (ton ≤ t < ts): During this subinterval ((1 -d)ts), switch So is turned OFF.Therefore, the inductor L1 discharge into the capacitors C1 and C2, leading them to be charged.Switches S1 and S4 are turned ON to mimic the operation of the typical SEPIC converter and provide a path for the current passing the inductor L2 to flow through the output capacitor Co, increasing its voltage (see Figure7b).

Figure 6 .
Figure 6.SPDT relays connections in the DC/DC mode (from the PV modules to the battery packs).
the switch S O is turned OFF.As a result, the inductor L 1 discharge into the capacitors C 1 and C 2 , while the inductor L 2 is still being charged by turning S 2 and S 3 ON from the output capacitor C o .Therefore, this subinterval provides the required decoupling between the input and output sides, as shown in Figure5b.Energies 2022, x FOR PEER REVIEW 9 of 25

Figure 6 .
Figure 6.SPDT relays connections in the DC/DC mode (from the PV modules to the battery packs).

Figure 6 .
Figure 6.SPDT relays connections in the DC/DC mode (from the PV modules to the battery packs).
), the switch So is turned ON, resulting in the inductor L1 being charged by the input DC voltage (from the PV module).Concurrently, the capacitors C1 and C2 are discharging into the inductor L2.Therefore, iL1 and iL2 are linearly increasing.The output capacitor Co, on the other hand, discharges into the battery pack.The duration of this period is ton = d•ts, with and ts being the duty-cycle ratio and the switching time of the SM.▪ Subinterval 2 (ton ≤ t < ts): During this subinterval ((1 -d)ts), switch So is turned OFF.

Figure 6 .
Figure 6.SPDT relays connections in the DC/DC mode (from the PV modules to the battery packs).

Figure 6 .
Figure 6.SPDT relays connections in the DC/DC mode (from the PV modules to the battery packs).This mode includes two subintervals whose equivalent circuits are demonstrated in Figure7a,b: Subinterval 1 (0 ≤ t < ton): During the first subinterval (see Figure7a), the switch So is turned ON, resulting in the inductor L1 being charged by the input DC voltage (from the PV module).Concurrently, the capacitors C1 and C2 are discharging into the inductor L2.Therefore, iL1 and iL2 are linearly increasing.The output capacitor Co, on the other hand, discharges into the battery pack.The duration of this period is ton = d•ts, with and ts being the duty-cycle ratio and the switching time of the SM. Subinterval 2 (ton ≤ t < ts): During this subinterval ((1 -d)ts), switch So is turned OFF.Therefore, the inductor L1 discharge into the capacitors C1 and C2, leading them to be charged.Switches S1 and S4 are turned ON to mimic the operation of the typical SEPIC converter and provide a path for the current passing the inductor L2 to flow through the output capacitor Co, increasing its voltage (see Figure7b).

Figure 6 .
Figure 6.SPDT relays connections in the DC/DC mode (from the PV modules to the battery packs).
Therefore, iL1 and iL2 are linearly increasing.The output capacitor Co, on the other hand, discharges into the battery pack.The duration of this period is ton = d•ts, with and ts being the duty-cycle ratio and the switching time of the SM. Subinterval 2 (ton ≤ t < ts): During this subinterval ((1 -d)ts), switch So is turned OFF.

Subinterval 2
(t on ≤ t < t s ): During this subinterval ((1 − d)t s ), switch S o is turned OFF.Therefore, the inductor L 1 discharge into the capacitors C 1 and C 2 , leading them to be charged.Switches S 1 and S 4 are turned ON to mimic the operation of the typical SEPIC converter and provide a path for the current passing the inductor L 2 to flow through the output capacitor C o , increasing its voltage (see Figure7b).

Figure 6 .
Figure 6.SPDT relays connections in the DC/DC mode (from the PV modules to the battery packs).This mode includes two subintervals whose equivalent circuits are demonstrated in Figure7a,b:▪ Subinterval 1 (0 ≤ t < ton): During the first subinterval (see Figure7a), the switch So is turned ON, resulting in the inductor L1 being charged by the input DC voltage (from the PV module).Concurrently, the capacitors C1 and C2 are discharging into the inductor L2.Therefore, iL1 and iL2 are linearly increasing.The output capacitor Co, on the other hand, discharges into the battery pack.The duration of this period is ton = d•ts, with and ts being the duty-cycle ratio and the switching time of the SM.▪ Subinterval 2 (ton ≤ t < ts): During this subinterval ((1 -d)ts), switch So is turned OFF.Therefore, the inductor L1 discharge into the capacitors C1 and C2, leading them to be charged.Switches S1 and S4 are turned ON to mimic the operation of the typical SEPIC converter and provide a path for the current passing the inductor L2 to flow through the output capacitor Co, increasing its voltage (see Figure7b).

Figure 8 .
Figure 8. SM controller during DC/AC conversion from PV modules to the AC grid: (a) block diagram.(b) Hysteresis band (d cl : closed-loop control duty-cycle ratio; d ff : feedforward dutycycle ratio).

Figure 9 .
Figure 9. SM controller during DC/AC conversion from batteries to the AC grid (dcl: closed-loop control duty-cycle ratio; dff: feedforward duty-cycle ratio).

Figure 9 .
Figure 9. SM controller during DC/AC conversion from batteries to the AC grid (d cl : closed-loop control duty-cycle ratio; d ff : feedforward duty-cycle ratio).

Figure 11 .Figure 10 .
Figure 11.SM controller during DC/DC conversion from PV modules to batteries.

Figure 11 .Figure 11 .
Figure 11.SM controller during DC/DC conversion from PV modules to batteries.

Figure 12 .
Figure 12.SIMULINK/MATLAB simulations of the proposed MMC for DC/AC conversion: (a) total output (grid) power; (b) grid voltage and current; (c) output voltage of SM1; (d) PV arrays current (input current) of SM1.

Figure 12 .
Figure 12.SIMULINK/MATLAB simulations of the proposed MMC for DC/AC conversion: (a) total output (grid) power; (b) grid voltage and current; (c) output voltage of SM1; (d) PV arrays current (input current) of SM1.

Figure 13 .
Figure 13.SIMULINK/MATLAB simulations during DC/AC inversion from batteries to the grid: (a) total output (grid) power; (b) single-phase grid voltage and current (c) output voltage of SM1.(d) Battery packs' current of SM1.

Figure 13 .Figure 13 .
Figure 13.SIMULINK/MATLAB simulations during DC/AC inversion from batteries to the grid: (a) total output (grid) power; (b) single-phase grid voltage and current (c) output voltage of SM 1 .(d) Battery packs' current of SM 1 .

Figure 15 .
Figure 15.Experimental setup of the proposed MMC with 12 SMs.

Figure 16 .Figure 15 .
Figure 16.The block diagram of the connection of the SMs in experiments.

Figure 15 .
Figure 15.Experimental setup of the proposed MMC with 12 SMs.

Figure 16 .Figure 16 .
Figure 16.The block diagram of the connection of the SMs in experiments.

Figure 19 .
Figure 19.Central controller in the experiments (per phase).

Figure 19 .
Figure 19.Central controller in the experiments (per phase).

Figure 19 .
Figure 19.Central controller in the experiments (per phase).Energies 2022, x FOR PEER REVIEW 22 of 25

Figure 20 .
Figure 20.SM's control system in the experiments.

Figure 20 .
Figure 20.SM's control system in the experiments.

Figure 21 .
Figure 21.Experimental results during DC/AC inversion from DC sources to the grid.(a) Total output (grid) power; (b) single-phase grid voltage and current; (c) output voltage of the first four SMs; (d) first SM's input current (PV current).

Figure 21 .Figure 22 .
Figure 21.Experimental results during DC/AC inversion from DC sources to the grid.(a) Total output (grid) power; (b) single-phase grid voltage and current; (c) output voltage of the first four SMs; (d) first SM's input current (PV current).To show the DC/DC operation mode of the SMs when the system is used to charge the battery segments through the DC voltage sources (as PV modules), the charging test has been carried out, and the results are shown in Figure22.The input voltage and current of the first SM are depicted in Figure22a.Further, the output current (of the first SM) charging the battery segment and the charging power are shown in Figure22b,c, respectively.Energies 2022, x FOR PEER REVIEW 23 of 25

Figure 22 .
Figure 22.Experimental results during DC/DC operation mode from DC sources to the grid.(a) PV voltage and current of the first SM; (b) SM1 s (battery's) output current; (c) charging power.

Figure 22 .
Figure 22.Experimental results during DC/DC operation mode from DC sources to the grid.(a) PV voltage and current of the first SM; (b) SM1′s (battery's) output current; (c) charging power.

Figure 23 .
Figure 23.Experimental results during sudden 75% drop in power.(a) Total output (grid) power; (b) single-phase grid voltage and current; (c) output voltage first four SMs; (d) first SM's input current (PV current).

Figure 23 .
Figure 23.Experimental results during sudden 75% drop in power.(a) Total output (grid) power; (b) single-phase grid voltage and current; (c) output voltage of the first four SMs; (d) first SM's input current (PV current).