Attention weight calculation method and system for disinfection control of sewage plant

By acquiring operational data from small and medium-sized wastewater treatment plants, and combining business rules and water quality pattern matching to calculate multi-dimensional weight coefficients, the attention weight of the disinfectant dosing model is dynamically adjusted. This solves the overfitting problem of deep learning models when data is insufficient, achieves precise disinfectant dosing, and improves the accuracy of disinfection control.

CN122241625APending Publication Date: 2026-06-19SHANGHAI ENVIRONMENT PROTECTION GROUP +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI ENVIRONMENT PROTECTION GROUP
Filing Date
2026-05-25
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Due to limited historical data accumulation, small and medium-sized wastewater treatment plants are prone to overfitting deep learning models in disinfectant dosing control, resulting in poor prediction accuracy and difficulty in meeting actual control requirements.

Method used

By acquiring wastewater treatment plant operation data, combining business rules, sliding window analysis, and water quality pattern matching, multi-dimensional weight coefficients are calculated, and the attention weight of the disinfectant dosing model is dynamically adjusted. Taking into account process experience, real-time data, and historical operating conditions, precise disinfectant dosing is achieved.

Benefits of technology

In the absence of sufficient data, it improved the accuracy and robustness of disinfectant dosing and enhanced the precision of disinfection control in wastewater treatment plants.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122241625A_ABST
    Figure CN122241625A_ABST
Patent Text Reader

Abstract

This application provides a method and system for calculating attention weights in wastewater treatment disinfection control, relating to the field of wastewater treatment disinfection control technology. The technical solution provided in this application obtains operational data from the wastewater treatment plant and uses three different analytical methods—comparing the operational data with business rules, calculating correlation indicators through a sliding window, and analyzing based on water quality pattern matching—to obtain a first weight coefficient, a second weight coefficient, and a third weight coefficient. This comprehensively considers the impact of process experience rules, real-time data correlation, and historical operating condition similarity on disinfection control. Even in small and medium-sized wastewater treatment plants with limited historical data accumulation, the application of business rules and water quality pattern matching compensates for the lack of data, improving the accuracy and robustness of predictions, thereby achieving precise disinfectant dosing and improving the disinfection control precision of the wastewater treatment plant.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of wastewater treatment disinfection control technology, specifically to an attention weight calculation method and system for disinfection control in wastewater treatment plants. Background Technology

[0002] Disinfection control in wastewater treatment plants is a crucial step in ensuring that effluent quality meets standards. Disinfectants are added to treated wastewater to kill pathogenic microorganisms and prevent water pollution and disease transmission. Precise control of the disinfectant dosage directly affects disinfection effectiveness and operating costs. Insufficient dosage leads to inadequate disinfection, while excessive dosage results in wasted disinfectant and increases the risk of disinfection byproducts forming in the effluent.

[0003] Many related technologies employ deep learning-based control methods, which build neural network models to learn the mapping relationship between influent water quality, flow rate, and disinfectant dosage from historical operating data, enabling intelligent prediction and control of dosage. However, training deep learning models requires a large amount of high-quality historical data. For small and medium-sized wastewater treatment plants, due to their short construction and operation time and limited online monitoring equipment, the accumulation of historical operating data is relatively small. Training deep learning models with insufficient data can easily lead to overfitting, resulting in poor prediction accuracy for new operating conditions and failing to meet the precision requirements of actual control. Summary of the Invention

[0004] This application provides a method and system for calculating attention weights for disinfection control in wastewater treatment plants, which can achieve precise dosing of disinfectants, thereby improving the accuracy of disinfection control in wastewater treatment plants.

[0005] Firstly, this application provides a method for calculating attention weights for disinfection control in wastewater treatment plants, the method comprising: Obtain operational data from wastewater treatment plants; The running data is compared with the preset business rules to determine the first weight coefficient of the adjustment variable corresponding to the business rule. By using a sliding window of preset duration, the correlation coefficient and mutual information value between the influent flow rate and the disinfectant dosage in the operation data are calculated, and the second weighting coefficient is determined based on the correlation coefficient and mutual information value. The current mode vector corresponding to the current water quality mode is determined based on the current influent parameters in the operational data. The third weighting coefficient is determined based on the current mode vector and the historical mode vector matched in the historical operational data. The first weighting coefficient, the second weighting coefficient, and the third weighting coefficient are combined into a dynamic attention weight for multiple wastewater treatment devices; The dynamic attention weights and operational data are input into a preset disinfectant dosing prediction model, which outputs disinfectant dosing instructions for each wastewater treatment device. The disinfectant dosing instructions are used to adjust the operating frequency of the dosing pump to control the effluent indicators of the wastewater treatment plant.

[0006] By adopting the above technical solution, operational data of wastewater treatment plants is acquired. This data is then analyzed using three different methods: comparing it with business rules, calculating correlation indicators through a sliding window, and applying water quality pattern matching. These methods yield first, second, and third weighting coefficients, comprehensively considering the impact of process experience rules, real-time data correlation, and historical operating condition similarity on disinfection control. The three weighting coefficients are integrated into dynamic attention weights for multiple wastewater treatment devices, enabling the prediction model to dynamically adjust the importance of different feature variables based on the current operating status, highlighting the role of key influencing factors in prediction. The dynamic attention weights and operational data are input into the disinfectant dosing prediction model. The model's output disinfectant dosing command fully integrates multi-source information and dynamic weights. Even in small and medium-sized wastewater treatment plants with limited historical data, the model compensates for insufficient data through methods such as business rules and water quality pattern matching, improving prediction accuracy and robustness. This achieves precise disinfectant dosing and enhances the disinfection control precision of wastewater treatment plants.

[0007] Secondly, this application provides an attention weight calculation system for disinfection control in wastewater treatment plants, the system comprising: The data acquisition module is used to acquire operational data from the wastewater treatment plant. The first weight coefficient calculation module is used to compare the running data with the preset business rules and determine the first weight coefficient of the adjustment variable corresponding to the corresponding business rule. The second weighting coefficient calculation module is used to calculate the correlation coefficient and mutual information value between the influent flow rate and the disinfectant dosage in the operation data through a sliding window of preset duration, and to determine the second weighting coefficient based on the correlation coefficient and mutual information value. The third weighting coefficient calculation module is used to determine the current mode vector corresponding to the current water quality mode based on the current influent parameters in the operation data, and to determine the third weighting coefficient based on the current mode vector and the historical mode vector matched in the historical operation data. The weight coefficient fusion module is used to fuse the first weight coefficient, the second weight coefficient, and the third weight coefficient into dynamic attention weights for multiple wastewater treatment devices; The instruction output module is used to input dynamic attention weights and operating data into a preset disinfectant dosing prediction model and output disinfectant dosing instructions for each wastewater treatment device. The disinfectant dosing instructions are used to adjust the operating frequency of the dosing pump to control the effluent indicators of the wastewater treatment plant.

[0008] Thirdly, this application provides a computer storage medium that stores multiple instructions adapted for loading by a processor and executing any of the methods described above.

[0009] Fourthly, this application provides an electronic device including a processor, a memory, and a transceiver. The memory is used to store instructions, the transceiver is used to communicate with other devices, and the processor is used to execute the instructions stored in the memory to cause the electronic device to perform any of the methods described above.

[0010] In summary, the beneficial effects of the technical solution of this application include: By adopting the above technical solution, operational data of wastewater treatment plants is acquired. This data is then analyzed using three different methods: comparing it with business rules, calculating correlation indicators through a sliding window, and applying water quality pattern matching. These methods yield first, second, and third weighting coefficients, comprehensively considering the impact of process experience rules, real-time data correlation, and historical operating condition similarity on disinfection control. The three weighting coefficients are integrated into dynamic attention weights for multiple wastewater treatment devices, enabling the prediction model to dynamically adjust the importance of different feature variables based on the current operating status, highlighting the role of key influencing factors in prediction. The dynamic attention weights and operational data are input into the disinfectant dosing prediction model. The model's output disinfectant dosing command fully integrates multi-source information and dynamic weights. Even in small and medium-sized wastewater treatment plants with limited historical data, the model compensates for insufficient data through methods such as business rules and water quality pattern matching, improving prediction accuracy and robustness. This achieves precise disinfectant dosing and enhances the disinfection control precision of wastewater treatment plants. Attached Figure Description

[0011] Figure 1 This is a flowchart illustrating an attention weight calculation method for disinfection control in a wastewater treatment plant, according to an embodiment of this application. Figure 2 This is a schematic diagram of the structure of an attention weight calculation system for disinfection control in a wastewater treatment plant, according to an embodiment of this application. Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0012] Explanation of reference numerals in the attached drawings: 300, electronic device; 301, processor; 302, communication bus; 303, user interface; 304, network interface; 305, memory. Detailed Implementation

