## 4 Problem Formulation
### Algorithm Results over 24 \(H\)
* **First state of test network (24:00 p.m.-4:00 a.m.)** This test network state occurred during the low-tariff period, and the test network load values consider consumption from models of uncontrolled loads, which are minimal in the observed period. Meanwhile, the controllable load models operated at 80% of their  
Figure 4: The algorithm’s results for the selection of the location of (**a**) the first APF and (**b**) the second APF. Figure 5: Total overview of the obtained APF locations. rated power during the observed time interval. This test network state is defined as an underloaded state and takes place from 24:00 to 4:00 a.m. This observed state will be analyzed at 24:00, as the network conditions in the other specified intervals are very similar. Figure 6a presents the voltage harmonic spectra at 00:00 before the algorithm for determining the optimal settings of APF at the test network is applied. Figure 6b shows the network state (voltage harmonic spectra) after the APF is connected to the test network as a result of the optimization process. The current state of the network shown in Figure 6a observed only in the KTS 16 0.4 kV busbar shows that all relative harmonic values are below the value defined by the standard (i.e., less than \(U_{h}\leq 0.5\%\)\(U_{\text{In}}\)), which fully meets the standard requirements. However, if the individual harmonics are observed in the depth of the feeder, it is noticeable that in the  
Figure 6: The test network state at 00:00 on the characteristic terminals before (**a**) and after (**b**) the optimization process. characteristic Terminal_12 and Terminal_31, an excessively high value of the 15 th voltage harmonic appears. The above results meet the conditions prescribed by the standard only in the KTS 16 0.4 kV, while an optimization procedure is required in the depth of the feeder. The results after implementing the algorithm and optimization procedure are shown in Figure 6b. The results of the optimization process, which lasts an average of 3:30 h, and after connecting two APFs on buses 41 (rated current 70 A) and 25 (rated current 30 A), confirm that the optimization method successfully determined the parameters and optimal settings for the APF. The result of the corresponding objective function is the minimization of \(\mathit{THD_{V}}\) across all buses, which the optimization method successfully achieved. In Figure 7a, results are presented, and it can be concluded that \(\mathit{THD_{V}}\) values across all network buses decreased. The reduction in \(\mathit{THD_{V}}\) across all buses in relative terms is from 10.82% to 13.95%. After the optimization process, the total relative reduction in harmonic losses for the observed time interval is 14.29%, while in other time intervals, the total reduction in harmonic losses ranged between 17.64% and 25.00%. It is important to note that the total values of \(\mathit{THD_{V}}\) in all three phases before the optimization process, only in some nodes, are greater than 4%. This condition suggests that the optimization process is unnecessary, as \(\mathit{THD_{V}}\) values below 5% are within the limits of the test network requirement and imply that any resulting issues are minor and rare [50]. However, monitoring the network status throughout every phase of the test network is vital for ensuring optimal performance and identifying potential problems early on. Figure 7b shows the \(\mathit{THD_{V}}\) levels in phase A, where single-phase controllable and uncontrollable load models are connected, and specific buses (from 49 to 55) exceed the recommended 5% threshold. Since the optimization process uses the three-phase APFs, affecting all three phases, \(\mathit{THD_{V}}\) is also successfully reduced in phase A.  
Figure 7: \(\mathit{THD_{V}}\) values at 00:00 before and after the optimization process: (**a**) for all buses of the test network; (**b**) \(\mathit{THD_{V}}\) values in phase A on all buses of the test network.