Sewage treatment process parameter optimization method and device, computer equipment and medium

By constructing an effluent quality prediction model and combining it with a greedy Monte Carlo search strategy, the problem of low efficiency in parameter optimization in wastewater treatment was solved, enabling the rapid identification of the optimal combination of process parameters for resource consumption, thereby improving the intelligence and economic benefits of wastewater treatment.

CN122264205APending Publication Date: 2026-06-23BEIJING JINDAYU ENVIRONMENT TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING JINDAYU ENVIRONMENT TECH CO LTD
Filing Date
2026-03-23
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

Existing technologies struggle to quickly find the globally optimal parameter combination that balances effluent quality standards with resource minimization in wastewater treatment. This is especially true in the sequencing batch reactor (SBR) process, where traditional methods such as NSGA-II, grid search, and genetic algorithms are inefficient in high-dimensional parameter spaces and fail to meet practical engineering requirements.

Method used

By constructing an effluent water quality prediction model, deep learning algorithms are used to explore the nonlinear correlation between influent water quality and process parameters. Combined with a greedy Monte Carlo search strategy, the initial process parameters are iteratively optimized to find the target process parameters that meet the preset optimization conditions.

Benefits of technology

This technology enables the rapid identification of the optimal combination of process parameters for resource consumption while ensuring stable and compliant effluent quality, thereby improving the intelligence level and economic efficiency of wastewater treatment processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122264205A_ABST
    Figure CN122264205A_ABST
Patent Text Reader

Abstract

This invention relates to the field of wastewater treatment technology, and discloses a method, apparatus, computer equipment, and medium for optimizing wastewater treatment process parameters. The method includes: acquiring initial process parameters of the biochemical stage of a wastewater treatment process and current influent water quality data; inputting the current influent water quality data and the initial process parameters into a pre-constructed effluent water quality prediction model to obtain first predicted effluent water quality data; iteratively optimizing the initial process parameters based on the current influent water quality data and the first predicted effluent water quality data to obtain target process parameters that meet preset optimization conditions, wherein the target process parameters are used to adjust the operating parameters of the process equipment. This invention solves the problems of low search efficiency and difficulty in quickly finding the globally optimal parameters that achieve effluent water quality compliance and minimize resource consumption in the context of multi-parameter optimization of wastewater treatment processes in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of wastewater treatment technology, specifically to methods, apparatus, computer equipment, and media for optimizing wastewater treatment process parameters. Background Technology

[0002] The Sequencing Batch Reactor (SBR) process has been widely used in wastewater treatment due to its simple structure, small footprint, strong resistance to shock loads, and flexible operation. With the rapid development of artificial intelligence (AI) technology, its application in wastewater treatment is gradually emerging, but it is still in its early exploratory stages. Existing research is mostly based on statistical analysis or traditional machine learning methods, seeking correlations between historical operating data (such as influent water quality, process parameters, and effluent quality). While these methods can provide some data reference for process adjustments, their depth of analysis is limited, only capturing linear or shallow correlations. They struggle to handle the complex nonlinear and multi-parameter coupling relationships between influent water quality, process parameters, and effluent quality, resulting in poor model adaptability and inability to dynamically update. When high influent loads or water quality fluctuations occur that are not previously recorded in historical data, models based on historical patterns often fail, unable to provide accurate guidance for actual production.

[0003] Existing technologies also have significant shortcomings in parameter optimization. For the optimization of multiple parameters (such as aeration time, aeration rate, and reaction time) involved in SBR processes, traditional methods such as Non-Dominated Sorting Genetic Algorithm II (NSGA-II), grid search, and Genetic Algorithm (GA) suffer from serious deficiencies in search efficiency. NSGA-II has high computational complexity, with search time increasing exponentially with parameter dimensionality; grid search requires traversing the entire parameter space, resulting in enormous computational demands, which is difficult to implement in practical engineering; GA has slow convergence speed in high-dimensional parameter spaces, is prone to getting trapped in local optima, and cannot quickly find the globally optimal parameter combination that achieves effluent quality standards and minimizes production costs within a limited time, failing to meet the demands of practical engineering for efficient, low-cost, and automated operation. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide a method, apparatus, computer equipment and medium for optimizing wastewater treatment process parameters, in order to solve the problems of low search efficiency and difficulty in quickly finding the globally optimal parameters that achieve effluent quality compliance and minimize resource consumption in the context of multi-parameter optimization of wastewater treatment processes in the prior art.

[0005] In a first aspect, embodiments of the present invention provide a method for optimizing wastewater treatment process parameters, the method comprising:

[0006] Obtain the initial process parameters of the biological stage of the wastewater treatment process and the current influent water quality data; The current influent water quality data and the initial process parameters are input into the pre-constructed effluent water quality prediction model to obtain the first predicted effluent water quality data. Based on the current influent water quality data and the first predicted effluent water quality data, the initial process parameters are iteratively optimized to obtain target process parameters that meet preset optimization conditions. The target process parameters are used to adjust the operating parameters of the process equipment.

[0007] Furthermore, the method for constructing the effluent water quality prediction model includes: Obtain historical operating data of the biochemical section of the wastewater treatment process, wherein the historical operating data includes at least historical influent water quality data, historical process parameters, and corresponding historical effluent water quality data; A training sample set is constructed using the historical operating data, wherein the training sample set takes the historical process parameters and the corresponding historical influent water quality data as input and the corresponding historical effluent water quality data as output. The initial prediction model is trained using the training sample set to obtain the effluent water quality prediction model.

[0008] Furthermore, the step of constructing a training sample set using the historical operational data includes: Calculate the process characteristic indicators corresponding to the historical operating data, wherein the process characteristic indicators include at least one of the following: aeration intensity, air-to-water ratio, stirring intensity, stirring duration ratio, sludge load, pollutant load, wastewater volume index, free ammonia inhibition factor, sulfide inhibition factor, nutrient balance ratio, and alkalinity supply. The training sample set is constructed by using the process characteristic indicators and the historical process parameters as input data and the historical effluent water quality data as output data.

[0009] Furthermore, the iterative optimization of the initial process parameters based on the current influent water quality data and the first predicted effluent water quality data to obtain target process parameters that meet preset optimization conditions includes: The first evaluation function value corresponding to the initial process parameters is calculated using the current influent water quality data and the first predicted effluent water quality data. Select any candidate process parameter in the process parameter space, and input the current influent water quality data and the candidate process parameter into the pre-constructed effluent water quality prediction model to obtain the second predicted effluent water quality data; The second evaluation function value corresponding to the candidate process parameters is calculated using the current influent water quality data and the second predicted effluent water quality data. Based on the first evaluation function value and the second evaluation function value, the baseline process parameters for the next iteration are determined from the initial process parameters and the candidate process parameters, and candidate process parameters for the next iteration are selected from the process parameter space. Repeat the iterative optimization process until the target process parameters that meet the preset optimization conditions are obtained.

[0010] Furthermore, the step of calculating the first evaluation function value corresponding to the initial process parameters using the current influent water quality data and the first predicted effluent water quality data includes: Calculate the purification resource consumption corresponding to the initial process parameters based on the current influent water quality data and the first predicted effluent water quality data. Calculate the consumption of reagent resources and energy resources corresponding to the initial process parameters; Calculate the corresponding resource consumption coefficient based on the purification resource consumption, the reagent resource consumption, and the energy resource consumption; The first evaluation function value corresponding to the initial process parameters is determined based on the resource consumption coefficient.

[0011] Furthermore, determining the baseline process parameters for the next iteration based on the first evaluation function value and the second evaluation function value from the initial process parameters and the candidate process parameters includes: When the value of the second evaluation function is greater than the value of the first evaluation function, the candidate process parameter is determined as the baseline process parameter for the next iteration; When the value of the second evaluation function is less than or equal to the value of the first evaluation function, the candidate process parameter is determined as the benchmark process parameter for the next iteration with a preset probability, or the initial process parameter is determined as the benchmark process parameter for the next iteration with a preset probability.

[0012] Furthermore, the method also includes: Obtain the actual effluent water quality data after the process equipment operates based on the target process parameters; Calculate the corresponding prediction deviation data based on the actual effluent water quality data and the predicted effluent water quality data corresponding to the target process parameters. When the predicted deviation data reaches the preset deviation condition, the model parameters in the effluent water quality prediction model are updated.

[0013] Secondly, embodiments of the present invention provide a wastewater treatment process parameter optimization device, the device comprising: The acquisition module is used to acquire the initial process parameters of the biochemical section of the wastewater treatment process and the current influent water quality data; The input module is used to input the current influent water quality data and the initial process parameters into the pre-constructed effluent water quality prediction model to obtain the first predicted effluent water quality data. The optimization module is used to iteratively optimize the initial process parameters based on the current influent water quality data and the first predicted effluent water quality data to obtain target process parameters that meet preset optimization conditions, wherein the target process parameters are used to adjust the operating parameters of the process equipment.

