Training method of sludge concentration prediction module and sludge concentration adjusting system

BP neural network is trained through the fruit fly optimization algorithm and gradient descent method, and combined with traditional algorithm decision-making, the accuracy and adaptability problems of sludge concentration regulation are solved, and efficient dynamic regulation of sludge concentration and water quality stability are achieved.

CN120542491APending Publication Date: 2025-08-26广州市净水有限公司
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510612397.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-13
Publication Date
2025-08-26

AI Technical Summary

Technical Problem

In the prior art, the sludge concentration control method has poor adaptability to nonlinear complex systems, the BP neural network training process has a slow convergence speed and is easily trapped in the local optimality, resulting in insufficient sludge concentration regulation accuracy.

Method used

The Drosophila optimization algorithm is used to initialize the weight and bias of the BP neural network, and iterative training is carried out in combination with the gradient descent method. The input node characteristics are standardized and decision-making is made in combination with a variety of traditional algorithms to build a sludge concentration regulation system.

Benefits of technology

It improves the accuracy of sludge concentration prediction and the accuracy of regulation, expands the scope of application, realizes dynamic and precise regulation of sludge concentration, reduces drug consumption and sludge losses, and improves the management efficiency and water quality stability of the water purification plant.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120542491A_ABST
    Figure CN120542491A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of sewage treatment, in particular to a training method of a sludge concentration prediction module and a sludge concentration adjusting system.The prediction module is trained by establishing a BP neural network and adopting a historical data set, and the initial weight and the initial offset amount of the BP neural network are obtained through a fruit fly optimization algorithm; the fitting accuracy of the BP neural network is improved, and the sludge concentration judgment accuracy of the BP neural network is improved. The adjusting system further combines a neural network prediction result and a result of a traditional empirical algorithm in multiple scenes, further improves the accuracy of sludge concentration regulation and control, widens the application range, and facilitates the realization of automation of accurate sludge concentration regulation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of sewage treatment, and more particularly to a training method for a sludge concentration prediction module and a sludge concentration regulation system. Background Art

[0002] In the sewage treatment process, removing biodegradable COD and biological nitrogen and phosphorus removal through the biological activity of sludge bacteria is a common method of sewage purification. During water purification, the sludge concentration must be adjusted based on multiple sewage factors. When the sludge concentration is too high, problems such as insufficient dissolved oxygen, sludge bulking or floating, increased energy consumption, and equipment overload may arise. When the sludge concentration is too low, problems such as insufficient treatment capacity, weak shock resistance, and sludge aging may arise. Therefore, how to accurately control the sludge concentration based on multiple sewage factors is essential for realizing intelligent sewage treatment plants.

[0003] Currently, the control of sludge concentration mainly relies on the following methods: 1. Traditional empirical formulas. However, this method has poor adaptability to nonlinear complex systems, and the treatment results are too idealized. It cannot accurately reflect the dynamic relationship between various factors in the sewage treatment process, resulting in a deviation between the output results and the actual control;

[0004] 2. BP (Back Propagation) neural network model. BP neural networks can adaptively learn nonlinear relationships and are applicable to predictive analysis in complex nonlinear scenarios such as sewage treatment. However, BP neural networks suffer from slow training convergence, prone to falling into local optimality, and sensitivity to initial parameters. These issues significantly impact the prediction accuracy and training cost of the neural network prediction model. Therefore, a sludge concentration prediction model that optimizes BP neural networks is urgently needed. Summary of the Invention

[0005] The purpose of the present invention is to overcome the deficiency of the prior art that the initial parameters have a great influence on the accuracy of the neural network sludge prediction model, and to provide a training method for a sludge concentration prediction module, which can reduce the influence of the initial parameter deviation on the training of the neural network model.

[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0007] A training method for a sludge concentration prediction module is provided, comprising:

[0008] S1, constructing a BP neural network prediction model, including an input node X, a hidden layer and an output node y^; the hidden layer includes an input weight w1, an input bias b1, an activation function σ(x), an output weight w2 and an output bias b2, and the input node is processed by the hidden layer to obtain an output node;

[0009] S2. Select at least five sewage treatment characteristics as input nodes X of the BP neural network prediction model, select sludge concentration as output node y^ of the BP neural network prediction model, select Sigmoid as activation function σ(x), and train to obtain input weights, input biases, output weights, and output biases of the BP neural network prediction model;

[0010] S3, obtaining the initial weight and initial bias of the BP neural network prediction model through the fruit fly optimization algorithm;

[0011] S4, iteratively training the BP neural network prediction model by gradient descent method;

[0012] S5. Evaluate the BP neural network prediction model. If it does not meet the requirements, re-train it. If it meets the requirements, save it.

[0013] The basic architecture of the neural network prediction model is:

[0014] The input layer enters the hidden layer: z1 = X.w1 + b1;

[0015] Activation function processing: a1 = σ(z1);

[0016] The hidden layer outputs to the output layer: z2 = a1·w2+b2;

[0017] In step S3, the initial values ​​of input weight, input bias, output weight and output bias are first generated by random initialization using Gaussian distribution, and then the above initial values ​​are optimized by the fruit fly optimization algorithm. Finally, the optimized initial values ​​are used as the benchmark for model training.

