Intelligent excrement sewage treatment system and method

By optimizing the adaptive neurofuzzy inference system and the Stacking ensemble model using particle swarm optimization and combining it with real-time data analysis, the frequency of the blower and the aeration volume are dynamically adjusted, solving the problem of the accuracy of aeration volume control in sewage treatment and achieving energy reduction and improved treatment efficiency.

CN120736670BActive Publication Date: 2026-08-04FUZHOU SHUNWEI TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
FUZHOU SHUNWEI TECHNOLOGY CO LTD
Filing Date
2025-06-24
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

In existing technologies, it is difficult to achieve precise control of aeration volume during the treatment of fecal wastewater, resulting in high energy consumption and low efficiency. Intelligent algorithm models have weak generalization ability and lagging rule base updates in application, which affects the reliability and accuracy of aeration demand prediction.

Method used

The membership function parameters and fuzzy rules of the adaptive neural fuzzy inference system are optimized by using particle swarm optimization algorithm. Combined with the Stacking ensemble model, a COD prediction model is constructed by real-time collection and analysis of wastewater parameters. The blower frequency and aeration volume are dynamically adjusted, the sludge return ratio and stirring intensity are optimized, and the lowest cost operation plan is formulated.

Benefits of technology

It enables accurate prediction of COD concentration in the biological treatment tank, precise control of aeration volume, reduction of energy consumption, and improvement of treatment efficiency. Furthermore, it reduces operating costs through a minimum-cost operating scheme, ensuring efficient and stable wastewater treatment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120736670B_ABST
    Figure CN120736670B_ABST
Patent Text Reader

Abstract

The application discloses an intelligent excrement sewage treatment system and method, and belongs to the field of sewage treatment.The system comprises a data acquisition module, which is used for collecting COD, ammonia nitrogen, DO, pH, water temperature, SS and microbial activity parameters of sewage in real time, performing normalization treatment on the collected water quality parameters, and forming a unified standard data basis; a first model module, which is based on the data processed by the data acquisition module, uses a particle swarm algorithm to optimize membership function parameters and fuzzy rules of an adaptive neural fuzzy inference system, trains an ANFIS model, outputs a prediction value of COD concentration in a biochemical tank in real time, and forms a COD prediction model; and a second model module, which takes the COD prediction value in the first model module and the data processed by the data acquisition module as inputs, constructs a Stacking integrated model, and contains base learners and meta learners in the integrated model, and then adopts a five-fold cross-validation method to generate a prediction result of the base learners.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of wastewater treatment, and more specifically, to an intelligent sewage treatment system and method. Background Technology

[0002] Current technology for treating sewage typically involves first filtering the sludge to obtain sewage, and then using a biological reaction tank to aerate the sewage. The biological reaction tank is mainly used for the degradation of organic pollutants and the removal of nitrogen and phosphorus, and it is also the most energy-intensive part of the entire treatment process. The operation during the aeration process directly affects the efficiency of the biological reaction, which in turn affects the degradation effect of organic pollutants and the effectiveness of nitrogen and phosphorus removal, and also greatly affects whether the effluent quality can meet the standards.

[0003] While pursuing effluent quality standards, how to effectively save energy and reduce redundant operating costs has become a major problem facing the wastewater treatment industry. Precision aeration can not only dynamically adjust the aeration volume according to real-time water quality conditions and improve the efficiency of biochemical reactions, but also significantly reduce energy consumption and improve the energy efficiency ratio of the entire treatment system.

[0004] In practical applications, achieving precise aeration is a technical challenge. In recent years, intelligent algorithms such as fuzzy inference and neural networks have been gradually introduced into the field of wastewater treatment, providing new ideas for solving this problem. However, it is worth noting that single intelligent algorithm models often suffer from weak generalization ability and lagging rule base updates in practical applications, which to some extent limits their application effect. Taking the Adaptive Neural Fuzzy Inference System (ANFIS) as an example, the system has shown some potential in predicting aeration volume in wastewater treatment. However, if its membership function parameters are not optimized, the prediction error of the ANFIS model will increase significantly, thus affecting the realization of precise aeration. In addition, although conventional ensemble learning models can fuse multi-source data, their fusion ability is still limited when processing multi-source heterogeneous data, which directly affects the reliability and accuracy of aeration demand prediction. Summary of the Invention

[0005] To address the problems existing in the prior art, the present invention aims to provide an intelligent sewage treatment system and method for feces and wastewater, which can accurately predict the aeration demand for future periods through a Stacking integrated model. Based on these accurate predictions, the system can dynamically adjust the blower power to ensure that the aeration process meets the biochemical reaction requirements while avoiding unnecessary energy consumption.

[0006] To solve the above problems, the present invention adopts the following technical solution:

[0007] Firstly, an intelligent method for treating fecal wastewater includes:

[0008] Step S1: Real-time collection of COD, ammonia nitrogen, DO, pH, water temperature, SS, and microbial activity parameters of fecal wastewater; normalization of the collected water quality parameters to form a unified standard data basis.

[0009] Step S2: Based on the data processed in step S1, the membership function parameters and fuzzy rules of the adaptive neurofuzzy inference system are optimized using the particle swarm optimization algorithm. By training the ANFIS model, the predicted value of COD concentration in the biochemical tank is output in real time, and a COD prediction model is formed.

[0010] Step S3: Based on the COD prediction value in step S2 and the processed data in step S1 as input, construct a Stacking ensemble model. The ensemble model contains a base learner and a meta learner. Then, use five-fold cross-validation to generate the prediction results of the base learner. Input these results into the meta learner for training and output the aeration demand M for the future period.

[0011] Step S4: Based on the future aeration demand M output in step S3 and the DO data in step S1, establish a fuzzy rule base, clarify the relationship between the deviation of M and DO, generate a PID parameter adjustment strategy through the Mamdani inference method, and then use the centroid method to defuzzify and output the blower frequency adjustment parameters to realize the real-time dynamic adjustment of the blower frequency.

[0012] Step S5: Based on the blower frequency adjustment parameters and the real-time water quality data in step S1, analyze the influence of blower frequency parameters on dissolved oxygen distribution and hydraulic shear force. Based on the feedback of microbial activity, optimize the sludge return ratio and stirring intensity to generate a combination of hydraulic parameters that helps stabilize the microbial community.

[0013] Step S6: Based on the hydraulic parameters optimized in Step S5, the aeration volume demand M for the future period in Step S3, and the time-of-use electricity price of the power grid and the daily treatment volume demand of fecal sewage, formulate the lowest cost operation plan under the premise of meeting the daily treatment volume.

[0014] Furthermore, real-time data collection of fecal wastewater parameters including COD, ammonia nitrogen, DO, pH, water temperature, SS, and microbial activity is performed. The collected water quality parameters are then normalized to form a standardized data foundation, including:

[0015] Step S11: Using an online COD monitor, ammonia nitrogen detector, dissolved oxygen sensor, pH meter, water temperature probe, suspended solids analyzer, and microbial activity analyzer, COD, ammonia nitrogen, DO, pH, water temperature, SS, and microbial activity parameters in fecal wastewater are collected in real time. During the collection process, a preset sampling frequency is set.

[0016] Step S12 involves using a normalization algorithm to eliminate the differences in the dimensions of different parameters among the various water quality parameters collected in step S11, mapping the data to a unified numerical range, and forming a data foundation with a unified standard.

[0017] Furthermore, based on the data processed in step S1, the membership function parameters and fuzzy rules of the adaptive neural fuzzy inference system are optimized using the particle swarm optimization algorithm. By training the ANFIS model, the predicted COD concentration in the biochemical tank is output in real time, forming a COD prediction model, including:

[0018] Step S21: Analyze the characteristics of COD, ammonia nitrogen, and DO data of normalized fecal wastewater, determine the initial parameters of particle swarm optimization algorithm and adaptive neurofuzzy inference system, set the particle swarm size, iteration number, inertia weight, and learning factor parameters, and initialize the membership function type and initial parameters of ANFIS, as well as the fuzzy rule framework.

[0019] Step S22: Apply the initial parameters determined in step S21 to the particle swarm algorithm. Use the prediction error of the ANFIS model as the fitness function. By continuously searching in the solution space, the particles update their own positions and velocities, and optimize the membership function parameters and fuzzy rules of ANFIS. In each iteration, evaluate the performance of the ANFIS model corresponding to each particle and retain the parameter combination that makes the fitness function value optimal.

[0020] Step S23: Substitute the membership function parameters and fuzzy rules optimized by the particle swarm algorithm in step S22 into the ANFIS model, and train the ANFIS model using the processed data. During the training process, continuously adjust the model parameters and train repeatedly until the model reaches the set convergence condition.

[0021] Step S24: The trained ANFIS model is put into actual operation. The data processed in step S1 is used as real-time input. The model outputs the predicted value of COD concentration in the biochemical pool in real time. At the same time, the trained model structure, parameters and optimized fuzzy rules are saved to form a COD prediction model.

[0022] Furthermore, based on the COD prediction value from step S2 and the processed data from step S1 as input, a Stacking ensemble model is constructed. This model includes a base learner and a meta-learner. Then, five-fold cross-validation is used to generate the prediction results of the base learner. These results are input into the meta-learner for training, outputting the future aeration demand M, including:

