Real-time effluent ammonia nitrogen concentration detection method based on hierarchical fusion neural network

By using a layered fusion neural network and elite roulette selection strategy in the detection of ammonia nitrogen concentration in wastewater treatment, the problems of insufficient model characterization capabilities and weak generalization performance in the existing technology are solved, and high-precision and real-time detection effects are achieved.

CN120028508AActive Publication Date: 2025-05-23QINGDAO UNIV OF TECH
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202510502633.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-22
Publication Date
2025-05-23
Estimated Expiration
2045-04-22

AI Technical Summary

Technical Problem

When detecting the ammonia nitrogen concentration in the effluent of urban sewage treatment, the existing technology has problems such as insufficient model characterization capabilities and weak generalization performance, which is difficult to meet the real-time monitoring needs.

Method used

A hierarchical fusion neural network is used to combine fuzzy neural networks (FNN), long and short-term memory networks (LSTM) and polynomial neural networks (PNN), and an elite roulette selection (ERWS) strategy is used to achieve accurate prediction of ammonia nitrogen concentration in wastewater effluent.

Benefits of technology

It improves the generalization ability and robustness of detection, maintains good prediction accuracy under complex operating conditions, and reduces system deployment and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120028508A_ABST
    Figure CN120028508A_ABST
Patent Text Reader

Abstract

The invention relates to the field of urban sewage treatment detection, in particular to a layered fusion neural network-based effluent ammonia nitrogen concentration real-time detection method, which comprises the following steps of: 1, acquiring index parameters influencing effluent ammonia nitrogen concentration in a sewage treatment process, and defining input and output of a subsequent model; 2, an FNN structure is established, and nonlinear features are extracted; 3, setting a sliding window, and intercepting segments to predict the effluent ammonia nitrogen concentration; step 4, introducing a polynomial neural network PNN to obtain a hierarchical fusion neural network model of "FNN-LSTM-PNN"; and 5, inputting the index parameters into the hierarchical fusion neural network model, and outputting and obtaining a prediction result of the effluent ammonia nitrogen concentration. According to the invention, through flexible combination of layered series connection and elite wheel disc selection, real-time accurate measurement of the ammonia nitrogen concentration of the effluent of the sewage can be completed in a relatively low-cost calculation environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of urban sewage treatment detection, and in particular to a real-time detection method for effluent ammonia nitrogen concentration based on a layered fusion neural network. Background Art

[0002] The stability of urban sewage treatment systems is closely related to effluent water quality monitoring, among which effluent ammonia nitrogen concentration is one of the key indicators, which directly reflects the sewage treatment effect and ecological environmental safety. Currently, the commonly used effluent ammonia nitrogen concentration detection methods mainly include traditional detection method and instrument detection method.

[0003] Traditional detection methods mainly include Nessler's reagent spectrophotometry or other chemical analysis-based detection methods. Although they have high precision, they have problems such as long detection cycle, high cost, and complicated operation procedures, which make it difficult to meet the real-time monitoring needs of the sewage treatment process.

[0004] In contrast, although online ammonia nitrogen monitoring instruments can achieve real-time detection, they generally have problems such as high maintenance costs and unstable measurements. In particular, when facing operating conditions with significant changes in influent load or large fluctuations in pollutant composition, the reliability of the instrument is reduced.

[0005] At present, measurement models based on machine learning or deep learning have attracted much attention. For example, single fuzzy neural networks (FNN) or long short-term memory networks (LSTM) can effectively capture the nonlinear or time series characteristics of input variables, but they often pay insufficient attention to the high-order nonlinearity and multivariate correlation in the ammonia nitrogen conversion process, making it difficult to fully describe the complex biochemical reaction process in the sewage treatment process, resulting in the need to improve the detection accuracy. In view of the above problems, it is urgent to establish a real-time, accurate and robust measurement method to achieve accurate and rapid detection of effluent ammonia nitrogen concentration, so as to ensure the stability of the sewage treatment process and the continuous compliance of effluent water quality. Summary of the invention

[0006] In view of the problems of insufficient model representation ability and weak generalization performance in the prior art when facing nonlinearity, non-stationarity and time series dependency problems, the purpose of the present invention is to provide a hierarchical neural network architecture that integrates fuzzy neural network (FNN), long short-term memory network (LSTM) and polynomial neural network (PNN), and combines it with elite roulette wheel selection (ERWS) strategy to achieve a real-time detection method for effluent ammonia nitrogen concentration, which can accurately predict the ammonia nitrogen concentration of sewage effluent.