[0013] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0014] In the description of the embodiments of this application, words such as "illustrative," "for example," or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "illustrative," "for example," or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Rather, the use of words such as "illustrative," "for example," or "for example" is intended to present the relevant concepts in a specific manner.

[0015] In the description of the embodiments of this application, the term "multiple" means two or more. For example, multiple systems means two or more systems, and multiple screen terminals means two or more screen terminals. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0016] Please see Figure 1 This is a flowchart illustrating an attention weight calculation method for disinfection control in wastewater treatment plants, provided in an embodiment of this application. This method can be implemented using a computer program, a microcontroller, or run on an attention weight calculation system for disinfection control in wastewater treatment plants based on the von Neumann architecture. The computer program can be integrated into the application or run as a standalone utility application. The specific steps of the attention weight calculation method for disinfection control in wastewater treatment plants are described in detail below.

[0017] S101: Obtain operational data from the wastewater treatment plant; Among them, the operational data of a wastewater treatment plant refers to the collection of digital information reflecting the status of the wastewater treatment process, which is collected in real time by various sensors, detection instruments, and monitoring systems during the wastewater treatment process. The operational data represents the real-time operating parameters of each treatment unit of the wastewater treatment plant, including but not limited to influent flow rate, influent water quality indicators (chemical oxygen demand (COD), biochemical oxygen demand (BOD), total nitrogen (TN), total phosphorus (TP), ammonia nitrogen (NH3-N), suspended solids (SS), etc.), liquid level, dissolved oxygen concentration, sludge concentration, effluent water quality indicators, chemical dosage (disinfectant, carbon source, flocculant, etc.), equipment operating status (dosing pump frequency, aeration fan power, agitator speed, etc.), and environmental parameters (temperature, pH value, weather conditions, rainfall, etc.).

[0018] Specifically, the system first establishes a communication connection with the wastewater treatment plant's automated control system via a data interface, which can be an OPC (OLE for Process Control) protocol, a Modbus protocol, or other industrial communication protocols. Then, the system reads the latest operating parameter values ​​from various data acquisition points according to a preset sampling frequency. The sampling frequency depends on the variation characteristics of different parameters; rapidly changing parameters, such as influent flow rate, may be sampled once per minute, while slowly changing parameters, such as water temperature, may be sampled once per hour. The system performs preliminary processing on the acquired raw data, including data validity verification (checking for abnormalities such as sensor malfunctions and communication interruptions), outlier removal (using the 3σ principle or quartile method to identify and process data points that significantly deviate from the normal range), and missing value imputation (for data missing for a short period, linear interpolation or forward imputation methods can be used to complete the data). The preprocessed operating data is organized into a structured data format, such as a time series data table or a multidimensional array, and stored in the system's real-time database, providing a reliable data foundation for subsequent weight calculations and model predictions.

[0019] S102: Compare the running data with the preset business rules to determine the first weight coefficient of the adjustment variable corresponding to the business rule; Among them, business rules refer to the conditional judgment logic and parameter adjustment strategies formed based on the principles of wastewater treatment processes, operational experience, and expert knowledge. They are expert system rule sets used to indicate how to adjust the weights of control parameters under specific operating conditions. Pre-set business rules are rule bases jointly formulated and solidified in the system by wastewater treatment engineers, process experts, and automation control experts. These rules are stored in the form of "IF-THEN" conditional statements, such as "IF rainfall > 10 mm / h THEN reduce influent flow weight by 20%". Adjustment variables refer to operating parameters whose importance needs to be reassessed when different business rules are triggered. The weights of these variables are dynamically adjusted according to the current operating conditions. The first weight coefficient is used to represent the degree of influence of each adjustment variable determined at the business rule level on the disinfectant dosing decision. Its value range is usually between 0 and 1; the larger the value, the higher the importance of the variable to disinfection control under the current operating conditions.

[0020] Specifically, the system first loads a pre-configured business rule base, which is organized according to rule type (such as rainy day rules, compound exceedance rules, time decay rules, etc.). Each rule includes elements such as triggering conditions, target variables, adjustment methods, and adjustment magnitudes. Then, the system iterates through each rule in the rule base, extracting the necessary judgment parameters from the operational data. For example, the rainy day rule requires extracting current weather conditions and rainfall data, while the compound exceedance rule requires extracting real-time monitoring values ​​of various water quality indicators. Next, the system performs logical judgments on the triggering conditions of each rule, evaluating whether the current operational data meets the rule's activation conditions, such as determining whether "rainfall exceeds the preset rainfall threshold" or "total influent ammonia nitrogen value exceeds the first preset concentration threshold." For triggered rules, the system identifies the adjustment variables associated with the rule and calculates new weight coefficients according to the adjustment method defined in the rule. The adjustment method can be proportional scaling (e.g., reducing by 20%), absolute value setting (e.g., setting to 0.3), or calculation based on a formula (e.g., exponential decay formula). The system summarizes the weight adjustment results generated by all triggered rules. When the same variable is affected by multiple rules at the same time, a predefined conflict resolution strategy is adopted, such as taking the maximum value, weighted average, or priority coverage, to determine the final first weight coefficient.

[0021] S103: Calculate the correlation coefficient and mutual information value between the influent flow rate and the disinfectant dosage in the operation data through a sliding window of preset duration, and determine the second weighting coefficient based on the correlation coefficient and mutual information value; In time series data analysis, a sliding window with a preset duration refers to a fixed-length time period. This window moves forward on the time axis with a certain step size to capture the dynamic changes and local statistical regularities of the data. The preset duration of the sliding window indicates the historical data time span covered by the window. Influent flow rate and disinfectant dosage are two key process variables in the operation of a wastewater treatment plant. The former represents the volumetric flow rate of wastewater entering the wastewater treatment system per unit time, while the latter represents the mass or volumetric flow rate of disinfectant (such as sodium hypochlorite or chlorine dioxide) added to achieve disinfection. There is an inherent correlation between the two. The correlation coefficient refers to the Pearson correlation coefficient, a statistic used to represent the degree of linear correlation between two continuous variables. Its value ranges from -1 to 1, with positive values ​​indicating positive correlation and negative values ​​indicating negative correlation. A larger absolute value indicates a stronger linear relationship. Mutual information is a measure of the degree of interdependence between two random variables from an information theory perspective. It can capture nonlinear relationships and complex dependency patterns between variables; a larger mutual information value indicates that one variable contains more information about the other. The second weighting coefficient is used to represent the influence weight of the influent flow rate on the disinfectant dosing decision, which is determined based on data statistical analysis. This coefficient takes into account both linear and nonlinear correlation strengths.

[0022] Specifically, the system first extracts historical sequences of influent flow rate and disinfectant dosage from the operating database within the 24 hours prior to the current moment, based on a preset sliding window duration (assuming 24 hours) and data sampling interval (assuming 5 minutes). These two sequences contain the same number of data points (24 hours × 60 minutes ÷ 5 minutes = 288 data points). The system then preprocesses the extracted data sequences, including removing outliers and smoothing to reduce measurement noise, using methods such as median filtering or moving average filtering. Next, the system calculates the Pearson correlation coefficient. The specific calculation process is as follows: first, the mean of each sequence is calculated; then, the deviation of each data point from its mean is calculated; the covariance is obtained by summing the products of the deviations of corresponding points in the two sequences; then, the standard deviation of each sequence is calculated; finally, the correlation coefficient is obtained by dividing the covariance by the product of the two standard deviations. In parallel, the system calculates the mutual information value. The calculation process is as follows: First, the two continuous variables are discretized, dividing the numerical range into several intervals (e.g., 10 intervals). The frequency of data points falling into each interval is counted to estimate the probability distribution. Then, the marginal probability distribution and joint probability distribution of each variable are calculated. Finally, the mutual information value is calculated by summing all interval combinations according to the mutual information formula. To make the correlation coefficient and mutual information value comparable, the system normalizes both. The absolute value of the correlation coefficient is used as the normalized correlation coefficient (range 0 to 1), and the mutual information value is divided by the theoretical maximum mutual information value (determined by the entropy of the variable) to obtain the normalized mutual information value (range 0 to 1). Finally, the system performs a weighted summation of the two normalized indicators according to a preset weighting ratio (e.g., correlation coefficient accounts for 60%, mutual information value accounts for 40%). The calculation formula is: Second weight coefficient = 0.6 × Normalized correlation coefficient + 0.4 × Normalized mutual information value, which yields the second weight coefficient that comprehensively reflects the linear and nonlinear association.