[0023] Step S31: Based on the COD prediction value in step S2 and the processed data in step S1, determine the base learner and meta learner of the Stacking ensemble model.

[0024] Step S32: Merge the COD prediction values ​​from step S2 with the data processed in step S1, clean the processed data, remove duplicate data, check and process any missing values, and form the input dataset.

[0025] Step S33: The base learner in step S31 is trained and predicted using five-fold cross-validation. The dataset processed in step S32 is divided into five parts. One part is selected as the test set each time, and the other four parts are used as the training set. Each base learner is trained in turn, and the trained base learner is used to predict the test set. The prediction results are recorded each time.

[0026] Step S34: Collect all prediction results generated by the three base learners in step S33 under five-fold cross-validation, organize them into a new feature matrix, and use this feature matrix as input data to train the meta-learner in step S31. During the training process, continuously adjust the parameters of the meta-learner.

[0027] Furthermore, step S34 also includes:

[0028] Step S341: The input dataset processed in step S32 is re-inputted into the base learner initialized in step S31 to obtain the prediction results of each base learner for the dataset. These prediction results are then integrated and input into the meta-learner trained in step S34. After processing by the meta-learner, the aeration demand M for the future period is finally output.

[0029] Furthermore, based on the future aeration demand M output in step S3 and the DO data in step S1, a fuzzy rule base is established to clarify the correlation between the deviations of M and DO. A PID parameter adjustment strategy is generated using the Mamdani inference method, and then the centroid method is used to defuzzify the data, outputting the blower frequency adjustment parameters to achieve real-time dynamic adjustment of the blower frequency, including:

[0030] Step S41: Obtain the aeration demand M for the future period from step S351, and at the same time extract the DO data processed in step S1. Perform statistical analysis on the M and DO data to determine the range of variation of the deviation between M and DO and divide multiple data intervals.

[0031] Step S42: Based on the data interval determined in step S41, define at least two sets of fuzzy linguistic variables to describe the aeration demand M in the future period, and at least three sets of fuzzy linguistic variables to describe the DO deviation. Based on the principle of sewage treatment process and actual operation experience, formulate fuzzy rules between M and DO deviation, construct a fuzzy rule base, and clarify the adjustment strategies to be adopted under different combinations of M and DO deviation.

[0032] Step S43: The future aeration demand M and DO data in step S41 are fuzzified according to the fuzzy linguistic variables defined in step S42, and converted into corresponding fuzzy set membership values, which are used as inputs for the Mamdani inference method.

[0033] Step S44: Using the fuzzified input data from step S43, combined with the fuzzy rule base constructed in step S42, logical reasoning is performed using the Mamdani reasoning method to calculate the fuzzy output result of the PID parameter adjustment strategy.

[0034] Step S45: The fuzzy output result of the PID parameter adjustment strategy obtained in step S44 is defuzzified using the centroid method to convert the fuzzy quantity into a precise value, thereby obtaining the specific PID parameter adjustment value.

[0035] Step S46: Based on the PID parameter adjustment value obtained in step S45, establish a mapping relationship with the blower frequency adjustment parameter, output the blower frequency adjustment parameter, and send it as a control signal to the blower control system to realize real-time dynamic adjustment of the blower power.

[0036] Furthermore, based on the blower frequency parameters and the real-time water quality data from step S1, the influence of the blower frequency parameters on dissolved oxygen distribution and hydraulic shear force is analyzed. Based on feedback from microbial activity, the sludge return ratio and stirring intensity are optimized to generate a combination of hydraulic parameters conducive to stabilizing the microbial community, including:

[0037] Step S51: Based on the blower frequency adjustment parameters obtained in step S46, and simultaneously extract the real-time water quality data processed in step S1, including DO, SS, and microbial activity data, perform correlation analysis between the blower frequency parameters and the DO data in the real-time water quality data, plot the distribution curves of dissolved oxygen with time and space under different blower frequencies, and explore the influence of blower frequency on dissolved oxygen distribution.

[0038] Step S52: The hydraulic shear force of the blower at different frequencies is measured and recorded in advance through experiments to form the correspondence between different frequencies of the blower and the hydraulic shear force.

[0039] Step S53: The relationship between the blower frequency and hydraulic shear force determined in step S52 is combined with the microbial activity data in step S1 for comprehensive analysis. The changing trend of microbial activity under different hydraulic shear forces is studied, and the hydraulic shear force threshold that has a positive effect on microbial activity is identified.

[0040] Step S54: Based on the relationship between microbial activity and hydraulic shear force obtained in step S53, as well as the dissolved oxygen distribution, establish a correlation model between sludge return ratio, stirring intensity and microbial activity. By setting different combinations of sludge return ratio and stirring intensity parameters, simulate the response of microbial activity and screen out parameter combinations that are conducive to improving microbial activity.

[0041] Step S55: The sludge return ratio and stirring intensity parameter combination selected in step S54 are evaluated in combination with the constraints of the actual fecal sewage treatment process. The genetic algorithm is used to further optimize the parameter combination to generate a hydraulic parameter combination that helps stabilize the microbial community, including the optimal sludge return ratio and stirring intensity.

[0042] Furthermore, based on the hydraulic parameters optimized in step S5, the aeration demand M for the future period in step S3, and considering the time-of-use electricity price of the power grid and the daily treatment capacity of sewage, a minimum-cost operation plan is formulated to meet the daily treatment capacity, including:

[0043] Step S61: Obtain the optimized hydraulic parameters from step S55, extract the aeration demand M predicted in step S341 for future periods, collect the time-of-use electricity price data of the power grid, clarify the electricity price standards for different periods, and integrate these data with the daily treatment capacity demand of the sewage treatment plant to establish a basic dataset.

[0044] Step S62: Based on the basic dataset integrated in step S61, construct a cost model for fecal and sewage treatment, link hydraulic parameters with equipment energy consumption, link aeration demand M with blower energy consumption, and combine time-of-use electricity pricing to calculate the treatment cost for each time period under different combinations of operating parameters, clarifying the quantitative relationship between cost and each parameter.

[0045] Step S63: Taking the daily treatment capacity of fecal sewage as a constraint, and combining the cost model constructed in step S62, the objective function is set as minimizing the total daily cost of fecal sewage treatment. A mathematical optimization algorithm is used to optimize and solve the values ​​of hydraulic parameters and aeration volume at different times.

[0046] Step S64: Perform feasibility verification on the operating parameter combination scheme obtained in step S63, check whether each parameter is within the equipment's operating capacity range and whether it meets the technical requirements of the sewage treatment process. If there are infeasible parameters, adjust the parameter value range and re-optimize the solution until a feasible operating parameter combination scheme is obtained.

[0047] Furthermore, step S64 also includes:

[0048] Step S641: The feasible combination of operating parameters verified in step S64 is refined into specific operating instructions, specifying the specific values ​​of sludge return ratio, stirring intensity, and aeration volume parameters for each time period, forming the lowest cost operating scheme under the premise of meeting the daily treatment capacity, and outputting the scheme for actual production use.

[0049] Secondly, an intelligent sewage treatment system for feces and wastewater, applied to the aforementioned intelligent sewage treatment method for feces and wastewater, includes:

[0050] The data acquisition module is used to collect COD, ammonia nitrogen, DO, pH, water temperature, SS and microbial activity parameters of sewage in real time, and to normalize the collected water quality parameters to form a unified standard data foundation.

[0051] The first model module, based on the data processed by the data acquisition module, uses the particle swarm optimization algorithm to optimize the membership function parameters and fuzzy rules of the adaptive neural fuzzy inference system. By training the ANFIS model, it outputs the predicted value of COD concentration in the biochemical tank in real time and forms a COD prediction model.

[0052] The second model module uses the COD prediction value from the first model module and the processed data from the data acquisition module as input to build a Stacking ensemble model. The ensemble model contains a base learner and a meta learner. Then, the prediction results of the base learner are generated by five-fold cross-validation. These results are input into the meta learner for training and output the aeration demand M for future periods.

[0053] The adjustment module establishes a fuzzy rule base based on the future aeration demand M output from the second model module and the DO data from the data acquisition module, clarifies the relationship between the deviations of M and DO, generates a PID parameter adjustment strategy through the Mamdani inference method, and then uses the centroid method to defuzzify and output the blower frequency adjustment parameters to achieve real-time dynamic adjustment of the blower frequency.

[0054] The processing module analyzes the impact of blower frequency parameters on dissolved oxygen distribution and hydraulic shear force based on blower frequency adjustment parameters and real-time water quality data from the data acquisition module. Based on feedback from microbial activity, it optimizes the sludge return ratio and stirring intensity to generate a combination of hydraulic parameters that helps stabilize the microbial community.

[0055] The scheme generation module, based on the hydraulic parameters optimized in the processing module, the future aeration demand M output by the second model module, and the time-of-use electricity price of the power grid and the daily treatment capacity of fecal sewage, formulates the lowest cost operation scheme under the premise of meeting the daily treatment capacity.