[0018] Through this setting method, when the model is trained, the weights and initial values ​​of the bias of the BP neural network prediction model can be globally explored through the fruit fly optimization algorithm to avoid falling into the local optimal solution or the initial value being too far away from the target value, thereby improving the speed and accuracy of the model training, thereby improving the accuracy of the BP neural network prediction model for sludge calculation. Subsequently, the BP neural network prediction model is iteratively trained through the gradient descent method to improve the fitting ability of the BP neural network until the BP neural network meets the preset requirements and is saved for subsequent use to generate the sludge concentration of the output node through the characteristic value of the input layer. After MSE and determination coefficient R 2 Evaluation and verification show that compared with the traditional BP neural network, this model has significant improvements in prediction accuracy, convergence speed and stability, with an accuracy increase of 5%-10%.

[0019] Preferably, in step S2, the influent water volume x1, the influent total nitrogen x2, the effluent total nitrogen x3, the designed sludge concentration coefficient x4 and the designed sludge concentration x5 are selected as input nodes respectively.

[0020] Among them, the influent water volume, influent total nitrogen, and effluent total nitrogen are relatively important features for calculating sludge concentration in water purification processes, while the designed sludge concentration coefficient and designed sludge concentration are relatively important features for improving model fitting.

[0021] Preferably, the features of the input nodes are standardized respectively, and the processing formula is:

[0022]

[0023] Among them, X is the original data, X′ is the standardized data, and X min and X max are the minimum and maximum values ​​of the feature, respectively.

[0024] This setting method can reduce the bias of input features at each input node, which is beneficial to improving the reference of samples and thus improving the accuracy of the trained model.

[0025] Preferably, the output nodes are normalized using the same principle.

[0026] Preferably, in step S3, the following steps are specifically included:

[0027] S31. Generate an initialized fruit fly population. Each fruit fly randomly generates a set of initial parameters of weights and biases. The dimension of each fruit fly individual is D, D = Nin·Nh+Nh·No+Nh·No, where Nin, Nh, and No represent the number of input nodes, hidden layers, and output nodes, respectively.

[0028] S32, calculating the fitness of each fruit fly through the mean square error;

[0029] S33, comparing the fitness of each fruit fly. If the fitness of the current individual is higher than that of the previous fruit fly, then updating the position of the current fruit fly to the initial position; otherwise, proceeding to the next search;

[0030] S34. After n rounds of comparison are performed or when the fitness of the fruit fly has not been significantly improved, the comparison is stopped, and the fruit fly with the highest fitness is selected as the initial weight and initial bias of the BP neural network prediction model.

[0031] The dimension D of each fruit fly represents the total number of weights and bias parameters in the neural network, where each dimension corresponds to a specific network parameter value. During training, the fruit fly optimization algorithm randomly generates a population of fruit flies in D-dimensional space, decodes the vectors back into the neural network's weight structure, and then calculates the mean squared error (MSE) as the fitness value. The dimension D determines the size of the search space for the optimization problem: a larger D value increases the potential for parameter optimization but also increases the difficulty of the search. Fitness directly reflects the quality of the parameter set by evaluating the network's predictive performance under the current D-dimensional parameter combination, guiding the algorithm to gradually approach the optimal parameter combination that minimizes the mean squared error (MSE) during iteration.

[0032] Through this setting method, the fruit fly optimization algorithm provides an efficient and robust parameter initialization scheme for the BP neural network through a bionic intelligent search mechanism, solving the pain points of traditional neural network methods such as falling into local optimality, slow convergence speed and high-dimensional parameter coordination when facing the multidimensional problem of sludge regulation. It is conducive to obtaining good initial values ​​of weights and biases to reduce training time and improve the accuracy of the BP neural network.

[0033] Preferably, the mean square error is obtained as follows:

[0034]

[0035] Among them, y true is the true value, i.e. the actual sludge concentration obtained in the real environment;

[0036] y pred It is the network forward propagation output value, that is, the output node prediction value generated by the model based on the current weights and biases in each training.

[0037] When calculating fitness, the D-dimensional vector of the fruit fly individual encodes all the weights and biases of the neural network w1, b1, w2, and b2. It must first be decoded and restored to the network parameter structure, and then the parameters are used to configure the forward propagation to calculate the predicted output of the training set. The prediction deviation is specifically quantified by the mean square error. The fitness value = 1 / (1+MSE) achieves higher fitness as the smaller the error.

[0038] Preferably, in step S33, a dynamic step size adjustment mechanism is further included: at the t-th iteration, the step size of fruit fly individual i is R_i^t=a*(P_best-X_i^{t-1})+(1-a)*R_i^{t-1};

[0039] Where a∈(0,1) is the learning factor and P_best is the optimal position of the current population.

[0040] The mechanism for dynamically adjusting step size R occurs during the fruit fly position update phase: at iteration t, individual i's step size R_i^t = a*(P_best - X_i^{t-1}) + (1-a)*R_i^{t-1}, where a∈(0,1) is a learning factor and P_best is the current optimal position of the population. Linear interpolation is used to balance global exploration (moving closer to the optimal individual as a approaches 1) and local exploitation (maintaining the original search inertia as a approaches 0). After the step size is adjusted, a random perturbation of X_i^t = X_i^{t-1} + R_i^t*N(0,1) is applied. This mechanism promotes global exploration in the early stages of the iteration and refines local search in the later stages by adaptively scaling the search step.

[0041] Preferably, in step S4, each round of training calculates the mean square error by back propagation to update w1, w2, b1 and b2 in the neural network to minimize the loss function.