[0007] To achieve the above object, the technical solution adopted by the present invention is: a real-time detection method for effluent ammonia nitrogen concentration based on a hierarchical fusion neural network, comprising the following steps: Step 1: Collect the index parameters that affect the effluent ammonia nitrogen concentration during sewage treatment, define the input matrix X, mark the collected effluent ammonia nitrogen concentration as the target data Y, normalize the input matrix X and the target data Y, and divide the normalized data into training set, validation set, and test set as the input and output of the subsequent model; Step 2: Establish an FNN structure with a Gaussian membership function, perform fuzzification and nonlinear mapping on the input matrix X, and extract the nonlinear features in the original multidimensional input matrix X; Step 3: Construct the retained FNN structure output and target data Y into time series samples, set the sliding window, extract segments from the time series to predict the ammonia nitrogen concentration of the effluent, capture the time series information in the LSTM layer, iteratively update the LSTM parameters through back propagation, and calculate the prediction error of each LSTM on the validation set; Step 4: Introduce the polynomial neural network PNN, perform high-order fitting and residual correction on the nonlinear features extracted in step 2 and the temporal dependency captured in step 3, and obtain a hierarchical fusion neural network model of "FNN→LSTM→PNN"; Step 5: Input the index parameters affecting the effluent ammonia nitrogen concentration into the hierarchical fusion neural network model of "FNN→LSTM→PNN" and output the predicted result of the effluent ammonia nitrogen concentration.

[0008] In the above-mentioned real-time detection method of effluent ammonia nitrogen concentration based on hierarchical fusion neural network, in step 1, the index parameters include effluent redox potential, aerobic terminal dissolved oxygen, total suspended solids, effluent nitrate nitrogen, and effluent pH value.

[0009] In the above-mentioned real-time detection method of effluent ammonia nitrogen concentration based on hierarchical fusion neural network, in step 1, the input matrix X is obtained by arranging the collected N samples in chronological order. ,in, represents the feature vector of the i-th sample, M represents the input dimension, and T is the matrix transpose symbol; The target data ,in, It represents the effluent ammonia nitrogen concentration value corresponding to the i-th sample. After normalization, the data is mapped to the [0,1] interval.

[0010] In the above-mentioned real-time detection method of effluent ammonia nitrogen concentration based on hierarchical fusion neural network, in step 2, the fuzzification and nonlinear mapping processing uses r fuzzy rules to fuzzify the input, and weights the response of each rule, and finally outputs a preliminary ammonia nitrogen concentration prediction value.

[0011] In the above-mentioned method for real-time detection of effluent ammonia nitrogen concentration based on hierarchical fusion neural network, step 2 comprises: Step 2-1: Establish FNN structure: Design r fuzzy rules, each rule corresponds to an RBF node, including the center vector and width , and the output layer weights ; Step 2-2: Calculate Gaussian membership and pass the input vector With each center The distance is obtained by using the Gaussian function. , and then output each RBF node Normalize to get the membership ; Step 2-3: After getting all Then, combine them with the output layer weights Multiply and add to get the FNN output : ; Step 2-4: Parallel training Randomly initialize FNNs, use elite roulette wheel selection ERWS to select, select k FNNs with small errors on the validation set, make predictions on the training set, validation set, and test set for the retained FNNs, and splice them into a new feature matrix , providing input for subsequent steps, where represents the number of training set samples, k represents the number of FNN models retained after ERWS screening, represents the output value of the jth retained FNN model for the i-th sample, R represents a real number set, Indicates a A real matrix space with k rows and columns.

[0012] In the above-mentioned method for real-time detection of effluent ammonia nitrogen concentration based on hierarchical fusion neural network, in step 2-2, the response ,in Indicates The input vector of samples, represents the number of features, is the value of the sample in the dth dimension, represents the center of the jth fuzzy rule in the dth dimension, represents the width of the jth fuzzy rule in the dth dimension, is an exponential function, so that the activation Finally, in the range of (0,1], the activation values ​​of all nodes are added together to obtain: ,like , then let , otherwise normalization yields , where r represents the number of fuzzy rules.