[0056] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0057] (1) This scheme achieves accurate prediction of COD concentration in the biological tank by collecting and analyzing multiple key parameters in sewage in real time and using particle swarm optimization algorithm to optimize the membership function parameters and fuzzy rules of the adaptive neural fuzzy inference system. This prediction model provides a reliable basis for subsequent aeration demand prediction. Then, the aeration demand in future periods is accurately predicted through the Stacking ensemble model. Based on these accurate predictions, the system can dynamically adjust the blower power to ensure that the aeration process meets the biochemical reaction requirements and avoids unnecessary energy consumption. This intelligent control method significantly improves the efficiency of sewage treatment and effectively reduces energy consumption, achieving the goal of energy saving and consumption reduction.

[0058] (2) Based on the blower frequency parameters and real-time water quality data, this scheme analyzes in depth the influence of blower frequency on dissolved oxygen distribution and hydraulic shear force. Combined with the feedback of microbial activity, it optimizes the sludge return ratio and stirring intensity, and generates a combination of hydraulic parameters that helps stabilize the microbial community. In addition, the system also takes into account the time-of-use electricity price of the power grid and the daily sewage treatment demand, and formulates the lowest cost operation scheme under the premise of meeting the daily treatment volume. This scheme not only ensures the efficient and stable operation of sewage treatment, but also effectively reduces operating costs and improves overall economic benefits by reasonably scheduling equipment operation. Attached Figure Description

[0059] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.

[0060] Figure 1 This is a flowchart of an intelligent sewage treatment method for feces and wastewater according to the present invention;

[0061] Figure 2 This is a block diagram of an intelligent sewage treatment system for feces and wastewater according to the present invention. Detailed Implementation

[0062] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0063] Please see Figures 1 to 2 An intelligent method for treating fecal wastewater includes:

[0064] Step S1: Real-time collection of COD, ammonia nitrogen, DO, pH, water temperature, SS, and microbial activity parameters of fecal wastewater; normalization of the collected water quality parameters to form a unified standard data basis.

[0065] Step S2: Based on the data processed in step S1, the membership function parameters and fuzzy rules of the adaptive neurofuzzy inference system are optimized using the particle swarm optimization algorithm. By training the ANFIS model, the predicted value of COD concentration in the biochemical tank is output in real time, and a COD prediction model is formed.

[0066] Step S3: Based on the COD prediction value in step S2 and the processed data in step S1 as input, construct a Stacking ensemble model. The ensemble model contains a base learner and a meta learner. Then, use five-fold cross-validation to generate the prediction results of the base learner. Input these results into the meta learner for training and output the aeration demand M for the future period.

[0067] Step S4: Based on the future aeration demand M output in step S3 and the DO data in step S1, establish a fuzzy rule base, clarify the relationship between the deviation of M and DO, generate a PID parameter adjustment strategy through the Mamdani inference method, and then use the centroid method to defuzzify and output the blower frequency adjustment parameters to realize the real-time dynamic adjustment of the blower frequency.

[0068] Step S5: Based on the blower frequency adjustment parameters and the real-time water quality data in step S1, analyze the influence of blower frequency parameters on dissolved oxygen distribution and hydraulic shear force. Based on the feedback of microbial activity, optimize the sludge return ratio and stirring intensity to generate a combination of hydraulic parameters that helps stabilize the microbial community.

[0069] Step S6: Based on the hydraulic parameters optimized in Step S5, the aeration volume demand M for the future period in Step S3, and the time-of-use electricity price of the power grid and the daily treatment volume demand of fecal sewage, formulate the lowest cost operation plan under the premise of meeting the daily treatment volume.

[0070] Step S1 includes the following:

[0071] Step S11: Using an online COD monitor, ammonia nitrogen detector, dissolved oxygen sensor, pH meter, water temperature probe, suspended solids analyzer, and microbial activity analyzer, COD, ammonia nitrogen, DO, pH, water temperature, SS, and microbial activity parameters in fecal wastewater are collected in real time. During the collection process, a preset sampling frequency is set.

[0072] Step S12 involves using a normalization algorithm to eliminate the differences in the dimensions of different parameters among the various water quality parameters collected in step S11, mapping the data to a unified numerical range, and forming a data foundation with a unified standard.

[0073] In this embodiment, water quality parameters include COD, ammonia nitrogen, DO, pH, water temperature, SS, and microbial activity in wastewater. These parameters are normalized to eliminate differences in the dimensions and numerical ranges of different parameters, mapping the data to a unified interval, commonly [0,1] or [-1,1]. The most commonly used normalization method is min-max normalization, and its calculation formula is as follows: ,in, It is the raw data; and These are the minimum and maximum values ​​of the parameter in the dataset, respectively. This is the normalized data. This formula maps all data for each parameter to the interval [0, 1]. For example, if the minimum COD value in a set of COD data is 10 mg / L and the maximum value is 100 mg / L, and a measured COD value is 30 mg / L, the normalized value is... After normalization, different water quality parameters, such as COD and ammonia nitrogen, have the same dimensions and numerical ranges, providing a unified standard data foundation for subsequent data analysis and model building. This avoids the situation where certain parameters dominate the analysis process due to differences in dimensions, thus affecting the accuracy and reliability of the analysis results.

[0074] In a preferred embodiment of the present invention, step S2 includes the following:

[0075] Step S21: Analyze the characteristics of COD, ammonia nitrogen, and DO data of normalized fecal wastewater, determine the initial parameters of particle swarm optimization algorithm and adaptive neurofuzzy inference system, set the particle swarm size, iteration number, inertia weight, and learning factor parameters, and initialize the membership function type and initial parameters of ANFIS, as well as the fuzzy rule framework.

[0076] Step S22: Apply the initial parameters determined in step S21 to the particle swarm algorithm. Use the prediction error of the ANFIS model as the fitness function. By continuously searching in the solution space, the particles update their own positions and velocities, and optimize the membership function parameters and fuzzy rules of ANFIS. In each iteration, evaluate the performance of the ANFIS model corresponding to each particle and retain the parameter combination that makes the fitness function value optimal.

[0077] Step S23: Substitute the membership function parameters and fuzzy rules optimized by the particle swarm algorithm in step S22 into the ANFIS model, and train the ANFIS model using the processed data. During the training process, continuously adjust the model parameters and train repeatedly until the model reaches the set convergence condition.

[0078] Step S24: The trained ANFIS model is put into actual operation. The data processed in step S1 is used as real-time input. The model outputs the predicted value of COD concentration in the biochemical pool in real time. At the same time, the trained model structure, parameters and optimized fuzzy rules are saved to form a COD prediction model.

[0079] In this embodiment, statistical analysis is performed on the normalized wastewater COD, ammonia nitrogen, and DO data, such as calculating the mean, variance, and correlation, to understand the distribution characteristics of the data and the relationships between variables. These characteristics will affect the setting of the initial parameters of the particle swarm optimization algorithm and the adaptive neural fuzzy inference system (ANFIS).

[0080] For setting the particle swarm size, number of iterations, inertia weight, and learning factor parameters, the particle swarm size is generally set to 20-50 particles. Too small a size can easily lead to local optima, while too large a size increases the computational burden. The number of iterations is set according to the convergence speed and accuracy requirements, typically 100-500 times. The inertia weight... The initial value can be 0.9, and it can be adjusted later based on the search results. If the algorithm needs to search for the global optimum over a large area in the early stages, a larger value, such as 0.9, can be maintained. In the later stages of iteration, when a fine search for local optima is needed, the value should be gradually decreased. The value of ; the learning factor is and The initial settings can be This allows particles to learn towards both their individual and global optima. In scenarios involving optimizing ANFIS model parameters, this value can be tried first to observe the algorithm's convergence speed and accuracy. If it gets stuck in local optima too early, it can be adjusted. This adjustment can be based on the distance between the particle and the global optimum; the farther the particle is from the global optimum, the higher the value should be. Encourage self-exploration; proximity increases opportunities. To promote convergence towards the swarm optimum, the Euclidean distance between the particle's position and the global optimum is dynamically changed. , The selection of values ​​allows the algorithm to be more flexible in adapting to complex wastewater treatment parameter optimization tasks.

[0081] For setting the initial parameters of ANFIS, the selection should be based on the characteristics of the data. Gaussian type can be selected as the initial membership function type. For the selected membership function type, its initial parameters are set. Taking the Gaussian membership function as an example, its parameters include mean and standard deviation. These initial parameters can be roughly estimated according to the distribution range of the data. For example, the mean can be set as the data mean, and the standard deviation can be set as a certain proportion of the data standard deviation. Fuzzy rules are the basis for ANFIS inference. Its framework is built based on the relationship between input and output variables. For example, for a model with inputs of COD, ammonia nitrogen, and DO, and output of COD concentration prediction value, fuzzy rules can be initially set based on experience, such as the rule form of "if COD is high, ammonia nitrogen is low, and DO is moderate, then the COD concentration prediction value is high", which forms the initial fuzzy rule framework.

[0082] In the particle swarm optimization algorithm, each particle represents a set of parameters of the ANFIS model in the solution space, such as membership function parameters and fuzzy rule-related parameters. Particles have two attributes: position and velocity. Position corresponds to the parameter values ​​of the ANFIS model, while velocity determines the update direction and step size. The prediction error of the ANFIS model is used as the fitness function. A commonly used prediction error metric is the mean squared error (MSE), calculated using the following formula: ,in For the sample size, This represents the actual COD concentration value. The value represents the COD concentration predicted by the ANFIS model. The smaller the fitness function value, the better the prediction effect of the ANFIS model.