[0042] This setting method is conducive to continuously updating weights and biases through iterative training, thereby improving the reliability and accuracy of the neural network model, calculating the mean square error (MSE) as the value of the loss function to measure the gap between the predicted value and the true value, using backpropagation to calculate the gradient of the loss function with respect to the weights and biases, and using gradient descent to update the weights and biases to minimize the loss function value. This process is repeated until the model converges, that is, the loss function is minimized.

[0043] Preferably, in step S4, the following steps are specifically included:

[0044] S41. Calculate the output layer error δ1:

[0045]

[0046] S42. Calculate the gradients of the output weight and output bias respectively:

[0047] Output weight gradient:

[0048]

[0049] Output bias gradient:

[0050]

[0051] S43, propagating the error to the hidden layer,

[0052]

[0053] Where σ′(x) is the derivative of σ(x);

[0054] S43. Calculate the gradient of input weight and input bias:

[0055] Input weight gradient:

[0056] Input bias gradient:

[0057] S44. Update weights. In each round of iteration, w1, w2, b1, and b2 are updated separately according to the following formula:

[0058] Input weights:

[0059] Input bias:

[0060] Output weights:

[0061] Output bias:

[0062] Among them, η is the learning rate, which is set manually and the value range of η is 0.001~0.1.

[0063] Preferably, in step S5, the evaluation method is specifically as follows: performing inverse normalization on the first theoretical sludge concentration to obtain theoretical initial data X original , by calculating the MSE and determination coefficient R of the theoretical initial data 2 to evaluate the predictive performance of the model.

[0064] Preferably, in step S5, the denormalization method is:

[0065] X original =X scaled ×σ1+μ;

[0066] Among them, X scaled is the training data after X is standardized, σ1 is the standard deviation of the target variable when it is standardized, and μ is the mean of the target variable when it is standardized.

[0067] Preferably, in step S5, the determination coefficient R 2 The method to obtain is:

[0068]

[0069] Among them, y true,i is the true value of the i-th sample, y pred,i is the predicted value of the i-th sample, is the average of the true values. 2 When it reaches 0.75, it indicates that the model meets the requirements.

[0070] A sludge concentration adjustment system, comprising a sludge concentration prediction module trained by any of the above training methods, and further comprising

[0071] An algorithm module, comprising algorithms A, B, and C for executing different effluent total nitrogen concentrations, wherein algorithms A, B, and C are all used to generate a second theoretical sludge concentration according to different working conditions;

[0072] The decision module is used to receive the sludge concentration generated by the sludge concentration prediction module and the algorithm module respectively, compare them according to the actual working conditions, and then output the control instructions of the sludge pump;

[0073] The steps include:

[0074] SA1: The sludge concentration prediction module generates a first theoretical sludge concentration, and the algorithm module selects an algorithm according to actual working conditions to generate a second theoretical sludge concentration;

[0075] SA2, the decision module receives the first theoretical sludge concentration and the second theoretical sludge concentration, and selects the preferred option as the decision sludge concentration;

[0076] SA3. The decision module detects the actual sludge concentration, compares the decided sludge concentration with the actual sludge concentration, and controls the operation of the sludge pump according to the comparison result.

[0077] This setup method allows the sludge concentration control system to generate a first theoretical sludge concentration that matches actual conditions based on a fruit fly-optimized BP neural network model. This is then verified using a second theoretical sludge concentration generated traditionally within the algorithm module, which incorporates traditional empirical algorithms for a variety of scenarios. This increases the system's applicability to water treatment plants operating under various standards. By leveraging classical algorithms and machine learning algorithms, the system rapidly improves sludge concentration decision-making and control strategies, enhancing control efficiency and water quality stability.

[0078] Preferably, the decision module includes

[0079] Algorithm A: When the target total nitrogen concentration in wastewater is required to be greater than or equal to 11 mg / L, the following formula is used to calculate

[0080] The second theoretical sludge concentration:

[0081]

[0082] Among them, Q is the amount of water treated, taking the monthly average value;

[0083] S0——Biochemical oxygen demand concentration of influent for 5 days, taking the monthly average value;

[0084] V——biochemical pool volume;

[0085] MLSS – second theoretical sludge concentration;

[0086] F / M——sludge load, take the design value;

[0087] Algorithm B, when the target total nitrogen concentration of sewage is required to be lower than 11 mg / L, the sludge is calculated according to the following formula

[0088] concentration:

[0089]

[0090] Among them, Q 设 — Designed water treatment volume;

[0091] TN 设进 ——Designed influent total nitrogen concentration;

[0092] TN 设出 ——Designed effluent total nitrogen concentration;

[0093] MLSS 设 ——Designed sludge concentration;

[0094] Q——water volume treated, monthly average value;

[0095] TN 进 ——Total nitrogen concentration in influent, taking the monthly average value;

[0096] TN 出 ——Target concentration of total nitrogen in effluent, taking the monthly average value;

[0097] MLSS – second theoretical sludge concentration;

[0098] Algorithm C, when the sewage treatment tank is a secondary sedimentation tank process, the second theoretical sludge concentration is calculated according to the following formula:

[0099]

[0100] Where, G is sludge solid load;

[0101] Q——actual amount of water treated;

[0102] K z ——Sewage variation coefficient;

[0103] MLSS – sludge concentration;

[0104] R 外 ——External return ratio, the ratio of sludge return volume to treated water volume;

[0105] A——area of ​​secondary sedimentation tank.

[0106] Preferably, in step SA2, the following comparison path is specifically included:

[0107] (1) When the target total nitrogen concentration is higher than 11 mg / L and the sewage pool does not have a secondary sedimentation tank, compare the first theoretical sludge concentration with the second theoretical sludge concentration obtained by algorithm A, and select the smaller one as the decision sludge concentration;

