With the increasing demand for better living environment, the discharge standards for wastewater are becoming increasingly strict. The concentration of effluent ammonia nitrogen (SNHe) and effluent total nitrogen (TN) are not only the most important parameters for water quality but also serve as the key indicators for the discharge standards of wastewater treatment processes (wastewater treatment plants). SNHe and TN are closely related with penalties caused by excessive emissions and are also intimately linked with the degree of water eutrophication. Therefore, it is of great necessity to monitor the concentration of SNHe and TN, as this can help to detect and effectively address the issue of water eutrophication in time. Currently, there are many methods to measure effluent ammonia nitrogen and total nitrogen, such as ultraviolet absorption spectrometry, ammonia nitrogen determination, step-by-step measurement of relevant elements followed by summation etc. Although these methods offer high precision, they are cumbersome, time-consuming, labor-intensive, and require specialized laboratory testing, which cannot meet the demands for real-time monitoring.
In contrast, data-driven soft measurement techniques can achieve rapid and accurate online predictions, overcoming the inherent limitations of chemical methods and online instruments measurements. Conventional data-driven methods normally exhibit weak data representation capabilities, as prediction models based on baseline networks typically rely on simple network structures, which cannot extract effective features from raw data collected by wastewater treatment plants. Besides, in many practical projects, raw data often contains noise and interference. In this case, the effective features of the dataset are crucial to ensuring that the baseline network model can accurately reflect the actual situation. Therefore, the lack of effective features often leads to a deterioration in the performance of the baseline network.
The present application provides a water quality measurement method, device, equipment, and storage medium, aimed at solving the technical problem in the existing technologies where the effective features in the raw data sets cannot be efficiently extracted, leading to low accuracy in measurement results.
In this regard, the first aspect of the application provides a water quality measurement method, which includes:
Optionally, the method also includes:
The iterative training of the baseline network includes:
Optionally, the aforementioned calculation of the error state value based on the errors obtained from two consecutive iterations includes:
Optionally, the process of determining whether the error state value of the current iteration satisfies the preset conditions includes:
Optionally, the process of updating the network parameters of the baseline network using the error from the current iteration includes:
Optionally, the calculation of the learning rate for the current iteration based on the error obtained from the current iteration includes:
Optionally, the process of performing water quality measurement for the wastewater treatment plant using the measurement model includes:
The second aspect of the application provides a water quality measurement device, which includes:
The third aspect of the application provides an electronic equipment, which includes a processor and a memory;
The fourth aspect of the present application provides a computer-readable storage medium, which is used to store program code. When the program code is executed by a processor, it can implement any of the water quality measurement methods described in the first aspect.
From the above technical solutions, it can be seen that the present application has the following advantages:
In this application, during the iterative training of the baseline network, the error state value is derived according to the errors in each iteration. And the error state value determines whether to update the network parameters or not. If the error state value does not satisfy the preset conditions, the network parameters will not be updated. In this way, it prevents the backpropagation of the abnormal data or the training data that may degrade the performance of the baseline network, ensuring effective feature extraction from the raw dataset and enhancing the validity of the data. This helps to improve the accuracy of the prediction results, and address the technical issues in the existing technologies where effective features from the raw dataset cannot be effectively extracted, leading to poor measurement accuracy.
To better illustrate the embodiments of the present application or the technical solutions in the existing technologies, the relevant figures will be briefly introduced below. It is evident that the figures described below are merely some embodiments of this application, and those skilled in the art can, without creative efforts, derive other figures based on these.
To enable those skilled in the art to better understand the solution of this application, the technical solutions in the embodiments of this application will be clearly and comprehensively described below in conjunction with the attached figures. It is evident that the described embodiments are only a part of the embodiments of this application, rather than all of them. Based on the embodiments of this application, all other embodiments obtained by those ordinary skilled in the art without creative efforts shall fall within the protection scope of this application.
To facilitate understanding, please refer to
Step 101: Acquiring multiple sets of training data and determining the labels of each set of training data.
In the embodiments of this application, the training data includes nitrate nitrogen concentration, dissolved oxygen concentration, influent total nitrogen concentration, and influent suspended solids concentration, and the labels are effluent ammonia nitrogen concentration or effluent total nitrogen concentration. The data can be obtained from the Benchmark Simulation Model No. 1 (BSM1) which is jointly developed by the International Water Association and the European Union. The sampling interval can be 15 minutes, and the total collection period is 14 days. The collected data includes the nitrate nitrogen concentration (SNO2) in Unit 2 (
When obtaining the soft measurement model for effluent ammonia nitrogen, the input data include SNO2, SO3, SO4, SO5, TNin, and TSS, and the output data (i.e., the label) is the effluent ammonia nitrogen concentration. As for the soft measurement model of effluent total nitrogen, the input data are SNO2, SO3, SO4, SO5, and TNin as well, with the output data (i.e., the label) being the effluent total nitrogen concentration. After determining the input and output data, the input data can be normalized.
Step 102: Training the baseline network iteratively using the training data, and calculating the errors based on the predicted values output by the baseline network and the corresponding labels.
A baseline network is constructed to receive the training data for iterative training. It should be noted that the baseline network can adopt the existing Convolutional Neural Network (CNN) structure. But in the embodiments of this application, a Recursive Fuzzy Neural Network (RFNN) is preferably used as the baseline network. As shown in
The membership function layer is used to calculate the degree of membership of the training data, and each neuron in this layer represents a linguistic variable value. When the training data arrives at the membership function layer, the center c and width σ of the Gaussian membership function need to be updated during the iterative process. The membership function layer can be expressed as:
In the fuzzy rule layer, each neuron represents a fuzzy rule. The fuzzy rule layer performs fuzzy processing on the membership degree of the training data, to obtain the fuzzy features of the training data. The fuzzy rule layer can be expressed as:
The error ei is calculated based on the predicted value yi output by the baseline network and the corresponding label ŷi. In some example embodiments, the error can be obtained by calculating the difference between the predicted value and the label, i.e., ei=yi−ŷi.
Step 103: Calculating the error state value based on the errors obtained from two consecutive iterations. If the error state value of the current iteration satisfies the preset conditions, then the network parameters of the baseline network will be updated using the error of the current iteration. If the error state value does not meet the preset conditions, the network parameters will not be updated. This process continues until the baseline network converges and the measurement model is obtained.
The deviation between the error obtained in the current iteration and the error obtained in the previous iteration is calculated to derive the first error state value corresponding to the current iteration. Specifically, a variable γ is defined to assess the trend of error reduction during the training process. By computing the mean error of the training data in the current iteration t, and calculating the difference between the mean error in the current iteration t and the mean error in the previous iteration t−1, the first error state value γ(t) for iteration t can be obtained as:
Determining whether both the first error state value γ(t) and second error state value κ(t) of the current iteration are less than the preset threshold. If they are, it can be concluded that the error state value of the current iteration meets the preset condition; otherwise, it does not meet the preset condition.
Specifically, assuming that (γ(t), κ(t)) represents an event based on the error state, all events occurring during the training process of the baseline network can be defined as:
From
Furthermore, it can be seen from
After the training data passes through the aforementioned five layers, the forward propagation of the neural network is concluded. Subsequently, error backpropagation is required. Traditionally, the error backpropagation algorithm (EBP) based on gradient descent is employed, but this algorithm has a slow convergence rate and is prone to getting trapped in local optima, making it difficult to achieve the optimal solution. This will result in low prediction accuracy and long training durations. The Levenberg-Marquardt (LM) algorithm, as a typical second-order method, combines the advantages of the gradient descent method and Newton's method. This algorithm is characterized by fast convergence and high accuracy. The embodiments of this application improve the learning rate in the LM algorithm to further enhance the model's prediction accuracy.
In the embodiments, the update formulas for all network parameters Ω of the baseline network (such as center c, width σ, feedback weights β, and output weights ω) can be expressed as:
The value of λ(t) will affect the final water quality measurement result. To accelerate the learning process of the recursive fuzzy neural network, the embodiments of this application improve the learning rate by calculating the learning rate for the current iteration based on the error of the current iteration. Specifically, the L1-norm and L2-norm of the current iteration's error is computed. Then, a weighted sum of these norms is calculated using preset conditional parameters to obtain the learning rate for the current iteration:
When the number of iterations of the baseline network reaches the maximum iteration count, or the error falls below the error threshold, or the error converges to a certain value, it is then determined that the baseline network has converged, and a trained measurement model is obtained.
After the training is completed, test data can be obtained from the Benchmark Simulation Model No. 1 (BSM1). This test data is then input into the trained measurement model to obtain the water quality measurement results. Subsequently, the measurement performance can be evaluated using the Root Mean Square Error (RMSE), Mean Absolute Percentage Error (MAPE), and Accuracy. The formulas for RMSE, MAPE, and Accuracy are as follows:
In the equation, ei represents the error of the i-th test data.
The embodiments of the present application verify the superiority of the proposed method through comparative experiments. First, soft measurements of effluent ammonia nitrogen concentration and effluent total nitrogen concentration are performed using a conventional EBP-based fuzzy neural network (FNN_EBP). Then, the event-driven triggering mechanism is incorporated into the FNN_EBP network, forming an event-driven EBP fuzzy neural network (EFNN_EBP) to validate the effectiveness of the event-driven triggering mechanism. Next, an improved adaptive recursive neural network (ARFNN) is employed to conduct the soft measurements of effluent ammonia nitrogen concentration and effluent total nitrogen concentration. Similarly, the event-driven triggering mechanism is added to the ARFNN network to form an event-driven ARFNN network (EARFNN). By comparing the soft measurement results of FNN_EBP, EFNN_EBP, ARFNN, and EARFNN networks, the superiority of the EARFNN model, which integrates the improved adaptive LM algorithm and event-driven mechanism, is demonstrated. Specific results can be found in
The improved adaptive LM algorithm proposed in the embodiments of the present application exhibits faster convergence rate compared to the traditional EBP algorithm, as clearly reflected in
Through the comparative experiments described above, it can be concluded that the ARFNN achieves the highest accuracy in soft measurements of effluent ammonia nitrogen concentration and effluent total nitrogen concentration, with the best overall performance in RMSE and MAPE. That is to say, the EARFNN model proposed in the embodiments, which integrates the event-driven triggering mechanism and adaptive LM algorithm, demonstrates significant competitiveness in soft measurement tasks.
The embodiments of the present application address the issue of low measurement accuracy caused by the inability to extract effective features from datasets in existing technologies. Specifically, it employs an event-driven triggering mechanism, which can effectively extract useful features from the raw data. For abnormal data or training data that degrades network performance, no backpropagation is performed to update the network, effectively filtering out the abnormal data. By doing so, it can achieve the purpose of extracting effective features from the raw dataset and enhancing data validity. Furthermore, to tackle the problems of slow convergence, susceptibility to local optima, and low measurement accuracy associated with the error backpropagation method used in existing neural networks, the embodiments of the present application adopt an improved Levenberg-Marquardt method instead of the error backpropagation method. By introducing the L1-norm and L2-norm as penalty factors in the learning rate, the model's adaptive learning capability is enhanced. This allows the model to take larger learning steps when the error is significant, and take smaller learning steps when the error is minimal, thereby improving the network's convergence rate, avoiding local optima, and enhancing the measurement accuracy.
Step 104: Conducting water quality measurements for the wastewater treatment plant by using the obtained measurement model.
Collecting water quality parameters from the wastewater treatment plant, which includes nitrate nitrogen concentration, dissolved oxygen concentration, inflow total nitrogen concentration, and inflow suspended solids concentration. Inputting water quality parameters into the measurement model to predict the effluent ammonia nitrogen concentration or effluent total nitrogen concentration, thereby obtaining the water quality measurement results of the wastewater treatment plant.
In the embodiments of this application, when iteratively training the baseline network using training data, the error state value is derived based on the errors from each iteration. And the error state value determines whether to update the network parameters or not. If the error state value does not satisfy the preset conditions, the network parameters will not be updated. In this way, it prevents the backpropagation of the abnormal data or the training data that may degrade the performance of the baseline network, ensuring effective feature extraction from the raw dataset and enhancing the validity of the data. This helps to improve the accuracy of the prediction results, and address the technical issues in the existing technologies where effective features from the raw dataset cannot be effectively extracted, leading to poor measurement accuracy.
The above describes the embodiments of a water quality measurement method provided by the present application. The description below gives the embodiments of a water quality measurement device provided by this application.
Please refer to
As a further improvement, the device also includes:
As a further improvement, the measurement unit is specifically used for:
In the embodiments of this application, when iteratively training the baseline network using training data, the error state value is derived based on the errors from each iteration. And the error state value determines whether to update the network parameters or not. If the error state value does not satisfy the preset conditions, the network parameters will not be updated. In this way, it prevents the backpropagation of the abnormal data or the training data that may degrade the performance of the baseline network, ensuring effective feature extraction from the raw dataset and enhancing the validity of the data. This helps to improve the accuracy of the prediction results, and address the technical issues in the existing technologies where effective features from the raw dataset cannot be effectively extracted, leading to poor measurement accuracy.
The embodiments of the present application also provide an electronic equipment, which includes a processor and a memory;
Additionally, the embodiments of this application provide a computer-readable storage medium, which is used to store program code. When the program code is executed by a processor, it can implement any of the water quality measurement methods described in the aforementioned method embodiments.
Those skilled in the art shall clearly understand that, for the sake of convenience and brevity, the specific working process of the aforementioned devices and units can be referred to the corresponding processes in the previously described methods and embodiments, and will not be repeated here.
| Number | Date | Country | Kind |
|---|---|---|---|
| 202410036526.9 | Jan 2024 | CN | national |