[0023] S104: Determine the current mode vector corresponding to the current water quality mode based on the current influent parameters in the operation data, and determine the third weighting coefficient based on the current mode vector and the historical mode vector matched in the historical operation data. The current influent parameters refer to the set of water quality index values ​​detected in real time at the wastewater treatment plant inlet. These parameters comprehensively reflect the pollution characteristics and treatment difficulty of the influent. The current water quality model represents the water quality state category or feature combination composed of multiple influent parameters. Different water quality models correspond to different treatment process requirements and disinfection strategies, such as high COD / low nitrogen / phosphorus model, high ammonia nitrogen model, and rainy season dilution model. The current model vector represents a feature vector that organizes the multi-dimensional influent water quality index values ​​at the current moment. Each dimension of the vector corresponds to a water quality index (such as chemical oxygen demand (COD), total nitrogen (TN), total phosphorus (TP), suspended solids (SS) concentration, etc.), and the vector value is the detected or normalized value of each index. Historical operating data refers to a complete dataset of records accumulated during the wastewater treatment plant's past operations, including influent parameters, operating parameters, control parameters, and effluent effects. This data is labeled, organized, and stored in a historical database. Historical pattern vectors refer to feature vectors extracted from historical operational data that have the same structure as the current water quality pattern. Each historical pattern vector represents the influent water quality state under a historical operating condition and is associated with the treatment effect and control strategy under that condition. Historical pattern vectors are retrieved from the historical database through similarity calculations, identifying several historical vectors that are most similar to the current pattern vector. These matching vectors correspond to historical operating conditions that have similar water quality characteristics to the current operating condition. The third weight coefficient represents the influence weight of each water quality parameter on disinfection control, determined based on case reasoning and historical experience. This coefficient is assigned a value based on successful experiences under similar historical operating conditions.

[0024] Specifically, the system first extracts key water quality indicators from the current operating data, including at least chemical oxygen demand (COD), total nitrogen (TN), total phosphorus (TP), and suspended solids (SS) concentrations. Depending on actual needs, parameters such as ammonia nitrogen (AM), pH, and water temperature may also be included. The system then preprocesses the extracted raw indicator values, including unit standardization (e.g., unifying concentration values ​​from different units to mg / L), data cleaning (removing obviously unreasonable outliers), and normalization (mapping indicator values ​​of different dimensions to 0-1 or other unified ranges). Normalization can use min-max normalization or Z-score standardization. Next, the system assembles the preprocessed indicator values ​​into a current model vector according to a predetermined order. For example, a 5-dimensional vector [x1, x2, x3, x4, x5] corresponds to the normalized values ​​of COD, TN, TP, SS, and NH3-N, respectively. Finally, the system loads all historical model vectors from the historical operating database. These vectors have undergone the same preprocessing and normalization process when the historical data was imported, ensuring comparability with the current model vector. The system selects appropriate similarity measurement methods, commonly including cosine similarity algorithm (calculating the cosine of the angle between two vectors, ranging from -1 to 1, with closer to 1 indicating greater similarity) or Euclidean distance algorithm (calculating the straight-line distance between two vectors in space, with smaller distances indicating greater similarity). It calculates the similarity score between the current pattern vector and each historical pattern vector. The system sorts the vectors according to the similarity scores and selects the top K historical pattern vectors with the highest similarity (K is a preset number, such as 5 or 10) as the matched historical pattern vectors. For each selected matched historical pattern vector, the system extracts its associated historical control strategies and treatment effect data, analyzing the actual impact weight of each water quality parameter on disinfection control under those historical conditions. Finally, the system performs weighted aggregation on the weights corresponding to each matched historical vector, using the similarity score as the weight coefficient. Historical cases with higher similarity contribute more to the final weight. The system obtains the third weight coefficient corresponding to each water quality parameter through methods such as weighted averaging or weighted voting.

[0025] S105: Integrate the first weighting coefficient, the second weighting coefficient, and the third weighting coefficient into a dynamic attention weight for multiple wastewater treatment devices; Among them, multiple wastewater treatment devices refer to various equipment units involved in the disinfection process in a wastewater treatment plant, including but not limited to ultraviolet disinfection equipment, chlorination contact tanks, dosing pump systems, mixing and stirring devices, etc. Different equipment has different sensitivities to operating parameters. Dynamic attention weight is used to represent the comprehensive influence weight of each operating parameter on the control decision of a specific wastewater treatment device under the current operating conditions. The weight value is dynamically adjusted with changes in operating conditions, and parameters with higher weights receive more "attention" in the control decision.

[0026] Specifically, the system first constructs a correlation mapping matrix between wastewater treatment equipment and operational data feature variables. This matrix defines which feature variables affect which equipment, as well as the direction and intensity of the influence. For example, influent flow rate affects all equipment, while dissolved oxygen in the biological treatment tank mainly affects the biological treatment unit and has a smaller impact on the disinfection equipment. Then, for each wastewater treatment device, the system selects the relevant weight values ​​from three sets of weight coefficients based on the correlation mapping relationship, forming a target weight set for that device. For example, for a dosing pump, the target weight set might include three weight coefficients for influent flow rate (from the first, second, and third weights), three weight coefficients for influent COD, and three weight coefficients for ammonia nitrogen, etc. Next, the system assigns a fusion ratio to each weight coefficient in the target weight set. The fusion ratio reflects the credibility and applicability of different weight sources and can be set based on practical experience. The system organizes the comprehensive weight values ​​of all feature variables into a feature importance vector. The dimension of this vector is equal to the number of feature variables related to the device, and each element of the vector represents the comprehensive importance score of the corresponding feature. Finally, the system normalizes the feature importance vector. Common normalization methods include L1 normalization (making the sum of the vector elements equal to 1) or Softmax normalization (converting the weight values ​​into a probability distribution). The normalized vector is the dynamic attention weight corresponding to the wastewater treatment equipment, with weight values ​​ranging from 0 to 1 and summing to 1. The system repeats the above process for each wastewater treatment equipment to generate a unique dynamic attention weight vector for each equipment. These weight vectors will be used in the next step in conjunction with the prediction model of the corresponding equipment to achieve precise personalized control.

[0027] S106: Input the dynamic attention weights and operating data into the preset disinfectant dosing prediction model, and output disinfectant dosing instructions for each sewage treatment equipment. The disinfectant dosing instructions are used to adjust the operating frequency of the dosing pump to control the effluent indicators of the sewage treatment plant.

[0028] The preset disinfectant dosing prediction model refers to a pre-trained or configured mathematical model or control algorithm. This model can calculate the required disinfectant dosage or dosage adjustment value to achieve the target effluent quality based on the input operating data and attention weights. The model type can be a mechanistic model (based on chemical reaction kinetic equations), a data-driven model (such as regression models, time series models), or a hybrid model. The disinfectant dosing command refers to the specific operating commands generated by the system to control the dosing equipment, including parameters such as the target dosage value, dosing rate, and dosing time. The dosing pump is a metering pump device that quantitatively delivers disinfectant (such as sodium hypochlorite solution) to the wastewater treatment system; its operating frequency (in Hz) directly determines the dosing flow rate. Effluent indicators refer to the water quality parameters of the effluent after the complete treatment process, mainly including residual chlorine concentration, fecal coliform count, total nitrogen, and total phosphorus. These indicators must meet national or local discharge standards.

[0029] Specifically, the system first loads a pre-defined disinfectant dosing prediction model. This model can be a CT value (the product of disinfectant concentration and contact time) calculation model based on the principles of wastewater disinfection kinetics, or a machine learning model such as a multiple linear regression model or a support vector regression model trained on historical data. Then, the system extracts features from the current operational data and converts the format to fit the input format required by the model. Next, the system fuses the dynamic attention weight vector with the feature matrix. A common fusion method is feature weighting, which multiplies each column of the feature matrix by its corresponding attention weight value to obtain a weighted feature matrix. The system inputs the weighted feature matrix into the prediction model, which performs forward calculations based on internal parameters (such as regression coefficients and neural network weights) and outputs the predicted disinfectant dosage or dosage change. For multiple wastewater treatment devices, the system uses the dedicated dynamic attention weights and prediction model for each device to perform independent calculations, obtaining a recommended dosage value for each device. The system then converts the dosage into control commands based on the actual characteristics of the equipment. For dosing pumps, the system needs to query the pump's flow-frequency characteristic curve (usually provided by the equipment manufacturer or obtained through on-site calibration). This curve describes the mapping relationship between the pump's operating frequency and output flow rate. The system uses interpolation to determine the pump operating frequency required to achieve the target dosing flow rate. The system generates disinfectant dosing commands containing information such as equipment identification, target frequency, and execution time, and sends them to the PLC or frequency converter on-site via the control network.

