## Methodology
### The Practical HAM Derivation Approach for Fluctuating Power PV Systems
The detailed HAM derivation and self-tuning process are made up of the following steps, with the flowchart given in Figure 12:  
For Step (1) for any captured voltage and current waveforms within the selected power fluctuation range, record the corresponding spectrum \([V_{H}J_{h}]_{[t=2)}\) to the database if the condition number is between \([V_{H}]_{[t=2)}\) and the former saved voltage spectrum \([V_{H}]_{[t=1)}\) is below the predefined threshold value (e.g., \(1\times 10^{4}\)); calculate the operating power \(P_{k}\) and the estimated \([Y_{H,H}]_{Pk}\) from the saved spectrum by using \([Y_{H,H}]_{Pk}=[I_{H}]_{Pk}/[V_{H}]_{Pk}\);  
For Step (2), find the first non-singular voltage spectrum matrix \([V_{H,P1}\), \(V_{H,P2}\),..., \(V_{H,P10}]\) and the corresponding current spectrum matrix \([I_{H,P1}\), \(I_{H,P2}\),..., \(I_{H,P10}]\) after the number of captured measurement sets is above 10, and take the maximum operating power as the reference power level, \(P_{ref}\); mark the data sets as \([VI]_{\text{spec\_ns}}\);  
For Step (3) for any selected measurement set, \([V_{H},I_{h}]_{Pk}\), within the 10 measurement sets of the \([VI]_{\text{spec\_ns}}\) scale, its estimated \([Y_{H,H}]_{Pk}\) from \(P_{k}\) to \(P_{ref}\) if \(P_{k}\) is not equal to \(P_{ref}\) (i.e., \([Y_{H,H}]_{P{ref}}=[Y_{H,H}]_{Pk}/k_{S}\)); the scaling factor \(k_{S}\) is applied by assuming that the power dependencies of \([Y_{H,H}]\) have the same trend for all considered odd harmonics; \(k_{S}\) is calculated from the \(Y_{DVI,Pk}\) divided by \(Y_{DVI,Pref}\), where the subscript \(DVI\) refers to the common dominant voltage harmonic order between \([V_{H}]_{Pk}\) and \([V_{H}]_{Pref}\);  
For Step (4), scale the current spectrum \([I_{h}]_{Pk}\) from \(P_{k}\) to \(P_{ref}\) by using equation \([I_{h}]_{P{ref},S}=[Y_{H,H}]_{P{ref},S}\times[V_{H}]_{Pk}\); calculate \(Y_{1,1,Pref}\) at \(P_{ref}\) by applying the linear interpolation between \([Y_{1,1,P1},Y_{1,1,P2},\ldots,Y_{1,1,P10}]\) and \([P_{1},P_{2},\ldots,P_{10}]\); replace \([I_{1}]_{P{ref}}\) by \([Y_{1,1}]_{P{ref}}\times[V_{1}]_{Pk}\);  
For Step (5), repeat steps 3-4 until all the 10 current spectrums of \([VI]_{\text{spec\_ns}}\) are scaled to their counterparts at \(P_{ref}\) and calculate the \([Y_{h,H}]_{P{ref}}\) (i.e., HAM at \(P_{ref}\)) from (12); the initially obtained \([Y_{h,H}]_{P{ref}}\) will be applied for further parameter self-tuning process;  
Figure 11: The general HAMM development procedure for a grid-tied PV system. For Step (6) for any new measurement set \([V_{H}J_{h}]_{PK}\), use it to replace any measurement set within \([VI]_{\text{spec.ns}}\) and check if the updated voltage spectrum matrix is ill-conditioned; for any non-singular voltage spectrum matrix, scale \([I_{h}]\) from \(P_{k}\) to its counterpart at \(P_{n\!f}\) if \(P_{k}\) does not equal \(P_{n\!f}\) and calculate the new HAM, \([Y_{h,H}]_{\text{Pref},\!f}\) by (12) (with same calculation procedures specified in steps 4-5);  
For Step (7), calculate the total current difference \(TCD_{(k=1:10)}\) by using equation \(TCD_{(k=1:10)}=\sum\mid I_{\text{spec.ns}}([Y_{h,H}]_{\text{Pref},\!f})-I_{ \text{spec.Pref},\!S}\mid,\) where \(I_{\text{spec.Pref}}([Y_{h,H}]_{\text{Pref},\!f})\) refers to the current spectrum calculated by using \([Y_{h,H}]_{\text{Pref},\!f}\) and \(I_{\text{spec.Pref},\!f}\)s represents the current spectrum scaled to _Pref_; calculate the \(TCD\) at \(P_{n\!f}\), \(TCD_{n\!f}\) by using \(TCD_{\text{Pref}}=\sum\mid I_{\text{spec.ns}}([Y_{h,H}]_{\text{Pref},\!f})-I_{ \text{spec.Pref},\!S})\mid;\) within all the available \([Y_{h,H}]_{\text{Pref},\!f(k=1:10)}\), select \([Y_{h,H}]_{\text{Pref},\!m}\) with minimum \(TCD\) (i.e., \(TCD_{min}\)); replace \([Y_{h,H}]_{\text{Pref},\!f}\) with \([Y_{h,H}]_{\text{Pref},\!f}\) if \(TCD_{min}\) is smaller than \(TCD_{\text{Pref}}\).