## 4 Comparative Analysis of the Prediction Results  
The flow prediction results of the traditional water measurement method, the BP neural network model, the GA-BP neural network model, and the PSO-BP neural network model under different flow patterns are shown in Figure 5. Under the condition of free outflow with gate control, the traditional water measurement method has a large deviation from the predicted samples 16 to 30, and the rest of the sample points are closer to the measured flow. This is due to the large deviation between the fitted flow coefficient curve and the given \(M\) value at \(X=1.0\). The predicted flows of the BP model, GA-BP model, and PSO-BP model are all near the measured flow under this flow pattern. Under the condition of submerged outflow with gate control, due to the fact that some of the given \(M\) values are in a discrete state, the fitting accuracy of the flow coefficient curve is poor. Therefore, the predicted flows of the traditional water measurement method seriously deviated from the measured flows. The predicted flows of the three neural network models are all close to the measured flows under this flow pattern. Under the weir flow condition, although the fitting degree of the flow coefficient curve is good, the predicted flows of the traditional water measurement method are still significantly smaller than the measured flows. The predicted flows of the three neural network models show fluctuating changes in the prediction samples from 1 to 15 and leveling off from 16 to 30. Overall, the predicted flows of the three neural network models have a small deviation from the measured flows under this flow pattern. Figure 5d shows the flow prediction results of the BP model, GA-BP model, and PSO-BP model in the case of a combination of the three flow patterns. It can be seen that the predicted flows of the three neural network models can well fit the trend of the measured flows and have good self-adaptability. In addition, the predicted flows of the three neural network models vary near the measured flows, and there are no obvious discrete predicted sample points. In summary, the neural network prediction model has a much higher predictive ability for the flows under different flow patterns than the traditional water measurement method and has a self-adaptive ability for different flow patterns. Figure 4: Flow charts of the GA- and PSO-optimized BP neural networks [20]: (**a**) GA-BP neural network model and (**b**) PSO-BP neural network model. The relative error can reflect the credibility of the predicted results, which can be calculated by the following equation:  
\[\text{Relative error}=\frac{Q_{i}-Q_{i}^{\prime}}{Q_{i}}\times 100\% \tag{7}\]  
where \(Q_{i}\) is the measured flow and \(Q_{i}^{\prime}\) is the predicted flow. The changes in the relative errors between the predicted results of the BP, GA-BP, and PSO-BP models and the measured results are shown in Figure 6. In Figure 6, the relative error range of the traditional method is too large compared to the neural network prediction method, so we labeled the curve as an orange dash, and we show its axes on the right side. As shown in Figure 6, the prediction accuracy of the traditional methods is too low and cannot be used for flow prediction under combined flow patterns. The maximum error reaches 111.36%, 1492.74%, and 39.43% for FOG, SOG, and WF flow patterns, respectively. Therefore, we focused on analyzing the prediction accuracy of three neural network models. Under the condition of the free outflow with gate control, the relative errors of the GA-BP and PSO-BP models fluctuate within the \(\pm\)5% range, and the relative error of the BP model fluctuates within the range of 1.46% to 18.22%. Under the condition of submerged outflow with gate control, the relative errors of the GA-BP and PSO-BP models become larger. The error range of the GA-BP model is \(-\)8.5-16.5%, the error range of the PSO-BP model is \(-\)12.4-10.1%, and the error range of the BP model is \(-\)25-10%.