[0083] In each iteration, the particle updates its position and velocity according to the following formula:

[0084] Speed ​​update formula: ; in, It is a particle In the During the nth iteration Dimensional speed; It is a particle In the During the nth iteration Dimensional speed; and They are two random numbers between [0,1]. It is a particle In the The optimal position of the individual at the next iteration; The entire particle swarm is at the th The global optimal position at the next iteration; particle In the During the nth iteration The position of the dimension.

[0085] Position update formula: Through continuous iteration, the particles search in the solution space, update their position and velocity, and find the parameter combination that minimizes the fitness function value. That is, the membership function parameters and fuzzy rules of ANFIS are optimized. After each iteration, the performance of the ANFIS model corresponding to each particle is evaluated, and the parameter combination that makes the fitness function value optimal is retained.

[0086] ANFIS combines the learning capabilities of neural networks with the expressive power of fuzzy inference systems. After substituting the optimized membership function parameters and fuzzy rules from the particle swarm optimization algorithm into the ANFIS model, normalized wastewater data is used to train the model. During training, ANFIS employs a hybrid learning algorithm: least squares for forward propagation and gradient descent for backpropagation. During forward propagation, the membership degrees of each fuzzy set are calculated using the membership function, followed by fuzzy rule inference and defuzzification to obtain the output value. Then, the error between the output value and the actual value is calculated, and this error is propagated back to the network through backpropagation. Gradient descent is used to adjust the membership function parameters, gradually reducing the error. This process is repeated until the model reaches the set convergence conditions, such as a mean squared error less than a certain threshold or the number of iterations reaches a preset value. At this point, the ANFIS model completes training and can effectively fit the input data with COD (Chemical Oxygen Demand). The relationship between concentrations is investigated by putting the trained ANFIS model into actual operation. The data after normalization in step S1 is used as real-time input. Based on the input wastewater COD, ammonia nitrogen, DO and other data, the model uses the trained parameters and fuzzy rules to output the predicted value of COD concentration in the biological treatment tank in real time through fuzzy inference and calculation. This provides a basis for decision-making in process adjustment and management during wastewater treatment. The trained model structure, including input and output variables, membership function types and numbers, fuzzy rule framework, membership function parameters and optimized fuzzy rules, is saved to form a complete COD prediction model. The saved model can be directly called in subsequent use for COD concentration prediction of new data, and it also facilitates model maintenance and updates.

[0087] In a preferred embodiment of the present invention, step S3 includes the following:

[0088] Step S31: Based on the COD prediction value in step S2 and the processed data in step S1, determine the base learner and meta learner of the Stacking ensemble model.

[0089] Step S32: Merge the COD prediction values ​​from step S2 with the data processed in step S1, clean the processed data, remove duplicate data, check and process any missing values, and form the input dataset.

[0090] Step S33: The base learner in step S31 is trained and predicted using five-fold cross-validation. The dataset processed in step S32 is divided into five parts. One part is selected as the test set each time, and the other four parts are used as the training set. Each base learner is trained in turn, and the trained base learner is used to predict the test set. The prediction results are recorded each time.

[0091] Step S34: Collect all prediction results generated by the three base learners in step S33 under five-fold cross-validation, organize them into a new feature matrix, and use this feature matrix as input data to train the meta-learner in step S31. During the training process, continuously adjust the parameters of the meta-learner.

[0092] Step S34 includes step S341, in which the input dataset processed in step S32 is re-inputted into the base learner initialized in step S31, the prediction results of each base learner for the dataset are obtained, and these prediction results are integrated and input into the meta-learner trained in step S34. After processing by the meta-learner, the aeration demand M for the future period is finally output.

[0093] In this embodiment, the Stacking ensemble model improves its predictive performance by combining the prediction results of multiple base learners and then using a meta-learner for secondary learning. Based on the COD prediction value in step S2 and the characteristics of the processed data in step S1, suitable base learners and meta-learners are determined. The base learner is the underlying learning unit of the Stacking model, responsible for preliminary processing and prediction of the original data. Linear regression, decision tree, and support vector machine models can be selected as base learners. By choosing models based on different principles, data can be analyzed and predicted from multiple perspectives, providing richer information for the subsequent meta-learner. The meta-learner learns the relationship between the prediction results of the base learners and the true values, integrating and optimizing the outputs of the base learners. Common meta-learners include logistic regression and neural networks. The appropriate meta-learner is selected based on the complexity of the data and the prediction objective. If the data relationships are relatively simple, logistic regression can be used as a meta-learner; if the data relationships are complex, neural networks may be more suitable. After determining the meta-learner, it needs to be initialized by setting initial parameters, such as the number of layers and neurons in the neural network.

[0094] The predicted COD values ​​from step S2 are merged with the data processed in step S1. This data includes multi-dimensional information on wastewater such as COD, ammonia nitrogen, DO, pH, water temperature, SS, and microbial activity, as well as the COD concentration values ​​predicted by the ANFIS model. The merged dataset contains more comprehensive information and can more accurately reflect the relationship between wastewater quality and COD concentration, providing richer data support for subsequent model training. During data collection and processing, duplicate records may occur. Duplicate data not only consumes computing resources but may also affect the accuracy of model training. By comparing all fields of each record in the dataset, identical records are identified and duplicates are removed to ensure that each record in the dataset is unique, thereby improving data quality and validity. For the data during collection and processing, firstly, check if there are missing values ​​in the dataset. This can be determined by counting the number of non-empty values ​​in each field. There are various methods for handling missing values, such as deleting the record containing the missing value, but this method may reduce the amount of data and result in information loss. Alternatively, statistical measures such as the mean, median, and mode can be used to fill in missing values. For example, for the numerical variable COD concentration, the mean of the variable can be used to fill in missing values. More complex interpolation methods or model-based prediction methods can also be used to estimate missing values, such as using the K-nearest neighbor algorithm to fill in missing values ​​based on the values ​​of other records similar to the missing value record.

[0095] Each time, one dataset is selected as the test set, and the remaining four datasets are used as the training set. For example, in the first training iteration, the first dataset is used as the test set, and the second, third, fourth, and fifth datasets are used as the training set. The base learner is trained using the training set data to learn the patterns and rules in the data. After training, the trained base learner is used to predict on the test set to obtain the prediction result of the base learner on that test set. Following the same method, the other four datasets are used as test sets for training and prediction, for a total of five iterations. This ensures that each base learner undergoes five training and prediction iterations, allowing for a more comprehensive learning of data features and a more accurate evaluation of the model's performance on different dataset subsets. Five-fold cross-validation can reduce model evaluation bias caused by unreasonable data partitioning and improve the model's generalization ability. In step S33, all prediction results generated by the three base learners under five-fold cross-validation are collected. Since each base learner makes five predictions, each prediction produces a prediction value. For each sample, a total of 15 prediction values ​​are obtained from the five predictions of the three base learners (3 base learners × 5 predictions). These prediction values ​​are then organized into a new feature matrix. Each row of this feature matrix corresponds to a sample, and each column corresponds to the prediction result of a base learner on a certain fold test set. This new feature matrix contains prediction information from different perspectives of the original data from the base learners. As input data for the meta-learner, it provides richer features to help the meta-learner learn the relationship between the base learner's prediction results and the true values. The prepared feature matrix is ​​used as input data to train the meta-learner in step S31. During training, the meta-learner, based on the input feature matrix and the corresponding true values ​​(i.e., the actual aeration volume requirement), learns how to map the predictions of the base learners to the true values ​​by adjusting its own parameters, such as the weight coefficients of the logistic regression model and the connection weights of the neural network. It uses an appropriate loss function, such as mean squared error for regression problems, to measure the difference between the predicted and true values. Through optimization algorithms, such as gradient descent, the parameters of the meta-learner are continuously adjusted to minimize the loss function value, thereby improving the prediction accuracy of the meta-learner. The processed input dataset is then re-input into... In step S31, the initialized base learners each predict the dataset based on the rules they have learned, obtaining their own prediction results. These prediction results are then integrated to form new input data, which is input into the trained meta-learner. The meta-learner uses the knowledge and parameters learned during training to process and analyze the prediction results of the base learners. Through internal calculation and reasoning, it finally outputs the aeration demand M for the future period. This process is the core of the practical application of the Stacking ensemble model. Through the collaborative work of the base learners and the meta-learners, accurate prediction of the aeration demand for the future period is achieved, providing a scientific basis for aeration control in the wastewater treatment process.

[0096] In a preferred embodiment of the present invention, step S4 includes the following:

[0097] Step S41: Obtain the future aeration demand M from step S341, and extract the DO data processed in step S1. Perform statistical analysis on M and DO data to determine the range of variation of the deviation between M and DO and divide multiple data intervals.

