## 2 Principles of the Compensation Methods
### Unit Power Factor Compensation Method  
In this second compensation method, the APF is required to inject the appropriate currents with the objectives of both mitigation of the harmonic distortion and achieving a unit power factor, measured from the source. The unit power factor objective will be achieved when the source current is in phase with the voltage, that is, when the source generates the so-called active current. In fact, it has been well established in the literature on electrical power that the active current is the current that carries the load active (average) power and is collinear with the source voltage. Hence, the phase currents of the source after compensation will take the form (8):  
\[i_{s,i}(t)=G\,v_{i}(t) \tag{8}\]  
where \(G\) is the so-called equivalent conductance parameter of the load defined by (9):  
\[G=\frac{P}{V^{2}}=\frac{P}{V_{a}^{2}+V_{b}^{2}+V_{c}^{2}} \tag{9}\]  
In (9), \(P\) is the average power consumed by the load and \(V\) is the _rms_ value of the three-phase voltage determined from the _rms_ values of the phase voltages, \(V_{i}\). Appendix A describes the way to obtain the value of \(G\) by knowing the voltage and current rectangular coefficients. In general, it requires six ANNs, according to Equation (A8): three ANNs for the six voltage rectangular coefficients, \(A_{V,i}\), \(B_{V,i}\), and three ANNs for the six rectangular coefficients of the current fundamental harmonic, \(A_{I,i}\), \(B_{I,i}\). It could be thought that perhaps it is a better strategy to train an ANN directly for estimation of \(G\), instead of the coefficients, but in the authors' experience, this strategy would require the use of a very high number of combinations of distorted waveforms of the six signals involved (three voltages and three currents), and would result in an excessive amount of data for the training algorithm. If the source voltage is considered sinusoidal and balanced, then the different phase voltages are given by (10):  
\[v_{s,i}(t)=\sqrt{2}\,V_{i}\,\cos(\omega\,t+\alpha_{i}) \tag{10}\]  
where \(i=a\), \(b\), \(c\). With \(Va=Vb=Vc\), and \(\alpha a=\alpha\), \(\alpha b=\alpha-2\pi/3\), \(\alpha c=\alpha+2\pi/3\). Thus, as in (4), the three phase voltages can be expressed according to (11):  
\[ \begin{split}& v_{s,a}(t)=A_{V}\cos\omega\,t+B_{V}\sin\omega\,t\\ & v_{s,b}(t)=A_{V}\cos(\omega\,t-2\pi/3)+B_{V}\sin(\omega\,t-2 \pi/3)\\ & v_{s,c}(t)=A_{V}\cos(\omega\,t+2\pi/3)+B_{V}\sin(\omega\,t+2 \pi/3)\end{split}  \tag{11}\]  
A single ANN can estimate the values of the voltage rectangular coefficients, \(A_{V}\), \(B_{V}\). In the same way, for currents, a single ANN can estimate the rectangular coefficients of the current fundamental harmonic, \(A_{I}\), \(B_{I}\), (7). Taking this into account, it follows that, in the case of balanced voltages and loads, only two ANNs are necessary and the expression in (A8) to obtain \(G\) would be as shown in (12):  
\[G=\frac{A_{V}A_{I}+B_{V}B_{I}}{A_{V}^{2}+B_{V}^{2}} \tag{12}\]The voltage and current rectangular coefficients can be estimated by the ANNs from the sampling of any of the phase quantities; that is why in (12), the double subscript \(i\) is no longer necessary. The source currents after compensation can be identified with the active currents, (8), being the compensation currents injected by the APF given by (13):  
\[i_{c,j}(t)=i_{L,j}(t)-Gv_{s,j} \tag{13}\]  
with \(G\) set as in (A8) or determined by (12) if the three-phase system is balanced. The relationship gives the reference waveforms for the compensation currents to be supplied by the APF. When the voltage is sinusoidal and balanced, which can be considered reasonable from a practical point of view in many situations, from (11) and (13), the compensation currents can be obtained using two ANNs, and expressed by (14):  
\[