[0013] In the above-mentioned method for real-time detection of effluent ammonia nitrogen concentration based on hierarchical fusion neural network, step 3 comprises: Step 3-1: Construct a time series sliding window of length w. The retained FNN layer output has k columns of features, and a size of The matrix Z 1 , intercepting w consecutive inputs from the sequence as a time series sample to predict the target value of the w+1th input. The Z after sliding window processing 1 It is expressed as: , where s represents the starting subscript, Indicates the end of subscript; Step 3-2: In a single-layer LSTM network, the hidden unit dimension is h. Inside the LSTM, these w inputs are regarded as a small batch with a sequence length of w. Let the internal time step t=1,2,…,w. The core formula of LSTM at time step t is: , , , , , ,in, To receive the input vector, is the hidden state at time step t, is the hidden state of the previous time step, is the new candidate value, , , are the outputs of the forget gate, input gate, and output gate at time step t, respectively. is the cell state at time step t, , , , Respectively represent the connection input at time step t To the weight matrices of different gates, , , , is the bias term, is the sigmoid function, ⊙ represents element-wise multiplication; Step 3-3: When LSTM processes to the last step t=w, its hidden state Output prediction is obtained through the fully connected layer ; Step 3-4: Parallel training LSTM, and calculate the error on the validation set, and filter and retain through ERWS LSTM output.

[0014] In the above-mentioned method for real-time detection of effluent ammonia nitrogen concentration based on hierarchical fusion neural network, step 4 comprises: Step 4-1: Keep The LSTM output columns are recorded as , represents the retained output variable; Step 4-2: Construct quadratic polynomial features: , by traversing different column combinations, we can generate Candidate polynomial neurons PN; Step 4-3: Use least squares with regularization in PN to solve the regression coefficient vector β: in, represents the polynomial expansion matrix in the training set, y represents the target value vector, λ represents the regularization coefficient, I represents the identity matrix, and the regression coefficient vector , e is the polynomial coefficient; Step 4-4: Calculate the prediction error of each PN on the validation set, calculate the fitness, retain the best PN, and select its prediction result as the final output .

[0015] In the above-mentioned real-time detection method of effluent ammonia nitrogen concentration based on hierarchical fusion neural network, the calculation fitness includes: Step a: Let the true target be , predicted to be , the common loss function is the mean square error E, and the loss can be written as: ; Step b: During the training process, , , Perform gradient descent to minimize the loss, The gradient of is approximately: ,in It means to find partial derivatives; Step c: Get the update direction according to the chain rule, The gradient of is approximately: , The gradient of is approximately: ,in represents the center of the jth fuzzy rule in the dth dimension, is the width of the rule in the dth dimension, is the eigenvalue of the i-th sample in the d-th dimension; Step d: Calculate the mean square error of each FNN on the validation set. The model error is , define fitness: .

[0016] The beneficial effects of the real-time detection method of effluent ammonia nitrogen concentration based on a hierarchical fusion neural network of the present invention are: The technical solution of the present invention has strong generalization ability. FNN, LSTM and PNN make full use of fuzzy membership, gated time series learning and high-order polynomial fitting in their respective dimensions, and can cover data distribution under various complex working conditions. Even if the data characteristics vary greatly with the process conditions, good prediction accuracy can be maintained through layer-by-layer correction and elite selection.

[0017] With strong anti-noise capability, the fuzzy neural network first performs smooth mapping on the original data that is more sensitive to noise, LSTM can filter out high-frequency noise while capturing key time series information, and polynomial regression performs a detailed fitting of the previous residual error. The combination of the three significantly improves the overall model's suppression effect on noise interference.

[0018] Robustness is improved. Multiple models are trained in parallel at each layer and ERWS is used for elite retention, which can ensure that the optimal model is not randomly eliminated and give the suboptimal model a certain "survival" opportunity, thereby reducing the sharp decline in performance caused by poor individual initialization or improper hyperparameter setting, and enhancing the overall robustness of the model.

[0019] Through the flexible combination of hierarchical series connection (FNN→LSTM→PNN) and elite roulette wheel selection (ERWS), real-time and accurate measurement of ammonia nitrogen concentration in sewage effluent can be completed in a relatively low-cost computing environment, reducing the need for blind expansion of hardware equipment, thereby significantly reducing the overall system deployment and maintenance costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 This is a schematic diagram of the detection model architecture in an embodiment of the present invention; Figure 2 This is a schematic diagram of the FNN unit structure in an embodiment of the present invention; Figure 3 This is a schematic diagram of the LSTM layer structure in an embodiment of the present invention; Figure 4 This is a schematic diagram of the LSTM unit structure in an embodiment of the present invention; Figure 5 Schematic diagram of the structure of a PN neuron in an embodiment of the present invention; Figure 6 Schematic diagram of the real-time measurement effect of effluent ammonia nitrogen concentration in an embodiment of the present invention. DETAILED DESCRIPTION