[0098] Step S42: Based on the data interval determined in step S41, define at least two sets of fuzzy linguistic variables to describe the aeration demand M in the future period, and at least three sets of fuzzy linguistic variables to describe the DO deviation. Based on the principle of sewage treatment process and actual operation experience, formulate fuzzy rules between M and DO deviation, construct a fuzzy rule base, and clarify the adjustment strategies to be adopted under different combinations of M and DO deviation.

[0099] Step S43: The future aeration demand M and DO data in step S41 are fuzzified according to the fuzzy linguistic variables defined in step S42, and converted into corresponding fuzzy set membership values, which are used as inputs for the Mamdani inference method.

[0100] Step S44: Using the fuzzified input data from step S43, combined with the fuzzy rule base constructed in step S42, logical reasoning is performed using the Mamdani reasoning method to calculate the fuzzy output result of the PID parameter adjustment strategy.

[0101] Step S45: The fuzzy output result of the PID parameter adjustment strategy obtained in step S44 is defuzzified using the centroid method to convert the fuzzy quantity into a precise value, thereby obtaining the specific PID parameter adjustment value.

[0102] Step S46: Based on the PID parameter adjustment value obtained in step S45, establish a mapping relationship with the blower frequency adjustment parameter, output the blower frequency adjustment parameter, and send it as a control signal to the blower control system to realize real-time dynamic adjustment of the blower power.

[0103] In this embodiment, the future aeration demand M is first obtained, and the dissolved oxygen (DO) data processed in step S1 is extracted simultaneously. The future aeration demand M is predicted using a Stacking ensemble model, while the DO data is one of the wastewater quality parameters collected in real time and processed through normalization. Both reflect key information in the wastewater treatment process. Statistical analysis is performed on the M and DO data. Commonly used statistical indicators include mean, standard deviation, maximum value, and minimum value. By calculating these statistics, the central tendency and dispersion of the data can be understood. For example, the mean of the DO data can be calculated. and standard deviation ,by To serve as a reference for dividing the interval boundaries, where The values ​​are constants, such as 1 and 2. Observe the range of variation of M and DO deviations, and divide them into multiple data intervals according to the data distribution characteristics and wastewater treatment process requirements. For example, divide the DO deviation into intervals such as "negative medium", "negative small", "zero", "positive small", "positive medium", and "positive large", and divide the aeration demand M into intervals such as "low", "medium low", "medium", "medium high", and "high", to prepare for subsequent fuzzification processing and rule formulation.

[0104] Based on a defined data interval, define at least two sets of fuzzy linguistic variables to describe the aeration demand M for future periods. For example, define three fuzzy linguistic variables: "low aeration," "medium aeration," and "high aeration." Each fuzzy linguistic variable corresponds to a fuzzy set. Membership functions describe the degree to which data belongs to that fuzzy set. Membership functions can be triangular, trapezoidal, Gaussian, etc. For example, a trapezoidal membership function is used for "low aeration." The function parameters are set according to the defined data interval to determine the membership degree of different aeration demand values ​​belonging to the "low aeration" fuzzy set. Define at least three sets of fuzzy linguistic variables to describe DO deviation, such as "negative large DO deviation," "negative medium DO deviation," etc. The DO deviation is categorized into "small negative," "zero," "small positive," "medium positive," and "large positive." Similarly, a membership function is defined for each fuzzy linguistic variable to determine the membership relationship between the DO deviation value and each fuzzy set. Fuzzy rules are developed based on wastewater treatment process principles and practical operating experience. In wastewater treatment, aeration volume is closely related to DO concentration. For example, when the aeration demand M is "high" and the DO deviation is "large negative," it indicates insufficient aeration, requiring an increase in aeration volume, i.e., increasing the blower power. Conversely, when the aeration demand M is "low" and the DO deviation is "large positive," it indicates excessive aeration, requiring a decrease in blower power. These experiences are summarized into fuzzy rules in the form of "if...then...", such as "If the aeration demand M is high and the DO deviation is large negative, then the PID parameter adjustment strategy is to significantly increase the proportional coefficient, appropriately increase the integral coefficient, and slightly increase the derivative coefficient." This forms a fuzzy rule base, clarifying the adjustment strategies to be adopted under different combinations of M and DO deviations.

[0105] For the future aeration demand M, according to the membership function defined in step S42, and since the membership degree is the result of substituting the input value into the membership function, the membership degree of M is calculated by inputting each fuzzy linguistic variable into the corresponding membership function. Then, based on the membership degree values ​​of the fuzzy sets corresponding to the future aeration demand M and DO data, the fuzzy rule base is constructed for logical reasoning. For each fuzzy rule, the satisfaction degree of the antecedent part of the rule, that is, the "if" part, is calculated first. That is, the "AND" operation is performed on the membership degrees of multiple input fuzzy sets, usually by taking the minimum value. Then, according to the consequent part of the rule, that is, the satisfaction degree of the antecedent is applied to the output fuzzy set. The output fuzzy set corresponding to the rule is obtained by "truncating" or "scaling". After performing the above operation on all rules, the output fuzzy sets of each rule are "ORed", usually by taking the maximum value, to obtain the final fuzzy output result of the PID parameter adjustment strategy.

[0106] For the future aeration demand M, based on the membership function, the membership degree of M to each fuzzy linguistic variable, such as "low aeration", "medium aeration", and "high aeration", is calculated. Then, the membership degree of M to each DO deviation fuzzy linguistic variable, such as "negative large DO deviation" and "negative medium DO deviation", is calculated. These calculated membership degree values ​​are used as inputs to the Mamdani inference method to realize the conversion from precise data to fuzzy data.

[0107] Based on the constructed fuzzy rule base, logical reasoning is performed using the Mamdani inference method to calculate the fuzzy output result of the PID parameter adjustment strategy. Specifically, the fuzzy output result is treated as a whole graph, where the horizontal axis represents the adjustment amount of the PID parameters, and the vertical axis represents the membership degree corresponding to each adjustment amount. By calculating the "centroid" position of this graph, the precise PID parameter adjustment value can be obtained. The horizontal axis value corresponding to this "centroid" position is the final specific PID parameter adjustment value required. With this precise value, the wastewater treatment equipment can be accurately controlled to operate according to appropriate parameters, ensuring the effectiveness and efficiency of wastewater treatment.

[0108] Based on the obtained PID parameter adjustment values, a mapping relationship is established with the blower frequency adjustment parameters. This mapping relationship is based on the working characteristics between the PID controller and the blower in the wastewater treatment system and is determined through experiments or fitting actual operating data. For example, the relationship between the PID parameter adjustment values ​​and the blower frequency adjustment parameters is established through experimental testing and recorded. The recorded blower frequency adjustment parameters are sent as control signals to the blower control system. After receiving the signal, the blower control system adjusts the blower power according to the parameter to achieve real-time dynamic adjustment of the blower power. For example, if the calculated blower frequency adjustment parameter is to increase by 10%, the blower control system will increase the blower operating frequency by 10%, thereby adjusting the aeration rate and maintaining the DO concentration in the wastewater treatment process at a suitable level to ensure the stable operation of the wastewater treatment process.

[0109] In a preferred embodiment of the present invention, step S5 includes the following:

[0110] Step S51: Based on the blower frequency adjustment parameters obtained in step S46, and simultaneously extract the real-time water quality data processed in step S1, including DO, SS, and microbial activity data, perform correlation analysis between the blower frequency parameters and the DO data in the real-time water quality data, plot the distribution curves of dissolved oxygen with time and space under different blower frequencies, and explore the influence of blower frequency on dissolved oxygen distribution.

[0111] Step S52: The hydraulic shear force of the blower at different frequencies is measured and recorded in advance through experiments to form the correspondence between different frequencies of the blower and the hydraulic shear force.

[0112] Step S53: The relationship between the blower frequency and hydraulic shear force determined in step S52 is combined with the microbial activity data in step S1 for comprehensive analysis. The changing trend of microbial activity under different hydraulic shear forces is studied, and the hydraulic shear force threshold that has a positive effect on microbial activity is identified.

[0113] Step S54: Based on the relationship between microbial activity and hydraulic shear force obtained in step S53, as well as the dissolved oxygen distribution, establish a correlation model between sludge return ratio, stirring intensity and microbial activity. By setting different combinations of sludge return ratio and stirring intensity parameters, simulate the response of microbial activity and screen out parameter combinations that are conducive to improving microbial activity.

[0114] Step S55: The sludge return ratio and stirring intensity parameter combination selected in step S54 are evaluated in combination with the constraints of the actual fecal sewage treatment process. The genetic algorithm is used to further optimize the parameter combination to generate a hydraulic parameter combination that helps stabilize the microbial community, including the optimal sludge return ratio and stirring intensity.

