## 2 Reference Current Calculation
### CPC Power Theory and Reference Current Calculation  
Previously, due to CPC power theory involving a frequency domain transformation calculation, not much attention has been paid to this theory. However, in recent years, with the rapid development of hardware technology such as processors and memory storage devices, CPC theory has gradually found its place in power analyses. CPC theory combines time domain and frequency domain analysis methods. The basic idea is to decompose the current into a series of current components with clear physical meanings. According to CPC theory, the three-phase current vector generated by any unbalanced and nonlinear load can be decomposed into five parts [16; 17; 19]:  
\[\dot{\mathbf{i}}_{L}=\dot{\mathbf{i}}_{a}+\dot{\mathbf{i}}_{r}+\dot{\mathbf{i}}_{n}+\dot{\mathbf{i }}_{z}+\dot{\mathbf{i}}_{g} \tag{1}\]  
where \(\dot{\mathbf{i}}_{L}\) is a complex representation of the load current; \(\dot{\mathbf{i}}_{a}\) is defined as the active current component, which is the minimum effective current component required by the load to maintain its own power; \(\dot{\mathbf{i}}_{r}\) is defined as the inductive reactive current component, which is the current component with a phase shift of \(90^{\circ}\) relative to the voltage; \(\dot{\mathbf{i}}_{n}\) and \(\dot{\mathbf{i}}_{z}\) are the negative-sequence and zero-sequence current components generated when the load is unbalanced; and \(\dot{\mathbf{i}}_{g}\) is defined as the generative current, reflecting the nonlinear characteristics of the load or the time-varying parameters. Except for the active current component, the other current components can lead to increases in line loss, which are all reactive current components. Figure 1: Compensation schematic diagram of an active compensation device. In the load current component, in addition to generative current, other current components are found in the fundamental current. \[\mathbf{i}_{L}=\mathbf{i}_{L1}+\mathbf{i}_{g} \tag{2}\]  
where \(\mathbf{i}_{L1}\) is the fundamental current component. Since the fundamental current is the main frequency current in a distribution network, in this paper, we mainly study the decomposition of a fundamental current using CPC theory and the compensation of each reactive component. A reactive compensation circuit is shown in Figure 2. The compensation device here is an active power filter. After measuring the three-phase load currents \(i_{LA}\), \(i_{LB}\), and \(i_{LC}\) and the three-phase power supply voltages \(u_{A}\), \(u_{B}\), and \(u_{C}\), each reactive current component was calculated using CPC theory, and then, the optimization algorithm was used. Optimization algorithms such as particle swarm optimization (PSO) calculate the compensation current and finally output a three-phase compensation current through the controller. In Figure 2, \(i_{AC}\), \(i_{BC}\), and \(i_{Cc}\) are the three-phase currents output by the reactive power compensation device, and \(i_{A}\), \(i_{B}\), and \(i_{C}\) are the compensated power supply currents. The vectors of the three-phase fundamental frequency load current and voltage are as follows:  
\[\mathbf{i}_{L1}(t)\stackrel{{\mathrm{df}}}{{=}}\left[ \begin{array}[] {c}i_{LA}(t)\\ i_{LB}(t)\\ i_{LC}(t)\end{array} \right]=\sqrt{2}\mathrm{Re}\Bigg{\{}\left[ \begin{array}[] {c}\mathbf{I}_{LA}\\ \mathbf{I}_{LB}\\ \mathbf{I}_{LC}\end{array} \right]e^{i\omega t}\Bigg{\}}=\sqrt{2}\mathrm{Re}\Big{\{} \mathbf{I}e^{i\omega t}\Big{\}} \tag{3}\]  
\[\mathbf{u}(t)\stackrel{{\mathrm{df}}}{{=}}\left[ \begin{array}{c}u_ {A}(t)\\ u_{B}(t)\\ u_{C}(t)\end{array} \right]=\sqrt{2}\mathrm{Re}\Bigg{\{}\left[ \begin{array}{c} \mathbf{U}_{A}\\ \mathbf{U}_{B}\\ \mathbf{U}_{C}\end{array} \right]e^{i\omega t}\Bigg{\}}=\sqrt{2}\mathrm{Re}\mathbf{I}e^ {i\omega t} \tag{4}\]  
Equivalent admittance can be derived from the power supply phase voltage phasor (\(\mathbf{U}_{A}\), \(\mathbf{U}_{B}\), and \(\mathbf{U}_{C}\)) and the load current phasor (\(\mathbf{I}_{LA}\), \(\mathbf{I}_{LB}\), and \(\mathbf{I}_{LC}\)):  
\[\left\{