[0021] In order to enable those skilled in the art to better understand the technical solution of the present invention, the technical solution of the present invention is described below in conjunction with specific implementation methods and drawings.

[0022] Example 1 like Figure 1 As shown, a real-time detection method for effluent ammonia nitrogen concentration based on a hierarchical fusion neural network includes the following steps.

[0023] Step 1: Obtain sewage data. First, collect various indicators related to the effluent ammonia nitrogen concentration during sewage treatment, including but not limited to effluent oxidation-reduction potential ORP (mV), aerobic terminal dissolved oxygen DO (mg / l), total suspended solids TSS (mg / l), effluent nitrate nitrogen NO3-N (mg / l), effluent pH, etc. Arrange the collected N samples in chronological order and define the input matrix: ,in, is the feature vector of the i-th sample, and M represents the input dimension. At the same time, the collected effluent ammonia nitrogen concentration is recorded as: , in, Indicates the effluent ammonia nitrogen concentration value (mg / L) corresponding to the i-th sample.

[0024] In order to make the features of different dimensions comparable when entering the model, the present invention normalizes the input data X and the target data Y, and maps the data to the interval [0,1], thereby reducing the training instability and model convergence difficulties caused by the large value range. Then, the normalized results are used as the input and output of the subsequent models (FNN, LSTM, PNN) respectively, and enter the next step of training and verification process.

[0025] Step 2: After collecting the above X and Y, perform a "fuzzification" and nonlinear mapping process on X.

[0026] The present invention adopts FNN with Gaussian membership function (RBF) as the first layer model. The core idea is to fuzzify the input using r fuzzy rules, and weight the response of each rule, and finally output a preliminary ammonia nitrogen concentration prediction value.

[0027] The implementation is as follows: First, establish the FNN structure: design r fuzzy rules, each rule corresponds to an RBF node, including the center vector and width , and the output layer weights .

[0028] Secondly, calculate the Gaussian membership: the input vector passed in With each center The distance is obtained by using the Gaussian function. , and then output each RBF node Normalize to get the membership .

[0029] In getting all Then, combine them with the output layer weights Multiply and add to get the FNN output : .

[0030] Finally, parallel training FNN: To improve robustness, train The k FNNs with the best performance are selected on the validation set for the subsequent stages. Here, the elite roulette wheel selection (ERWS) is used to directly retain the FNNs with the smallest error on the validation set as "elites", and then the other FNNs are screened by roulette wheel according to the fitness ratio.

[0031] Through this step, the nonlinear features in the original multidimensional input data X can be better extracted, allowing the subsequent model to work in a more "fuzzy and smooth" feature space, which helps to reduce noise interference.

[0032] Step 3: Capture time series information in the LSTM layer. First, set the sliding window: construct the retained FNN output and the true label target data Y as a time series sample, that is, use a sliding window of length w to extract the input of the fragment [s, s+1,..., s+w−1] from the time series to predict the effluent ammonia nitrogen concentration at time s+w.

[0033] Next, initialize LSTM models, each of which contains an input layer, the input dimension is the number of FNN models k after ERWS screening, that is, the number of features output by the previous layer, LSTM hidden layer units, including a gating mechanism, and a fully connected output layer, and the LSTM layer parameters are iteratively updated through back propagation.

[0034] Finally, the prediction error of each LSTM is calculated on the validation set, and the ERWS screening method is continued to retain the best LSTM outputs. This allows us to keep the optimal model fixedly and randomly retain some suboptimal models to prevent overfitting.

[0035] Step 4: Use PNN (polynomial network) for high-order fitting and residual correction. Although the first two layers (FNN and LSTM) have preliminarily captured the nonlinearity and time-series dependence of the input data, the urban sewage treatment conditions are complex and changeable, and there is a nonlinear coupling effect between multiple variables, which needs to be characterized by polynomial high-order terms and cross terms. To this end, the present invention introduces a polynomial neural network (PNN) in the third layer to further correct the outputs of the first two layers.