[0115] In this embodiment, based on the acquired blower frequency adjustment parameters, real-time water quality data processed in step S1 is extracted simultaneously, including dissolved oxygen (DO), suspended solids (SS), and microbial activity data. These data are key parameters in the wastewater treatment process. The blower frequency adjustment parameters reflect the operating status of the aeration equipment, while the DO, SS, and microbial activity data reflect the wastewater quality and the effectiveness of the biochemical treatment. A correlation analysis is performed between the blower frequency parameters and the DO data in the real-time water quality data. Time series analysis is used to record the correspondence between blower frequency and DO concentration at different times. Spatially, DO sensors can be deployed at different locations within the biological treatment tank to obtain the DO levels at each location during blower operation. According to the study, statistical methods, such as calculating correlation coefficients, were used to quantify the linear relationship between blower frequency and DO concentration. Then, based on this data, plotting software, such as Python's Matplotlib library and Origin, was used to plot the distribution curves of dissolved oxygen over time and space at different blower frequencies. In the curves, the horizontal axis can represent time or spatial location, and the vertical axis represents DO concentration. Different blower frequencies are distinguished by different colors or line types. By observing these curves, the influence of blower frequency on dissolved oxygen distribution can be intuitively explored, such as whether a high blower frequency can increase the DO concentration more quickly, and how uniform the DO concentration is at different locations in the biological treatment tank.

[0116] Through experiments, the blower was set to different operating frequencies. For each frequency point, the corresponding hydraulic shear force value was precisely measured. For example, a miniature piezoresistive sensor was used for testing. At each frequency, after waiting for the flow field in the biological treatment tank to stabilize for about 10-30 minutes, multiple points were measured using a shear force sensor. For example, 3-5 sensors were arranged in different areas of the biological treatment tank, and the average value was taken as the hydraulic shear force at that frequency.

[0117] To ensure the accuracy and reliability of the data, the hydraulic shear force measurement at each frequency point should be repeated multiple times, and the average value should be taken as the final measurement result at that frequency. After completing the measurement at all frequency points, the hydraulic shear force data of different frequencies and their corresponding hydraulic shear forces should be recorded in detail and compiled into a clear dataset of the correspondence between different frequencies of the blower and hydraulic shear forces, so as to be queried and used in subsequent applications.

[0118] The relationship between the determined blower frequency and hydraulic shear force was comprehensively analyzed in conjunction with microbial activity data. Microbial activity data can be characterized by measuring indicators such as microbial respiration rate, ATP content, and enzyme activity. The hydraulic shear force values ​​corresponding to different blower frequencies were integrated with microbial activity data from the same period to form a dataset containing blower frequency, hydraulic shear force, and microbial activity. Data analysis methods, such as regression analysis and curve fitting, were used to study the changing trends of microbial activity under different hydraulic shear forces. For example, by plotting the curve of microbial activity versus hydraulic shear force, it was observed whether microbial activity increases or decreases with increasing hydraulic shear force, or increases first and then decreases. Through analysis of the curve, the hydraulic shear force range corresponding to the optimal state of microbial activity was identified, i.e., the hydraulic shear force threshold that positively affects microbial activity. This threshold is crucial for optimizing wastewater treatment processes because appropriate hydraulic shear force helps maintain microbial activity and promotes biochemical reactions during wastewater treatment.

[0119] Based on the obtained relationship between microbial activity and hydraulic shear force, as well as the obtained dissolved oxygen distribution, a correlation model was established between sludge return ratio, stirring intensity, and microbial activity. Sludge return ratio and stirring intensity are important operating parameters in the wastewater treatment process, which affect the degree of mixing of wastewater in the biological treatment tank, the contact efficiency between substrate and microorganisms, and thus affect microbial activity. Using neural network models, sludge return ratio and stirring intensity were used as input variables, and microbial activity was used as the output variable. The model was trained using existing data. During the training process, the model parameters were adjusted to ensure that the model could accurately describe the relationship between the input and output variables. By setting different combinations of sludge return ratio and stirring intensity parameters, these combinations were input into the established correlation model to simulate the response of microbial activity. A series of parameter combinations could be generated using methods such as grid search and random search. Then, the model was used to calculate the predicted value of microbial activity under each parameter combination. By comparing the predicted values ​​of microbial activity under different parameter combinations, parameter combinations that can significantly improve microbial activity were screened. These parameter combinations provided candidate solutions for subsequent process optimization.

[0120] The selected combinations of sludge return ratio and mixing intensity parameters were evaluated in conjunction with the constraints of the actual wastewater treatment process. These constraints included equipment operating capacity (e.g., maximum power limit of the mixing equipment), flow range of the sludge return pump, treatment costs (e.g., energy costs, reagent costs), and effluent quality requirements (e.g., restrictions on COD, ammonia nitrogen, etc.). For each parameter combination, its feasibility and economic benefits under the actual constraints were calculated, and combinations that did not meet the constraints or had poor economic benefits were excluded. A genetic algorithm is used to further optimize the remaining parameter combinations. During the algorithm's operation, the fitness function value of an individual is used as an evaluation index that comprehensively considers factors such as microbial activity, treatment cost, and effluent quality to perform selection operations, retaining individuals with higher fitness. Through crossover operations, some genes of two individuals are exchanged to generate new individuals. Through mutation operations, some genes of individuals are randomly changed to increase the diversity of the population. After multiple generations of evolution, the genetic algorithm can search for the optimal or near-optimal parameter combinations in the parameter space, that is, generate hydraulic parameter combinations that help stabilize the microbial community, including the optimal sludge return ratio and stirring intensity, thereby optimizing the wastewater treatment process.

[0121] In a preferred embodiment of the present invention, step S6 includes the following:

[0122] Step S61: Obtain the optimized hydraulic parameters from step S55, extract the predicted aeration demand M for future periods output from step S341, collect time-of-use electricity price data of the power grid, clarify the electricity price standards for different periods, and integrate these data with the daily treatment capacity demand of the sewage treatment plant to establish a basic dataset.

[0123] Step S62: Based on the basic dataset integrated in step S61, construct a cost model for fecal and sewage treatment, link hydraulic parameters with equipment energy consumption, link aeration demand M with blower energy consumption, and combine time-of-use electricity pricing to calculate the treatment cost for each time period under different combinations of operating parameters, clarifying the quantitative relationship between cost and each parameter.

[0124] Step S63: Taking the daily treatment capacity of fecal sewage as a constraint, and combining the cost model constructed in step S62, the objective function is set as minimizing the total daily cost of fecal sewage treatment. A mathematical optimization algorithm is used to optimize and solve the values ​​of hydraulic parameters and aeration volume at different times.

[0125] Step S64: Perform feasibility verification on the operating parameter combination scheme obtained in step S63, check whether each parameter is within the equipment's operating capacity range and whether it meets the technical requirements of the sewage treatment process. If there are infeasible parameters, adjust the parameter value range and perform optimization again until a feasible operating parameter combination scheme is obtained.

[0126] Step S64 includes step S641, which refines the feasible combination of operating parameters verified in step S64 into specific operating instructions, clarifies the specific values ​​of sludge return ratio, stirring intensity, and aeration volume parameters for each time period, forms the lowest cost operating scheme under the premise of meeting the daily treatment capacity, and outputs the scheme for actual production use.

[0127] In this embodiment, hydraulic parameters optimized by a genetic algorithm are obtained, including the optimal sludge return ratio and stirring intensity; the predicted future aeration demand M is extracted, which is derived from the analysis and prediction of wastewater quality parameters based on the Stacking ensemble model; time-of-use electricity price data from the power grid is collected to clarify the electricity price standards for different time periods, such as peak hours, valley hours, and normal hours. Electricity price data can be obtained through information published by the power sector or through real-time electricity trading platforms; combined with the daily wastewater treatment capacity demand of the wastewater treatment plant, which is typically determined based on factors such as the population of the service area and industrial wastewater discharge, these data reflect the wastewater treatment capacity demand. The data obtained, including water treatment process parameters, energy costs, and treatment task requirements, are integrated to establish a basic dataset. Using time as the dimension, the hydraulic parameters, aeration volume requirements, electricity price standards, and daily wastewater treatment volume requirements for each time period are correlated. For example, a day is divided into 24 hours, and the sludge return ratio, mixing intensity, aeration volume requirement M, electricity price, and the amount of wastewater to be treated for each hour are recorded, forming a structured data table or database table. Through data integration, different types of data are unified, providing a comprehensive data foundation for subsequent cost model construction and optimization analysis.

[0128] The hydraulic parameters, such as sludge return ratio and mixing intensity, are correlated with the energy consumption of related equipment (such as sludge return pumps and mixing equipment). For example, the sludge return ratio can be measured experimentally beforehand. Power of sludge return pumps at different sizes The mapping relationship between the stirring intensity H and the power P2 of the stirring equipment was measured experimentally. Then, the energy consumption of the corresponding equipment in each time period was calculated based on the power and running time. The mapping relationship between the aeration volume M and the blower power P3 was measured experimentally. Similarly, the energy consumption of the blower in each time period was calculated based on the power and running time. Combined with the time-of-use electricity price, the energy consumption of each equipment in different time periods was multiplied by the electricity price of the corresponding time period to calculate the treatment cost of each time period under each combination of operating parameters. For example, if the energy consumption of the sludge return pump is E1, the energy consumption of the stirring equipment is E2, the energy consumption of the blower is E3, and the electricity price of the time period is p, then the treatment cost of the time period is C=(E1+E2+E3)×p. By calculating the cost of each time period under different combinations of operating parameters, the quantitative relationship between cost and various parameters such as hydraulic parameters and aeration volume demand is analyzed, and the degree of influence of each parameter on cost is clarified. With the constraint of meeting the daily wastewater treatment capacity requirement, the goal is to ensure that the wastewater treatment plant can process the prescribed amount of wastewater each day during the optimization of operating parameters, avoiding both insufficient and excessive treatment capacity. The objective function is set as minimizing the total daily wastewater treatment cost, i.e. ,in The total number of time periods divided into a day. For the first The objective function defines the direction of optimization as reducing the overall processing cost throughout the day by adjusting operating parameters.