[0014] Thirdly, embodiments of the present invention provide a computer device, including: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the method described in the first aspect or any corresponding embodiment thereof.

[0015] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer instructions that cause a computer to perform the method described in the first aspect or any of its corresponding embodiments.

[0016] The method provided in this application has the following beneficial effects: The method provided in this application provides a real-time and accurate data foundation for subsequent precise prediction and optimization by acquiring the initial process parameters of the biochemical section of the wastewater treatment process and the current influent water quality data, ensuring the reliability of the input during the optimization process. By inputting the current influent water quality data and the initial process parameters into a pre-constructed effluent water quality prediction model, the first predicted effluent water quality data is obtained. The model is used to deeply mine the nonlinear correlation patterns in historical data, achieving rapid and accurate prediction of the process treatment effect, avoiding the limitations of traditional methods that rely on experience or simple statistics. By iteratively optimizing the initial process parameters based on the current influent water quality data and the first predicted effluent water quality data, target process parameters that meet preset optimization conditions are obtained. The target process parameters are then used to adjust the operating parameters of the process equipment. Under the premise of ensuring stable effluent water quality compliance, the optimal combination of process parameters is quickly found using an efficient search strategy, realizing closed-loop optimization from data prediction to parameter decision-making to equipment control, significantly improving the intelligence level and economic benefits of process operation. Attached Figure Description

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

[0018] Figure 1 This is a schematic flowchart of a wastewater treatment process parameter optimization method according to an embodiment of the present invention; Figure 2 This is a schematic flowchart of another wastewater treatment process parameter optimization method according to an embodiment of the present invention; Figure 3 This is a flowchart illustrating the parameter optimization iterative search process according to an embodiment of the present invention; Figure 4 This is a schematic flowchart of another wastewater treatment process parameter optimization method according to an embodiment of the present invention; Figure 5 This is a structural block diagram of a wastewater treatment process parameter optimization device according to an embodiment of the present invention; Figure 6 This is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] According to embodiments of the present invention, a method, apparatus, computer equipment, and medium for optimizing wastewater treatment process parameters are provided. It should be noted that the steps shown in the flowcharts in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0021] This embodiment provides a method for optimizing wastewater treatment process parameters. Figure 1 This is a flowchart of a wastewater treatment process parameter optimization method according to an embodiment of the present invention, such as... Figure 1 As shown, the process includes the following steps: Step S101: Obtain the initial process parameters of the biochemical section of the wastewater treatment process and the current influent water quality data.

[0022] In this embodiment, the biochemical section of the wastewater treatment process refers to the unit in the wastewater treatment process that utilizes microorganisms to carry out biochemical reactions such as organic matter degradation, nitrogen and phosphorus removal, etc., such as the reaction tank part of the sequencing batch reactor (SBR). This area maintains the activity of microorganisms through controlled aeration, stirring, and other operations to achieve pollutant transformation. Initial process parameters refer to various adjustable control parameters set before process operation or at the beginning of the current cycle. Typical parameters include influent level, anoxic reaction time, aeration reaction time, dosage of reagents (such as phosphate salts, liquid alkali), instantaneous aeration flow rate, etc. These parameters directly affect the treatment effect and energy consumption. Current influent water quality data refers to the water quality indicators of the wastewater that will enter the biochemical section before entering the reaction tank. These typically include chemical oxygen demand (COD), ammonia nitrogen concentration, total nitrogen concentration, pH value, temperature, etc., which can be obtained through real-time monitoring by online sensors or laboratory testing.

[0023] Specifically, the system collects necessary information from multiple data sources via data interfaces. For initial process parameters, the currently set operating parameter values ​​are typically read from the wastewater treatment plant's automatic control system (such as PLC or DCS) or process management database. For example, the frequency settings of aerator blowers and the acceleration rate of metering pumps are exported from the SCADA system. Current influent water quality data is acquired in real-time through online water quality monitoring instruments deployed in the influent channel or equalization tank (such as online COD analyzers, online ammonia nitrogen sensors, and pH meters), or by obtaining the latest test results from a Laboratory Information Management System (LIMS). To ensure data consistency, the system can set a fixed collection frequency (e.g., 5 minutes before each batch begins) to align process parameters and water quality data by timestamp. Furthermore, if the data is stored in different databases (e.g., PostgreSQL for test data and InfluxDB for sensor data), data extraction scripts (such as SQL queries and API calls) are written to extract the data separately and then integrate them in memory or temporary storage to form a complete input dataset for subsequent steps.

[0024] Step S102: Input the current influent water quality data and initial process parameters into the pre-constructed effluent water quality prediction model to obtain the first predicted effluent water quality data.

[0025] In this embodiment, the pre-constructed effluent quality prediction model refers to a mathematical model pre-trained using deep learning algorithms (such as fully connected neural networks) based on historical operating data of the biochemical section of a wastewater treatment process. This model can predict the corresponding effluent quality based on input water quality data and process parameters. By mining the nonlinear correlation between influent water quality, process parameters, and effluent water quality in historical data, this model achieves accurate prediction of treatment effects under different operating conditions. The first predicted effluent water quality data refers to the expected effluent water quality indicators calculated and output by the model after inputting the current influent water quality data and initial process parameters into the aforementioned prediction model. These typically include the concentration values ​​of key pollutants such as chemical oxygen demand (COD), ammonia nitrogen concentration, and total nitrogen concentration, used for effect evaluation in subsequent optimization steps.

[0026] Specifically, the current influent water quality data (such as COD, ammonia nitrogen, total nitrogen, pH, temperature, etc.) and initial process parameters (such as influent level a, anoxic reaction time b, aeration reaction time c, phosphate dosage d, liquid alkali dosage e, instantaneous aeration flow rate f) are used as input data. Since the pre-built effluent water quality prediction model incorporates process mechanism characteristics (such as aeration intensity, air-to-water ratio, stirring intensity, etc.) during training, the system needs to calculate these process characteristic indicators in real time based on the current influent water quality data and initial process parameters before actual prediction (e.g., aeration intensity AI = instantaneous aeration flow rate f / effective wastewater volume, air-to-water ratio = f). (c / effective volume of wastewater, etc.) and combine the calculated feature indicators with some original parameters to form a vector (usually 12-dimensional) conforming to the model input format. Then, the system calls a pre-trained fully connected neural network model (a 4-layer FNN structure including a Dropout layer) to calculate three values ​​from the output layer through forward propagation: COD, ammonia nitrogen, and total nitrogen concentrations in the first predicted effluent water quality data. The entire process is completed in milliseconds, providing rapid effluent effect predictions for subsequent parameter optimization. In engineering practice, this step can be implemented as a model service encapsulated as a RESTful API, or integrated as an offline calculation module into process optimization software, supporting batch prediction and real-time invocation.

[0027] Step S103: Based on the current influent water quality data and the first predicted effluent water quality data, the initial process parameters are iteratively optimized to obtain target process parameters that meet the preset optimization conditions. The target process parameters are used to adjust the operating parameters of the process equipment.

[0028] In this embodiment, iterative optimization refers to the process of gradually adjusting process parameters through repeated iterative calculations to find the optimal parameter combination. In each iteration, the evaluation function value based on the current parameters is compared with the evaluation function values ​​of candidate parameters, and the next benchmark parameter is selected according to preset rules (such as the greedy-Monte Carlo criterion) until the termination condition is met. The preset optimization condition is a pre-set standard for stopping iteration, such as the evaluation function value converging to a stable range, reaching the maximum number of iterations, or the upper limit of the search time. Its core objective is to ensure that the finally found process parameters can minimize the operating cost while ensuring that the effluent water quality meets the standards. The target process parameters are the process parameter combinations that are finally determined after iterative optimization and meet the preset optimization conditions, and are used to directly adjust the operating status of process equipment (such as aerators, metering pumps, etc.) in the future.

[0029] Specifically, based on the first predicted effluent water quality data and the current influent water quality data, the first evaluation function value corresponding to the initial process parameters is calculated. This evaluation function comprehensively reflects the overall operating cost under the current parameter combination. Its calculation method includes: calculating the pollutant removal amount based on the difference between influent and effluent water quality and multiplying it by the unit removal cost to obtain the purification resource consumption; calculating the chemical resource consumption and energy resource consumption based on the dosage of chemicals (such as phosphate salts and liquid alkali) and energy consumption (such as the power of the stirring motor and the power of the aeration blower); weighting and summing the above resource consumption amounts, and introducing a non-compliance penalty factor (such as adding a penalty term when the removal rate does not meet the standard), finally obtaining a quantified resource consumption coefficient as the evaluation function value.

