Data-driven sewage treatment carbon source addition model predictive control system and method
By building a prediction module based on M-DMCAN neural network and an MPC optimization control strategy, the accuracy and stability of carbon source injection control in sewage treatment plants are solved, and the precise control of carbon source injection is achieved, reducing costs and improving the adaptability and stability of the system.
Patent Information
- Application Number
- CN202510604213.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-12
- Publication Date
- 2025-08-26
AI Technical Summary
In the carbon source injection control, existing sewage treatment plants have problems such as low control accuracy, lagging response, and difficulty in adapting to complex working conditions, resulting in unstable total nitrogen concentration in the effluent, increasing the cost of agents and environmental pollution risks.
A prediction module based on M-DMCAN neural network is constructed, combined with MPC optimization control strategy, and through time and variable feature extraction, feedback correction and gradient descent algorithms, precise control of carbon source addition is achieved, forming a closed-loop control system.
It improves the accuracy and system stability of carbon source injection control, reduces drug consumption and operating costs, ensures that the total nitrogen concentration in effluent meets the standards, and adapts to changes in different water inlet conditions.
Smart Images

Figure CN120540066A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of sewage treatment, and in particular relates to a data-driven sewage treatment carbon source dosing model predictive control system and method. Background Art
[0002] In wastewater treatment, carbon source dosing control plays a crucial role in achieving efficient nitrogen removal and stabilizing water quality. However, current wastewater treatment plants face numerous challenges in this process. Traditional control methods and existing intelligent control technologies have significant drawbacks, making them difficult to meet practical needs.
[0003] Limitations of Traditional Carbon Source Dosage Control Methods: Traditional carbon source dosing in wastewater treatment relies primarily on manual operation or simple automated equipment. Manual operation relies on the operator's experience to determine the carbon source dosage, which is highly subjective and lacks scientific and precise basis. Because wastewater quality and water volume are constantly changing, manual experience cannot accurately adapt to these changes, which can easily lead to excessive or insufficient carbon source dosage. For example, when water quality suddenly changes, it is difficult for manual adjustments to be made in a timely and appropriate manner. This not only results in wasteful treatment and increased treatment costs, but can also cause the total nitrogen concentration in the effluent to exceed standards, failing to meet environmental protection standards.
[0004] Although the constant dosing method or the dosing method based on a simple linear relationship has achieved automation to a certain extent, it still has serious shortcomings. The constant dosing method adds carbon sources according to a fixed dosage, completely ignoring the real-time changes in water quality and water volume, and cannot be flexibly adjusted according to actual conditions. The dosing method based on a simple linear relationship only considers the relationship between some water quality parameters and the amount of carbon source added. When faced with complex sewage treatment processes, its control accuracy and adaptability are far from enough. There are many factors that influence each other in the sewage treatment process, such as the carbon-nitrogen ratio of the influent, microbial activity, hydraulic retention time, etc. The complex changes of these factors make it difficult for a simple linear relationship to accurately describe the relationship between the amount of carbon source added and the treatment effect, resulting in poor treatment effect and unstable effluent water quality.
[0005] Deficiencies of existing intelligent control technology: With the advancement of science and technology, intelligent control technology has gradually been applied to wastewater treatment, but it still faces many challenges in controlling carbon source dosage. The wastewater treatment process is characterized by strong nonlinearity, time-varying characteristics, and large time lags, which places extremely high demands on intelligent control technology. Existing intelligent control methods based on artificial intelligence algorithms such as neural networks can predict water quality changes and adjust carbon source dosage by learning from historical data. However, they exhibit significant limitations when dealing with long time lags and complex variable correlations.
[0006] In actual sewage treatment plants, there is a long time delay between carbon source addition and changes in effluent total nitrogen concentration, making it difficult to effectively implement control strategies based on real-time data. At the same time, the sewage treatment process involves numerous variables, and the correlations between them are complex and changeable. Existing intelligent control methods struggle to accurately capture these complex relationships, resulting in low prediction accuracy, which in turn affects the accuracy of carbon source addition. Actual operation also presents problems such as equipment failure, sensor errors, and external disturbances. These uncertainties further interfere with the accuracy and stability of intelligent control. Sensor measurement errors may lead to erroneous control signals, causing the carbon source dosage to deviate from the optimal value, affecting the sewage treatment effect.
[0007] Impact on the operation of sewage treatment plants: The above-mentioned carbon source addition control problem has had a serious negative impact on the operation of sewage treatment plants. Due to improper control of carbon source addition, the total nitrogen concentration in the effluent often fluctuates and is difficult to meet the standard stably. This may not only cause the sewage treatment plant to face environmental penalties, but also pollute the surrounding water environment and affect the ecological balance. At the same time, the waste or excessive addition of carbon sources has greatly increased the cost of chemicals for sewage treatment plants. In order to maintain the operation of the equipment under poor addition conditions, the loss and maintenance costs of the equipment will be increased, the service life of the equipment will be reduced, and the operating costs will be further increased. Therefore, it is urgent to develop a data-driven sewage treatment carbon source addition control technology that can effectively overcome the above-mentioned problems. This has important practical significance for improving the operating efficiency of sewage treatment plants, reducing costs, and protecting the environment. Summary of the Invention
[0008] In light of this, the present invention aims to provide a data-driven predictive control system and method for carbon source dosing in sewage treatment, aiming to address the low control accuracy, delayed response, and difficulty adapting to complex operating conditions that plague existing carbon source dosing control technologies. By constructing an accurate predictive model and optimizing control strategies, the system achieves precise regulation of carbon source dosing during sewage treatment, ensuring that effluent total nitrogen concentrations consistently meet standards. This approach also reduces carbon source consumption and operating costs, improving the efficiency and stability of sewage treatment plants.
[0009] In order to achieve the above object, the present invention provides the following technical solutions:
[0010] A data-driven wastewater treatment carbon source dosing model predictive control system, comprising:
[0011] Prediction module: Based on the M-DMCAN neural network, it is used to predict the total nitrogen concentration in the effluent;
[0012] Optimization control module: Constructs a nonlinear model of the system, transforms the nonlinear control problem of tracking the reference sequence into an optimization problem, and then solves the control sequence of the carbon source dosage;
[0013] Feedback correction module: Calculates the deviation between the actual output and the predicted output of total nitrogen concentration in water, multiplies the deviation by the feedback coefficient to obtain the feedback amount, and adds the feedback amount to the predicted value to obtain the feedback predicted output. The feedback predicted output calculated at the current moment participates in the rolling optimization of the carbon source dosage control law at the next moment to form a closed-loop control;
[0014] Control law solving module: Use the gradient descent algorithm to dynamically correct the control input sequence, track the set reference trajectory by minimizing the cost function by gradient descent in the next few steps, and realize automatic and accurate addition of carbon source.
[0015] Furthermore, the prediction module based on the M-DMCAN neural network has a dual-branch structure, one for time scale feature extraction and the other for variable dimension feature extraction;
[0016] The time scale feature extraction branch is used to downsample, decompose and mix the input historical data to learn the periodicity and trend characteristics of the time series;
[0017] The variable dimension feature extraction branch uses a patch-based segmentation method and a multi-head attention mechanism to capture the cross-correlations between different variables.
[0018] Furthermore, the operation process of the optimization control module is as follows:
[0019] I. Construct a nonlinear system model for predictive control of carbon source addition in wastewater treatment;
[0020] y p (t)=f(y(t-1),y(t-2),...,y(tn y ),u(t-1),u(t-2),...,u(tn u ))
[0021] Among them, y(t)=[y(t-1),y(t-2),...,y(t-ny)] T is the total nitrogen concentration in the effluent; u(t) is the amount of carbon source added; n y and n u is the maximum delay;
[0022] II. Using the MPC principle, a nonlinear control problem of tracking a reference sequence is transformed into an optimization problem;
[0023] The objective function of the optimization problem is:
[0024]
[0025] stu min ≤u(t)≤u max
[0026]
[0027] Among them, y r (t) is the set value of total nitrogen concentration in effluent; The output of the total nitrogen concentration prediction of the effluent water is H. p ×1; Δu(t)=[Δu(t),Δu(t+1),...,Δu(t+H u -1)] T is the carbon source addition control increment, dimension is H d ×1; γ1 is the state error weight parameter; γ2 is the control input weight parameter;
[0028] III. By optimizing the above objective function, the optimal carbon source dosage sequence is solved and the rolling optimization control of the carbon source dosage is realized.
[0029] Furthermore, the operation process of the feedback correction module is as follows:
[0030] I. will predict the future H from the present time t p The output of the system controlled variable at each moment;
[0031] y p (t) = [y p (t+1)|t,y p (t+2)|t,...,y p (t+H p )|t] T
[0032] II. Subtract the actual output sequence at time t+1 from the predicted output sequence at time t to obtain the prediction error, which is the deviation between the actual output and the predicted output of total nitrogen concentration in water;
[0033] e(t+1)=y(t+1)-y p (t+1|t)
[0034] III. Multiply the error by the previous feedback coefficient to obtain the feedback value, and add the feedback value to the prediction value based on the prediction module at time t+1 to obtain the feedback prediction output;
[0035]
[0036] Where β=[β1,β2,...,β Hp ] is the feedback correction vector;
[0037] IV. The predicted output of the corrected effluent total nitrogen concentration participates in the rolling optimization of the carbon source dosage control law at the next moment to form a closed-loop control.
[0038] Furthermore, in the control law solving module, the update formula of the control input sequence u(t) is:
[0039]
[0040] where ξ is the learning rate for gradient descent updates of the input sequence, and ξ > 0.
[0041] The present invention also discloses a data-driven sewage treatment carbon source addition model predictive control method, comprising the following steps:
[0042] S1. Data processing: Collect input and output data of sewage treatment, normalize the data, and then divide it into training and test sets;
[0043] S2. Model training: Use the training set data to train the M-DMCAN neural network, determine the model parameters, and obtain the effluent total nitrogen concentration prediction model;
[0044] S3. Prediction and Control:
[0045] At each control moment, based on the current status and historical data of the sewage treatment system, the trained effluent total nitrogen concentration prediction model is used to predict the effluent total nitrogen concentration in the future period;
[0046] Based on the predicted value and the target set value, the control sequence of carbon source dosage is calculated through the optimization control module, and the first step of the control sequence is applied to the sewage treatment system;
[0047] S4. Feedback correction: Obtain the actual effluent total nitrogen concentration, calculate the deviation between the actual output and the predicted output, and correct the predicted output through the feedback correction module. The correction result is used for the control calculation at the next moment;
[0048] S5. Loop execution: Repeat S3 and S4 to achieve stable control of carbon source addition.
[0049] Furthermore, in step S1, the input and output data of the sewage treatment include carbon source dosage, effluent total nitrogen concentration, influent total nitrogen concentration, influent flow rate, influent chemical oxygen demand and influent nitrate nitrogen.
[0050] Furthermore, in the training process of the effluent total nitrogen concentration prediction model in step S2, an early stopping strategy is adopted. If the evaluation index MAE on the validation set does not improve within 5 epochs, the training is stopped.
[0051] Furthermore, in step S3, the characteristics of the effluent total nitrogen concentration prediction model are as follows:
[0052] The prediction input length of the effluent total nitrogen concentration prediction model is 40, and the prediction output length is 3, 6, or 12;
[0053] The effluent total nitrogen concentration prediction model adopts the average pooling method with three pooling layers;
[0054] The number of MLP hidden layers in the prediction layer of the effluent total nitrogen concentration prediction model is 1, and the dimension is set to 64; the number of attention heads is 2, and the number of cross-dimensional cross-attention scale layers is 2.
[0055] Further, stability analysis.
[0056] The stability of M-DMCAN-MPC is proven based on Lyapunov theory. Specifically, the relevant expressions are substituted into the differential form of the Lyapunov function. Combined with the calculation of the control law and the characteristics of the model, it is proved that when the prediction model is guaranteed to converge, M-DMCAN-MPC can maintain stability, providing reliability for practical applications.
[0057] Beneficial effects:
[0058] 1. Improved Control Precision: This data-driven model predictive control system for carbon source dosing in wastewater treatment, combining the precise prediction capabilities of the M-DMCAN neural network with the optimized control strategy of the MPC, effectively overcomes the nonlinearity and time-varying nature of the wastewater treatment process, improving the control precision of carbon source dosing, ensuring that effluent total nitrogen concentration more consistently meets emission standards and reducing water quality fluctuations. Under different influent conditions, the fluctuation range of effluent total nitrogen concentration is significantly reduced compared to traditional control methods.
[0059] 2. Reduced operating costs: By precisely controlling the amount of carbon source added, carbon source waste is avoided and reagent costs are reduced. This also reduces the cost of secondary treatment due to substandard effluent quality, as well as the additional equipment wear and maintenance costs caused by excessive carbon source addition, thereby improving the economic efficiency of the sewage treatment plant. Experiments have shown that the control method of this invention reduces carbon source consumption by 12.8%-41.2%.
[0060] 3. Enhanced system stability and robustness: The feedback correction mechanism and Lyapunov-based stability proof enable the predictive control system to effectively cope with environmental uncertainty, variable operating conditions, and model bias. This enhances system stability and robustness, ensuring reliable operation in complex wastewater treatment environments. Even in the event of brief sensor errors or sudden changes in influent water quality, the system can quickly adjust to maintain stable operation.
[0061] 4. Adaptability to Different Operating Conditions: Experimental verification under different influent conditions (such as sunny and rainy days) demonstrates that the predictive control system can adapt to changes in influent quality and quantity while maintaining excellent control performance. This enables efficient carbon source dosing control in sewage treatment plants under various practical operating conditions. Precise carbon source dosing control is achieved regardless of whether the influent total nitrogen concentration is high or low.
[0062] Other advantages, objects, and features of the present invention will be described in part in the following description and, in part, will be apparent to those skilled in the art upon examination of the following description or may be learned from practice of the present invention. The objects and other advantages of the present invention may be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 This is a structural diagram of a data-driven carbon source dosing model predictive control system for sewage treatment according to the present invention;
[0064] Figure 2 This is the basic closed-loop control structure diagram of BSM1;
[0065] Figure 3 is the total nitrogen concentration of influent under three working conditions;
[0066] Figure 4 Comparison of water inlet flow under three working conditions;
[0067] Figure 5a Total nitrogen concentration in effluent under different total carbon source dosages under sunny conditions;
[0068] Figure 5b Total nitrogen concentration in effluent under different total carbon source dosages under rainy day conditions;
[0069] Figure 5c Total nitrogen concentration in effluent under different total amounts of carbon source added during rainstorm conditions;
[0070] Figure 6 is the total nitrogen concentration of effluent under different dosing strategies;
[0071] Figure 7 The tracking status and error of total nitrogen concentration in outlet water under sunny conditions;
[0072] Figure 8 Tracking status and error of total nitrogen concentration in effluent under rainy conditions;
[0073] Figure 9 is the total flow rate change of carbon source addition under rainy conditions. DETAILED DESCRIPTION
[0074] To make the technical solutions, advantages, and purposes of the present invention more clear, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the described embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0075] The present invention provides a data-driven model predictive control system for carbon source dosing in sewage treatment (M-DMCAN-MPC), which constructs a prediction model based on the M-DMCAN neural network and integrates it into the MPC framework. Figure 1 As shown, the predictive control system of the present invention includes a prediction module, an optimization control module, a feedback correction module and a control law solving module.
[0076] Prediction module: Built based on the M-DMCAN neural network, it is used to predict the total nitrogen concentration in the effluent. The prediction module built based on the M-DMCAN neural network has a dual-branch structure, which performs feature extraction for the time scale and variable dimension respectively. The time scale feature extraction branch downsamples, decomposes, and mixes the input historical data to learn the periodic and trend characteristics of the time series. For example, by processing data such as influent water quality, carbon source dosage, and effluent total nitrogen concentration in different time periods, the pattern of data changes over time is captured. The variable dimension feature extraction branch uses a patch-based segmentation method and a multi-head attention mechanism to effectively capture the cross-correlations between different variables. In sewage treatment, multiple variables such as the influent carbon-nitrogen ratio, dissolved oxygen concentration, and microbial activity affect each other. This branch can accurately explore the complex relationships between these variables.
[0077] Accurately predicting effluent total nitrogen concentration: Through the synergistic effect of the dual-branch structure described above, the M-DMCAN neural network is able to accurately predict effluent total nitrogen concentration. During training, the network is trained using a large amount of historical data, and network parameters are continuously adjusted to improve prediction accuracy. The prediction results will serve as an important basis for subsequent optimization and control.
[0078] Optimization control module: Integrate the prediction model into the MPC framework, build a nonlinear model of the system, transform the nonlinear control problem of tracking the reference sequence into an optimization problem, and then solve the control sequence of the carbon source dosage.
[0079] The operation process of the optimization control module is as follows:
[0080] I. Construct a nonlinear system model for predictive control of carbon source addition in wastewater treatment;
[0081] y p(t)=f(y(t-1),y(t-2),...,y(tn y ),u(t-1),u(t-2),...,u(tn u )) (1)
[0082] Among them, y(t)=[y(t-1),y(t-2),...,y(t-ny)] T is the total nitrogen concentration in the effluent; u(t) is the amount of carbon source added; n y and n u is the maximum delay;
[0083] II. Using the MPC principle, a nonlinear control problem of tracking a reference sequence is transformed into an optimization problem;
[0084] The objective function of the optimization problem is:
[0085]
[0086] Among them, y r (t) is the set value of total nitrogen concentration in effluent; The output of the total nitrogen concentration prediction of the effluent water is H. p ×1; Δu(t)=[Δu(t),Δu(t+1),...,Δu(t+H u -1)] T is the carbon source addition control increment, dimension is H d ×1; γ1 is the state error weight parameter; γ2 is the control input weight parameter;
[0087] III. By optimizing the above objective function, the optimal carbon source dosage sequence is solved and the rolling optimization control of the carbon source dosage is realized.
[0088] Feedback correction module: Calculate the deviation between the actual output and the predicted output of total nitrogen concentration in water, multiply the deviation by the feedback coefficient to obtain the feedback amount, add the feedback amount to the predicted value to obtain the feedback predicted output, and the feedback predicted output calculated at the current moment participates in the rolling optimization of the carbon source dosage control law at the next moment to form a closed-loop control.
[0089] Due to environmental uncertainty, variable operating conditions, and model bias in the sewage treatment process, there is often a discrepancy between the actual and predicted outputs of effluent total nitrogen concentration. To address this issue, the present invention introduces a feedback correction process, which is primarily used to correct the predicted output online, mitigating inaccuracies in the prediction model output or excessive external disturbances, thereby improving system robustness.
[0090] The operation process of the feedback correction module is:
[0091] I. will predict the future H from the present time tp The output of the system controlled variable at each moment is expressed as:
[0092] y p (t) = [y p (t+1)|t,y p (t+2)|t,...,y p (t+H p )|t] T (3)
[0093] II. Subtract the actual output sequence at time t+1 from the predicted output sequence at time t to obtain the prediction error, which is the deviation between the actual output and the predicted output of total nitrogen concentration in water;
[0094] e(t+1)=y(t+1)-y p (t+1|t)(4)
[0095] III. During this prediction process, the error is multiplied by the previous feedback coefficient to obtain the feedback value, which is then added to the prediction value based on the prediction module at time t+1 to obtain the feedback prediction output at time t+1.
[0096]
[0097] Where β=[β1,β2,...,β Hp ] is the feedback correction vector, generally, β1=1;
[0098] IV. The corrected effluent total nitrogen concentration prediction output is used to optimize the carbon source dosage control law at the next moment, forming a closed-loop control. This effectively mitigates inaccurate prediction model outputs or excessive external disturbances, improving system robustness.
[0099] Control law solving module: Use the gradient descent algorithm to dynamically correct the control input sequence, track the set reference trajectory by minimizing the cost function by gradient descent in the next few steps, and realize automatic and accurate addition of carbon source.
[0100] Given that the M-DMCAN effluent total nitrogen concentration prediction model is a "black box model," it cannot provide an explicit, parseable state-space representation, making it difficult to directly apply to traditional optimization frameworks, especially in problem-solving scenarios such as linear quadratic programming (QP). To address the challenges posed by such non-explicit modeling, the present invention employs an iterative optimization strategy, exemplified by the gradient descent algorithm. This algorithm effectively avoids the complexity and limitations of explicit optimization problems by dynamically adjusting the control input sequence, providing a feasible approach to solving control laws.
[0101] In the model predictive control system proposed in the present invention, in order to speed up the convergence speed and reduce the number of iterations required to obtain the optimal value, the gradient descent method is used to update the control variables at each moment. The core idea of the gradient descent method is that, for the currently selected control input, in the subsequent steps, the value of the cost function is continuously reduced by means of gradient descent, thereby closely tracking the pre-set reference trajectory. Compared with other methods, using the gradient descent idea to update the control variables has significant advantages. The computational complexity of the algorithm mainly depends on the control input sequence, and its computational complexity will not increase significantly even in the face of highly nonlinear and complex systems. This feature enables the gradient descent method to maintain good computational efficiency when dealing with complex systems, ensuring that the model predictive control system can operate efficiently and stably. The control input sequence u(t) is updated to:
[0102]
[0103] Further we get:
[0104]
[0105] where ξ is the learning rate for gradient descent updates of the input sequence, and ξ > 0.
[0106] By differentiating the optimization function J(t) with respect to u(t), we can obtain:
[0107]
[0108] For the M-DMCAN effluent total nitrogen concentration prediction model:
[0109]
[0110] Then the control increment sequence can be expressed as:
[0111]
[0112] Further we get:
[0113]
[0114] Use the control input sequence obtained from the M-DMCAN model:
[0115]
[0116] Substitute equations (12) and (13) into equation (11) to obtain Δu(t), and then update the control input sequence u(t).
[0117] This paper studies data-driven process models in wastewater treatment processes and establishes a data-driven predictive control framework for carbon source dosing. First, a total nitrogen concentration prediction model based on the M-DMCAN model is established to accurately predict effluent total nitrogen concentration. Second, the predictive control system solves an optimization problem online at each control moment to obtain the optimal control sequence.
[0118] The present invention also provides a data-driven wastewater treatment carbon source addition model predictive control method, comprising the following steps:
[0119] S1. Data processing: Collect input and output data of sewage treatment, normalize the data, and then divide it into training and test sets;
[0120] Among them, the input and output data of sewage treatment include carbon source dosage, effluent total nitrogen concentration, influent total nitrogen concentration, influent flow rate, influent chemical oxygen demand and influent nitrate nitrogen;
[0121] S2. Model training: Use the training set data to train the M-DMCAN neural network, determine the model parameters, and obtain the effluent total nitrogen concentration prediction model;
[0122] In step S2, during the training of the effluent total nitrogen concentration prediction model, an early stopping strategy is adopted. If the evaluation index MAE on the validation set does not improve within 5 epochs, the training is stopped.
[0123] S3. Prediction and Control:
[0124] At each control moment, based on the current status and historical data of the sewage treatment system, the trained effluent total nitrogen concentration prediction model is used to predict the effluent total nitrogen concentration in the future period;
[0125] Based on the predicted value and the target set value, the control sequence of carbon source dosage is calculated through the optimization control module, and the first step of the control sequence is applied to the sewage treatment system;
[0126] In step S3, the characteristics of the effluent total nitrogen concentration prediction model are as follows:
[0127] The prediction input length of the effluent total nitrogen concentration prediction model is 40, and the prediction output length is 3, 6, or 12;
[0128] The effluent total nitrogen concentration prediction model adopts the average pooling method with three pooling layers;
[0129] The prediction layer MLP hidden layer number of the effluent total nitrogen concentration prediction model is 1, and the dimension is set to 64; the number of attention heads is 2, and the number of cross-dimensional attention scale layers is 2;
[0130] S4. Feedback correction: Obtain the actual effluent total nitrogen concentration, calculate the deviation between the actual output and the predicted output, and correct the predicted output through the feedback correction module. The correction result is used for the control calculation at the next moment;
[0131] S5. Loop execution: Repeat S3 and S4 to achieve stable control of carbon source addition.
[0132] Stability analysis:
[0133] The stability of M-DMCAN-MPC is verified based on Lyapunov theory. Assuming the prediction model can converge, M-DMCAN-MPC can maintain stability. This proof requires constructing an appropriate Lyapunov function and then verifying its decreasing properties. This theoretical approach ensures the stability of M-DMCAN-MPC in practical applications, providing a solid theoretical basis for the reliable operation of this control system in carbon source dosing control for wastewater treatment.
[0134] Theorem 1: In the finite-horizon optimal control problem of M-DMCAN-MPC, μ is defined as Equation (14). If μ satisfies Equation (15), the control system can maintain stability.
[0135]
[0136] Proof: The Lyapunov function is defined for the M-DMCAN-MPC control system as follows:
[0137] V(t)=E T (t)E(t) (16)
[0138] in, is the tracking error between the target value and the predicted value.
[0139] Then the differential form of the above Lyapunov function is:
[0140] ΔV(t)=V(t+1)-V(t) (17)
[0141] Combining formula (16), the above formula can be expressed as:
[0142]
[0143] in:
[0144]
[0145] Substituting equations (9), (11) and (19) into equation (18), the differential form of the Lyapunov function can be expressed as:
[0146]
[0147] Where μ satisfies Equation (15). Then ΔV(t) < 0, proving Theorem 1, M-DMCAN-MPC is stable.
[0148] Experimental design and results analysis:
[0149] The benchmark simulation model BSM1 is a combination of 13 components and 8 reaction processes from ASM1. It is a double exponential sedimentation kinetic model of a secondary clarifier with a total biomass volume of 5999 m 3 The biological volume of the anaerobic tank and the anoxic tank is 1000m 3 The biological volume of the three aerobic pools at the back is 1333m 3 It combines nitrification and denitrification and is commonly used for nitrogen removal in municipal wastewater treatment plants.
[0150] like Figure 2 As shown. The first two biochemical reaction chambers are anoxic zones, where nitrates are reduced to nitrogen by denitrifying bacteria. The last three are aeration zones, which support aerobic bacteria that remove organic matter and ammonia by supplying oxygen. The last aerobic tank recirculates part of the effluent (internal recirculation) back to the anaerobic tank at a flow rate of Q a , concentration Z a The remaining effluent is at a flow rate Q f , concentration Z f Enter the secondary sedimentation tank. The secondary sedimentation tank has three exits:
[0151] (1) Tailwater discharge, flow rate is Q e ;
[0152] (2) Return to the anaerobic tank (external return), the flow rate is Q r ;
[0153] (3) The sludge flowing out of the secondary sedimentation tank has a flow rate of Q w .
[0154] Under the PI-based internal recirculation and aeration closed-loop control of BSM1, the aeration intensity of the anaerobic tank and the anoxic tank is: K L a1=K L a2=0h -1 ; Aerobic pool 1 and aerobic pool 2 have fixed aeration intensity: K L a3=K L a4=10h -1 =240d -1 ; Finally, aerobic pool 3 adjusts K through PI control L a5, dissolved oxygen (S o ) concentration was maintained at 2g·COD / m 3 and by manipulating Q aThe nitrate nitrogen (S NO ) concentration is controlled at a predetermined set value of 1g·N / m 3 ; Carbon source flow outside the aerobic pool: q EC,3 =q EC,4 =q EC,5 =0m 3 / d.
[0155] The inlet data of the BSM1 benchmark simulation model are 14 days of real water plant sampling values, including three inlet conditions: sunny days, rainy days, and rainstorm days. Figure 3 The changes of total nitrogen concentration in influent under three working conditions are shown in Figure 2. It can be seen that the total nitrogen concentration in influent fluctuates the most under rainy conditions. Figure 4 The changes in water flow under three working conditions are shown. It can be seen that the water flow fluctuation is the largest under the rainstorm condition.
[0156] To effectively validate the proposed control method using the BSM1 benchmark simulation platform, it was necessary to first study the relationship between effluent total nitrogen concentration and carbon source dosage under closed-loop control. To this end, experiments with carbon source quantitative dosing and carbon source dosing strategy were conducted. The results of these two experiments will lay the foundation for setting control constraints and selecting inlet conditions in subsequent experiments.
[0157] (1) Carbon source quantitative addition experiment: In order to select the inlet conditions for the comparative experiment, the experiment was conducted on the change law of carbon source addition and effluent total nitrogen concentration under three inlet conditions: sunny day, rainy day and rainstorm day. The design is as follows: ①q EC,2 =0m 3 / d;②q EC,2 =2m 3 / d;③q EC,2 =4m 3 / d quantitative addition experiment, the closed-loop simulation results are as follows Figure 5a-5c shown.
[0158] (2) Carbon source addition strategy experiment: In order to select the carbon source addition location in the comparative experiment (addition only in the anoxic tank or addition in the anaerobic tank and anoxic tank respectively), the carbon source addition flow rate q EC The dosing strategy and upper limit value were tested and the design was as follows:
[0159] ①q EC,2 =4m 3 / d;②q EC,1 =q EC,2 =2m 3 / d;③q EC,1 =q EC,2 =3m 3 / d;④q EC,1 =q EC,2 =4m 3 / d carbon source addition strategy experiment, the closed-loop simulation results are as follows Figure 6 .
[0160] By analyzing the simulation results of the carbon source quantitative addition experiment and the carbon source addition strategy experiment, the following rules can be summarized:
[0161] (1) Under the basic closed-loop control of the BSM1 benchmark simulation platform, the total nitrogen concentration in the effluent showed a periodic fluctuation characteristic, and there was still a problem of exceeding the standard and the fluctuation was large, which can simulate the actual operation status of the sewage treatment plant;
[0162] (2) The fluctuation of the total nitrogen concentration in the effluent under rainy conditions is greater than that under rainstorm conditions, and the fluctuation time of the total nitrogen concentration model in the inlet water under rainy conditions is longer, so it is more appropriate to conduct an intuitive verification of the control performance;
[0163] (3) The carbon source dosage and total nitrogen removal efficiency show a nonlinear relationship. When the total flow rate of carbon source quantitative addition reaches 8m 3 / d, the removal effect of carbon source on the total nitrogen concentration in effluent began to decline;
[0164] (4) When the total flow rate of carbon source addition is equal, the effect of adding carbon source to the anaerobic tank and the anoxic tank separately is better than the effect of adding carbon source only to the anoxic tank.
[0165] Therefore, the influent data of this experiment is selected from the real water plant sampling values under two working conditions, sunny and rainy days, for 14 days. Carbon source is added to the anaerobic tank and the anoxic tank respectively, that is, q EC,1 =q EC,2 =u(t) / 2, the proposed control method is verified, and the total carbon source addition flow rate q EC The upper limit is set to 8m 3 / d.
[0166] To simulate the carbon source addition process in the denitrification reaction section of a real sewage treatment plant and verify the control performance of the designed control system, the carbon source dosage u(t) was set to a random number between [0, 8] and entered into the BSM1 benchmark simulation platform. 2000 sets of sample data were obtained under both sunny and rainy influent conditions. 1600 of these samples were selected as training data, and the remaining samples were used as test data for offline training of the effluent total nitrogen concentration prediction model.
[0167] The operating environment of this experiment is MATLAB R2022b, the CPU is Intel Corei5-9300H; the GPU is 32.0GB, and the operating system is Windows 10. Based on the closed-loop control of the above-mentioned BSM1, the carbon source addition flow rate q of the anaerobic tank and the anoxic tank is controlled. EC,1 and q EC,2, verify the control method proposed in the invention. In the control strategy, the prediction time domain is set to H p =5, control time domain H d =2; control weight parameters γ1 = 0.5 and γ2 = 0.5; online gradient optimization learning rate ξ of the control law = 0.1.
[0168] According to actual engineering requirements, the target setting value y r is 10mg / L; the fluctuation bandwidth is set to [y r -2,y r +2], i.e. [8,12]; total nitrogen concentration in effluent (S Ntot The upper limit of the emission standard is set at 15 mg / L based on my country's actual emission standards. The BSM1 benchmark simulation model was used for 14 days, with a sampling point every 15 minutes. PID control and nonlinear MPC were used as comparative experiments.
[0169] Evaluation indicators:
[0170] (1) Carbon source addition effect evaluation index
[0171] The water quality data indicators in the BSM1 simulation experiment platform include 13 components from ASM1, and their symbol definitions are shown in Table 1.
[0172] Table 1 Variable symbols and their definitions
[0173]
[0174]
[0175] The effluent quality index (EQI) is the average value of the weighted sum of the concentrations of different substances in the effluent over a period of time, reflecting the overall treatment effect of the sewage treatment plant, and is expressed as:
[0176]
[0177] Where T = t stop -t start is the evaluation time range; t start Start time; t stop TSS is the stopping time e is the total suspended solids concentration; COD e is chemical oxygen demand; S NKj,e is the Kjeldahl nitrogen concentration; S NO is the nitrate nitrogen concentration; Q e is the water outflow.
[0178] Total nitrogen in effluent (S Ntot) is the total nitrogen concentration in the effluent at the current moment. The control goal of the present invention is to reduce the fluctuation range of the total nitrogen concentration in the effluent while saving the carbon source through precise addition control of the carbon source. Therefore, the total nitrogen concentration in the effluent is also an important indicator for measuring the performance of the control system of the present invention, which is expressed as:
[0179] S Ntot =S NH +S NO +S ND +X ND +i XB ·(X BH +X BA )+i XP ·(X P +X I ) (twenty two)
[0180] Among them, i XB =0.08,i XP =0.06.
[0181] Carbon source dosage (EC) is the average amount of carbon source dosage over a period of time, reflecting the carbon source consumption of wastewater treatment, expressed as:
[0182]
[0183] Among them, COD EC is the external carbon source concentration (4×10 5 g·COD / m 3 ).
[0184] The calculation formula for the fluctuation range of effluent total nitrogen concentration is:
[0185]
[0186] Among them, T c It is the total time that the total nitrogen concentration in the effluent exceeds the fluctuation bandwidth.
[0187] (2) Control performance evaluation indicators
[0188] Three common evaluation indicators are used in this paper: the integral of absolute error (IAE), the integral of square error (ISE) and the maximum error (Dev max ), comprehensively evaluate the performance of the control system. Its calculation formula is as follows:
[0189]
[0190]
[0191] Dev max =max{|r(t)-y(t)|} (27)
[0192] Among them, r(t) is the expected output and y(t) is the true value.
[0193] Overall, IAE, ISE and Dev max IAE is a commonly used evaluation index for basic control performance. It measures the overall deviation of the control system from tracking the target value. By accumulating the absolute value of the error, it evenly reflects the tracking accuracy of the system over the entire time domain. Its linear accumulation characteristic makes the index relatively tolerant to small fluctuations, focusing more on long-term steady-state performance and reflecting long-term control stability. ISE is sensitive to large deviations and emphasizes the penalty for large errors. It is used to evaluate the control system's ability to suppress sudden water quality fluctuations. max It is used to detect the peak deviation of carbon source dosage in transient process, which is a key indicator for evaluating the anti-overshoot capability of control system, so as to avoid the deterioration of water quality caused by overshoot. max The indicators are all negatively correlated with the control effect, that is, the smaller the indicator value, the better the performance.
[0194] Experimental results and analysis:
[0195] Due to the variable influent conditions, in order to analyze the long-term effect of control, the long-term changes in the total nitrogen concentration in the effluent from 1 to 14 days under sunny and rainy conditions are displayed, and the control effect analysis and comparison are carried out.
[0196] Under sunny conditions:
[0197] Comparison of control system performance under sunny day water inflow conditions Figure 7 As shown. Figure 7 (a) The tracking curves of the effluent total nitrogen concentration show that the three control systems can all be adjusted around the fixed set value within an operating cycle of 1 to 14 days. Among them, the effluent total nitrogen concentration curve of the PID control system fluctuates relatively significantly, especially around day 7, when the effluent total nitrogen concentration shows a significant deviation. The tracking trajectories of NMPC and M-DMCAN-MPC are closer to the set value, but NMPC still experiences significant fluctuations during the 8-12 day period.
[0198] Further from Figure 7 (b) The error analysis diagram shows that the maximum absolute value of the PID control error exceeds 5 mg / L, and the error direction changes frequently. Although the error fluctuation amplitude of the NMPC is smaller than that of the PID, it still exhibits periodic oscillation characteristics. In contrast, the error band of the M-DMCAN-MPC is always stable at around ±2 mg / L, and the oscillation frequency is significantly reduced, demonstrating stronger anti-interference ability and steady-state maintenance characteristics. The M-DMCAN-MPC's deep learning of the system's dynamic characteristics and precise control mechanism have better adaptability to the nonlinear characteristics of the sewage treatment process.
[0199] Table 2 shows the evaluation indicators for carbon source addition under sunny inlet conditions. The M-DMCAN-MPC control system achieved the best effluent quality, achieving a 21.1% reduction compared to the NMPC and a 28.3% reduction compared to the PID control system. Regarding carbon source addition (EC), the M-DMCAN-MPC's average daily carbon source consumption was 1546.251 kg·COD / d, a 12.8% reduction compared to the NMPC and a 24.9% reduction compared to the PID. Compared to the PID and NMPC, the M-DMCAN-MPC exhibited smaller fluctuations in effluent total nitrogen concentration under sunny conditions, demonstrating its ability to more accurately maintain effluent total nitrogen concentration within the set limit. It is noteworthy that the PID control system, despite achieving the highest carbon source addition, exhibited a decreased control effect, with effluent total nitrogen concentration slightly exceeding the standard, exposing its shortcomings in balancing carbon source addition with denitrification efficiency.
[0200] Table 2 Evaluation indexes of carbon source addition effect under sunny conditions
[0201]
[0202] In rainy weather conditions:
[0203] Control system performance comparison Figure 8 As shown in the figure. Under rainy conditions, the surge in influent flow significantly impacted the control system's dynamic response capabilities. The PID control system exhibited significant instability when operating conditions suddenly changed on the eighth day, resulting in a sharp fluctuation in the effluent total nitrogen concentration after a sharp surge, even briefly exceeding the standard. While the NMPC control system was able to more quickly track operating condition changes, periodic fluctuations in the effluent total nitrogen concentration were still present, often lagging behind. The M-DMCAN-MPC tracking curve exhibited relatively small fluctuations in the effluent total nitrogen concentration during operating condition transitions.
[0204] from Figure 8 It can be seen from the error that the maximum error of PID control reaches 6, and the overall error bandwidth reaches 10; the maximum error of NMPC is relatively reduced, but the error oscillation frequency is significantly increased; M-DMCAN-MPC compresses the error to within ±2 in the steady-state stage, and has the dual advantages of rapid response and stable maintenance when dealing with sudden changes in influent water quantity and quality.
[0205] Further by Figure 4 and Figure 9 Comprehensive analysis shows that under rainy conditions, the inlet flow rate surged on the eighth day. M-DMCAN-MPC responded in advance and increased the carbon source dosage, which reduced the fluctuation range of the effluent total nitrogen concentration compared with the PID and NMPC control strategies.
[0206] As shown in Table 3, under rainy conditions, the effluent water quality index (EQI) of the M-DMCAN-MPC was 32.9% and 42.2% lower than that of the NMPC and PID, respectively. In terms of carbon source dosage, the average carbon source dosage (EC) of the M-DMCAN-MPC was 16.2% and 36.7% lower than that of the NMPC and PID, respectively, indicating that its carbon source utilization efficiency and water quality treatment effect were more significant.
[0207] Table 3 Evaluation indexes of carbon source addition effect under rainy conditions
[0208]
[0209] Fluctuations in effluent total nitrogen concentration directly reflect the stability of the control system. The M-DMCAN-MPC exhibited the lowest fluctuations in effluent total nitrogen concentration under rainy conditions. However, when the inlet state suddenly abruptly changed, the NMPC's effluent total nitrogen concentration slightly exceeded the standard and fluctuated slightly more than under stable conditions, making it slightly less capable of responding to emergencies than the M-DMCAN-MPC. However, due to the impact of the inlet flow rate, the PID's effluent total nitrogen concentration briefly exceeded the standard and experienced increased fluctuations, leading to a surge in carbon source consumption, reaching 2545.731. This suggests that in practical projects, if the control system accuracy is low, the effluent total nitrogen concentration setpoint needs to be lowered to ensure that the effluent total nitrogen concentration does not exceed the standard, resulting in an increase in carbon source dosage.
[0210] From the control performance indicators in Table 4, it can be seen that M-DMCAN-MPC has the advantages of IAE, ISE and Dev max The control performance of the three control performance evaluation indicators is better than that of NMPC and PID, especially in rainy conditions when the inlet water quality and water quantity fluctuate greatly. Although the control performance is lower than that under sunny conditions, it is still better than the other two control methods.
[0211] Table 4 Control system performance evaluation indicators under two working conditions
[0212]
[0213] Overall, the three control strategies can meet basic control requirements:
[0214] (1) Under the three control methods, the water quality under rainy conditions is generally better than that under sunny conditions. This is because the surge in influent flow leads to a decrease in effluent concentration, thus reducing EQI. However, due to the influent shock, the hydraulic retention time is shortened, which dilutes the carbon source, resulting in a decrease in denitrification reaction efficiency, an increase in carbon source consumption, and an increase in carbon source dosage.
[0215] (2) The errors of the three control methods are slightly larger than the nonlinear system control errors in general biochemical pools. This is because the correlation between variables in the sewage treatment process is complex. Although the effluent total nitrogen concentration is most correlated with the carbon source dosage, the effluent total nitrogen concentration is far away from the anoxic pool where the carbon source is added, and cannot show a direct strong correlation like the dissolved oxygen concentration and aeration volume in the biochemical pool. However, for the purpose of this study, M-DMCAN-MPC performs better than NMPC and PID in tracking and controlling the effluent total nitrogen concentration, reducing the fluctuation range of the effluent total nitrogen concentration and, under the same set value, better ensuring that the effluent total nitrogen concentration does not exceed the standard.
[0216] (3) M-DMCAN-MPC has outstanding performance in optimizing resource utilization, dynamic response speed and improving control stability. It can not only reduce the required dosage when the dosage is excessive, but also increase the dosage when the dosage is insufficient and the effluent water quality indicators are increased, thereby improving the carbon source utilization rate and reducing the fluctuation range of the effluent total nitrogen concentration. The set value of the effluent total nitrogen concentration can be increased to a certain range close to the excess value. While ensuring the compliance of sewage treatment discharge, it can also control costs, providing an effective solution for improving the precise addition of carbon sources in the sewage treatment process.
[0217] This invention not only provides an efficient solution for carbon source addition control in sewage treatment, but also explores a new technical path for the intelligent regulation of complex industrial processes.
[0218] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not limiting. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solutions, which should all be included in the scope of protection of the present invention.
Claims
1. A data-driven carbon source dosing model predictive control system for sewage treatment, characterized in that: include: Prediction module: Based on the M-DMCAN neural network, it is used to predict the total nitrogen concentration in the effluent; Optimization control module: Constructs a nonlinear model of the system, transforms the nonlinear control problem of tracking the reference sequence into an optimization problem, and then solves the control sequence of the carbon source dosage; Feedback correction module: Calculates the deviation between the actual output and the predicted output of total nitrogen concentration in water, multiplies the deviation by the feedback coefficient to obtain the feedback amount, and adds the feedback amount to the predicted value to obtain the feedback predicted output. The feedback predicted output calculated at the current moment participates in the rolling optimization of the carbon source dosage control law at the next moment to form a closed-loop control; Control law solving module: Use the gradient descent algorithm to dynamically correct the control input sequence, track the set reference trajectory by minimizing the cost function by gradient descent in the next few steps, and realize automatic and accurate addition of carbon source.
2. A data-driven wastewater treatment carbon source dosing model predictive control system according to claim 1, characterized in that: The prediction module built based on the M-DMCAN neural network has a dual-branch structure, one for time scale feature extraction and the other for variable dimension feature extraction; The time scale feature extraction branch is used to downsample, decompose and mix the input historical data to learn the periodicity and trend characteristics of the time series; The variable dimension feature extraction branch uses a patch-based segmentation method and a multi-head attention mechanism to capture the cross-correlations between different variables.
3. A data-driven wastewater treatment carbon source dosing model predictive control system according to claim 2, characterized in that: The operation process of the optimization control module is as follows: I. Construct a nonlinear system model for predictive control of carbon source addition in wastewater treatment; y p (t)=f(y(t-1),y(t-2),...,y(t-n y ),u(t-1),u(t-2),...,u(t-n u )) Among them, y(t)=[y(t-1),y(t-2),...,y(t-ny)] T is the total nitrogen concentration in the effluent; u(t) is the amount of carbon source added; n y and n u is the maximum delay; II. Using the MPC principle, a nonlinear control problem of tracking a reference sequence is transformed into an optimization problem; The objective function of the optimization problem is: Among them, y r (t) is the set value of total nitrogen concentration in effluent; The output of the total nitrogen concentration prediction of the effluent water is H. p ×1; Δu(t)=[Δu(t),Δu(t+1),...,Δu(t+H u -1)] T is the carbon source addition control increment, dimension is H d ×1; γ1 is the state error weight parameter; γ2 is the control input weight parameter; III. By optimizing the above objective function, the optimal carbon source dosage sequence is solved and the rolling optimization control of the carbon source dosage is realized.
4. A data-driven wastewater treatment carbon source dosing model predictive control system according to claim 3, characterized in that: The operation process of the feedback correction module is as follows: I. will predict the future H from the present time t p The output of the system controlled variable at each moment; y p (t)=[y p (t+1)|t,y p (t+2)|t,...,y p (t+H p )|t] T II. Subtract the actual output sequence at time t+1 from the predicted output sequence at time t to obtain the prediction error, which is the deviation between the actual output and the predicted output of total nitrogen concentration in water; e(t+1)=y(t+1)-y p (t+1|t) III. Multiply the error by the previous feedback coefficient to obtain the feedback value, and add the feedback value to the prediction value based on the prediction module at time t+1 to obtain the feedback prediction output; in, is the feedback correction vector; IV. The predicted output of the corrected effluent total nitrogen concentration participates in the rolling optimization of the carbon source dosage control law at the next moment to form a closed-loop control.
5. A data-driven wastewater treatment carbon source dosing model predictive control system according to claim 4, characterized in that: In the control law solving module, the update formula of the control input sequence u(t) is: where ξ is the learning rate for gradient descent updates of the input sequence, and ξ > 0.
6. A data-driven predictive control method for carbon source dosing in sewage treatment, characterized in that: The following steps are involved: S1. Data processing: Collect input and output data of sewage treatment, normalize the data, and then divide it into training and test sets; S2. Model training: Use the training set data to train the M-DMCAN neural network, determine the model parameters, and obtain the effluent total nitrogen concentration prediction model; S3. Prediction and Control: At each control moment, based on the current status and historical data of the sewage treatment system, the trained effluent total nitrogen concentration prediction model is used to predict the effluent total nitrogen concentration in the future period; Based on the predicted value and the target set value, the control sequence of carbon source dosage is calculated through the optimization control module, and the first step of the control sequence is applied to the sewage treatment system; S4. Feedback correction: Obtain the actual effluent total nitrogen concentration, calculate the deviation between the actual output and the predicted output, and correct the predicted output through the feedback correction module. The correction result is used for the control calculation at the next moment; S5. Loop execution: Repeat S3 and S4 to achieve stable control of carbon source addition.
7. A data-driven carbon source dosing model predictive control method for sewage treatment according to claim 6, characterized in that: In step S1, the input and output data of the sewage treatment include the carbon source dosage, the effluent total nitrogen concentration, the influent total nitrogen concentration, the influent flow rate, the influent chemical oxygen demand and the influent nitrate nitrogen.
8. A data-driven carbon source dosing model predictive control method for sewage treatment according to claim 7, characterized in that: During the training of the effluent total nitrogen concentration prediction model in step S2, an early stopping strategy is adopted. If the evaluation index MAE on the validation set does not improve within 5 epochs, the training is stopped.
9. A data-driven carbon source dosing model predictive control method for sewage treatment according to claim 8, characterized in that: In step S3, the characteristics of the effluent total nitrogen concentration prediction model are as follows: The prediction input length of the effluent total nitrogen concentration prediction model is 40, and the prediction output length is 3, 6, or 12; The effluent total nitrogen concentration prediction model adopts the average pooling method with three pooling layers; The number of MLP hidden layers in the prediction layer of the effluent total nitrogen concentration prediction model is 1, and the dimension is set to 64; the number of attention heads is 2, and the number of cross-dimensional cross-attention scale layers is 2.
Citation Information
Cited By
Intelligent recommendation method for adding amount of biogas slurry carbon source for sewage treatment plant
CN121094256A
Intelligent recommendation method for dosing amount of biogas slurry carbon source in sewage treatment plant
CN121094256B