[0129] Mathematical optimization algorithms are used to optimize the values ​​of hydraulic parameters and aeration rate at different time periods. Common mathematical optimization algorithms include linear programming, nonlinear programming, and integer programming. The appropriate algorithm is selected based on the characteristics of the cost model, such as whether the relationship between cost and parameters is linear. For example, if the cost model is linear, a linear programming algorithm can be used; if it is nonlinear, a nonlinear programming algorithm is used. During the algorithm solution process, constraints and the objective function are used as inputs. Through iterative calculation, the combination of operating parameters that satisfies the constraints and minimizes the objective function value is searched, i.e., the optimal sludge return ratio, stirring intensity, and aeration rate values ​​for each time period. It is checked whether each parameter is within the equipment's operating capacity range, such as whether the sludge return pump flow rate is within its rated flow rate range, whether the stirring intensity of the stirring equipment exceeds its maximum working intensity, and whether the blower's aeration rate is within its adjustable range. If any parameters exceed the equipment's operating capacity, the proposed solution is infeasible. Verify whether the parameters meet the technical requirements of the wastewater treatment process, such as whether the sludge return ratio can ensure normal sludge circulation and microbial activity in the biological treatment tank, and whether the aeration rate can maintain a suitable dissolved oxygen concentration to meet the needs of the biochemical reaction. If the process requirements are not met, the solution is also deemed infeasible. If infeasible parameters are found during the feasibility verification, adjust the parameter value range. Based on the equipment manual and process experience, narrow down the range of parameters that exceed the range. Then, substitute the adjusted parameter range back into the mathematical optimization algorithm for a new round of optimization. Repeat the feasibility verification steps until a feasible combination of operating parameters is obtained.

[0130] The feasible combination of operating parameters will be refined into specific operating instructions, using time as the unit, specifying the exact values ​​of parameters such as sludge return ratio, mixing intensity, and aeration rate for each time period. For example, if a 24-hour day is divided into hourly periods, the sludge return ratio for the first hour will be detailed as follows: The stirring intensity is Aeration volume is The sludge return ratio in the second hour was [value missing]. The stirring intensity is Aeration volume is This process continues until a minimum-cost operating plan is achieved while meeting the daily treatment capacity. This plan is then output for actual production use. The refined operating instructions are compiled into documents or spreadsheets and provided to the wastewater treatment plant's operation and management personnel. Simultaneously, the plan can be imported into the wastewater treatment plant's automated control system, enabling equipment to operate automatically according to optimized parameters. This ensures effective wastewater treatment while reducing treatment costs.

[0131] An intelligent sewage treatment system, applied to the aforementioned intelligent sewage treatment method, includes:

[0132] The data acquisition module is used to collect COD, ammonia nitrogen, DO, pH, water temperature, SS and microbial activity parameters of sewage in real time, and to normalize the collected water quality parameters to form a unified standard data foundation.

[0133] The first model module, based on the data processed by the data acquisition module, uses the particle swarm optimization algorithm to optimize the membership function parameters and fuzzy rules of the adaptive neural fuzzy inference system. By training the ANFIS model, it outputs the predicted value of COD concentration in the biochemical tank in real time and forms a COD prediction model.

[0134] The second model module uses the COD prediction value from the first model module and the processed data from the data acquisition module as input to build a Stacking ensemble model. The ensemble model contains a base learner and a meta learner. Then, the prediction results of the base learner are generated by five-fold cross-validation. These results are input into the meta learner for training and output the aeration demand M for future periods.

[0135] The adjustment module establishes a fuzzy rule base based on the future aeration demand M output from the second model module and the DO data from the data acquisition module, clarifies the relationship between the deviations of M and DO, generates a PID parameter adjustment strategy through the Mamdani inference method, and then uses the centroid method to defuzzify and output the blower frequency adjustment parameters to achieve real-time dynamic adjustment of the blower frequency.

[0136] The processing module analyzes the impact of blower frequency parameters on dissolved oxygen distribution and hydraulic shear force based on blower frequency adjustment parameters and real-time water quality data from the data acquisition module. Based on feedback from microbial activity, it optimizes the sludge return ratio and stirring intensity to generate a combination of hydraulic parameters that helps stabilize the microbial community.

[0137] The scheme generation module, based on the hydraulic parameters optimized in the processing module, the future aeration demand M output by the second model module, and the time-of-use electricity price of the power grid and the daily treatment capacity of fecal sewage, formulates the lowest cost operation scheme under the premise of meeting the daily treatment capacity.

[0138] The above description is merely a preferred embodiment of the present invention; however, the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and its improved concepts, should be covered within the scope of protection of the present invention.

Claims

1. An intelligent method for treating fecal wastewater, characterized in that, include: Step S1: Real-time collection of COD, ammonia nitrogen, DO, pH, water temperature, SS, and microbial activity parameters of fecal wastewater; normalization of the collected water quality parameters to form a unified standard data basis. Step S2: Based on the data processed in step S1, the membership function parameters and fuzzy rules of the adaptive neurofuzzy inference system are optimized using the particle swarm optimization algorithm. By training the ANFIS model, the predicted value of COD concentration in the biochemical tank is output in real time, and a COD prediction model is formed. Step S3: Based on the COD prediction value in step S2 and the processed data in step S1 as input, construct a Stacking ensemble model. The ensemble model contains a base learner and a meta learner. Then, use five-fold cross-validation to generate the prediction results of the base learner. Input these results into the meta learner for training and output the aeration demand M for the future period. Step S4: Based on the future aeration demand M output in step S3 and the DO data in step S1, establish a fuzzy rule base, clarify the relationship between the deviation of M and DO, generate a PID parameter adjustment strategy through the Mamdani inference method, and then use the centroid method to defuzzify and output the blower frequency adjustment parameters to realize the real-time dynamic adjustment of the blower frequency. Step S5: Based on the blower frequency adjustment parameters and the real-time water quality data in step S1, analyze the influence of blower frequency parameters on dissolved oxygen distribution and hydraulic shear force. Based on the feedback of microbial activity, optimize the sludge return ratio and stirring intensity to generate a combination of hydraulic parameters that helps stabilize the microbial community. Step S6: Based on the hydraulic parameters optimized in Step S5, the aeration volume demand M for the future period in Step S3, and the time-of-use electricity price of the power grid and the daily treatment volume demand of fecal sewage, formulate the lowest cost operation plan under the premise of meeting the daily treatment volume.

2. The intelligent sewage treatment method according to claim 1, characterized in that, Real-time collection of COD, ammonia nitrogen, DO, pH, water temperature, SS, and microbial activity parameters of sewage and wastewater; normalization of the collected water quality parameters to form a unified standard data foundation, including: Step S11: Using an online COD monitor, ammonia nitrogen detector, dissolved oxygen sensor, pH meter, water temperature probe, suspended solids analyzer, and microbial activity analyzer, COD, ammonia nitrogen, DO, pH, water temperature, SS, and microbial activity parameters in fecal wastewater are collected in real time. During the collection process, a preset sampling frequency is set. Step S12 involves using a normalization algorithm to eliminate the differences in the dimensions of different parameters among the various water quality parameters collected in step S11, mapping the data to a unified numerical range, and forming a data foundation with a unified standard.

3. The intelligent sewage treatment method according to claim 2, characterized in that, Based on the data processed in step S1, the membership function parameters and fuzzy rules of the adaptive neural fuzzy inference system are optimized using the particle swarm optimization algorithm. By training the ANFIS model, the predicted COD concentration in the biochemical tank is output in real time, forming a COD prediction model, including: Step S21: Analyze the characteristics of COD, ammonia nitrogen, and DO data of normalized fecal wastewater, determine the initial parameters of particle swarm optimization algorithm and adaptive neurofuzzy inference system, set the particle swarm size, iteration number, inertia weight, and learning factor parameters, and initialize the membership function type and initial parameters of ANFIS, as well as the fuzzy rule framework. Step S22: Apply the initial parameters determined in step S21 to the particle swarm algorithm. Use the prediction error of the ANFIS model as the fitness function. By continuously searching in the solution space, the particles update their own positions and velocities, and optimize the membership function parameters and fuzzy rules of ANFIS. In each iteration, evaluate the performance of the ANFIS model corresponding to each particle and retain the parameter combination that makes the fitness function value optimal. Step S23: Substitute the membership function parameters and fuzzy rules optimized by the particle swarm algorithm in step S22 into the ANFIS model, and train the ANFIS model using the processed data. During the training process, continuously adjust the model parameters and train repeatedly until the model reaches the set convergence condition. Step S24: The trained ANFIS model is put into actual operation. The data processed in step S1 is used as real-time input. The model outputs the predicted value of COD concentration in the biochemical pool in real time. At the same time, the trained model structure, parameters and optimized fuzzy rules are saved to form a COD prediction model.