[0030] Subsequently, a candidate process parameter is selected from a predefined process parameter space (such as the feasible value set of parameters like influent level, anoxic reaction time, and aeration reaction time). This candidate parameter, along with the current influent water quality data, is input into the effluent water quality prediction model to obtain the second predicted effluent water quality data. The second evaluation function value corresponding to this candidate parameter is then calculated using the same method. Based on the comparison between the first and second evaluation function values, the system determines the benchmark process parameter for the next iteration according to the greedy-Monte Carlo fusion rule: if the second evaluation function value is better than the first evaluation function value (i.e., smaller), the candidate parameter is directly accepted as the new benchmark; if the second evaluation function value is worse than the first evaluation function value, the worse solution is accepted with a small preset probability (e.g., ε < 0.1), thus escaping the local optimum trap and enhancing the global search capability. The system continuously repeats the above process of "selecting candidates - predicting - evaluating - comparing - updating the baseline," changing only some parameter dimensions in each iteration (for example, first fixing the influent level, phosphate dosage, and liquid alkali dosage, then performing a greedy search on the anoxic reaction time, aeration reaction time, and instantaneous aeration flow rate, interspersed with Monte Carlo random perturbations) until the preset optimization conditions are met (such as the evaluation function value showing no improvement for multiple consecutive times or the number of iterations being exhausted). At this point, the current baseline parameter is determined as the target process parameter. This target parameter is then pushed to the automatic control system for real-time adjustment of the operating parameters of the aeration equipment, mixing equipment, and dosing device.

[0031] As an example, taking a coking wastewater treatment SBR process as an example, before each batch of influent begins, initial process parameters are read from the PLC in the central control room: influent level 0.45 meters, anoxic reaction time 3 hours, aeration reaction time 5 hours, phosphate dosage 50 kg, liquid alkali dosage 2000 kg, and instantaneous aeration flow rate 8000 m³ / h. Simultaneously, current influent water quality data is obtained through online monitoring instruments: COD concentration 1200 mg / L, ammonia nitrogen concentration 150 mg / L, total nitrogen concentration 180 mg / L, pH value 7.8, and temperature 25 degrees Celsius. Based on the current influent water quality data and initial process parameters, 12 process characteristic indicators, such as aeration intensity, air-to-water ratio, and stirring intensity, are calculated, and input vectors are constructed and fed into a pre-built fully connected neural network effluent water quality prediction model. After forward propagation, the model outputs the first predicted effluent water quality data: COD 80 mg / L, ammonia nitrogen 5 mg / L, and total nitrogen 30 mg / L, indicating that the expected effluent water quality meets the discharge standards under the current parameter combination. Based on the current influent water quality data and the first predicted effluent water quality data, the first evaluation function value C1=125 corresponding to the initial process parameters is calculated (considering the cost of pollutant removal, reagent cost, energy consumption cost, and compliance penalty). Subsequently, the system fixes the influent level a, phosphate dosage d, and liquid alkali dosage e, and uses a greedy-Monte Carlo fusion algorithm to iteratively optimize the anoxic reaction time b, aeration reaction time c, and instantaneous aeration flow rate f: b=2.5h, 3.5h, and 4h are tried in sequence, and the predicted effluent water quality is substituted into the model and the evaluation function value is calculated. It is found that the C value drops to 118 when b=3.5h, so the baseline b=3.5h is updated; then c=4 is tried on the basis of b=3.5h. 0.5h, 5.5h, 6h, found that C=110 when c=5.5h; then tried f=7500m³ / h, 8500m³ / h, 9000m³ / h, where C=105 when f=8500m³ / h, but the Monte Carlo step accepted a poor f=9000m³ / h (C=108) with a probability of ε=0.05 to explore new regions. Subsequent iterations found that there was no better solution in this direction, and finally regressed to f=8500m³ / h. After multiple iterations, when the evaluation function value stabilized at 102 and showed no improvement for three consecutive rounds, the system terminated the search and output the target process parameters: influent level a = 0.45m, anoxic reaction time b = 3.5h, aeration reaction time c = 5.5h, phosphate dosage d = 50kg, liquid alkali dosage e = 2000kg, and instantaneous aeration flow rate f = 8500m³ / h. These target parameters are expected to reduce operating resource consumption by approximately 18% compared to the initial scheme while ensuring effluent meets standards. Subsequently, the target process parameters are pushed to the automatic control system to adjust the operating parameters of the aeration blower, mixing equipment, and dosing device, achieving optimized process control.

[0032] In the embodiments of this application, the method for constructing the effluent water quality prediction model is as follows: Figure 2 As shown, it includes: Step S201: Obtain historical operating data of the biochemical section of the wastewater treatment process. The historical operating data includes at least historical influent water quality data, historical process parameters, and corresponding historical effluent water quality data.

[0033] In this embodiment, historical operating data refers to various recorded data related to the operation of the biological treatment section of the SBR process accumulated by the wastewater treatment plant during past production cycles. This includes, but is not limited to, influent water quality, process parameter settings, and corresponding effluent effects, serving as the foundational material for constructing predictive models. Historical influent water quality data refers to the wastewater quality indicators entering the biological treatment section monitored before the start of each treatment batch, such as COD, ammonia nitrogen, total nitrogen, pH, and temperature, typically derived from online instruments or laboratory test records. Historical process parameters refer to the adjustable control parameters actually set in each treatment batch, such as influent level, anoxic reaction time, aeration reaction time, reagent dosage, and aeration flow rate, which can be obtained from automatic control system logs or process reports. Historical effluent water quality data refers to the water quality indicators obtained by detecting the treated effluent after each treatment batch, such as effluent COD, ammonia nitrogen, and total nitrogen, used to evaluate the actual treatment effect of the process parameters for that batch.

[0034] Specifically, historical operational data is extracted from multiple data sources via data interfaces. Laboratory data (such as influent and effluent water quality indicators, reagent dosage, etc.) is typically stored in relational databases (such as PostgreSQL) and exported in batches by time range (e.g., all data from the past year or since the process was put into operation) using SQL queries. Real-time sensor monitoring data (such as instantaneous aeration flow rate, temperature, pH, etc.) is stored in time-series databases (such as InfluxDB), and values ​​with corresponding timestamps are obtained through a time-series query API. Since the two types of data are stored in different databases and their collection frequencies may differ (laboratory data is typically recorded daily or per batch, while sensor data is recorded continuously at high frequencies), the system needs to perform time alignment on a batch basis: based on the start and end times of each batch, the average, cumulative, or specific moment value (such as the liquid level at the start time) for that period is extracted from the sensor database and correlated with the corresponding batch record in the laboratory data table to form a complete original historical operational dataset. Furthermore, for partially missing or inconsistently formatted data, preliminary screening can be performed during the acquisition phase to remove obviously abnormal or duplicate records, ensuring the reliability of subsequent sample construction. In practical engineering, it can also be extended to read process parameters directly from the historical archives of PLC controllers through the industrial Internet of Things platform, or export reagent procurement and consumption records from the resource planning system (ERP) as a supplement to enrich the dimensions of historical data.

[0035] Step S202: Construct a training sample set using historical operating data, wherein the training sample set takes historical process parameters and corresponding historical influent water quality data as input and corresponding historical effluent water quality data as output.

[0036] In this embodiment of the application, a training sample set is constructed using historical operational data, including: Step A1: Calculate the process characteristic indicators corresponding to the historical operating data. The process characteristic indicators include at least one of the following: aeration intensity, air-to-water ratio, stirring intensity, stirring duration ratio, sludge load, pollutant load, wastewater volume index, free ammonia inhibition factor, sulfide inhibition factor, nutrient balance ratio, and alkalinity supply.

[0037] It should be noted that process characteristic indicators refer to derived parameters that are calculated from historical operating data based on the wastewater treatment process mechanism and can more profoundly reflect the state and conditions of biochemical reactions. Among them, aeration intensity refers to the aeration volume per unit effective volume per unit time, used to characterize aeration efficiency; air-to-water ratio refers to the ratio of total aeration volume to treated water volume, reflecting the matching degree of aeration scale; stirring intensity characterizes the mixing shear force, which is related to stirring power, wastewater viscosity and liquid level, and is used to assess mixing uniformity; stirring time ratio is the proportion of anoxic reaction time to total reaction time, affecting denitrification and hydrolysis effects; sludge load refers to the amount of organic matter carried by a unit mass of sludge per day, reflecting the microbial treatment pressure; pollutant load refers to the total amount of pollutants treated in a single batch, determining the required reaction intensity; wastewater volume index is calculated by settling ratio and sludge concentration to assess sludge settling performance; free ammonia inhibition factor is calculated based on pH and temperature to assess the potential inhibition of free ammonia on sludge; sulfide inhibition factor is calculated based on pH and sulfide concentration to assess the toxicity impact of sulfides; nutrient balance ratio reflects whether the carbon, nitrogen and phosphorus ratio meets the growth requirements of microorganisms; alkalinity supply integrates influent alkalinity, residual alkalinity in the tank and added alkalinity to measure the system's buffering capacity.