[0036] First, get the output of the parallel LSTM and train it in parallel on the second layer After LSTM, use the validation set error and ERWS elite roulette wheel to select the retained The optimal models are constructed and their output columns on the training / validation / test sets are concatenated into a new feature matrix.

[0037] Secondly, perform polynomial feature expansion. If the retained LSTM output contains 2 to 3 columns (or more), you can enumerate various column combinations and construct polynomial features for each. For a given input combination, select a quadratic polynomial (including cross terms).

[0038] Next, on the generated feature matrix, PNN uses the following regularized least squares to solve the regression coefficients: : ,

[0039] in, Represents the weight of each input feature in the model output, which is used to map the expanded feature matrix To the target variable λ is the regularization coefficient. When λ>0, overfitting can be suppressed. When λ=0, it degenerates into ordinary least squares. Then, the error of each combination is calculated on the validation set, and the optimal PN (polynomial neuron) is screened again using ERWS.

[0040] Finally, a hierarchical fusion neural network model of "FNN→LSTM→PNN" is obtained, which can more accurately fit the potential high-order nonlinear and time series characteristics in the sewage effluent ammonia nitrogen concentration, thereby further reducing the residual error. Through this step, the present invention can introduce polynomial regression to characterize complex high-order relationships while retaining the advantages of LSTM time series characteristics, thereby significantly improving the measurement accuracy and generalization ability of effluent ammonia nitrogen concentration.

[0041] Step 5: Input the obtained parameters affecting the effluent ammonia nitrogen concentration into the detection model determined in steps 1 to 4, so as to realize the real-time and accurate detection of the effluent ammonia nitrogen concentration, that is, to obtain the measured value .

[0042] Example 2 A real-time detection method for effluent ammonia nitrogen concentration based on hierarchical fusion neural network, combined with Figure 1-Figure 5 The detection model architecture schematic diagram in FIG. 1 , the specific steps of the present invention are as follows.

[0043] Step 1: Obtain relevant characteristic variables from the sewage treatment system, including but not limited to effluent redox potential ORP (mV), aerobic terminal dissolved oxygen DO (mg / l), total suspended solids TSS (mg / l), effluent nitrate nitrogen NO3-N (mg / l), effluent pH, etc. Suppose there are N samples in total, construct the input matrix: , in is the feature vector of the i-th sample, and M represents the input dimension.

[0044] The effluent ammonia nitrogen concentration is collected as the target data Y, which is recorded as: , in Indicates The ammonia nitrogen value of each sample (can be mg / L).

[0045] After normalization, the sorted data is divided into 60% training set, 20% validation set, and 20% test set, which are used for model training, hyperparameter verification, and final evaluation, respectively.

[0046] Step 2: The processed data is processed by the FNN (fuzzy neural network) layer. The first layer of the present invention uses the RBF style fuzzy neural network (FNN) to perform nonlinear mapping and fuzzification processing on the input features. The main principles are as follows: Assume that the FNN has r fuzzy rules (or RBF nodes). Each rule contains a “center” (dimension is the same as input dimension M), "width" and the "output layer weights" For any input vector x, the activation value (Gaussian membership) of the jth RBF node can be expressed as: (1).

[0047] Add up the activation values ​​of all nodes: (2) Where r represents the number of fuzzy rules. (to prevent division by zero), then let ; Otherwise normalization yields: (3).

[0048] The final output of the FNN is: (4).

[0049] Error and gradient updates.

[0050] Let the real target be , predicted to be , the common loss function is mean square error (MSE). If a single sample is taken as an example, the loss can be written as: (5).

[0051] During the training process, by adjusting the FNN parameters (center ,width and weight ) performs gradient descent to minimize the loss.

[0052] Taking weight as an example, its gradient is approximated: (6).

[0053] The center gradient and width gradient are approximately expressed as: (7) (8) The above is the update direction obtained according to the chain rule. It means to find partial derivatives.

[0054] Then parallel training In order to reduce the instability caused by random initialization, the present invention can train FNN at one time. Then perform ERWS screening: calculate the MSE of each FNN on the validation set, and set The model error is , define fitness: (9).

[0055] After sorting, the first NE FNNs are retained as elites, and the remaining models are selected by roulette wheel according to the fitness ratio. For the retained FNN, make predictions on the training set, validation set, and test set respectively, and concatenate them into a new feature matrix Z 1 , providing input for subsequent steps.