[0108] (2) When the target total nitrogen concentration is lower than or equal to 11 mg / L and the sewage pool does not have a secondary sedimentation tank, compare the first theoretical sludge concentration with the second theoretical sludge concentration obtained by algorithm B, and select the smaller one as the decision sludge concentration.

[0109] (3) When the target total nitrogen concentration is higher than 11 mg / L and the sewage tank uses a secondary sedimentation tank, compare the first theoretical sludge concentration with the second theoretical sludge concentration obtained by algorithm A and select the smaller one. Then compare the smaller one with the output result of algorithm C for the second time and select the smaller one as the decision sludge concentration.

[0110] (4) When the target total nitrogen concentration is lower than or equal to 11 mg / L and the sewage pool uses a secondary sedimentation tank, compare the first theoretical sludge concentration with the second theoretical sludge concentration obtained by algorithm A and select the smaller one. Then compare the smaller one with the output result of algorithm C for the second time and select the smaller one as the decision sludge concentration.

[0111] While ensuring biological denitrification, relatively low sludge concentrations can better remove phosphorus, reduce phosphorus removal drug consumption, and reduce chemical sludge production, thus achieving a virtuous cycle in the biochemical system. However, lower sludge concentrations do not necessarily guarantee the achievement of the target total nitrogen concentration below 11 mg / L or the target total nitrogen concentration below 6 mg / L. Traditional process theoretical calculations, based on a generalization theory, specify a specific design sludge concentration based on the most stringent wastewater treatment conditions. However, in actual operation, these theoretical limits are often not encountered, and operators can only adjust the design sludge concentration. This results in high drug dosage and sludge loss, making it impossible to dynamically and accurately adjust the wastewater conditions. In other words, the conclusions derived solely from generalization theory are simply not applicable to actual operating conditions that both meet the target requirements and achieve technical reductions. Therefore, neural network calculations are introduced. Based on historical data, the neural network model output is compared with the output of traditional process theoretical calculations. Since both values ​​are based on meeting the target total nitrogen concentration, the lower value between the two can improve the accuracy of control.

[0112] Preferably, in step SA3, the comparison process of the decision module is as follows:

[0113] (1) When the sludge concentration is greater than the actual value, a "stop" command is output to the sludge pump to control the sludge pump to stop working;

[0114] (2) When the decision sludge concentration is less than or equal to the actual sludge concentration, an “on” command is output to the sludge pump to control the sludge pump to start working.

[0115] Preferably, the sludge concentration regulating system further comprises a transmission module, and the transmission module is used for communicating data with a host computer of the sewage treatment plant.

[0116] Through this setting method, the system can operate independently or establish a communication connection with the original host computer system of the sewage treatment plant to directly participate in the control.

[0117] Compared with the prior art, the present invention has the following beneficial effects:

[0118] (1) The BP neural network prediction model is processed by the fruit fly optimization algorithm to obtain good initial values ​​of weights and biases, thereby avoiding subsequent iterations from falling into local optimal solutions and reducing the number of iterations, which is conducive to obtaining a high-precision sludge concentration prediction module, improving the accuracy of the prediction, and being more conducive to dynamically controlling the sludge concentration according to the sewage quality.

[0119] (2) By combining the algorithm module and the sludge concentration prediction module into a sludge concentration control system, the neural network fitting results are calculated using the traditional empirical formula algorithm for multiple scenarios, further improving the accuracy of sludge concentration control.

[0120] (3) The algorithm module, through the combination of Algorithm A, Algorithm B and Algorithm C, covers a variety of water purification standards of current domestic water purification plants, and expands the scope of application of this sludge concentration regulation system.

[0121] (4) Through the setting of the transmission module, the sludge concentration control system can operate independently, or it can communicate data with the host computer, directly participate in the control, and realize automatic adjustment of sludge concentration. BRIEF DESCRIPTION OF THE DRAWINGS

[0122] Figure 1 This is a schematic diagram of the fruit fly optimization process of the present invention;

[0123] Figure 2 It is a schematic flow chart of the sludge concentration regulating system of the present invention. DETAILED DESCRIPTION

[0124] The present invention will be further described below in conjunction with specific embodiments. The accompanying drawings are for illustrative purposes only and are only schematic diagrams, not actual drawings, and should not be construed as limiting the present invention.

[0125] The same or similar numbers in the drawings of this embodiment correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right", etc. indicate the orientation or position relationship, they are based on the orientation or position relationship shown in the drawings. This is only for the convenience of describing the present invention and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation. Therefore, the terms describing the position relationship in the drawings are only used for illustrative purposes and cannot be understood as limiting this patent. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.

[0126] Example 1

[0127] like Figure 1 FIG. 1 shows a first embodiment of a training method for a sludge concentration prediction module according to the present invention, comprising:

[0128] S1. Construct a BP neural network prediction model, including input node X, hidden layer and output node y ^ The hidden layer includes input weight w1, input bias b1, activation function σ(x), output weight w2 and output bias b2. The input node is processed by the hidden layer to obtain the output node.

[0129] S2. Select at least five sewage treatment characteristics as the input node X of the BP neural network prediction model, and select sludge concentration as the output node y of the BP neural network prediction model ^ , select Sigmoid as the activation function σ(x), and train the input weight, input bias, output weight and output bias of the BP neural network prediction model;