[0038] Specifically, for each piece of historical operational data (including historical influent water quality data, historical process parameters, corresponding historical effluent water quality data, and necessary sensor records), each process characteristic index is calculated sequentially according to a predefined process mechanism formula. During the calculation, the necessary raw variables are first extracted from the data: for example, COD, ammonia nitrogen, total nitrogen, pH, temperature, sulfide concentration, and alkalinity are obtained from the influent water quality data; influent level (a), anoxic reaction time (b), aeration reaction time (c), phosphate dosage (d), liquid alkali dosage (e), and instantaneous aeration flow rate (f) are obtained from the process parameters; sludge concentration, 30-minute settling ratio, mixer power (P), influent level (H1), reaction tank bottom area (S), and wastewater dynamic viscosity (μ) (interpolated from a table based on temperature) are obtained from the sensor records. Then, each characteristic index is calculated sequentially by substituting it into the formula. Aeration intensity = f / (S) (H1+a)); Carbonated water ratio = f c / (S (H1+a)); Stirring intensity = sqrt(P / (μ)) (H1+a))); The mixing time ratio = b / (b+c); Sludge load = (Influent COD) a S) / (MLSS S H1 (b+c)), where MLSS is the sludge concentration; Pollutant load = influent COD a S (can be calculated separately for different pollutants); Wastewater volume index = sedimentation ratio 10 / MLSS; Free ammonia inhibitory factor = 10^pH / exp(6334 / (273+T)+10^pH); Sulfide inhibitory factor = 1 / (1+K_s / 10^(-pH)); Nutrient balance ratio = Influent COD / (Influent ammonia nitrogen) 5-Influent phosphorus concentration 15), where the influent phosphorus concentration needs to be calculated in conjunction with the phosphate salt dosage d, influent phosphorus concentration = (influent concentration) a S+d) / (a S); Alkalinity supply = Influent alkalinity a Residual alkalinity in S+ tank H1 S+e 1000 0.08 1.25.

[0039] All calculation results serve as the process feature index vector corresponding to the historical data, which can be used to construct training samples later. To ensure the accuracy of the calculation, the parameter mapping relationship of each formula can be established in advance, and temperature-dependent viscosity interpolation can be processed (a hydrodynamic viscosity table can be pre-stored, and linear interpolation can be performed based on temperature).

[0040] It should be noted that when calculating the stirring intensity, the corresponding dynamic viscosity coefficient μ can be obtained by interpolation from the table below based on the wastewater temperature to ensure the accuracy of the calculation results:

[0041] As an example, taking a batch of historical data from a SBR process for treating coking wastewater as an example: Influent water quality: COD 1200 mg / L, ammonia nitrogen 150 mg / L, total nitrogen 180 mg / L, pH 7.8, temperature 25℃, sulfide concentration 0.5 mg / L, influent alkalinity 200 mg / L; Process parameters: Influent level a = 0.45 m, anoxic reaction time b = 3 h, aeration reaction time c = 5 h, phosphate dosage d = 50 kg, liquid alkali dosage e = 2000 kg, instantaneous aeration flow rate f = 8000 m³ / h; Sensor data: Reactor bottom area S = 100 m², influent level H1 = 0.2 m, sludge concentration MLSS = 4 g / L, 30-minute settling ratio = 30%, mixer power P = 5 kW, residual alkalinity in the tank 150 mg / L. Based on the hydrodynamic viscosity table at 25℃, μ = 0.899 × 10⁻⁶. - ³kPa·s. Calculate each characteristic index: Aeration intensity = 8000 / (100) (0.2+0.45))≈123.08m³ / (m²·h); Carbonated water ratio = 8000 5 / (100 0.65)≈615.38; Stirring intensity = sqrt(5000 / (0.899e-3)) (0.65)))≈sqrt(8.56e6)≈2927s - ¹; The mixing time ratio = 3 / (3+5) = 0.375; sludge load = (1200 0.45 100) / (4 100 0.2 8) = 84.375 kg COD / (kg MLSS·d) (Note the unit conversion); Pollutant load = 1200 0.45 100 = 54 kg; Wastewater volume index = 30 10 / 4 = 75; Free ammonia inhibitory factor = 10^7.8 / exp(6334 / (273+25)+10^7.8)≈0.036; Sulfide inhibition factor = 1 / (1+0.5 / 10^(-7.8))≈3.16e-8; Nutrient balance ratio = 1200 / (150) 5-Influent phosphorus concentration 15) The influent phosphorus concentration needs to be calculated first: Assuming the influent phosphorus concentration = 5 mg / L, then the contribution of phosphate salt addition = 50 kg / (0.45) 100 1000)≈1.11mg / L, total phosphorus≈6.11mg / L, then the nutrient balance ratio =1200 / (750-91.65)≈1.82; Alkalinity supply = 200 0.45 100+150 0.2 100+2000 1000 0.08 1.25 = 212000mg (calculated as CaCO3).

[0042] Step A2 involves using process characteristic indicators and historical process parameters as input data and historical effluent water quality data as output data to construct a training sample set.

[0043] Specifically, the process characteristic indicators (such as aeration intensity, air-to-water ratio, and stirring intensity) of each batch of historical data are concatenated with the historical process parameters (such as influent level a, anoxic reaction time b, aeration reaction time c, phosphate dosage d, liquid alkali dosage e, and instantaneous aeration flow rate f) of that batch to form a complete input feature vector. Simultaneously, the historical effluent water quality data (such as effluent COD, ammonia nitrogen, and total nitrogen concentration) of that batch are used as the corresponding output labels. All input-output pairs from all batches together constitute the original training sample set. To improve the model's adaptability to abnormal operating conditions, data augmentation techniques can be used to expand the sample size. For example, the SMOTE algorithm can be applied to minority class samples (such as effluent exceeding standards) to synthesize new samples, or Gaussian noise can be added to existing samples to generate variants. Subsequently, the sample set undergoes preprocessing: input features and output labels are scaled to similar dimensions (e.g., using Z-score normalization or Min-Max normalization) to accelerate model convergence; the samples are randomly divided into training, validation, and test sets according to a certain ratio (e.g., 7:2:1) to ensure that each data distribution is independent and highly representative. The final training sample set is stored in a structured format (e.g., TFRecord, NumPy array, or database table) for use in training the model. In practical engineering, this can be encapsulated as an automated data processing pipeline, periodically updating the sample set based on incremental historical data, and supporting dynamic adjustment of feature combinations and enhancement strategies.

[0044] Step S203: Train the initial prediction model using the training sample set to obtain the effluent water quality prediction model.

[0045] In this embodiment, the initial prediction model refers to a deep learning model that has not yet learned the patterns of historical data before training. It typically includes randomly initialized network weights and a preset network structure (such as the number of layers, neurons, activation functions, etc.), and is the model to be trained. The effluent quality prediction model refers to a model that, after training, can accurately predict the effluent quality based on the input influent water quality data and process parameters; that is, the final model that has been trained and meets the performance requirements.

[0046] Specifically, the training sample set is first loaded, which already contains input features (a combination of process feature indicators and historical process parameters) and corresponding output labels (historical effluent water quality data). The samples are typically randomly divided into training, validation, and test sets in a 7:2:1 ratio to ensure that each dataset is independently distributed and representative. Then, the network structure of the initial prediction model is defined: based on a fully connected neural network, the input layer dimension matches the number of input features (e.g., 17 dimensions), the hidden layers use multi-layer stacking (e.g., 12 neurons in the first hidden layer and 6 neurons in the second hidden layer), a Dropout layer is added after each layer to prevent overfitting, and the output layer has 3 neurons, corresponding to the predicted effluent COD, ammonia nitrogen, and total nitrogen concentrations. A linear function is used as the activation function. The Adam optimizer is selected during model compilation, the root mean square error (RMSE) is used as the loss function, and an evaluation metric such as the coefficient of determination (R²) is set. An early stopping strategy is used during training: training is terminated early when the RMSE on the validation set no longer decreases for several consecutive rounds (e.g., 5 rounds) to avoid overfitting. After each round of training, the R² of the training and validation sets is calculated to monitor the model's fitting effect. After training, the model's performance is evaluated on the test set, requiring an R² of ≥0.92 for COD prediction, ≥0.90 for ammonia nitrogen prediction, and ≥0.80 for total nitrogen prediction, ensuring sufficient prediction accuracy. Models meeting these criteria are saved as effluent water quality prediction models for use in the optimization process.

[0047] In this embodiment, the initial process parameters are iteratively optimized based on the current influent water quality data and the first predicted effluent water quality data to obtain target process parameters that meet preset optimization conditions, including: Step B1: Calculate the first evaluation function value corresponding to the initial process parameters using the current influent water quality data and the first predicted effluent water quality data.