[0030] Based on the above embodiments, as an optional implementation method, the business rules include rainy day rules, compound exceeding rules, and time decay rules. In S102, the running data is compared with the preset business rules to determine the first weight coefficient of the adjustment variable corresponding to the business rule. Specifically, this can be achieved through the following steps S201-S204.

[0031] S201: Based on the rainy weather rule, obtain the current weather information or rainfall information from the operation data; if the current weather is rainy or the rainfall is greater than the preset rainfall threshold, then use the inflow rate as an adjustment variable and reduce the first weight coefficient corresponding to the inflow rate according to the first preset ratio; The "Rainy Day Rule" refers to specific control rules formulated for changes in wastewater treatment operating conditions under rainfall conditions. These rules reflect the dilution effect and impact of rainwater on the wastewater treatment system. Current weather information refers to weather status classification data provided by a real-time meteorological monitoring system, including categories such as sunny, cloudy, rainy, and snowy. Rainfall information represents the amount of precipitation per unit time, typically quantified in millimeters per hour. The preset rainfall threshold is the critical rainfall value that triggers the rainy day rule. When the actual rainfall exceeds this threshold, it is considered a significant rainfall condition. This threshold is set based on the characteristics of the wastewater treatment plant's catchment area and the pipe network capacity. The first preset proportion represents the reduction in the influent flow weight coefficient under rainy day conditions. This proportion is determined based on the process principle that rainwater dilution leads to a decrease in pollutant concentration and a corresponding reduction in disinfectant demand, and its value typically ranges from 3% to 5%.

[0032] In practice, weather condition fields or real-time values ​​from rainfall sensors are extracted from operational data and obtained through data interfaces with weather stations or rain gauges within the plant area. Weather information is assessed to determine if the current weather type falls under the rainy category; in parallel, rainfall values ​​are compared to thresholds to determine if the rainfall exceeds a preset critical value. When the weather condition is rainy or the rainfall exceeds the threshold, the rainy day rule is triggered. The influent flow rate parameter is marked as the target variable for this adjustment because rainfall causes combined sewer overflows, significantly increasing the influent flow rate but diluting pollutant concentrations, thus weakening the indicative effect of influent flow rate on disinfectant dosage.

[0033] S202: Based on the compound exceeding the standard rule, obtain the total influent ammonia nitrogen value and the ammonia nitrogen detection value of the biological treatment tank effluent from the operation data; if the total influent ammonia nitrogen value is greater than the first preset concentration threshold or the biological treatment tank effluent ammonia nitrogen detection value is greater than the second preset concentration threshold, then the total influent ammonia nitrogen and the biological treatment tank effluent ammonia nitrogen are used as adjustment variables, and the first weighting coefficients corresponding to the total influent ammonia nitrogen and the biological treatment tank effluent ammonia nitrogen are increased according to the second preset ratio; Among them, the compound exceeding the standard rule refers to the emergency control rule triggered when the concentration of a specific pollutant exceeds the process design range or emission standard limit. This rule aims to strengthen the focus on the treatment of pollutants exceeding the standard. The total influent ammonia nitrogen value represents the mass concentration of ammonia nitrogen pollutants at the influent of the wastewater treatment plant, reflecting the pollution load level of nitrogen-containing compounds in the raw water. The ammonia nitrogen detection value of the biological treatment tank effluent represents the residual ammonia nitrogen concentration in the effluent of the biological reaction tank after treatment by the biological denitrification process. This indicator reflects the denitrification effect of the biological treatment. The first preset concentration threshold is the critical value for judging the exceedance of total influent ammonia nitrogen. When the influent ammonia nitrogen concentration exceeds this threshold, it indicates that the influent pollution load is abnormally high. This threshold is usually set at 35 mg / L. The second preset concentration threshold is the critical value for judging the exceedance of ammonia nitrogen in the biological treatment tank effluent. When the effluent ammonia nitrogen concentration exceeds this threshold, it indicates that the biological denitrification effect is poor. This threshold is usually set at 3 mg / L. The second preset ratio represents the increase in the weighting coefficient of relevant parameters under the condition of excessive ammonia nitrogen. The value range is usually 15% to 35%. This ratio setting takes into account the negative impact of ammonia nitrogen on the subsequent disinfection effect. High concentrations of ammonia nitrogen will consume disinfectant and generate harmful byproducts.

[0034] In practice, when executing the compound exceeding the standard rule, real-time monitoring values ​​of influent ammonia nitrogen concentration and effluent ammonia nitrogen concentration from the operational data are read. These two concentration values ​​are then compared with their corresponding preset thresholds. If the total influent ammonia nitrogen value exceeds the first preset concentration threshold, or the effluent ammonia nitrogen value exceeds the second preset concentration threshold, the ammonia nitrogen exceeding the standard rule is triggered. Excessive ammonia nitrogen concentration can cause side reactions with disinfectants, consuming some of the effective disinfectant components. Simultaneously, a high ammonia nitrogen environment reduces disinfection efficiency. Therefore, the responsiveness of total influent ammonia nitrogen and effluent ammonia nitrogen to the effects of disinfectants needs to be enhanced, significantly increasing the importance of ammonia nitrogen parameters for disinfection control. At this point, the total influent ammonia nitrogen and effluent ammonia nitrogen parameters are marked as adjustment variables, and their original weighting coefficients are increased according to a second preset ratio. This increase is achieved by multiplying the original weighting coefficient by one and adding the coefficient of the second preset ratio. The adjusted ammonia nitrogen weighting coefficient is larger, and it receives more attention in subsequent weight fusion and prediction model calculations. This makes the dosing decision more focused on changes in ammonia nitrogen concentration, and the adverse effects of ammonia nitrogen on disinfection effect can be compensated by increasing the amount of disinfectant added, thus ensuring that the disinfection indicators of the effluent meet the standards.

[0035] In some embodiments, when the total influent ammonia nitrogen value is greater than or equal to 35 mg / L, or when the ammonia nitrogen value detected in the effluent of the biological treatment tank is greater than or equal to 3 mg / L, the weighting coefficients of the total influent ammonia nitrogen and the effluent ammonia nitrogen of the biological treatment tank are increased by 15% to 35%. The specific increase in weight is dynamically determined according to the degree of exceedance; the more severe the exceedance, the greater the increase. After the weighting is increased, the prediction model becomes more sensitive to changes in ammonia nitrogen concentration. When an increase in ammonia nitrogen concentration is detected, the disinfectant dosage can be increased in a timely manner to ensure effective disinfection under high ammonia nitrogen load conditions and prevent microbial indicators from exceeding the standards.

[0036] S203: Obtain the historical carbon source addition amount from the operating data, and substitute the historical carbon source addition amount into the exponential decay formula corresponding to the time decay rule to obtain the first weighting coefficient corresponding to the historical carbon source addition amount.

[0037] Historical carbon source dosage refers to the record of the amount of external carbon source substances added by the wastewater treatment plant at a certain point in time or within a certain period to enhance nitrogen removal. Carbon source addition affects the biochemical reaction process and thus indirectly affects disinfection requirements. The time decay rule indicates that the impact of historical addition events on current control decisions gradually weakens over time. This rule is designed based on the time memory characteristics of the control system. The exponential decay formula is a mathematical expression describing the exponential decay of the weighting coefficients over time; the decay rate is determined by the decay coefficient in the formula.

[0038] When applying the time decay rule, the system first retrieves records of past carbon source additions from the historical operation database, extracting the carbon source addition amount and the timestamp of the addition. Then, it calculates the time interval between the historical addition time and the current time, quantifying this time interval in hours as the independent variable for decay calculation. Next, the time interval is substituted into the exponential decay formula, which is based on the natural exponential function. The time interval is multiplied by a negative decay coefficient, which is set to 0.08. The larger the time interval, the larger the absolute value of the exponential term, and the smaller the decay factor value obtained after exponential calculation. The initial weight value is multiplied by the calculated decay factor to obtain the first weight coefficient corresponding to the historical carbon source addition amount after time decay adjustment. Due to the use of a negative exponential form, the weight coefficient shows a rapid decreasing trend with time, reflecting the objective law that the influence of historical carbon source addition events on current disinfection control gradually weakens over time. The weight coefficient adjusted by decay ensures that the control system pays more attention to recent operating conditions while retaining a moderate memory of important historical events, achieving dynamic balance and adaptive adjustment.

[0039] In some embodiments, the weight of historical carbon source additions decays exponentially with time lag, with more recent additions having a higher weight. The specific exponential decay formula is as follows: ; i represents the lag hours. The time interval is in hours. The decay factor is calculated by substituting the values ​​into the exponential decay formula. For every additional hour in the time interval, the decay factor decreases exponentially. This time decay mechanism aligns with the dynamic characteristics of wastewater treatment processes. The impact of carbon source addition on microbial activity and metabolic state is significant in the short term, but this impact is gradually overridden by subsequent process adjustments and environmental changes. Through exponential decay adjustment, the weight of historical carbon source addition decreases to a low level after several hours, ensuring that control decisions are primarily based on the current and recent actual operating conditions, thus improving the timeliness and adaptability of the control system.