[0056] Step 3: The concatenated feature matrix is ​​then passed to the next LSTM (long short-term memory network) layer. Since the effluent ammonia nitrogen concentration has an obvious dependence on the time dimension, in order to further capture dynamic characteristics, the present invention introduces an LSTM model on the features of the FNN output.

[0057] The main ideas are as follows: First, construct a time series sliding window: If the output retained by the FNN layer has a total of k columns, then form a time series sliding window of size In order to let LSTM learn time correlation, the present invention uses a window length w to intercept w consecutive inputs from the sequence as a time series sample to predict the target value of the w+1th input. Specifically, it can be recorded as: (10) Where s represents the starting subscript, Indicates the end of subscript.

[0058] Taking a single-layer LSTM as an example, let the hidden unit dimension be h. The core formula of LSTM at time step t is: (11) (12) (13) (14) (15) (16) in, is sigmoid, ⊙ means element-wise multiplication, To receive the input vector, is the hidden state vector at time step t, and finally at the last time step The hidden state of Output prediction is obtained through the fully connected layer , is the hidden state of the previous time step, is the new candidate value, , , are the outputs of the forget gate, input gate, and output gate at time step t, respectively. is the cell state vector at time step t, , , , Respectively represent the connection input at time step t To the weight matrices of different gates, , , , is the bias term.

[0059] At the same time, similar to FNN, the present invention will train in parallel LSTM, and calculate the error on the validation set, and filter and retain through ERWS LSTM outputs are used in subsequent polynomial networks.

[0060] Step 4: The filtered LSTM layer output is subjected to high-order correction by the PNN (polynomial network) layer. Under complex working conditions, water quality indicators may have multivariate high-order interactions. In order to further reduce the residual error in addition to the nonlinear and time series information extracted by the first two layers, the present invention introduces a polynomial network (PNN) for fitting correction.

[0061] First, if the second layer is retained LSTM output columns, recorded as: , these outputs are used to construct polynomial features. Represents a retained output variable of the LSTM model.

[0062] Construct a quadratic polynomial feature: (17).

[0063] By traversing different column combinations, you can generate candidate PNs (polynomial neurons).

[0064] Assume that the polynomial expansion matrix in the training set is , dimension If the target value vector is y, the regression coefficient vector β is solved using the least squares method with regularization in PN: (18) in, represents the polynomial expansion matrix in the training set, y represents the target value vector, λ represents the regularization coefficient, I represents the identity matrix, and the regression coefficient vector , e is the polynomial coefficient, λ is the regularization coefficient, λ>0 can suppress overfitting; λ=0 degenerates into ordinary least squares. In this embodiment, the function type used by PN neurons is a simplified quadratic polynomial , and Represents the output variables of the i-th and j-th LSTM models retained after screening by the elite roulette wheel selection strategy (ERWS).

[0065] Then, the prediction error of each PN is calculated on the validation set, and the fitness is calculated according to formula (9). The best PN is retained through "elite retention + roulette wheel selection", and its prediction result is selected as the final output .

[0066] Step 5: Figure 1As shown, the present invention constructs a water ammonia nitrogen detection model based on the "FNN-LSTM-PNN" hierarchical fusion neural network. In the initial stage, the fuzzy neural network (FNN) is first used to preprocess the input data to extract the deep nonlinear features in the data: the original multidimensional variables are mapped to the fuzzy rule space through the Gaussian membership function, so as to capture the key features under different operating conditions and reduce noise interference. Subsequently, the FNN output is passed to the long short-term memory network (LSTM) layer after screening and splicing; this layer uses the gating mechanism (forget gate, input gate, output gate) to dynamically capture the long-term dependency of time series data and effectively reveal the law of water ammonia nitrogen changing over time. Finally, in the third layer, the polynomial network (PNN) is used to perform interactive combination and fitting correction of high-order features to further explore potential nonlinear coupling and cross-relationships between variables.

[0067] In the above multi-layer model, the elite roulette wheel selection (ERWS) strategy is also integrated to perform multiple rounds of screening and retention on the FNN and LSTM models trained in parallel, thereby strengthening the focus on key features and excellent models and suppressing the output of sub-models that perform poorly under complex working conditions. Through this mechanism, the feature channels are dynamically adjusted and optimized, and finally a more robust and generalized prediction result is obtained.

[0068] Step 6: Input the variables that affect the effluent ammonia nitrogen concentration into the detection model determined in steps 1 to 5 to obtain the effluent ammonia nitrogen concentration. .