[0048] In this embodiment of the application, the calculation of the first evaluation function value corresponding to the initial process parameters using the current influent water quality data and the first predicted effluent water quality data includes: Step B101: Calculate the purification resource consumption corresponding to the initial process parameters based on the current influent water quality data and the first predicted effluent water quality data.

[0049] Specifically, the consumption of purification resources refers to the quantitative indicator of the treatment resources consumed in the wastewater treatment process to remove pollutants. It is expressed as the weighted sum of the mass of various pollutants removed through biochemical reactions and their corresponding unit removal costs. This indicator reflects the treatment overhead required by the treatment system to achieve a certain effluent quality under the current combination of process parameters and is an important component of the subsequent comprehensive evaluation function.

[0050] First, the influent concentration values ​​of each pollutant, including COD, ammonia nitrogen, and total nitrogen, are extracted from the current influent water quality data; simultaneously, the corresponding predicted effluent concentration values ​​are extracted from the first predicted effluent water quality data. Then, the removal amount of each pollutant is calculated, i.e., the influent concentration minus the effluent concentration (usually in mg / L). Since the total amount of pollutants is related to the treated water volume in the actual treatment process, but the evaluation function usually directly represents the removal contribution by multiplying the concentration difference by a weight, there is no need to multiply by the water volume (unless the weight definition already includes water volume conversion). The system calls the pre-set unit removal cost coefficients for each pollutant. These coefficients can be determined through historical data statistics (such as reagent dosage and energy consumption correlation analysis). For example, w_cod represents the treatment cost required to remove one milligram per liter of COD (dimensionless weight or normalized value). The formula for calculating the purification resource consumption C_r is: C_r = w_cod × (COD in - COD out) + w_ammonia nitrogen × (ammonia nitrogen in - ammonia nitrogen out) + w_total nitrogen × (total nitrogen in - total nitrogen out). The calculation results serve as the purification resource consumption corresponding to the process parameters, used for subsequent calculations of resource consumption coefficients. In practical applications, if the process involves other key pollutants (such as total phosphorus and suspended solids), corresponding weights can be configured in the system. The unit removal cost coefficient can be updated periodically based on changes in operating conditions or system calibration to ensure the timeliness of consumption calculations.

[0051] Step B102: Calculate the consumption of reagent resources and energy resources corresponding to the initial process parameters.

[0052] Specifically, reagent resource consumption refers to the quantitative indicator of resource consumption corresponding to the chemical reagents (such as phosphates and liquid alkali) added during wastewater treatment to remove pollutants. It is typically calculated based on the reagent dosage and a pre-set reagent consumption weighting coefficient, and is used to characterize the contribution of reagent use to the overall treatment cost. Energy resource consumption refers to the quantitative indicator of energy consumption corresponding to the electrical energy consumed by various equipment (such as stirring motors and aeration blowers) during the treatment process. It is calculated based on equipment operating time, power, and a pre-set energy consumption weighting coefficient, and is used to characterize the contribution of energy consumption to the overall treatment cost.

[0053] First, parameters related to reagent consumption are extracted from the initial process parameters, including phosphate dosage d (unit: kg) and liquid alkali dosage e (unit: kg). Pre-set reagent consumption weighting coefficients are then used, where w_p represents the consumption weight (dimensionless or normalized value) corresponding to a unit dosage of phosphate, and w_naoh represents the consumption weight corresponding to a unit dosage of liquid alkali. The formula for calculating reagent resource consumption C_m is: C_m = w_p × d + w_naoh × e. For energy resource consumption, the system extracts the anoxic reaction time b (unit: h), aeration reaction time c (unit: h), instantaneous aeration flow rate f (unit: m³ / h), and influent level a (unit: m) from the initial process parameters. Simultaneously, the power parameters of relevant equipment are acquired or calculated: the power P_A (unit: kW) of the anoxic stirring motor is a fixed equipment parameter; the power P_O of the aeration blower needs to be dynamically calculated based on the current operating conditions, and its formula is P_O=f×P / (3600×η), where P is the air pressure (unit: kPa) and η is the blower efficiency (usually taken as 0.85). The formula for calculating the air pressure P is P=(H1+a)×9.8×(1+15%), where H1 is the water level in the pool before water inlet (unit: m), and 15% is the resistance coefficient of the pipeline and aerator. The system calls the preset energy consumption weight coefficient β (i.e., the consumption weight corresponding to unit energy consumption), and the formula for calculating the energy resource consumption C_e is: C_e=β×(b×P_A+c×P_O). The calculated C_m and C_e are used as the reagent resource consumption and energy resource consumption corresponding to the initial process parameters for subsequent synthesis of resource consumption coefficients. In practical applications, the reagent consumption weighting coefficient can be updated periodically based on the actual consumption cost or reagent concentration, while the energy consumption weighting coefficient can be adjusted according to electricity prices or carbon emission factors. The system supports dynamic configuration of these coefficients to reflect changes in actual operating conditions. If the process involves other reagents (such as carbon sources or flocculants), corresponding weighting items can be configured in the system parameters.

[0054] Step B103: Calculate the corresponding resource consumption coefficient based on the consumption of purification resources, pharmaceutical resources, and energy resources.

[0055] Specifically, the resource consumption coefficient is a comprehensive quantitative indicator used to characterize the overall treatment cost incurred to achieve pollutant removal and ensure effluent compliance under the current combination of process parameters. This coefficient is calculated jointly from the consumption of reagent resources, energy resources, non-compliance penalty factor, purification resources, and influent level, and is the core value of the subsequent evaluation function.

[0056] First, obtain the purification resource consumption C_r, reagent resource consumption C_m, and energy resource consumption C_e. Then, calculate the removal rate of each pollutant based on the current influent water quality data and the first predicted effluent water quality data: COD removal rate = (COD in - COD out) / COD in × 100%, ammonia nitrogen removal rate = (ammonia nitrogen in - ammonia nitrogen out) / ammonia nitrogen in × 100%, total nitrogen removal rate = (total nitrogen in - total nitrogen out) / total nitrogen in × 100%. Compare each removal rate with the preset compliance thresholds (COD removal rate ≥ 90%, ammonia nitrogen removal rate ≥ 98%, total nitrogen removal rate ≥ 85%), and count the number of items that do not meet the standards (denoted as n). If n = 0, then the non-compliance penalty factor γ = 0; otherwise, γ = n × 10000 (where 10000 is the preset penalty base, which can be adjusted according to process requirements). The system extracts the influent level 'a' from the initial process parameters and then substitutes it into the formula for calculating the resource consumption coefficient C: C = (C_m + C_e + γ) / (C_r × a). This calculation result is the resource consumption coefficient corresponding to the current process parameters, serving as the basis for determining the value of the first evaluation function. To ensure calculation stability, if C_r or a is 0 (which is almost impossible in actual engineering), the system can preset a very small positive number (such as 1e-6) as a substitute. In practical applications, the compliance threshold and penalty base can be dynamically adjusted through configuration files to adapt to different emission standards or process requirements; if the process involves more pollutants (such as total phosphorus), the removal rate calculation and penalty logic can be adjusted accordingly.

[0057] Step B104: Determine the first evaluation function value corresponding to the initial process parameters based on the resource consumption coefficient.

[0058] Specifically, the first evaluation function value is a quantitative value determined based on the corresponding resource consumption coefficient for the initial process parameters. This value directly reflects the quality of the parameter combination in subsequent iterative optimization and is the core basis for parameter comparison and selection.

[0059] The resource consumption coefficient C (e.g., C=(C_m+C_e+γ) / (C_r×a)) is read and assigned to the first evaluation function value variable F_init. This value requires no further transformation, as the optimization objective is to minimize this coefficient (a smaller coefficient indicates lower overall processing overhead and better performance). Subsequently, the system associates and stores this value with the current process parameters (i.e., the initial process parameters) for use by the comparison logic. The calculation timestamp and parameter version of this coefficient can also be recorded for traceability and debugging. For example, the resource consumption coefficient C≈752.8 corresponds to the initial process parameters (a=0.45m, b=3h, c=5h, d=50kg, e=2000kg, f=8000m³ / h). The system directly determines 752.8 as the first evaluation function value and stores it in a memory data structure, marked as "initial parameter_evaluation function value=752.8". This value will be compared with the second evaluation function value of the candidate process parameters to determine whether to accept the candidate parameters as the benchmark for the next iteration.

[0060] Step B2: Select any candidate process parameter in the process parameter space, and input the current influent water quality data and the candidate process parameter into the pre-constructed effluent water quality prediction model to obtain the second predicted effluent water quality data.

