## Methodology
### Harmonic Generation and Grid Interaction Mechanism of Rooftop PV Systems  
Before applying HAMM to the PV systems, the harmonic generation and grid interaction mechanisms have to be investigated. Figure 6 is the generalized circuit topology of a single-phase rooftop PV system, which consists of a PV panel, a dc-link capacitor, \(\mathcal{C}_{dc}\), a full-bridge inverter and LC filter for harmonic suppressing [23]. According to the KCL principle, the grid-side current, \(i_{g}\), can be expressed as (5). As the LC filter capacitor, \(\mathcal{C}_{f}\), has a relatively small value, (5) can be simplified as (6). By applying a Fourier transform to (6), the grid-side current, \(i_{g}\), can be divided into a fundamental current, \(i_{g}^{\ddagger}\), and the harmonic currents, \(\sum\limits_{g^{\ddagger}}^{h}\) as in (7). It is noticed that the harmonic current, \(i_{g}^{\ddagger}\), is mainly determined by the inverter output voltage harmonic, \(v_{inv}^{h}\) and the grid supply voltage harmonic, \(v_{g}^{h}\), which is uncontrollable. To further investigate the features of \(v_{inv}^{h}\), the inverter output voltage, \(v_{inv}\), can be expressed as the dc-link voltage, \(v_{dc}\), multiplied by the PWM pulse signal, \(d\), as in (8). It should be noted that the harmonic contents of the PWM pulse signal, \(d^{h}\), is determined by the PWM strategy being applied. It can be concluded from (8) that \(v_{inv}^{h}\) is determined by the dc-link voltage variation, \(\widetilde{v}_{dc}\), and the PWM pulse signal harmonics, \(d^{\ddagger}\).  
To establish the connection between the dc-link voltage, \(v_{dc}\), and the grid-side current, \(i_{g}\) the power output of the PV panels, \(p_{inv}\), and the power injected into the power grid, \(p_{g}\), can be expressed as (9) and (10), respectively (here, a unit power factor is assumed). As the power losses for the power conversion stage are relatively small as opposed to the total power generated, it is assumed that \(p_{inv}\) equals \(p_{g}\), (also \(V_{g}^{1}l_{g}^{1}\approx v_{dc}i_{pv}\)); therefore, (11) can be derived. It is noticed from (11) that \(\widetilde{v}_{dc}\) brings in even harmonic content twice the frequency of the grid, \(2w_{0}\). It is also noticed that \(\widetilde{v}_{dc}\) (and hence \(v_{inv}^{h}\) in (8)) is power  
Figure 6: The generalized circuit topology of a single-phase rooftop PV system.  
dependent. In addition, \(|\vec{v}_{dc}|\) will be reduced with the decreasing operating power of PV systems. Accordingly, \(\vec{v}_{dc}\) is characterized by the odd harmonics with the angular frequency equaling \((2k+1)w_{0}\) (\(k\) is a positive integer number), and the odd harmonics will also be observed from \(v_{inv}\), as in (8). Therefore, the harmonic generation and grid interaction mechanism of PV systems can be summarized as follows: (1) the PV systems mainly generate odd harmonics; (2) the harmonic emission level of PV systems is mainly determined by the PWM strategy being applied, the background supply voltage distortions and the system operating power.  
\[i_{g}=\int\frac{v_{inv}-v_{g}}{L_{f}}dt-C_{f}\dot{v}_{g} \tag{5}\]  
\[i_{g}=\int\frac{v_{inv}-v_{g}}{L_{f}}dt \tag{6}\]  
\[i_{g}=i_{g}^{1}+\sum_{h=2}^{N}i_{g}^{h}=\frac{1}{L_{f}}\int\ (v_{inv}^{1}-v_{g}^{1})dt+\frac{1}{L_{f}}\int\ (\sum_{h=2}^{N}v_{inv}^{h}-\sum_{h=2}^{N}v_{g}^{h})dt \tag{7}\]  
\[v_{inv}=v_{inv}^{1}+\sum_{h=2}^{N}v_{inv}^{h}=dv_{dc}=d^{1}V_{dc}+(d^{1}\vec{v }_{dc}+V_{dc}\sum_{h=2}^{N}d^{h}+\widetilde{v}_{dc}\sum_{h=2}^{N}d^{h}) \tag{8}\]  
\[p_{g}=v_{g}^{1}i_{g}^{1}=V_{g}^{1}I_{g}^{1}[1+\cos(2w_{0}t)] \tag{9}\]  
\[p_{dc}=v_{dc}i_{pv}-v_{dc}C_{dc}\frac{dv_{dc}}{dt}=v_{dc}i_{pv}-v_{dc}C_{dc} \frac{d\widetilde{v}_{dc}}{dt} \tag{10}\]  
\[\widetilde{v}_{dc}=-\int\ [\frac{V_{g}^{1}I_{g}^{1}}{C_{dc}V_{dc}}v_{dc}i_{pv} \cos(2w_{0}t)]dt \tag{11}\]