[0130] S3, obtaining the initial weight and initial bias of the BP neural network prediction model through the fruit fly optimization algorithm;

[0131] S4, iteratively training the BP neural network prediction model by gradient descent method;

[0132] S5. Evaluate the BP neural network prediction model. If it does not meet the requirements, re-train it. If it meets the requirements, save it.

[0133] The basic architecture of the neural network prediction model is:

[0134] The input layer enters the hidden layer: z1 = X.w1 + b1;

[0135] Activation function processing: a1 = σ(z1);

[0136] The hidden layer outputs to the output layer: z2 = a1·w2+b2;

[0137] In step S3, the initial values ​​of input weight, input bias, output weight and output bias are first generated by random initialization using Gaussian distribution, and then the above initial values ​​are optimized by the fruit fly optimization algorithm. Finally, the optimized initial values ​​are used as the benchmark for model training.

[0138] Through this setting method, when the model is trained, the weights and initial values ​​of the bias of the BP neural network prediction model can be globally explored through the fruit fly optimization algorithm to avoid falling into the local optimal solution or the initial value being too far away from the target value, thereby improving the speed and accuracy of the model training, thereby improving the accuracy of the BP neural network prediction model for sludge calculation. Subsequently, the BP neural network prediction model is iteratively trained through the gradient descent method to improve the fitting ability of the BP neural network until the BP neural network meets the preset requirements and is saved for subsequent use to generate the sludge concentration of the output node through the characteristic value of the input layer. After MSE and determination coefficient R 2 Evaluation and verification show that compared with the traditional BP neural network, this model has significant improvements in prediction accuracy, convergence speed and stability, with an accuracy increase of 5%-10%.

[0139] As an embodiment of the present invention, in step S2, the influent water volume x1, the influent total nitrogen x2, the effluent total nitrogen x3, the designed sludge concentration coefficient x4 and the designed sludge concentration x5 are respectively selected as input nodes.

[0140] As an embodiment of the present invention, the features of the input nodes are standardized respectively, and the processing formula is:

[0141]

[0142] Among them, X is the original data, X′ is the standardized data, and X min and X max are the minimum and maximum values ​​of the feature, respectively.

[0143] This setting method can reduce the bias of input features at each input node, which is beneficial to improving the reference of samples and thus improving the accuracy of the trained model.

[0144] As an embodiment of the present invention, in step S3, the following steps are specifically included:

[0145] S31. Generate an initialized population of fruit flies. Each fruit fly randomly generates a set of initial parameters of weights and biases. The dimension of each fruit fly individual is D, D = Nin·Nh+Nh·No+Nh·No, where Nin, Nh, and No represent the number of input nodes, hidden layers, and output nodes, respectively.

[0146] S32, calculating the fitness of each fruit fly through the mean square error;

[0147] S33, comparing the fitness of each fruit fly. If the fitness of the current individual is higher than that of the previous fruit fly, then updating the position of the current fruit fly to the initial position; otherwise, proceeding to the next search;

[0148] S34. After n rounds of comparison are performed or when the fitness of the fruit fly has not been significantly improved, the comparison is stopped, and the fruit fly with the highest fitness is selected as the initial weight and initial bias of the BP neural network prediction model.

[0149] As an embodiment of the present invention, the mean square error is obtained as follows:

[0150]

[0151] Among them, y true is the true value, i.e. the actual sludge concentration obtained in the real environment;

[0152] y pred It is the network forward propagation output value, that is, the output node prediction value generated by the model based on the current weights and biases in each training.

[0153] When calculating fitness, the D-dimensional vector of the fruit fly individual encodes all the weights and biases of the neural network w1, b1, w2, and b2. It must first be decoded and restored to the network parameter structure, and then the parameters are used to configure the forward propagation to calculate the predicted output of the training set. The prediction deviation is specifically quantified by the mean square error. The fitness value = 1 / (1+MSE) achieves higher fitness as the smaller the error.

[0154] Through this setting method, the fruit fly optimization algorithm provides an efficient and robust parameter initialization scheme for the BP neural network through a bionic intelligent search mechanism, solving the pain points of traditional neural network methods such as falling into local optimality, slow convergence speed and high-dimensional parameter coordination when facing the multidimensional problem of sludge regulation. It is conducive to obtaining good initial values ​​of weights and biases to reduce training time and improve the accuracy of the BP neural network.

[0155] As an embodiment of the present invention, in step S4, each round of training calculates the mean square error by back propagation to update the weights and biases in the neural network to minimize the loss function.

[0156] As an embodiment of the present invention, in step S5, the evaluation method is specifically as follows: performing inverse normalization on the first theoretical sludge concentration to obtain theoretical initial data, and calculating the MSE and determination coefficient R of the theoretical initial data. 2 to evaluate the predictive performance of the model.

[0157] Example 2

[0158] The following is a first embodiment of a sludge concentration regulating system of the present invention, including a sludge concentration prediction module trained by the training method of Example 1, and further limiting step S33, step S4, and step S5.

[0159] As an embodiment of the present invention, step S33 also includes a dynamic step size adjustment mechanism: at the tth iteration, the step size of fruit fly individual i is R_i^t=a*(P_best-X_i^{t-1})+(1-a)*R_i^{t-1}; where a∈(0,1) is a learning factor, and P_best is the optimal position of the current population.

