*Scenario 2*

In this section, a scenario is considered where the irradiance across the PV panels connected to sub-modules in an arm of the MMC is uneven. The sub-modules in an arm of the MMC are allowed to track MPPT by providing individual MPP references from the MPPT algorithm to the power reference generation block in the controller.

If the sub-module capacitor voltage is allowed to follow the MPPT reference within the arm of the MMC, then each sub-module in the arm will deviate from the average value i.e., *vcxyi*= *<sup>v</sup>*Σ*cxy*/*N*.

The current controllers will increase or decrease the inserted arm voltage reference to compensate for the voltage difference due to unequal sub-module voltages in the arm of the MMC. However, the sorting and tracking algorithm does not account for the voltage error between the desired arm voltage and the arm voltage to be inserted. This voltage error varies based on choice of sub-modules to be inserted. This leads to a voltage error in each switching period per arm of the MMC, resulting in a residual voltage. This residual voltage per phase (sub-script 'y' is dropped for simplicity) can be expressed as

$$v\_{\mathbf{x},\mathcal{E}} = N\left(\frac{v\_{\mathbf{x}}^{\star}}{v\_{d\mathcal{E}}}\right) - \sum\_{j=1}^{N\_{\mathcal{E}}} v\_{\mathbf{c}X\_{K(j)}}\tag{6}$$

where the '*K*' is a row matrix [1 × *Nxy* ] with the sub-module indexes to be inserted. Therefore, *vcxyK*(*j*) will yield the value of the sub-module capacitor whose index is stored in the *j*th location of the row matrix '*K*'.

If the residual error is large then it will lead to increased harmonics in the output current. Such a variation is acceptable until the THD is well below 5% as required by IEEE 519 [21] and that no *dc* current greater than 0.5% of the rated current is injected to the grid [22].

The simulation results are shown where the irradiance is linearly distributed across all of the upper and lower arms of the MMC from 10 W/m<sup>2</sup> to 1000 W/m2. For the scenario considered, the sub-module capacitor voltages are shown in Figure 8a for each of the six arms of the MMC. Figure 8b shows the upper and lower arm currents (*iuy* [*A*], *ily* [*A*]), output currents (*isy* [*A*]), circulating currents (*icy* [*A*] ∀ y = a, b, c), the active and reactive power injected to the grid (*P* [*kW*], *Q* [*kVAr*]), and the last plot shown the voltages (*vsy* [*V*] ∀ y = a, b, c) at PCC along with the phase currents (*isy* [*A*]) for 100 ms duration between 4.9 s to 5 s, ∀ y = a, b, c.

**Figure 8.** Simulation results for scenario 2: (**a**) Capacitor voltages for all the sub-modules in an arm of the MMC for all three phases. From the top, upper arm phase "a", upper arm phase "b", upper arm phase "c", lower arm phase "a", lower arm phase "b", and lower arm phase "c", respectively. (**b**) The upper and lower arm currents (*iuy* [*A*], *ily* [*A*]), output currents (*isy* [*A*]), circulating currents (*icy* [*A*] ∀ y = a, b, c), the active and reactive power injected to the grid (*P* [*kW*], *Q* [*kVAr*]), and the plot shown the voltages (*vsy* [*V*] ∀ y = a, b, c) at PCC and the phase currents (*isy* [*A*]) for 100 ms duration between 4.9 s to 5 s, ∀ y = a, b, c.

It is seen that the sorting and tracking algorithm [13] can be used for tracking the MPP voltages for the respective sub-modules by providing the individual references from the MPPT algorithm instead of a average voltage. Moreover, balanced active power is injected to the grid at unity power factor. Since each arm of the MMC produces equal power there is no need to transfer power between the phases of the MMC. Hence the circulating current is zero. The Figure 9 shows the residual voltage defined as in (6). The Figure 10a–c shows the frequency spectrum of the phase currents; the THDs are 5.11%, 5.28%, and 5.36% for phase a, b, and c currents, respectively. It is seen that the THD is higher that the permitted level as per IEEE 519 standard.

The positive, negative, and zero sequence components of the three-phase currents are shown in Figure 11 for the scenario 2. It is seen that the unbalance current injected to the grid is well within 0.5% of the rated magnitude of phase current for the scenario 2.

**Figure 9.** The residual voltage as defined in (6) for the phase a upper arm of the MMC.

(**a**) THD = 5.11%, *isa*1 = 43.06A (**b**) THD = 5.11%, *isb*1 = 43.11A (**c**) THD = 5.11%, *isc*1 = 43.06A **Figure 10.** Frequency spectrum of the output phase currents in % with respect to the 50 Hz fundamental current, *isy*1 ∀ y = a, b, c.

**Figure 11.** The positive sequence current (*is*(+)), negative sequence current (*is*(−)), and zero sequence current (*is*(0)) for the currents injected to the grid for scenario 2.

#### **5. Modified Sorting and Tracking Algorithm**

The sorting and tracking algorithm enables the MMC to have individual MPPT for each sub-module, as seen in scenario 2. This increases the MPPT granularity of the MMC-based PV plant to 6N. For the plant considered in this paper, the MPPT granularity will be 114. The drawback is that the residual error leads to harmonic distortion at the output current. Based on the operating condition, the value of the harmonic distortion might not adhere to the value permitted by the IEEE standard 519 [21]. Therefore, to ensure that for all operating steady-state conditions the harmonic distortion is within the limits, the residual voltage has to be alleviated. The voltage error as per (6) has to be mitigated to reduces the harmonic distortion and any unbalance in current injected to the grid.

In this section, a modified sorting and tracking algorithm is proposed that takes into account the voltage error and increases or decreases the insertion indexes. Further, during a switching period one of the inserted sub-modules is pulse-width modulated such that the average value of the inserted arm voltage inserted matches the desired arm voltage in a switching period. Sub-modules with minimum or maximum voltage deviation from their MPP voltage value are selected, based on the arm current polarity, for PWM in every switching period. Therefore, the duty ratio and the sub-module index for the PWM changes every switching period. By doing so, the loss of power extraction from the PV panel due to the PWM of the sub-module is minimized.

The sorting and tracking algorithm selects the *Nx* sub-modules to be inserted per arm of the MMC in a given phase, with this the residual voltage is computed as per (6). If the error is negative, then the insertion index is increased to minimize the error. If the error is positive, then the insertion index is decreased to mitigate the residual voltage. The insertion index is either increased or decreased until the magnitude of the ratio as per (7) is less than one, this will be the modified number of sub-modules to be inserted " *N*- *x* ".

$$w = \frac{|v\_{x,\epsilon}|}{\sum\_{j=1}^{N\_{\rm tr}} v\_{c x\_{\mathcal{K}(j)}}} \tag{7}$$

If the arm current is positive (or negative) then the sub-module with the lowest (or highest) voltage in the set of sub-modules to be inserted is selected for modulation. The duty ratio is the calculated as 

$$d = \frac{\left| N\left(\frac{\upsilon^{\star}\_{\mathcal{X}}}{\upsilon\_{d\mathcal{L}}}\right) - \sum\_{j=1}^{N^{\star}\_{\mathcal{x}}} \upsilon\_{c\mathbf{x}\_{\mathcal{K}(j)}} \right|}{\sum\_{j=1}^{N^{\star}\_{\mathcal{X}}} \upsilon\_{c\mathbf{x}\_{\mathcal{K}(j)}}} < 1\tag{8}$$