[0061] Specifically, the process parameter space refers to the set of all possible process parameter values, defined by the minimum, maximum, and step size of each parameter. For example, the influent level 'a' ranges from 0.35 to 0.55 m (step size 0.01 m), and the anoxic reaction time 'b' ranges from 2.5 to 4 hours (step size 0.5 hours). This space contains all parameter combinations that can be explored by the optimization algorithm. Candidate process parameters are parameter combinations selected from the process parameter space during the current iteration to be evaluated and compared with the current baseline parameters to determine their superiority. The second predicted effluent quality data refers to the expected effluent quality indicators (usually including COD, ammonia nitrogen, and total nitrogen concentration) calculated and output by the model after inputting the current influent quality data and candidate process parameters into the pre-constructed effluent quality prediction model. These indicators are used to subsequently evaluate the treatment effect of the candidate process parameters.

[0062] As an example, the process parameter space of the SBR process includes the value range, step size, and number of candidate parameters for each process parameter, used to select candidate process parameters during iterative optimization, as shown in the table below:

[0063] First, a candidate process parameter is selected from the process parameter space according to a preset search strategy. The selection method depends on the current stage of the optimization algorithm: in the greedy search stage, the candidate values ​​of a parameter are usually traversed sequentially (e.g., starting from the minimum value and increasing sequentially); in the Monte Carlo exploration stage, a random sampling method is used to select from the space. The system ensures that the selected candidate process parameter contains complete parameter dimensions (e.g., each parameter a, b, c, d, e, and f has a specific value). Subsequently, the current influent water quality data and the candidate process parameter are used as input to call the pre-built effluent water quality prediction model for forward calculation. Before the call, the required process characteristic indicators (such as aeration intensity, air-to-water ratio, etc.) need to be calculated in real time based on the candidate process parameter and the current influent water quality data, and these characteristic indicators are concatenated with the candidate process parameter to form the model input vector. After forward propagation, the model outputs the second predicted effluent water quality data, namely the predicted effluent COD, ammonia nitrogen, and total nitrogen concentrations. This prediction result is associated with the candidate process parameter and stored for use in calculating the second evaluation function value.

[0064] Step B3: Calculate the second evaluation function value corresponding to the candidate process parameters using the current influent water quality data and the second predicted effluent water quality data.

[0065] Specifically, the second evaluation function value refers to a quantitative indicator determined for candidate process parameters based on current influent water quality data and predicted effluent water quality data obtained from the effluent water quality prediction model, following the same calculation logic as the first evaluation function value (including factors such as purification resource consumption, reagent resource consumption, energy resource consumption, non-compliance penalty factor, and influent liquid level). This value is used to measure the comprehensive treatment cost of the candidate process parameters; the smaller the value, the lower the resource consumption while ensuring effluent compliance, and it is the core basis for parameter comparison and iterative selection.

[0066] First, following the evaluation function calculation process, the following sub-calculations are executed sequentially: Based on the current influent water quality data and the second predicted effluent water quality data, the purification resource consumption C_r_candidate corresponding to the candidate process parameters is calculated, that is, the concentration difference between influent and effluent COD, ammonia nitrogen, and total nitrogen is multiplied by their respective unit removal cost coefficients and then summed; the dosage of reagents (such as phosphate dosage d, liquid alkali dosage e) and energy-related parameters (anoxic reaction time b, aeration reaction time c, instantaneous aeration flow rate f, influent liquid level a, etc.) are extracted from the candidate process parameters, combined with the preset reagent consumption weighting coefficients (w_p, w_naoh) and The energy consumption weighting coefficient β is used to calculate the chemical resource consumption C_m_candidate and the energy resource consumption C_e_candidate, where the aeration fan power needs to be dynamically calculated based on the liquid level. The removal rates of each pollutant are calculated based on the current influent water quality and the second predicted effluent water quality, and compared with the compliance thresholds (COD≥90%, ammonia nitrogen≥98%, total nitrogen≥85%). The number of non-compliant items n is counted, and the non-compliant penalty factor γ = n × 10000 is determined (γ = 0 if all standards are met). The above items are substituted into the resource consumption coefficient formula: C_candidate = (C_m_candidate + C_e_candidate + γ) / (C_r_candidate × a), where a is the influent liquid level. The calculated C_candidate is directly assigned as the value of the second evaluation function.

[0067] Step B4: Determine the baseline process parameters for the next iteration from the initial process parameters and candidate process parameters based on the first evaluation function value and the second evaluation function value, and select candidate process parameters for the next iteration from the process parameter space.

[0068] In this embodiment of the application, determining the benchmark process parameter for the next iteration from the initial process parameters and candidate process parameters based on the first evaluation function value and the second evaluation function value includes: when the second evaluation function value is greater than the first evaluation function value, determining the candidate process parameter as the benchmark process parameter for the next iteration; when the second evaluation function value is less than or equal to the first evaluation function value, determining the candidate process parameter as the benchmark process parameter for the next iteration with a preset probability, or determining the initial process parameter as the benchmark process parameter for the next iteration with a preset probability.

[0069] Specifically, first obtain the first evaluation function value corresponding to the initial process parameters (denoted as F_current), and the second evaluation function value corresponding to the candidate process parameters (denoted as F_candidate). Subsequently, compare the magnitude relationship between these two values, and determine the benchmark process parameters for the next iteration according to the comparison result and the preset rules: If F_candidate < F_current, it indicates that the comprehensive processing cost of the candidate parameters is lower (i.e., better), and the system determines the candidate process parameters as the benchmark process parameters for the next iteration. If F_candidate ≥ F_current, it means that the candidate parameters are not better than the current benchmark (possibly worse or equal). At this time, with a preset probability ε (e.g., ε = 0.05), the candidate process parameters (i.e., the worse solution) are accepted as the benchmark process parameters for the next iteration, and the candidate is rejected with a probability of 1 - ε, keeping the current benchmark process parameters unchanged. This mechanism is the incorporation of the Monte Carlo criterion, aiming to jump out of the local optimal region by allowing the acceptance of inferior solutions with a small probability.

[0070] After determining the benchmark process parameters for the next iteration, select the candidate process parameters for the next iteration in the process parameter space for the next round of loop. The selection method depends on the current optimization stage and search strategy: In the greedy search stage, usually fix some parameters (such as the influent water level a, the phosphorus salt dosage d, the liquid alkali dosage e), and then sequentially traverse each alternative value of another parameter (such as the anoxic reaction duration b) as candidates in turn; In the Monte Carlo exploration stage, the candidates are selected by random sampling from the parameter space to increase the diversity of solutions. The selected candidate process parameters need to include the complete parameter dimensions (such as a, b, c, d, e, f all have specific values), and are prepared for evaluation in the next iteration. Record the current iteration number and the evaluated parameter combinations to avoid repeated search and improve efficiency.

[0071] Step B5, repeat the iterative optimization process until the target process parameters that meet the preset optimization conditions are obtained.

[0072] Specifically, the preset optimization condition is the criterion for terminating the iteration set in advance, usually including that the evaluation function value no longer improves in several consecutive iterations (i.e., converges), reaching the preset maximum iteration number, or the search time exceeding the time limit allowed by the process (such as the optimization needs to be completed within the SBR batch reaction cycle), which is used to ensure that the finally obtained parameter combination meets the actual engineering requirements. The target process parameters refer to the benchmark process parameters currently held when the iterative process meets the preset optimization conditions. This parameter combination is considered to be the optimal solution that can achieve the qualified effluent quality and minimize the operating cost under the given influent water quality, and will be used to adjust the operating state of the process equipment subsequently.

[0073] First, a loop structure is constructed, starting with the initial process parameters (or the baseline parameters determined in the previous round). In each iteration, a candidate parameter is selected from the process parameter space based on the current baseline parameters and a preset search strategy (such as greedy sequential traversal or Monte Carlo random sampling). The predicted effluent quality is obtained through the effluent quality prediction model, and its evaluation function value is calculated. Then, based on the comparison results of the first and second evaluation function values ​​and the preset probability rules, the baseline parameters for the next round are determined, and the current optimal evaluation function value and its corresponding parameter combination are recorded. After each iteration, it is checked whether the preset optimization conditions are met: for example, if the current optimal evaluation function value does not decrease in N consecutive rounds (such as 10 rounds) (i.e., no longer improves), it is considered to have converged; or if the number of iterations reaches the preset upper limit (such as 200 times), or the cumulative search time exceeds the maximum allowable time of the process (such as 2.5 hours, to ensure that optimization is completed before the SBR batch begins), the loop is terminated. When any condition is met, the loop ends, and the optimal baseline parameters (i.e., the parameter combinations corresponding to the historical best evaluation function values) saved in the last iteration are determined as the target process parameters and output to the database or automatic control system. If the termination condition is not met, the next iteration continues, selecting new candidate parameters (possibly switching to the next parameter value in a predetermined order, or resampling randomly), and repeating the evaluation process. To improve efficiency, the system can maintain a hash table of explored parameter combinations to avoid repeatedly evaluating the same combinations; it also supports dynamically adjusting the search step size or exploration probability to balance global search and local refinement.