[0040] Based on the above embodiments, as an optional implementation method, the correlation coefficient and mutual information value between the influent flow rate and the disinfectant dosage in the operation data are calculated through a sliding window of preset duration, and the second weighting coefficient is determined according to the correlation coefficient and mutual information value. This can be specifically achieved through the following steps S301-S304.

[0041] S301: Extract the historical influent flow rate data sequence and historical disinfectant dosage data sequence from the operational data for a preset duration prior to the current moment, and use them as sample data within a sliding window of a preset duration; The historical influent flow rate data sequence refers to the historical influent flow rate records extracted from the operational database and arranged in chronological order. Each record contains the flow rate measurement value at a specific moment. The historical disinfectant dosage data sequence refers to the actual disinfectant dosage values ​​recorded in chronological order within the same time period. The sliding window refers to a time range formed by tracing back a preset duration from the current moment. The window is continuously updated over time, always maintaining a fixed time span.

[0042] When performing data extraction, the current timestamp is first determined as the window endpoint, and then the starting timestamp of the window is obtained by calculating a preset time period backward from the current time. All influent flow rate measurement records between the window endpoint and the starting point are retrieved from the operational database and organized into a historical influent flow rate data sequence in chronological order. Similarly, disinfectant dosage records within the same time period are retrieved and organized into a historical disinfectant dosage data sequence. The time points of the two data sequences must strictly correspond to ensure that each flow rate data point has a corresponding dosage data point. The extracted data sequence serves as sample data within the sliding window for subsequent correlation analysis calculations. The sliding window mechanism ensures that the correlation analysis is always based on the most recent operational data, dynamically reflecting the latest changing trends in the relationship between influent flow rate and disinfectant dosage.

[0043] S302: Calculate the Pearson correlation coefficient between the historical influent flow rate data series and the historical disinfectant dosage data series, and calculate the mutual information value between the historical influent flow rate data series and the historical disinfectant dosage data series; The Pearson correlation coefficient is a statistic that measures the degree of linear correlation between two variables. Its value ranges from -1 to +1, with positive values ​​indicating a positive correlation and negative values ​​indicating a negative correlation. A larger absolute value indicates a stronger correlation. Mutual information, in information theory, is an indicator used to measure the degree of interdependence between two variables. It can capture not only linear relationships but also nonlinear associations; a larger value indicates a higher degree of information sharing between the two variables.

[0044] When calculating the Pearson correlation coefficient, the means of the historical influent flow rate data series and the historical disinfectant dosage data series are first calculated separately. Then, the deviation of each data point from its respective mean is calculated. The covariance is obtained by multiplying the deviations of the two series at corresponding times and summing them. The standard deviations of the two series are then calculated separately. The Pearson correlation coefficient is obtained by dividing the covariance by the product of the two standard deviations. When calculating the mutual information value, the two data series are first discretized or their probability density is estimated to construct a joint probability distribution and their respective marginal probability distributions. Then, the relative entropy of the product of the joint probability distribution and the marginal probability distributions is calculated according to the definition of mutual information. The Pearson correlation coefficient focuses on capturing the strength of the linear relationship between influent flow rate and dosage, while the mutual information value can identify more complex nonlinear dependence patterns between the two.

[0045] S303: Normalize the Pearson correlation coefficient and mutual information value respectively to obtain the normalized correlation coefficient and normalized mutual information value; The normalized correlation coefficient refers to the Pearson correlation coefficient after normalization, mapped to a standard interval of zero to one. The normalized mutual information value refers to the mutual information value after normalization, also mapped to a standard interval of zero to one.

[0046] During normalization, the Pearson correlation coefficient, whose original value range is between -1 and +1, is mapped to the zero-to-one interval through a linear transformation. Specifically, the correlation coefficient is incremented by one and then divided by two. For the mutual information value, since its theoretical bound depends on the variable's entropy, it is normalized by dividing by the theoretical maximum value, or by using a maximum-minimum normalization method based on historical statistical data, subtracting the historical minimum value from the mutual information value and then dividing by the difference between the historical maximum and minimum values. After normalization, both the Pearson correlation coefficient and the mutual information value are converted to a unified zero-to-one scale, facilitating subsequent weighted summation calculations. Normalization eliminates the difference in the original numerical ranges of the two indicators, ensuring that the contribution of the two indicators to the final result is not unbalanced due to dimensional issues during fusion calculations, allowing the weighted fusion result to truly reflect the combined effect of the two correlation measures.

[0047] S304: Summing the normalized correlation coefficient and the normalized mutual information value according to a preset weighting ratio yields the second weighting coefficient.

[0048] The weighting ratio refers to the weighting ratio assigned to the two indicators when integrating the normalized correlation coefficient and the normalized mutual information value. This ratio is determined based on the relative importance of linear and nonlinear relationships in practical applications.

[0049] When performing weighted summation, the weight values ​​of the normalized correlation coefficient and the normalized mutual information value are first determined according to the preset weighting ratio, and the sum of the two weight values ​​equals one. Then, the normalized correlation coefficient is multiplied by its corresponding weight value, and the normalized mutual information value is multiplied by its corresponding weight value. The two products are then added together to obtain the second weight coefficient. The weighting ratio reflects the degree of emphasis placed on linear and nonlinear correlations. When the influent flow rate and dosage in the wastewater treatment process mainly exhibit a linear relationship, the weight of the normalized correlation coefficient is set relatively large. When significant nonlinear characteristics exist, the weight of the normalized mutual information value is increased accordingly.

[0050] Optionally, when calculating the statistical correlation between variables and disinfectant dosage using a sliding window, the sliding window can update data in the following way: determine the sliding step size of the sliding window based on the preset duration of the sliding window; and update the running data within the sliding window at the end of each sliding step.

[0051] The sliding step size refers to the time interval by which the sliding window moves forward on the time axis each time. This step size determines the frequency of window updates and the timeliness of data refresh. Updating the running data within the window means that after the sliding window moves forward, historical data before the window's starting point is removed, while the latest data added at the window's ending point is included, keeping the total amount of data and the time span within the window constant.

[0052] When determining the sliding step size, a reasonable step size value is calculated based on the preset duration, ensuring both the continuity of window data and that the correlation analysis results can promptly reflect the latest operational status changes. During operation, the time of the last window update is recorded. When the time difference between the current time and the last update time reaches one sliding step size, the window update operation is triggered. The update operation first calculates the new window start time stamp, which is the current time minus the preset duration, and then calculates the new window end time stamp, which is the current time. Old data before the window start is deleted or marked from the operational database, and the latest operational data within the newly added time period of the window end is queried and added, including measurement records of parameters such as influent flow rate and disinfectant dosage. The updated sliding window contains a complete data sequence from the new start to the new end. Subsequent calculations of the Pearson correlation coefficient and mutual information value are re-executed based on the updated data sequence to obtain the second weight coefficient reflecting the correlation characteristics of the current stage.

[0053] Based on the above embodiments, as an optional implementation method, in S104, the current mode vector corresponding to the current water quality mode is determined according to the current influent parameters in the operating data, and the third weighting coefficient is determined according to the current mode vector and the historical mode vector matched in the historical operating data. This can be specifically achieved through the following steps S401-S404.

[0054] S401: Extract the current influent water quality indicators from the operational data and construct the influent water quality indicators into a current model vector. The influent water quality indicators include at least chemical oxygen demand, total nitrogen, total phosphorus, and suspended solids concentration. Among them, influent water quality indicators refer to key parameters reflecting the characteristics of pollutants in the wastewater treatment plant's influent. These indicators directly affect the biological treatment load and disinfectant requirements. Chemical oxygen demand (COD) represents the total amount of organic matter and reducing inorganic matter in the water that can be oxidized by chemical oxidants, reflecting the degree of organic pollution in the water. Total nitrogen refers to the sum of all forms of nitrogen in the water, including ammonia nitrogen, nitrate nitrogen, and organic nitrogen. Total phosphorus refers to the sum of all forms of phosphorus in the water, including orthophosphate and organic phosphorus. Suspended solids concentration refers to the mass concentration of insoluble solid particles in the water. The current model vector is a multidimensional numerical vector organized into multiple influent water quality indicators in a fixed order, used to characterize the comprehensive water quality characteristics of the influent at the current moment.