[0160] The mechanism for dynamically adjusting step size R occurs during the fruit fly position update phase: at iteration t, individual i's step size R_i^t = a*(P_best - X_i^{t-1}) + (1-a)*R_i^{t-1}, where a∈(0,1) is a learning factor and P_best is the current optimal position of the population. Linear interpolation is used to balance global exploration (moving closer to the optimal individual as a approaches 1) and local exploitation (maintaining the original search inertia as a approaches 0). After the step size is adjusted, a random perturbation of X_i^t = X_i^{t-1} + R_i^t*N(0,1) is applied. This mechanism promotes global exploration in the early stages of the iteration and refines local search in the later stages by adaptively scaling the search step.

[0161] As an embodiment of the present invention, in step S4, the following steps are specifically included:

[0162] S41. Calculate the output layer error δ1:

[0163]

[0164] S42. Calculate the gradients of the output weight and output bias respectively:

[0165] Output weight gradient:

[0166]

[0167] Output bias gradient:

[0168]

[0169] S43, propagating the error to the hidden layer,

[0170]

[0171] Where σ′(x) is the derivative of σ(x);

[0172] S43. Calculate the gradient of input weight and input bias:

[0173] Input weight gradient:

[0174] Input bias gradient:

[0175] S44. Update weights. In each round of iteration, w1, w2, b1, and b2 are updated separately according to the following formula:

[0176] Input weights:

[0177] Input bias:

[0178] Output weights:

[0179] Output bias:

[0180] Wherein, η is a learning rate, which is set manually, and the value range of η is 0.001 to 0.1, and 0.1 is selected as the learning rate here. As an embodiment of the present invention, in step S5, the denormalization method is:

[0181] X original =X scaled ×σ1+μ;

[0182] Among them, X scaled is the training data after X is standardized, σ1 is the standard deviation of the target variable when it is standardized, and μ is the mean of the target variable when it is standardized.

[0183] As one embodiment of the present invention, in step S5, the coefficient R is determined. 2 The method to obtain is:

[0184]

[0185] Among them, y true,i is the true value of the i-th sample, y pred,i is the predicted value of the i-th sample, is the average of the true values. 2 When it reaches 0.75, it indicates that the model meets the requirements.

[0186] Example 3

[0187] like Figure 2 The first embodiment of the sludge concentration control system of the present invention is shown, which includes a sludge concentration prediction module trained by the training method of embodiment 1 or 2, and also includes

[0188] Algorithm module, including algorithm A and algorithm B for executing different effluent total nitrogen concentrations, algorithm A, algorithm B and algorithm C are all used to generate a second theoretical sludge concentration according to different working conditions;

[0189] The decision module is used to receive the sludge concentration generated by the sludge concentration prediction module and the algorithm module respectively, compare them according to the actual working conditions, and then output the control instructions of the sludge pump;

[0190] The steps include:

[0191] SA1, the sludge concentration prediction module generates the first theoretical sludge concentration, and the algorithm module selects an algorithm according to the actual working conditions to generate the second theoretical sludge concentration;

[0192] SA2, the decision module receives the first theoretical sludge concentration and the second theoretical sludge concentration, and selects the preferred option as the decision sludge concentration;

[0193] SA3, the decision module detects the actual sludge concentration, compares the decision sludge concentration with the actual sludge concentration, and controls the operation of the sludge pump according to the comparison results.

[0194] This setup method allows the sludge concentration control system to generate a first theoretical sludge concentration that matches actual conditions based on a fruit fly-optimized BP neural network model. This is then verified using a second theoretical sludge concentration generated traditionally within the algorithm module, which incorporates traditional empirical algorithms for a variety of scenarios. This increases the system's applicability to water treatment plants operating under various standards. By leveraging classical algorithms and machine learning algorithms, the system rapidly improves sludge concentration decision-making and control strategies, enhancing control efficiency and water quality stability.

[0195] Preferably, the decision module includes

[0196] Algorithm A: When the target total nitrogen concentration in wastewater is required to be greater than or equal to 11 mg / L, the following formula is used to calculate

[0197] The second theoretical sludge concentration:

[0198]

[0199] Among them, Q is the amount of water treated, taking the monthly average value;

[0200] S0——Biochemical oxygen demand concentration of influent for 5 days, taking the monthly average value;

[0201] V——biochemical pool volume;

[0202] MLSS – second theoretical sludge concentration;

[0203] F / M——sludge load, take the design value;

[0204] Algorithm B, when the target total nitrogen concentration of sewage is required to be lower than 11 mg / L, the sludge is calculated according to the following formula

[0205] concentration:

[0206]

[0207] Among them, Q 设 — Designed water treatment volume;

[0208] TN 设进 ——Designed influent total nitrogen concentration;

[0209] TN 设出 ——Designed effluent total nitrogen concentration;

[0210] MLSS 设 ——Designed sludge concentration;

[0211] Q——water volume treated, monthly average value;

[0212] TN 进 ——Total nitrogen concentration in influent, taking the monthly average value;

[0213] TN 出 ——Target concentration of total nitrogen in effluent, taking the monthly average value;

[0214] MLSS – second theoretical sludge concentration;

[0215] Algorithm C, when the sewage treatment tank is a secondary sedimentation tank process, the second theoretical sludge concentration is calculated according to the following formula:

[0216]

[0217] Where, G is sludge solid load;

[0218] Q——actual amount of water treated;

[0219] K z ——Sewage variation coefficient;

[0220] MLSS – sludge concentration;

[0221] R 外 ——External return ratio, the ratio of sludge return volume to treated water volume;

[0222] A——area of ​​secondary sedimentation tank.

[0223] As an embodiment of the present invention, in step SA2, the following comparison path is specifically included:

[0224] (1) When the target total nitrogen concentration is higher than 11 mg / L and the sewage pool does not have a secondary sedimentation tank, compare the first theoretical sludge concentration with the second theoretical sludge concentration obtained by algorithm A, and select the smaller one as the decision sludge concentration;

[0225] (2) When the target total nitrogen concentration is lower than or equal to 11 mg / L and the sewage pool does not have a secondary sedimentation tank, compare the first theoretical sludge concentration with the second theoretical sludge concentration obtained by algorithm B, and select the smaller one as the decision sludge concentration.

[0226] (3) When the target total nitrogen concentration is higher than 11 mg / L and the sewage tank uses a secondary sedimentation tank, compare the first theoretical sludge concentration with the second theoretical sludge concentration obtained by algorithm A and select the smaller one. Then compare the smaller one with the output result of algorithm C for the second time and select the smaller one as the decision sludge concentration.

[0227] (4) When the target total nitrogen concentration is lower than or equal to 11 mg / L and the sewage pool uses a secondary sedimentation tank, compare the first theoretical sludge concentration with the second theoretical sludge concentration obtained by algorithm A and select the smaller one. Then compare the smaller one with the output result of algorithm C for the second time and select the smaller one as the decision sludge concentration.

[0228] While ensuring biological denitrification, relatively low sludge concentrations can better remove phosphorus, reduce phosphorus removal drug consumption, and reduce chemical sludge production, thus achieving a virtuous cycle in the biochemical system. However, lower sludge concentrations do not necessarily guarantee the achievement of the target total nitrogen concentration below 11 mg / L or the target total nitrogen concentration below 6 mg / L. Traditional process theoretical calculations, based on a generalization theory, specify a specific design sludge concentration based on the most stringent wastewater treatment conditions. However, in actual operation, these theoretical limits are often not encountered, and operators can only adjust the design sludge concentration. This results in high drug dosage and sludge loss, making it impossible to dynamically and accurately adjust the wastewater conditions. In other words, the conclusions derived solely from generalization theory are simply not applicable to actual operating conditions that both meet the target requirements and achieve technical reductions. Therefore, neural network calculations are introduced. Based on historical data, the neural network model output is compared with the output of traditional process theoretical calculations. Since both values ​​are based on meeting the target total nitrogen concentration, the lower value between the two can improve the accuracy of control.

[0229] As an embodiment of the present invention, in step SA3, the comparison process of the decision module is as follows:

[0230] (1) When the sludge concentration is greater than the actual value, a "stop" command is output to the sludge pump to control the sludge pump to stop working;

[0231] (2) When the decision sludge concentration is less than or equal to the actual sludge concentration, an “on” command is output to the sludge pump to control the sludge pump to start working.

[0232] As an embodiment of the present invention, the sludge concentration regulating system further includes a transmission module, and the transmission module is used for communicating data with a host computer of the sewage treatment plant.

[0233] Through this setting method, the system can operate independently or establish a communication connection with the original host computer system of the sewage treatment plant to directly participate in the control.

[0234] Obviously, the above embodiments of the present invention are merely examples for the purpose of illustrating the present invention clearly, and are not intended to limit the embodiments of the present invention. Those skilled in the art will appreciate that other variations or modifications can be made based on the above description. It is not necessary and impossible to enumerate all embodiments here. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention shall be included within the scope of protection of the claims of the present invention.

Claims

1. A training method for a sludge concentration prediction module, characterized in that: include: S1, constructing a BP neural network prediction model, including an input node X, a hidden layer and an output node y^; the hidden layer includes an input weight w1, an input bias b1, an activation function σ(x), an output weight w2 and an output bias b2, and the input node is processed by the hidden layer to obtain an output node; S2. Select at least five sewage treatment characteristics as input nodes X of the BP neural network prediction model, select sludge concentration as output node y^ of the BP neural network prediction model, select Sigmoid as activation function σ(x), and train to obtain input weights, input biases, output weights, and output biases of the BP neural network prediction model; S3, obtaining the initial weight and initial bias of the BP neural network prediction model through the fruit fly optimization algorithm; S4, iteratively training the BP neural network prediction model by gradient descent method; S5. Evaluate the BP neural network prediction model. If it does not meet the requirements, re-train it. If it meets the requirements, save it.

2. The training method of the sludge concentration prediction module according to claim 1, characterized in that: In step S2, the influent water volume x1, influent total nitrogen x2, effluent total nitrogen x3, designed sludge concentration coefficient x4 and designed sludge concentration x5 in the sewage characteristics are selected as input nodes X respectively.

3. The training method of the sludge concentration prediction module according to claim 2, characterized in that: The features of the input node X are standardized respectively, and the processing formula is: Among them, X is the original data, X′ is the standardized data, and X min and X max are the minimum and maximum values ​​of the feature, respectively.

4. The training method of the sludge concentration prediction module according to claim 1, characterized in that: In step S3, the following steps are specifically included: S31. Generate an initialized fruit fly population. Each fruit fly randomly generates a set of initial parameters of weights and biases. The dimension of each fruit fly individual is D, D = Nin*Nh+Nh*No+Nh*No, where Nin, Nh, and No represent the number of input nodes, hidden layers, and output nodes, respectively. S32, calculate the fitness of each fruit fly through the mean square error MSE, S33, comparing the fitness of each fruit fly. If the fitness of the current individual is higher than that of the previous fruit fly, then updating the position of the current fruit fly to the initial position; otherwise, proceeding to the next search; S34. After n rounds of comparison are performed or when the fitness of the fruit fly has not been significantly improved, the comparison is stopped, and the fruit fly with the highest fitness is selected as the initial weight and initial bias of the BP neural network prediction model.

