# Optimal Control of an Ultraviolet Water Disinfection System
## 5 Discussion  
### Searching Process and Results' Analysis  
Algorithm HTPSO_UV1 was implemented using the MATLAB language (and system) and executed for many imposed bacterial abatement \(A_{0}\) values. An optimal solution has three components: the UV light intensity \(I_{0}\), the flow rate \(Q_{0}\), and the performance index. Data concerning the UVDS under consideration are those from Appendices A and B. The constants and the implemented algorithm parameters are indicated in Appendix C. Some tests were carried out using the programs attached to this paper. Different tests could be conducted considering other data for UVDSs with a similar structure. Figure 5 shows the variables' typical evolution during the execution of algorithm HTPSO_UV1 for the imposed values of two bacterial abatements: \(A_{0}=3\) and \(A_{0}=3.5\). The searching process is traced for a few tens of steps because of the rapid algorithm's convergence. One can see that the GBEST value (performance index) monotonically decreases during the searching process. \begin{table}
\begin{tabular}{c c} \hline \hline
1 & **start** _function_(\(X_{i}\)) \\
2 & /* input argument: the position of a particle \\
3 & \(I_{0}\ \gets\ x_{i}^{1}(t)\); \\
4 & \(Q_{0}\ \gets x_{i}^{2}(t)\); \\
5 & \(t_{f}\ \leftarrow\ \frac{\mathcal{V}}{Q_{0}}\); \\
6 & \(D\ \leftarrow\ I_{0}\cdot t_{f}\) \\
7 & \(Ab\ \gets A\left(I_{0},Q_{0},t_{f}\right)\) \\
8 & \(J\ \gets D\ +\ \alpha\cdot|Ab\ -\ A_{0}|\); & /*\(\alpha\), \(A_{0}\) are global values*/ \\
9 & **return**\(J\) \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Description of the objective function. It should be noted that HTPSO_UV1 is a stochastic algorithm that tries to approach the UV_OCP1's optimal solution as much as possible. To decide whether it works well needs a minimal statistical analysis. When considering the convergent variables' evolution, each execution of the implemented algorithm generates stochastic processes. The evaluation of the algorithm was conducted using execution series because of its stochastic character. For example, our program was executed 30 times for each imposed value \(A_{0}\). Table 4 presents statistical measures regarding the number of steps until convergence and solution values, in the case \(A_{0}=3\). The first five columns show the mean values of the number of steps until convergence (\(t_{\text{conv}}\)), the number of objective function calls (_Ncalls_), \(I_{0}\), \(Q_{0}\), and the performance index \(J\). The standard deviations of \(t_{\text{conv}}\) and _Ncalls_ are presented in the last two columns. The optimal values for \(I_{0}\), \(Q_{0}\), and \(J\) are practically constant at the end of the 30 executions. Therefore, their mean values given in Table 4 are identical to these constant values:  
\[I_{0}=9.92\text{ mW}/\text{cm}^{2};Q_{0}=0.8\text{ L}/\text{s};J=24.803.\]  
Consequently, the standard deviation of these values is practically zero because the optimal solution belongs to the search domain's boundary (\(Q_{0}=0.8\)). That is, a position's limitation stops the search. This is a general property, as shown in the next section. One can see that the average number of steps until convergence is relatively small, namely 149 steps. All of the values are given in Appendix C. This relates to the complete convergence of the swarm, i.e., all the particles have the same \(SD\) position. There are two explanations for this fact. First, the hybrid topology and the adaptive particles' speed involve a good convergence speed. Second, in our implementation, the swarm is comprised of 30 particles. That is, the swarm has an important dimension for a PSO algorithm. The smaller the number of particles, the greater the number of steps until convergence. A very important aspect of such an algorithm's analysis is the computational complexity as a measure of its efficiency. Practically, this can be evaluated through the number