[0055] When extracting influent water quality indicators, the system reads the measured values ​​of water quality parameters obtained from various online monitoring devices or laboratory analyses at the current moment from the operational database. These parameters include the concentrations of chemical oxygen demand (COD), total nitrogen (TNO), total phosphorus (TP), and suspended solids (SSB). The extracted raw data is validated, outliers or missing values ​​are removed, and interpolation methods are used to complete missing data if necessary. The validated water quality indicators are arranged in a predetermined order to construct a multi-dimensional vector as the current model vector, with each dimension corresponding to a specific water quality indicator. The current model vector fully describes the influent water quality status and provides a standardized data structure for subsequent similarity comparisons with historical model vectors, facilitating rapid identification of similar historical operating conditions through vector operations.

[0056] S402: Use the cosine similarity algorithm or Euclidean distance algorithm to calculate the similarity value between the current pattern vector and multiple candidate historical pattern vectors in the pre-stored historical operation database; The cosine similarity algorithm measures the similarity of two vector directions by calculating the cosine of the angle between them. A cosine value closer to 1 indicates a closer similarity in the vector directions. The Euclidean distance algorithm measures the difference between two vectors by calculating the straight-line distance between points in a multidimensional space. A smaller distance indicates a greater similarity. The historical operation database is a data warehouse storing influent water quality indicators and corresponding operating parameters from different historical periods. Candidate historical pattern vectors are vectors composed of influent water quality indicators extracted from historical operation data at various historical moments. Each historical pattern vector represents a previously observed influent water quality state.

[0057] When calculating similarity scores, historical pattern vectors are first read one by one from the historical operation database. When using the cosine similarity algorithm, the sum of the products of the current pattern vector and the corresponding dimension values ​​of each historical pattern vector is calculated. The square root of the sum of the squares of the elements of each vector is then calculated, and the sum of the products is divided by the product of the two square roots to obtain the cosine similarity value. When using the Euclidean distance algorithm, the difference between the current pattern vector and the corresponding dimension values ​​of each historical pattern vector is calculated. The squares of each difference are then summed, and the square root of the sum is taken to obtain the Euclidean distance value. This distance value is then converted into a similarity value, calculated as the similarity equals the maximum distance minus the current distance value, divided by the maximum distance. All historical pattern vectors in the database are traversed, and the similarity score between each historical pattern vector and the current pattern vector is calculated, forming a similarity score list. The similarity calculation results quantitatively reflect the degree of closeness between the current influent water quality state and the influent water quality states of various historical periods.

[0058] S403: Select a preset number of historical pattern vectors as the historical pattern vectors for matching, based on the order of similarity values ​​from high to low. The preset quantity refers to the number of most similar samples selected from all historical pattern vectors. This number is preset based on the database size and prediction accuracy requirements. The matched historical pattern vectors refer to the several historical pattern vectors with the highest similarity to the current pattern vector. These vectors represent historical operating conditions that are closest to the current operating conditions, and their corresponding historical operating parameters have the highest reference value for current control decisions.

[0059] When selecting matching historical pattern vectors, all calculated similarity values ​​are first sorted in descending order, with the highest similarity value at the top and the lowest at the bottom. Historical pattern vectors are then selected sequentially from top to bottom according to the sorting result, stopping when a preset number of vectors are selected. The selected historical pattern vectors and their corresponding similarity values ​​are marked as matching results, and subsequent weight calculations and predictive analyses are performed only on these matching historical pattern vectors. By limiting the preset number, the representativeness of the reference samples is ensured, while avoiding noise interference introduced by too many low-similarity samples, thus improving the accuracy and computational efficiency of predictions based on historical data.

[0060] S404: Normalize the similarity values ​​corresponding to the historical pattern vectors to obtain the third weight coefficients corresponding to each historical pattern vector.

[0061] During normalization calculation, the similarity values ​​corresponding to all matching historical pattern vectors are first extracted, and the sum of these similarity values ​​is calculated. Then, the similarity value of each historical pattern vector is divided by the sum of similarities to obtain the third weight coefficient corresponding to that historical pattern vector. After normalization, the sum of all third weight coefficients equals one, ensuring the rationality and interpretability of the weight allocation. Historical pattern vectors with higher similarity values ​​obtain larger weight coefficients after normalization, indicating a high degree of similarity between the historical operating conditions and the current operating conditions, and their historical operating experience has higher reference value for current decision-making. Historical pattern vectors with lower similarity values ​​have smaller weight coefficients, and their impact on the prediction results is correspondingly weakened. The third weight coefficients obtained through normalization calculation achieve differentiated weighting for historical samples with different similarities. In subsequent disinfectant dosage prediction based on historical data, the historical dosage corresponding to each historical pattern vector is weighted and averaged according to the third weight coefficients to obtain the recommended dosage for the current influent water quality state, improving the targeting and accuracy of the prediction.

[0062] Based on the above embodiments, as an optional implementation method, the method of merging the first weight coefficient, the second weight coefficient and the third weight coefficient into the dynamic attention weight of multiple sewage treatment devices in S105 can be specifically implemented through the following steps S501-S504.

[0063] S501: Construct the association mapping relationship between multiple sewage treatment devices and each characteristic variable in the operation data. The association mapping relationship is used to characterize the degree of influence of each characteristic variable on the operating status of different sewage treatment devices. Wastewater treatment equipment refers to various treatment units and mechanical devices in the wastewater treatment process, including biological reaction tanks, secondary sedimentation tanks, disinfection equipment, and chemical dosing equipment. Characteristic variables refer to various parameters in the operational data that reflect the state of the wastewater treatment process, including influent water quality indicators, flow data, and historical dosage. The correlation mapping relationship describes the causal relationship or influence path between characteristic variables and wastewater treatment equipment, clarifying which characteristic variables have a significant impact on the operating state of specific equipment. The degree of influence refers to the strength of the effect of changes in the value of characteristic variables on the need to adjust equipment operating parameters; a greater degree of influence indicates that the characteristic variable is more important to equipment control decisions.

[0064] When constructing the correlation mapping relationship, all key equipment in the wastewater treatment process is first identified, and an equipment list is established. Then, the process function and control objectives of each piece of equipment are analyzed to determine the relevant characteristic variables affecting its operation. For disinfection equipment, its operating status is mainly affected by characteristic variables such as influent water quality indicators, influent flow rate, and historical disinfectant dosage; therefore, a correlation between disinfection equipment and these characteristic variables is established in the correlation mapping relationship. For biochemical reactors, their operating status is mainly affected by characteristic variables such as influent chemical oxygen demand, total nitrogen, and historical carbon source dosage; corresponding correlation relationships are established. Through a combination of process mechanism analysis, expert knowledge, and historical data statistical analysis, the influence of each characteristic variable on the equipment operating status is quantified. The degree of influence is numerically expressed through correlation analysis, sensitivity analysis, or causal inference methods. The completed correlation mapping relationship is stored in matrix or graph structure, where rows represent characteristic variables, columns represent wastewater treatment equipment, and the numerical values ​​of matrix elements represent the degree of influence.

[0065] S502: For each wastewater treatment device, based on the association mapping relationship, select the target weight set related to the wastewater treatment device from the first weight coefficient, the second weight coefficient and the third weight coefficient; The target weight set refers to the combination of relevant weight coefficients selected for a specific wastewater treatment equipment. This set includes various weight coefficients that have a real impact on the operation decision of the equipment.

[0066] When performing the screening operation, firstly, a wastewater treatment device to be analyzed is selected, and the list of relevant feature variables corresponding to that device is retrieved from the association mapping relationship. Then, the feature variables corresponding to the first weight coefficient, second weight coefficient, and third weight coefficient are checked one by one to determine whether these feature variables appear in the list of relevant feature variables for that device. If the historical carbon source dosage characteristic corresponding to the first weight coefficient is in the list of relevant feature variables for that device, then the first weight coefficient is included in the target weight set. If the influent flow rate characteristic corresponding to the second weight coefficient is in the list, then the second weight coefficient is included in the target weight set. If the influent water quality index characteristic corresponding to the third weight coefficient is in the list, then the third weight coefficient is included in the target weight set. For disinfection equipment, since its operation is mainly affected by influent flow rate and influent water quality, the target weight set obtained by screening includes the second weight coefficient and the third weight coefficient. For biological reactors, since their operation is affected by historical carbon source dosage and influent water quality, the target weight set obtained by screening includes the first weight coefficient and the third weight coefficient.

[0067] S503: Assign corresponding fusion ratios to each weight coefficient in the target weight set, perform weighted calculations, and generate feature importance vectors for each wastewater treatment device; The fusion ratio refers to the proportion allocated to each weight coefficient when combining multiple weight coefficients in the target weight set. This ratio reflects the relative importance of different types of weights to equipment control decisions. The feature importance vector is a multi-dimensional vector obtained after combining multiple weight coefficients. Each dimension of the vector corresponds to a feature variable, and the dimension value represents the overall importance of that feature variable to equipment operation decisions.