[0069] In order to evaluate the performance of the model of the present invention, the root mean square error (RMSE) and correlation coefficient (R 2 ) is used as the evaluation index, and the calculation formulas are: (19) (20) in, For the test set i The true measured value of the samples, is the detection value of the test set sample, is the mean of the test samples, and N is the number of samples.

[0070] Table 1 shows the comparison results of different algorithms. In comparing the performance of various models, including FNN, LSTM and PNN models, we analyze the RMSE and R 2 The present invention shows significant advantages in these two key statistical indicators. The specific prediction results are as follows: Figure 6 Specifically, the RMSE of the proposed method is much lower than that of other models, indicating that the difference between the detection result and the real data is small and the detection accuracy is high.2 The highest, can accurately mine the nonlinear relationship between data, and has a high degree of fitting. At the same time, it only takes 1 second to process sewage data. These indicators show that the present invention can effectively improve measurement accuracy and reduce running time. The present invention is of great significance to improving the accuracy and real-time performance of effluent ammonia nitrogen concentration detection.

[0071] Table 1: Comparison results of different algorithms .

[0072] The above embodiments are only for illustrating the inventive concept and features of the present invention, and their purpose is to enable those skilled in the art to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent changes or modifications made based on the essence of the content of the present invention should be included in the protection scope of the present invention.

Claims

1. A real-time detection method for effluent ammonia nitrogen concentration based on a hierarchical fusion neural network, characterized in that: The following steps are involved: Step 1: Collect the index parameters that affect the effluent ammonia nitrogen concentration during sewage treatment, define the input matrix X, mark the collected effluent ammonia nitrogen concentration as the target data Y, normalize the input matrix X and the target data Y, and divide the normalized data into training set, validation set, and test set as the input and output of the subsequent model; Step 2: Establish an FNN structure with a Gaussian membership function, perform fuzzification and nonlinear mapping on the input matrix X, and extract the nonlinear features in the original multidimensional input matrix X; Step 3: Construct the retained FNN structure output and target data Y into time series samples, set the sliding window, extract segments from the time series to predict the ammonia nitrogen concentration of the effluent, capture the time series information in the LSTM layer, iteratively update the LSTM parameters through back propagation, and calculate the prediction error of each LSTM on the validation set; Step 4: Introduce the polynomial neural network PNN, perform high-order fitting and residual correction on the nonlinear features extracted in step 2 and the temporal dependency captured in step 3, and obtain a hierarchical fusion neural network model of "FNN→LSTM→PNN"; Step 5: Input the index parameters affecting the effluent ammonia nitrogen concentration into the hierarchical fusion neural network model of "FNN→LSTM→PNN" and output the predicted results of the effluent ammonia nitrogen concentration.

2. The real-time detection method for effluent ammonia nitrogen concentration based on a hierarchical fusion neural network according to claim 1 is characterized in that: In step 1, the index parameters include effluent redox potential, aerobic terminal dissolved oxygen, total suspended solids, effluent nitrate nitrogen, and effluent pH value.

3. The real-time detection method for effluent ammonia nitrogen concentration based on a hierarchical fusion neural network according to claim 1 is characterized in that: In step 1, the input matrix X is obtained by arranging the collected N samples in chronological order. ,in, represents the feature vector of the i-th sample, M represents the input dimension, and T is the matrix transpose symbol; The target data ,in, It represents the effluent ammonia nitrogen concentration value corresponding to the i-th sample. After normalization, the data is mapped to the [0,1] interval.

4. The real-time detection method for effluent ammonia nitrogen concentration based on a hierarchical fusion neural network according to claim 1 is characterized in that: In step 2, the fuzzification and nonlinear mapping process is to fuzzify the input using r fuzzy rules, and weight the response of each rule, and finally output a preliminary ammonia nitrogen concentration prediction value.