[0074] Taking a fixed influent level a, phosphate dosage d, and alkali dosage e as an example, the iterative process of performing a greedy search on the anoxic reaction time b, aeration reaction time c, and instantaneous aeration flow rate f is shown in the table below:

[0075] In the table, b1, b2, and b3 represent different alternative values ​​for the hypoxia response time (e.g., 2.5h, 3h, 3.5h), c1, c2, and c3 represent different alternative values ​​for the aeration response time (e.g., 4h, 5h, 6h), and f1, f2, and f3 represent different alternative values ​​for the instantaneous aeration flow rate (e.g., 7000m³ / h, 8000m³ / h, 9000m³ / h). The C value is the evaluation function value. In the first step, b2 was selected to minimize the C value to 8; in the second step, based on b2, c2 was selected to further reduce the C value to 6; in the third step, based on the previously determined value, f1 was selected to minimize the C value to 5. Through this step-by-step greedy selection, we determined that under fixed parameters a, d, and e, the optimal combination of b, c, and f is b2, c2, and f1, at which point the evaluation function C reaches its minimum value of 5 under these fixed conditions.

[0076] As an example, such as Figure 3As shown, the parameter optimization process employs a greedy-Monte Carlo fusion algorithm for iterative search. First, the process parameters are initialized, fixing the influent level *a*, phosphate dosage *d*, and alkali dosage *e*. Then, the anoxic reaction time *b*, aeration reaction time *c*, and instantaneous aeration flow rate *f* are optimized. When optimizing each parameter, the evaluation function value *C2* of the candidate parameter is compared with the evaluation function value *C1* of the current optimal parameter: if *C2* < *C1*, the candidate parameter is directly accepted as the new optimal combination; if *C2* ≥ *C1*, the worse solution is accepted with a very small probability ε (ε << 0.01) for Monte Carlo exploration; otherwise, the current optimal value is maintained. After all candidate values ​​for a parameter have been traversed, the optimized parameter (e.g., *b* = *b2*) is fixed, and the next parameter (e.g., *c*, *f*) is optimized. After all parameters *b*, *c*, and *f* are optimized, *a*, *d*, *c*, and *f* are fixed, and *e* is optimized; then, *a*, *b*, *c*, and *f* are fixed again, and *d* is optimized. The final result is the target combination of process parameters that meets effluent standards and minimizes operating costs. This process rapidly approximates local optima using a greedy strategy, while avoiding getting trapped in local optima through Monte Carlo random sampling, achieving efficient global search within a finite time.

[0077] In the embodiments of this application, such as Figure 4 As shown, the method also includes: Step S301: Obtain the actual effluent water quality data after the process equipment operates based on the target process parameters.

[0078] In this embodiment, process equipment refers to various mechanical devices that operate the biochemical section of the SBR process, including aeration blowers, stirring motors, dosing pumps, inlet and outlet valves, etc. These devices are automatically controlled according to the set values ​​of the target process parameters to complete a complete treatment batch. The target process parameters are the optimal parameter combinations obtained through iterative optimization, including influent level, anoxic reaction time, aeration reaction time, reagent dosage, instantaneous aeration flow rate, etc., used to precisely regulate the operating status of the process equipment. Actual effluent water quality data refers to the actual effluent water quality indicators obtained through online monitoring instruments or laboratory testing after the process equipment has run a complete batch according to the target process parameters. These typically include chemical oxygen demand (COD), ammonia nitrogen concentration, total nitrogen concentration, etc., used to verify the accuracy of the model prediction and as the basis for model updates.

[0079] First, after the process equipment completes a batch of treatment according to the target process parameters, the actual effluent water quality data acquisition process is automatically triggered. Data is obtained from multiple data sources through data interfaces: for online sensors (such as online COD analyzers, online ammonia nitrogen sensors, pH meters, etc.), the monitoring values ​​at the end time or during the end period of the batch are queried through a time-series database (such as InfluxDB), and the average value after stabilization is usually taken as the representative value; for indicators that require laboratory testing (such as total nitrogen), the corresponding test results for the batch are obtained from the Laboratory Information Management System (LIMS) through a relational database (such as PostgreSQL). Based on the batch identifier (such as the start timestamp or batch number), the actual effluent water quality data is associated with the previously stored target process parameters and corresponding predicted effluent water quality data, and stored in the historical operation database, while marking the data status as "actual value obtained". To ensure data integrity, a scheduled task (such as automatic operation after each batch) or an event trigger mechanism (such as a batch end signal issued by the PLC) can be set, and data quality verification rules (such as numerical range checks and outlier removal) can be configured. If some data is missing or invalid, an alarm can be issued or an attempt can be made to collect data from a backup instrument to ensure that there is reliable input for deviation calculation.

[0080] Step S302: Calculate the corresponding prediction deviation data based on the actual effluent water quality data and the predicted effluent water quality data corresponding to the target process parameters.

[0081] In this embodiment, the predicted effluent water quality data corresponding to the target process parameters refers to the expected effluent water quality indicators obtained after inputting the target process parameters and the current influent water quality data into the effluent water quality prediction model. These typically include COD, ammonia nitrogen, and total nitrogen concentrations. This data is recorded and stored during the optimization process for comparison with actual operating results. Actual effluent water quality data refers to the measured effluent water quality indicators after the process equipment has run a complete batch according to the target process parameters. Prediction deviation data refers to the quantitative difference calculated by comparing the actual effluent water quality data and the predicted effluent water quality data of the same batch. This value is used to evaluate the accuracy of the model prediction and is usually expressed as absolute error, relative error, or comprehensive error indicators. It is an important basis for determining whether the model parameters need to be updated.

[0082] First, the predicted effluent quality data corresponding to the current batch (i.e., the batch of actual effluent quality data) is retrieved from the database. This predicted data is usually stored along with the target process parameters during the optimization process and is associated with a batch identifier (such as a start timestamp or batch number). The concentrations of COD, ammonia nitrogen, and total nitrogen are extracted from the predicted effluent quality data, and the corresponding measured concentrations are extracted from the actual effluent quality data. Then, the prediction deviation for each pollutant is calculated, using various statistical indicators: for example, calculating the absolute error (|predicted value - actual value|) or relative error (|predicted value - actual value| / actual value × 100%), or a comprehensive indicator such as the root mean square error. For multi-indicator scenarios, the COD deviation, ammonia nitrogen deviation, and total nitrogen deviation can be calculated separately, and a comprehensive deviation value can be synthesized according to preset weights, or compared with the deviation threshold of each indicator. After calculation, the predicted deviation data is stored in the database, and the batch is marked as "evaluated". This deviation data will serve as input to determine whether to trigger a model update.

[0083] Step S303: When the predicted deviation data reaches the preset deviation condition, update the model parameters in the effluent water quality prediction model.

[0084] In this embodiment, the preset deviation condition is a pre-set threshold or rule to trigger model updates. For example, the relative error of any pollutant exceeds 10%, or the comprehensive deviation index exceeds the limit range for multiple consecutive batches. This is used to determine whether the current model can no longer accurately reflect process changes. The effluent quality prediction model is a mathematical model built based on historical operating data using deep learning algorithms (such as fully connected neural networks). It can predict effluent quality based on influent quality and process parameters, and its parameters are determined during training. Model parameters refer to the trainable parameters such as weights and biases that constitute the neural network. Updating the model involves changing the values ​​of these parameters through retraining or optimization with new data.

[0085] First, prediction deviation data is continuously monitored, typically automatically after each treatment batch. The deviation values ​​for each pollutant are compared to preset deviation conditions: if the deviations for all pollutants are within acceptable ranges (e.g., COD relative error ≤10%, ammonia nitrogen ≤10%, total nitrogen ≤10%), the model is considered to maintain good prediction accuracy, and no update is triggered; the model continues to be used. If the deviation for any pollutant exceeds a preset threshold, or the comprehensive deviation index (e.g., weighted average error) reaches a preset condition, the current model is deemed unsuitable for process changes (e.g., a high load shock or sudden change in sludge activity not seen in historical data occurs), and a full retraining process is initiated. All historical operating data since the process was put into operation (including newly accumulated batches) is extracted from the database and re-executed: the data is cleaned and aligned, process characteristic indicators are calculated, a training sample set is constructed, and the model is retrained using the same network structure and hyperparameters as the initial training, until the new model meets performance requirements on the test set (e.g., COD prediction R² ≥ 0.92). After training, the parameters of the new model are saved and replace the original effluent quality prediction model for subsequent optimization processes. For batches that have not triggered full learning, the model can still be lightweightly optimized using new data according to a preset strategy (such as weekly incremental learning) to gradually adapt to slow process drift and achieve adaptive maintenance of the model.