[0068] When allocating the fusion ratio, a fusion ratio value is set for each weight coefficient in the target weight set based on the process characteristics and control requirements of the wastewater treatment equipment, and the sum of all fusion ratio values ​​equals one. For disinfection equipment, if the target weight set includes a second weight coefficient and a third weight coefficient, a fusion ratio of 0.4 is assigned to the second weight coefficient and a fusion ratio of 0.6 is assigned to the third weight coefficient, based on the relative influence of influent flow rate and influent water quality on disinfection requirements. During weighted calculation, each weight coefficient in the target weight set is first multiplied by its corresponding fusion ratio to obtain the weighted value of each weight coefficient. These weighted values ​​are then organized according to the feature variable dimensions to construct a feature importance vector. The number of dimensions in the feature importance vector equals the total number of feature variables related to the equipment, and the value of each dimension is the sum of all weighted weight coefficients related to the corresponding feature variable.

[0069] S504: Normalize the feature importance vector to obtain the dynamic attention weights corresponding to each wastewater treatment device.

[0070] During normalization, the sum of all dimensions in the feature importance vector is first calculated. Then, each dimension's value is divided by the sum to obtain the normalized value, which represents the dynamic attention weight component of the corresponding feature variable. The sum of all normalized dynamic attention weight components equals one, ensuring the rationality of weight allocation. Normalization eliminates the dimensional influence of the original feature importance vector values, converting them into a standardized probability distribution. The dynamic attention weight vector is directly applied to the control decision-making process of wastewater treatment equipment. In the prediction model or control algorithm, the input values ​​of each feature variable are weighted according to the dynamic attention weights; feature variables with larger weights have a more significant impact on prediction results and control commands. Since the dynamic attention weights are calculated based on real-time operating data, the weight vector is continuously and dynamically adjusted as the sliding window updates, similarity is recalculated, and the time decay coefficient changes. This allows the control strategy to adapt to changes in the importance of feature variables under different operating conditions, improving the accuracy and robustness of wastewater treatment process control.

[0071] Based on the above embodiments, as an optional implementation method, the dynamic attention weight and operation data are input into the preset disinfectant dosing prediction model in S106, and the disinfectant dosing instructions for each sewage treatment equipment are output. This can be achieved through the following steps S601-S602.

[0072] S601: Input the dynamic attention weights and operating data into the preset disinfectant dosing prediction model to obtain the current change in disinfectant dosing for each wastewater treatment device; The disinfectant dosage prediction model refers to a prediction model built based on machine learning or deep learning algorithms. This model accepts operational data and dynamic attention weights as input and outputs suggestions for adjusting the disinfectant dosage. The disinfectant dosage change refers to the amount of disinfectant that needs to be increased or decreased relative to the previous dosage. A positive value indicates that the dosage needs to be increased, and a negative value indicates that the dosage needs to be decreased.

[0073] During the prediction process, the numerical values ​​of each feature variable in the operational data are first extracted and organized into an input vector according to the order of the feature variables. Then, the dynamic attention weight vector is combined with the operational data input vector. By multiplying each dimension of the operational data input vector by the corresponding dynamic attention weight component, attention-weighted input data is obtained. This weighted input data is fed into the disinfectant dosing prediction model. Internally, the model uses a multi-layer neural network or other prediction algorithms to perform nonlinear transformations and feature extraction on the input data. The hidden layers of the model progressively learn the complex mapping relationship between input features and disinfectant dosage. The output layer of the prediction model generates the current value of the disinfectant dosage change for each wastewater treatment device. This value comprehensively considers changes in influent water quality, flow fluctuations, historical dosing effects, and the dynamic importance of different feature variables. Because the dynamic attention weight highlights the influence of key feature variables under the current operating conditions, the prediction model can specifically adjust the dosage change based on the changing trends of important features, improving prediction accuracy and response speed.

[0074] S602: Based on the preset flow-frequency characteristic curve of the dosing pump, the operating frequency of the dosing pump is determined according to the change in disinfectant dosage, and disinfectant dosing instructions are generated for each sewage treatment equipment.

[0075] The flow-frequency characteristic curve of a dosing pump describes the relationship between the pump's output flow rate and the motor's operating frequency. This curve reflects the characteristic of precisely controlling the chemical dosing flow rate by adjusting the pump's operating frequency. The pump's operating frequency refers to the AC frequency driving the pump motor; changes in this frequency directly affect the pump's speed and output flow rate.

[0076] When determining the operating frequency of the dosing pump, the current operating frequency and corresponding disinfectant dosing flow rate are first obtained. Based on the change in disinfectant dosage, the target disinfectant dosing flow rate is calculated; the target flow rate equals the current dosing flow rate plus the change in dosage. The operating frequency corresponding to the target dosing flow rate is retrieved from a preset dosing pump flow-frequency characteristic curve. The characteristic curve achieves precise conversion from flow rate to frequency through interpolation or table lookup. If the change in dosage is positive and the target frequency is higher than the current frequency, the dosing pump speed needs to be increased to increase the dosage. If the change in dosage is negative and the target frequency is lower than the current frequency, the dosing pump speed needs to be decreased to reduce the dosage. Based on the determined target operating frequency, a disinfectant dosing command is generated. The command includes the target frequency value, frequency adjustment rate, and the corresponding wastewater treatment equipment identifier. The generated disinfectant dosing command is sent to the dosing pump frequency converter via a communication interface. After receiving the command, the controller adjusts the motor power supply frequency, driving the dosing pump to operate at the target frequency, achieving precise control of the disinfectant dosing. For multiple dosing pumps of different sewage treatment equipment, corresponding dosing instructions are generated to achieve coordinated control of multiple equipment and ensure that the disinfection effect of the entire sewage treatment system meets the effluent water quality standards.

[0077] The following are system embodiments of this application, which can be used to execute the method embodiments of this application. For details not disclosed in the system embodiments of this application, please refer to the method embodiments of the application.

[0078] Please see Figure 2 This illustration shows a schematic diagram of an attention weight calculation system for disinfection control in a wastewater treatment plant, provided in an exemplary embodiment of this application. The system can be implemented as all or part of a system through software, hardware, or a combination of both. The attention weight calculation system for disinfection control in a wastewater treatment plant includes: The data acquisition module is used to acquire operational data from the wastewater treatment plant. The first weight coefficient calculation module is used to compare the running data with the preset business rules and determine the first weight coefficient of the adjustment variable corresponding to the corresponding business rule. The second weighting coefficient calculation module is used to calculate the correlation coefficient and mutual information value between the influent flow rate and the disinfectant dosage in the operation data through a sliding window of preset duration, and to determine the second weighting coefficient based on the correlation coefficient and mutual information value. The third weighting coefficient calculation module is used to determine the current mode vector corresponding to the current water quality mode based on the current influent parameters in the operation data, and to determine the third weighting coefficient based on the current mode vector and the historical mode vector matched in the historical operation data. The weight coefficient fusion module is used to fuse the first weight coefficient, the second weight coefficient, and the third weight coefficient into dynamic attention weights for multiple wastewater treatment devices; The instruction output module is used to input dynamic attention weights and operating data into a preset disinfectant dosing prediction model and output disinfectant dosing instructions for each wastewater treatment device. The disinfectant dosing instructions are used to adjust the operating frequency of the dosing pump to control the effluent indicators of the wastewater treatment plant.

[0079] This application also provides a computer storage medium that can store multiple instructions. The instructions are adapted to be loaded and executed by a processor, such as the attention weight calculation method for disinfection control in a wastewater treatment plant as described in the above embodiments. For the specific execution process, please refer to the detailed description of the embodiments, which will not be repeated here.

[0080] Please see Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 3 As shown, the electronic device 300 may include: at least one processor 301, at least one network interface 304, user interface 303, memory 305, and at least one communication bus 302.

[0081] The communication bus 302 is used to enable communication between these components.

[0082] The user interface 303 may include a display screen and a camera.

[0083] The network interface 304 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0084] The processor 301 may include one or more processing cores. The processor 301 connects to various parts of the server using various interfaces and lines, and performs various server functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 305, and by calling data stored in the memory 305. Optionally, the processor 301 may be implemented using at least one hardware form of digital signal processing, field-programmable gate array, or programmable logic array. The processor 301 may integrate one or more of the following: a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 301 and may be implemented as a separate chip.