5. The real-time detection method for effluent ammonia nitrogen concentration based on a hierarchical fusion neural network according to claim 4 is characterized in that: The step 2 comprises: Step 2-1: Establish FNN structure: Design r fuzzy rules, each rule corresponds to an RBF node, including the center vector and width , and the output layer weights ; Step 2-2: Calculate Gaussian membership and pass the input vector With each center The distance is obtained by using the Gaussian function. , and then output each RBF node Normalize to get the membership ; Step 2-3: After getting all Then, combine them with the output layer weights Multiply and add to get the FNN output : ; Step 2-4: Parallel training Randomly initialize FNNs, use elite roulette wheel selection ERWS to select, select k FNNs with small errors on the validation set, make predictions on the training set, validation set, and test set for the retained FNNs, and splice them into a new feature matrix , providing input for subsequent steps, where represents the number of training set samples, k represents the number of FNN models retained after ERWS screening, represents the output value of the jth retained FNN model for the i-th sample, R represents a real number set, Indicates a A real matrix space with k rows and columns.

6. The real-time detection method for effluent ammonia nitrogen concentration based on hierarchical fusion neural network according to claim 5 is characterized in that: In step 2-2, the response ,in Indicates The input vector of samples, represents the number of features, is the value of the sample in the dth dimension, represents the center of the jth fuzzy rule in the dth dimension, represents the width of the jth fuzzy rule in the dth dimension, is an exponential function, so that the activation Finally, in the range of (0,1], the activation values ​​of all nodes are added together to obtain: ,like , then let , otherwise normalization yields , where r represents the number of fuzzy rules.

7. The real-time detection method for effluent ammonia nitrogen concentration based on a hierarchical fusion neural network according to claim 5 is characterized in that: The step 3 comprises: Step 3-1: Construct a time series sliding window of length w. The retained FNN layer output has k columns of features, and a size of The matrix Z1 of the sliding window processing is expressed as: , where s represents the starting subscript, Indicates the end of subscript; Step 3-2: In a single-layer LSTM network, the hidden unit dimension is h. Inside the LSTM, these w inputs are regarded as a small batch with a sequence length of w. Let the internal time step t=1,2,…,w. The core formula of LSTM at time step t is: , , , , , ,in, To receive the input vector, is the hidden state at time step t, is the hidden state of the previous time step, is the new candidate value, , , are the outputs of the forget gate, input gate, and output gate at time step t, respectively. is the cell state at time step t, , , , Respectively represent the connection input at time step t To the weight matrices of different gates, , , , is the bias term, is the sigmoid function, ⊙ represents element-wise multiplication; Step 3-3: When LSTM processes to the last step t=w, its hidden state Output prediction is obtained through the fully connected layer ; Step 3-4: Parallel training LSTM, and calculate the error on the validation set, and filter and retain through ERWS LSTM output.

8. The real-time detection method for effluent ammonia nitrogen concentration based on hierarchical fusion neural network according to claim 7 is characterized in that: The step 4 comprises: Step 4-1: Keep The LSTM output columns are recorded as , represents the retained output variable; Step 4-2: Construct quadratic polynomial features: , by traversing different column combinations, we can generate Candidate polynomial neurons PN; Step 4-3: Use least squares with regularization in PN to solve the regression coefficient vector β: in, represents the polynomial expansion matrix in the training set, y represents the target value vector, λ represents the regularization coefficient, I represents the identity matrix, and the regression coefficient vector , e is the polynomial coefficient; Step 4-4: Calculate the prediction error of each PN on the validation set, calculate the fitness, retain the best PN, and select its prediction result as the final output .

9. The method for real-time detection of effluent ammonia nitrogen concentration based on a hierarchical fusion neural network according to claim 8, characterized in that: The calculation fitness includes: Step a: Let the true target be , predicted to be , the common loss function is the mean square error E, and the loss can be written as: ; Step b: During the training process, , , Perform gradient descent to minimize the loss, The gradient of is approximately: ,in It means to find partial derivatives; Step c: Get the update direction according to the chain rule, The gradient of is approximately: , The gradient of is approximately: ,in represents the center of the jth fuzzy rule in the dth dimension, is the width of the rule in the dth dimension, is the eigenvalue of the i-th sample in the d-th dimension; Step d: Calculate the mean square error of each FNN on the validation set. The model error is , define fitness: 。

Citation Information

Patent Citations

  • Method for soft measurement of effluent total phosphorus in sewage disposal process based on neural network

    CN104182794A

  • Aquatic cultivation dissolved oxygen prediction method and device

    CN107169610A

  • Effluent BOD soft measurement method based on self-organization RBF neural network

    CN108469507A

  • A method for predicting ammonia nitrogen concentration in effluent based on adaptive recurrent fuzzy neural network

    CN109344971A

  • Knowledge-based robust effluent ammonia nitrogen soft measurement method

    CN110542748A