5. The sludge concentration regulation system based on the fruit fly optimization algorithm according to claim 4, in step S33, further comprising a dynamic step size adjustment mechanism: at the t-th iteration, the step size of fruit fly individual i is R_i^t=a*(P_best-X_i^{t-1})+(1-a)*R_i^{t-1}; Where a∈(0,1) is the learning factor and P_best is the optimal position of the current population.

6. The training method of the sludge concentration prediction module according to claim 1, characterized in that: In step S4, each round of training calculates the mean square error through backpropagation to update w1, w2, b1 and b2 in the network to minimize the loss function.

7. The sludge concentration regulation system based on the fruit fly optimization algorithm according to claim 1 is characterized in that: In step S5, the evaluation method is as follows: the first theoretical sludge concentration is subjected to inverse normalization to obtain theoretical initial data, and the MSE and determination coefficient R are calculated based on the theoretical initial data. 2 to evaluate the predictive performance of the model.

8. A sludge concentration regulating system, characterized in that: A sludge concentration prediction module comprising a fruit fly optimization algorithm trained by the training method according to any one of claims 1 to 7, further comprising An algorithm module, comprising an algorithm A and an algorithm B for executing different effluent total nitrogen concentrations, wherein the algorithm, the algorithm B and the algorithm C are all used to generate a second theoretical sludge concentration according to different working conditions; A decision module is used to receive the first sludge concentration and the second theoretical sludge concentration respectively, compare them according to the actual working conditions, and then output a control instruction for the sludge pump; The steps include: SA1, the sludge concentration prediction module collects the influent water volume, influent total nitrogen, effluent total nitrogen, designed sludge concentration coefficient and designed sludge concentration in real time, the algorithm module obtains the target total nitrogen concentration, and the decision module obtains the actual value of the sludge concentration; SA2: The sludge concentration prediction module generates a first theoretical sludge concentration, and the algorithm module selects an algorithm according to actual working conditions to generate a second theoretical sludge concentration; SA3, the decision module receives the first theoretical sludge concentration and the second theoretical sludge concentration, and selects the smaller one as the decision sludge concentration; SA4. The decision module detects the actual sludge concentration, compares the decided sludge concentration with the actual sludge concentration, and controls the operation of the sludge pump according to the comparison result.

9. The sludge concentration regulation system based on the fruit fly optimization algorithm according to claim 8 is characterized in that: The decision module includes Algorithm A: When the target total nitrogen concentration in wastewater is required to be greater than or equal to 11 mg / L, the second theoretical sludge concentration is calculated according to the following formula: Among them, Q is the amount of water treated, taking the monthly average value; S0——Biochemical oxygen demand concentration of influent for 5 days, taking the monthly average value; V——biochemical pool volume; MLSS – second theoretical sludge concentration; F / M——sludge load, take the design value; Algorithm B: When the target total nitrogen concentration in wastewater is required to be lower than 11 mg / L, the sludge concentration is calculated according to the following formula: Among them, Q 设 — Designed water treatment volume; TN 设进 ——Designed influent total nitrogen concentration; TN 设出 ——Designed effluent total nitrogen concentration; MLSS 设 ——Designed sludge concentration; Q——water volume treated, monthly average value; TN 进 ——Total nitrogen concentration in influent, taking the monthly average value; TN 出 ——Target concentration of total nitrogen in effluent, taking the monthly average value; MLSS – second theoretical sludge concentration; Algorithm C, when the sewage treatment tank is a secondary sedimentation tank process, the second theoretical sludge concentration is calculated according to the following formula: Where, G is sludge solid load; Q——actual amount of water treated; K z ——Sewage variation coefficient; MLSS – sludge concentration; R 外 ——External return ratio, the ratio of sludge return volume to treated water volume; A——area of ​​secondary sedimentation tank.

10. The sludge concentration regulation system based on the fruit fly optimization algorithm according to claim 9 is characterized in that: In step SA2, the comparison path is specifically included as follows: (1) When the target total nitrogen concentration is higher than 11 mg / L and the sewage pool does not have a secondary sedimentation tank, compare the first theoretical sludge concentration with the second theoretical sludge concentration obtained by algorithm A, and select the smaller one as the decision sludge concentration; (2) When the target total nitrogen concentration is lower than or equal to 11 mg / L and the sewage pool does not have a secondary sedimentation tank, compare the first theoretical sludge concentration with the second theoretical sludge concentration obtained by algorithm B, and select the smaller one as the decision sludge concentration. (3) When the target total nitrogen concentration is higher than 11 mg / L and the sewage tank uses a secondary sedimentation tank, compare the first theoretical sludge concentration with the second theoretical sludge concentration obtained by algorithm A and select the smaller one. Then compare the smaller one with the output result of algorithm C for the second time and select the smaller one as the decision sludge concentration. (4) When the target total nitrogen concentration is lower than or equal to 11 mg / L and the sewage pool uses a secondary sedimentation tank, compare the first theoretical sludge concentration with the second theoretical sludge concentration obtained by algorithm A and select the smaller one. Then compare the smaller one with the output result of algorithm C for the second time and select the smaller one as the decision sludge concentration.

Citation Information

Cited By

  • Dosing treatment method for sewage and computer readable storage medium

    CN121348711A