[0085] The memory 305 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 305 may include a non-transitory computer-readable medium. The memory 305 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 305 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), instructions for implementing the various method embodiments described above, etc.; the data storage area may store data involved in the various method embodiments described above, etc. Optionally, the memory 305 may also be at least one storage device located remotely from the aforementioned processor 301. Figure 3 As shown, the memory 305, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an application program for an attention weight calculation method for disinfection control in wastewater treatment plants.

[0086] exist Figure 3 In the electronic device 300 shown, the user interface 303 is mainly used to provide an input interface for the user and to obtain the user input data; while the processor 301 can be used to call an application program stored in the memory 305 for an attention weight calculation method for disinfection control in a sewage treatment plant. When executed by one or more processors, the electronic device executes one or more methods as described in the above embodiments.

[0087] An electronic device readable storage medium stores instructions that, when executed by one or more processors, cause the electronic device to perform one or more methods as described in the above embodiments.

[0088] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0089] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0090] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the shown or discussed mutual couplings or direct couplings or communication connections may be through some service interfaces; indirect couplings or communication connections between apparatuses or units may be electrical or other forms.

[0091] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0092] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0093] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, portable hard drives, magnetic disks, or optical disks.

[0094] The above are merely exemplary embodiments of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. Those skilled in the art will readily conceive of other embodiments of this disclosure upon considering the specification and practical application disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described in this disclosure.

Claims

1. A method for calculating attention weights for disinfection control in wastewater treatment plants, characterized in that, The method includes: Obtain operational data from wastewater treatment plants; The running data is compared with the preset business rules to determine the first weight coefficient of the adjustment variable corresponding to the business rule; By using a sliding window of preset duration, the correlation coefficient and mutual information value between the influent flow rate and the disinfectant dosage in the operation data are calculated, and a second weighting coefficient is determined based on the correlation coefficient and the mutual information value. The current mode vector corresponding to the current water quality mode is determined based on the current influent parameters in the operation data, and the third weighting coefficient is determined based on the current mode vector and the historical mode vector matched in the historical operation data. The first weighting coefficient, the second weighting coefficient, and the third weighting coefficient are combined into a dynamic attention weight for multiple wastewater treatment devices; The dynamic attention weights and the operating data are input into a preset disinfectant dosing prediction model, and disinfectant dosing instructions are output for each of the wastewater treatment devices. The disinfectant dosing instructions are used to adjust the operating frequency of the dosing pump to control the effluent indicators of the wastewater treatment plant.

2. The method according to claim 1, characterized in that, The business rules include rainy day rules, compound exceedance rules, and time decay rules. The step of comparing the operational data with preset business rules to determine the first weighting coefficient of the adjustment variable corresponding to the business rule includes: Based on the rainy weather rules, the current weather information or rainfall information in the operation data is obtained; if the current weather is rainy or the rainfall is greater than the preset rainfall threshold, the inflow rate is used as an adjustment variable, and the first weighting coefficient corresponding to the inflow rate is reduced according to the first preset ratio. Based on the compound exceeding the standard rule, the total influent ammonia nitrogen value and the ammonia nitrogen detection value of the biological treatment tank effluent in the operation data are obtained; if the total influent ammonia nitrogen value is greater than the first preset concentration threshold or the ammonia nitrogen detection value of the biological treatment tank effluent is greater than the second preset concentration threshold, then the total influent ammonia nitrogen and the biological treatment tank effluent ammonia nitrogen are used as adjustment variables, and the first weighting coefficients corresponding to the total influent ammonia nitrogen and the biological treatment tank effluent ammonia nitrogen are increased according to the second preset ratio; Obtain the historical carbon source addition amount from the operational data, and substitute the historical carbon source addition amount into the exponential decay formula corresponding to the time decay rule to obtain the first weighting coefficient corresponding to the historical carbon source addition amount.

3. The method according to claim 1, characterized in that, The process involves calculating the correlation coefficient and mutual information value between the influent flow rate and the disinfectant dosage in the operational data through a sliding window of preset duration, and determining a second weighting coefficient based on the correlation coefficient and the mutual information value, including: Extract the historical influent flow rate data sequence and historical disinfectant dosage data sequence from the operational data for a preset duration prior to the current moment, and use them as sample data within a sliding window of a preset duration. Calculate the Pearson correlation coefficient between the historical influent flow rate data sequence and the historical disinfectant dosage data sequence, and calculate the mutual information value between the historical influent flow rate data sequence and the historical disinfectant dosage data sequence; The Pearson correlation coefficient and the mutual information value are normalized respectively to obtain the normalized correlation coefficient and the normalized mutual information value; The normalized correlation coefficient and the normalized mutual information value are summed according to a preset weighting ratio to obtain the second weighting coefficient.

4. The method according to claim 3, characterized in that, The method further includes: The sliding step size of the sliding window is determined according to the preset duration of the sliding window; At the end of each sliding step, the running data within the sliding window is updated.

5. The method according to claim 1, characterized in that, The step of determining the current mode vector corresponding to the current water quality mode based on the current influent parameters in the operational data, and determining the third weighting coefficient based on the current mode vector and the historical mode vector matched in the historical operational data, includes: The current influent water quality indicators are extracted from the operational data, and the influent water quality indicators are constructed into the current mode vector. The influent water quality indicators include at least chemical oxygen demand, total nitrogen, total phosphorus, and suspended solids concentration. The cosine similarity algorithm or the Euclidean distance algorithm is used to calculate the similarity value between the current pattern vector and multiple historical candidate pattern vectors in the pre-stored historical operation database; Based on the similarity values ​​from high to low, a preset number of historical candidate pattern vectors are selected as the historical pattern vectors for matching. The similarity values ​​corresponding to the historical pattern vectors are normalized to obtain the third weight coefficients corresponding to each historical pattern vector.

6. The method according to claim 1, characterized in that, The process of fusing the first weighting coefficient, the second weighting coefficient, and the third weighting coefficient into a dynamic attention weight for multiple wastewater treatment devices includes: A correlation mapping relationship is constructed between multiple wastewater treatment devices and each feature variable in the operational data. The correlation mapping relationship is used to characterize the degree of influence of each feature variable on the operating status of different wastewater treatment devices. For each of the wastewater treatment devices, based on the association mapping relationship, a set of target weights related to the wastewater treatment device is selected from the first weight coefficient, the second weight coefficient, and the third weight coefficient; Assign a corresponding fusion ratio to each weight coefficient in the target weight set, and perform weighted calculations to generate the feature importance vector of each of the wastewater treatment devices; The feature importance vector is normalized to obtain the dynamic attention weights corresponding to each wastewater treatment device.

7. The method according to claim 1, characterized in that, The step of inputting the dynamic attention weights and the operating data into a preset disinfectant dosing prediction model and outputting disinfectant dosing instructions for each of the wastewater treatment devices includes: The dynamic attention weights and the operating data are input into a preset disinfectant dosing prediction model to obtain the change in disinfectant dosing for each of the wastewater treatment devices at the current moment. Based on the preset flow-frequency characteristic curve of the dosing pump, the operating frequency of the dosing pump is determined according to the change in the amount of disinfectant added, and disinfectant dosing instructions are generated for each of the wastewater treatment devices.

8. An attention weight calculation system for disinfection control in wastewater treatment plants, characterized in that, The system includes: The data acquisition module is used to acquire operational data from the wastewater treatment plant. The first weight coefficient calculation module is used to compare the running data with the preset business rules and determine the first weight coefficient of the adjustment variable corresponding to the business rules. The second weighting coefficient calculation module is used to calculate the correlation coefficient and mutual information value between the influent flow rate and the disinfectant dosage in the operation data through a sliding window of preset duration, and to determine the second weighting coefficient based on the correlation coefficient and the mutual information value. The third weighting coefficient calculation module is used to determine the current mode vector corresponding to the current water quality mode based on the current influent parameters in the operation data, and to determine the third weighting coefficient based on the current mode vector and the historical mode vector matched in the historical operation data. The weight coefficient fusion module is used to fuse the first weight coefficient, the second weight coefficient, and the third weight coefficient into dynamic attention weights for multiple wastewater treatment devices; The instruction output module is used to input the dynamic attention weight and the running data into a preset disinfectant dosing prediction model, and output disinfectant dosing instructions for each of the wastewater treatment devices. The disinfectant dosing instructions are used to adjust the operating frequency of the dosing pump to control the effluent indicators of the wastewater treatment plant.

9. A computer storage medium, characterized in that, The computer storage medium stores a plurality of instructions, which are adapted to be loaded by a processor and executed as described in any one of claims 1 to 7.

10. An electronic device, characterized in that, The device includes a processor, a memory, and a transceiver, wherein the memory is used to store instructions, the transceiver is used to communicate with other devices, and the processor is used to execute the instructions stored in the memory to cause the electronic device to perform the method as described in any one of claims 1 to 7.