4. The intelligent sewage treatment method according to claim 3, characterized in that, Based on the COD prediction value from step S2 and the processed data from step S1 as input, a Stacking ensemble model is constructed. This model includes a base learner and a meta-learner. Five-fold cross-validation is then used to generate the prediction results of the base learner. These results are input into the meta-learner for training, outputting the future aeration demand M, including: Step S31: Based on the COD prediction value in step S2 and the processed data in step S1, determine the base learner and meta learner of the Stacking ensemble model. Step S32: Merge the COD prediction values ​​from step S2 with the data processed in step S1, clean the processed data, remove duplicate data, check and process any missing values, and form the input dataset. Step S33: The base learner in step S31 is trained and predicted using five-fold cross-validation. The dataset processed in step S32 is divided into five parts. One part is selected as the test set each time, and the other four parts are used as the training set. Each base learner is trained in turn, and the trained base learner is used to predict the test set. The prediction results are recorded each time. Step S34: Collect all prediction results generated by the three base learners in step S33 under five-fold cross-validation, organize them into a new feature matrix, and use this feature matrix as input data to train the meta-learner in step S31. During the training process, continuously adjust the parameters of the meta-learner.

5. The intelligent sewage treatment method according to claim 4, characterized in that, Step S34 also includes: Step S341: The input dataset processed in step S32 is re-inputted into the base learner initialized in step S31 to obtain the prediction results of each base learner for the dataset. These prediction results are then integrated and input into the meta-learner trained in step S34. After processing by the meta-learner, the aeration demand M for the future period is finally output.

6. The intelligent sewage treatment method according to claim 5, characterized in that, Based on the future aeration demand M output in step S3 and the DO data in step S1, a fuzzy rule base is established to clarify the correlation between the deviations of M and DO. A PID parameter adjustment strategy is generated using the Mamdani inference method, and then the centroid method is used to defuzzify the data, outputting the blower frequency adjustment parameters to achieve real-time dynamic adjustment of the blower frequency, including: Step S41: Obtain the future aeration demand M from step S341, and extract the DO data processed in step S1. Perform statistical analysis on M and DO data to determine the range of variation of the deviation between M and DO and divide multiple data intervals. Step S42: Based on the data interval determined in step S41, define at least two sets of fuzzy linguistic variables to describe the aeration demand M in the future period, and at least three sets of fuzzy linguistic variables to describe the DO deviation. Based on the principle of sewage treatment process and actual operation experience, formulate fuzzy rules between M and DO deviation, construct a fuzzy rule base, and clarify the adjustment strategies to be adopted under different combinations of M and DO deviation. Step S43: The future aeration demand M and DO data in step S41 are fuzzified according to the fuzzy linguistic variables defined in step S42, and converted into corresponding fuzzy set membership values, which are used as inputs for the Mamdani inference method. Step S44: Using the fuzzified input data from step S43, combined with the fuzzy rule base constructed in step S42, logical reasoning is performed using the Mamdani reasoning method to calculate the fuzzy output result of the PID parameter adjustment strategy. Step S45: The fuzzy output result of the PID parameter adjustment strategy obtained in step S44 is defuzzified using the centroid method to convert the fuzzy quantity into a precise value, thereby obtaining the specific PID parameter adjustment value. Step S46: Based on the PID parameter adjustment value obtained in step S45, establish a mapping relationship with the blower frequency adjustment parameter, output the blower frequency adjustment parameter, and send it as a control signal to the blower control system to realize real-time dynamic adjustment of the blower frequency.

7. The intelligent sewage treatment method according to claim 6, characterized in that, Based on the blower frequency parameters and the real-time water quality data in step S1, the influence of the blower frequency parameters on dissolved oxygen distribution and hydraulic shear force is analyzed. Based on feedback from microbial activity, the sludge return ratio and stirring intensity are optimized to generate a combination of hydraulic parameters conducive to stabilizing the microbial community, including: Step S51: Based on the blower frequency adjustment parameters obtained in step S46, and simultaneously extract the real-time water quality data processed in step S1, including DO, SS, and microbial activity data, perform correlation analysis between the blower frequency parameters and the DO data in the real-time water quality data, plot the distribution curves of dissolved oxygen with time and space under different blower frequencies, and explore the influence of blower frequency on dissolved oxygen distribution. Step S52: The hydraulic shear force of the blower at different frequencies is measured and recorded in advance through experiments to form the correspondence between different frequencies of the blower and the hydraulic shear force. Step S53: The relationship between the blower frequency and hydraulic shear force determined in step S52 is combined with the microbial activity data in step S1 for comprehensive analysis. The changing trend of microbial activity under different hydraulic shear forces is studied, and the hydraulic shear force threshold that has a positive effect on microbial activity is identified. Step S54: Based on the relationship between microbial activity and hydraulic shear force obtained in step S53, as well as the dissolved oxygen distribution, establish a correlation model between sludge return ratio, stirring intensity and microbial activity. By setting different combinations of sludge return ratio and stirring intensity parameters, simulate the response of microbial activity and screen out parameter combinations that are conducive to improving microbial activity. Step S55: The sludge return ratio and stirring intensity parameter combination selected in step S54 are evaluated in combination with the constraints of the actual fecal sewage treatment process. The genetic algorithm is used to further optimize the parameter combination to generate a hydraulic parameter combination that helps stabilize the microbial community, including the optimal sludge return ratio and stirring intensity.

8. The intelligent sewage treatment method according to claim 7, characterized in that, Based on the hydraulic parameters optimized in step S5, the aeration volume requirement M for the future period in step S3, and considering the time-of-use electricity price of the power grid and the daily treatment volume requirement of sewage, a minimum cost operation plan is formulated to meet the daily treatment volume requirement, including: Step S61: Obtain the optimized hydraulic parameters from step S55, extract the predicted aeration demand M for future periods output from step S341, collect time-of-use electricity price data of the power grid, clarify the electricity price standards for different periods, and integrate these data with the daily treatment capacity demand of the sewage treatment plant to establish a basic dataset. Step S62: Based on the basic dataset integrated in step S61, construct a cost model for fecal and sewage treatment, link hydraulic parameters with equipment energy consumption, link aeration demand M with blower energy consumption, and combine time-of-use electricity pricing to calculate the treatment cost for each time period under different combinations of operating parameters, clarifying the quantitative relationship between cost and each parameter. Step S63: Taking the daily treatment capacity of fecal sewage as a constraint, and combining the cost model constructed in step S62, the objective function is set as minimizing the total daily cost of fecal sewage treatment. A mathematical optimization algorithm is used to optimize and solve the values ​​of hydraulic parameters and aeration volume at different times. Step S64: Perform feasibility verification on the operating parameter combination scheme obtained in step S63, check whether each parameter is within the equipment's operating capacity range and whether it meets the technical requirements of the sewage treatment process. If there are infeasible parameters, adjust the parameter value range and re-optimize the solution until a feasible operating parameter combination scheme is obtained.

9. The intelligent sewage treatment method according to claim 8, characterized in that, Step S64 also includes: Step S641: The feasible combination of operating parameters verified in step S64 is refined into specific operating instructions, specifying the specific values ​​of sludge return ratio, stirring intensity, and aeration volume parameters for each time period, forming the lowest cost operating scheme under the premise of meeting the daily treatment capacity, and outputting the scheme for actual production use.

10. An intelligent sewage treatment system, applied to the intelligent sewage treatment method according to any one of claims 1-9, characterized in that, include: The data acquisition module is used to collect COD, ammonia nitrogen, DO, pH, water temperature, SS and microbial activity parameters of sewage in real time, and to normalize the collected water quality parameters to form a unified standard data foundation. The first model module, based on the data processed by the data acquisition module, uses the particle swarm optimization algorithm to optimize the membership function parameters and fuzzy rules of the adaptive neural fuzzy inference system. By training the ANFIS model, it outputs the predicted value of COD concentration in the biochemical tank in real time and forms a COD prediction model. The second model module uses the COD prediction value from the first model module and the processed data from the data acquisition module as input to build a Stacking ensemble model. The ensemble model contains a base learner and a meta learner. Then, the prediction results of the base learner are generated by five-fold cross-validation. These results are input into the meta learner for training and output the aeration demand M for future periods. The adjustment module establishes a fuzzy rule base based on the future aeration demand M output from the second model module and the DO data from the data acquisition module, clarifies the relationship between the deviations of M and DO, generates a PID parameter adjustment strategy through the Mamdani inference method, and then uses the centroid method to defuzzify and output the blower frequency adjustment parameters to achieve real-time dynamic adjustment of the blower frequency. The processing module analyzes the impact of blower frequency parameters on dissolved oxygen distribution and hydraulic shear force based on blower frequency adjustment parameters and real-time water quality data from the data acquisition module. Based on feedback from microbial activity, it optimizes the sludge return ratio and stirring intensity to generate a combination of hydraulic parameters that helps stabilize the microbial community. The scheme generation module, based on the hydraulic parameters optimized in the processing module, the future aeration demand M output by the second model module, and the time-of-use electricity price of the power grid and the daily treatment capacity of fecal sewage, formulates the lowest cost operation scheme under the premise of meeting the daily treatment capacity.