[0086] This embodiment also provides a wastewater treatment process parameter optimization device, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0087] This embodiment provides a wastewater treatment process parameter optimization device, such as... Figure 5 As shown, it includes: The acquisition module 51 is used to acquire the initial process parameters of the biochemical section of the wastewater treatment process and the current influent water quality data; Input module 52 is used to input the current influent water quality data and initial process parameters into the pre-constructed effluent water quality prediction model to obtain the first predicted effluent water quality data; The optimization module 53 is used to iteratively optimize the initial process parameters based on the current influent water quality data and the first predicted effluent water quality data to obtain target process parameters that meet the preset optimization conditions. The target process parameters are used to adjust the operating parameters of the process equipment.

[0088] In this embodiment of the application, the device further includes: a construction module, used to acquire historical operating data of the biochemical section of the wastewater treatment process, wherein the historical operating data includes at least historical influent water quality data, historical process parameters, and corresponding historical effluent water quality data; constructing a training sample set using the historical operating data, wherein the training sample set takes historical process parameters and corresponding historical influent water quality data as input and corresponding historical effluent water quality data as output; and training an initial prediction model using the training sample set to obtain an effluent water quality prediction model.

[0089] In this embodiment, the construction module is specifically used to calculate the process characteristic indicators corresponding to historical operating data. The process characteristic indicators include at least one of aeration intensity, air-to-water ratio, stirring intensity, stirring duration ratio, sludge load, pollutant load, wastewater volume index, free ammonia inhibition factor, sulfide inhibition factor, nutrient balance ratio, and alkalinity supply. The process characteristic indicators and historical process parameters are used as input data, and historical effluent water quality data are used as output data to construct a training sample set.

[0090] In this embodiment, the optimization module 53 is specifically used to calculate the first evaluation function value corresponding to the initial process parameters using the current influent water quality data and the first predicted effluent water quality data; select any candidate process parameter in the process parameter space, and input the current influent water quality data and the candidate process parameter into the pre-constructed effluent water quality prediction model to obtain the second predicted effluent water quality data; calculate the second evaluation function value corresponding to the candidate process parameter using the current influent water quality data and the second predicted effluent water quality data; determine the benchmark process parameter for the next iteration from the initial process parameters and candidate process parameters based on the first evaluation function value and the second evaluation function value, and select the candidate process parameter for the next iteration in the process parameter space; repeat the iterative optimization process until the target process parameter that meets the preset optimization conditions is obtained.

[0091] In this embodiment, the optimization module 53 is specifically used to calculate the purification resource consumption corresponding to the initial process parameters based on the current influent water quality data and the first predicted effluent water quality data; calculate the reagent resource consumption and energy resource consumption corresponding to the initial process parameters; calculate the corresponding resource consumption coefficient based on the purification resource consumption, reagent resource consumption and energy resource consumption; and determine the first evaluation function value corresponding to the initial process parameters based on the resource consumption coefficient.

[0092] In this embodiment of the application, the optimization module 53 is specifically used to determine the candidate process parameter as the benchmark process parameter for the next iteration when the second evaluation function value is greater than the first evaluation function value; and to determine the candidate process parameter as the benchmark process parameter for the next iteration with a preset probability, or to determine the initial process parameter as the benchmark process parameter for the next iteration with a preset probability when the second evaluation function value is less than or equal to the first evaluation function value.

[0093] In this embodiment of the application, the device further includes: an update module, used to acquire actual effluent water quality data obtained after the process equipment operates based on target process parameters; calculate corresponding prediction deviation data based on the actual effluent water quality data and the predicted effluent water quality data corresponding to the target process parameters; and update the model parameters in the effluent water quality prediction model when the prediction deviation data reaches a preset deviation condition.

[0094] Please see Figure 6 , Figure 6 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of the present invention, such as... Figure 6 As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system).

[0095] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.

[0096] The memory 20 stores instructions executable by at least one processor 10 to cause at least one processor 10 to perform the method shown in the above embodiments.

[0097] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device as shown by a landing page for an app. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, which can be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0098] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.

[0099] The computer device also includes a communication interface 30 for communicating with other devices or communication networks.

[0100] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.

[0101] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A method for optimizing wastewater treatment process parameters, characterized in that, The method includes: Obtain the initial process parameters of the biological stage of the wastewater treatment process and the current influent water quality data; The current influent water quality data and the initial process parameters are input into the pre-constructed effluent water quality prediction model to obtain the first predicted effluent water quality data. Based on the current influent water quality data and the first predicted effluent water quality data, the initial process parameters are iteratively optimized to obtain target process parameters that meet preset optimization conditions. The target process parameters are used to adjust the operating parameters of the process equipment.

2. The method according to claim 1, characterized in that, The method for constructing the effluent water quality prediction model includes: Obtain historical operating data of the biochemical section of the wastewater treatment process, wherein the historical operating data includes at least historical influent water quality data, historical process parameters, and corresponding historical effluent water quality data; A training sample set is constructed using the historical operating data, wherein the training sample set takes the historical process parameters and the corresponding historical influent water quality data as input and the corresponding historical effluent water quality data as output. The initial prediction model is trained using the training sample set to obtain the effluent water quality prediction model.

3. The method according to claim 2, characterized in that, The step of constructing a training sample set using the historical operational data includes: Calculate the process characteristic indicators corresponding to the historical operating data, wherein the process characteristic indicators include at least one of the following: aeration intensity, air-to-water ratio, stirring intensity, stirring duration ratio, sludge load, pollutant load, wastewater volume index, free ammonia inhibition factor, sulfide inhibition factor, nutrient balance ratio, and alkalinity supply. The training sample set is constructed by using the process characteristic indicators and the historical process parameters as input data and the historical effluent water quality data as output data.

4. The method according to claim 1, characterized in that, The iterative optimization of the initial process parameters based on the current influent water quality data and the first predicted effluent water quality data to obtain target process parameters that meet preset optimization conditions includes: The first evaluation function value corresponding to the initial process parameters is calculated using the current influent water quality data and the first predicted effluent water quality data. Select any candidate process parameter in the process parameter space, and input the current influent water quality data and the candidate process parameter into the pre-constructed effluent water quality prediction model to obtain the second predicted effluent water quality data; The second evaluation function value corresponding to the candidate process parameters is calculated using the current influent water quality data and the second predicted effluent water quality data. Based on the first evaluation function value and the second evaluation function value, the baseline process parameters for the next iteration are determined from the initial process parameters and the candidate process parameters, and candidate process parameters for the next iteration are selected from the process parameter space. Repeat the iterative optimization process until the target process parameters that meet the preset optimization conditions are obtained.

5. The method according to claim 4, characterized in that, The step of calculating the first evaluation function value corresponding to the initial process parameters using the current influent water quality data and the first predicted effluent water quality data includes: Calculate the purification resource consumption corresponding to the initial process parameters based on the current influent water quality data and the first predicted effluent water quality data. Calculate the consumption of reagent resources and energy resources corresponding to the initial process parameters; Calculate the corresponding resource consumption coefficient based on the purification resource consumption, the reagent resource consumption, and the energy resource consumption; The first evaluation function value corresponding to the initial process parameters is determined based on the resource consumption coefficient.

6. The method according to claim 4, characterized in that, The step of determining the baseline process parameters for the next iteration based on the first evaluation function value and the second evaluation function value from the initial process parameters and the candidate process parameters includes: When the value of the second evaluation function is greater than the value of the first evaluation function, the candidate process parameter is determined as the baseline process parameter for the next iteration; When the value of the second evaluation function is less than or equal to the value of the first evaluation function, the candidate process parameter is determined as the benchmark process parameter for the next iteration with a preset probability, or the initial process parameter is determined as the benchmark process parameter for the next iteration with a preset probability.

7. The method according to claim 1, characterized in that, The method further includes: Obtain the actual effluent water quality data after the process equipment operates based on the target process parameters; Calculate the corresponding prediction deviation data based on the actual effluent water quality data and the predicted effluent water quality data corresponding to the target process parameters. When the predicted deviation data reaches the preset deviation condition, the model parameters in the effluent water quality prediction model are updated.

8. A wastewater treatment process parameter optimization device, characterized in that, The device includes: The acquisition module is used to acquire the initial process parameters of the biochemical section of the wastewater treatment process and the current influent water quality data; The input module is used to input the current influent water quality data and the initial process parameters into the pre-constructed effluent water quality prediction model to obtain the first predicted effluent water quality data. The optimization module is used to iteratively optimize the initial process parameters based on the current influent water quality data and the first predicted effluent water quality data to obtain target process parameters that meet preset optimization conditions, wherein the target process parameters are used to adjust the operating parameters of the process equipment.

9. A computer device, characterized in that, include: A memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, the processor executing the computer instructions to perform the method of any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the method of any one of claims 1 to 7.