A deep learning-based real-time detection system for water quality parameters in sewage treatment

The real-time monitoring system for wastewater quality parameters based on deep learning utilizes a distributed sensor network and a multi-task deep learning model to achieve real-time and accurate monitoring and emergency response of the wastewater treatment process. This solves the problems of lag and unstable accuracy of traditional monitoring methods, and improves the safety and efficiency of wastewater treatment.

CN121167200BActive Publication Date: 2026-04-17HANGZHOU BEISHUI CLOUD SERVICE TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU BEISHUI CLOUD SERVICE TECHNOLOGY CO LTD
Filing Date
2025-09-19
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Traditional wastewater treatment plant water quality testing methods cannot achieve real-time detection, resulting in delayed test results, increased treatment pressure and environmental risks, and unstable detection accuracy.

Method used

A real-time monitoring system for wastewater treatment water quality parameters based on deep learning is adopted. This system collects multi-source dynamic data in real time through a distributed sensor network. By combining feature reconstruction, multi-task deep learning models, and multi-head self-attention mechanisms, it can achieve real-time and accurate prediction of multiple key effluent water quality parameters and trigger emergency response mechanisms.

Benefits of technology

It enables real-time and accurate detection of the wastewater treatment process, reduces prediction errors, improves the safety and controllability of the wastewater treatment process, reduces the risk of pollution spread, and achieves the dual goals of improving the quality and saving energy in wastewater treatment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121167200B_ABST
    Figure CN121167200B_ABST
Patent Text Reader

Abstract

The application provides a sewage treatment water quality parameter real-time detection system based on deep learning, and relates to the technical field of data processing, and comprises a data acquisition module, which is used for collecting multi-source dynamic data in a sewage treatment process in real time through a distributed sensor network; a feature reconstruction module, which is used for feature space reconstruction on the multi-source dynamic data, and generates a dynamic correction parameter through time sequence correlation analysis; a learning and prediction module, which is used for inputting the dynamic correction parameter into a pre-trained multi-task deep learning model, evaluating the influence degree of each feature variable through parameter contribution degree analysis, and dynamically adjusting feature importance distribution by using an adaptive weighting mechanism to obtain an adjusted feature representation. The application realizes real-time and accurate detection of water quality parameters, timely early warning of over-standard risk, and optimization of energy consumption and stable control of effluent water quality in the sewage treatment process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a real-time monitoring system for wastewater quality parameters based on deep learning. Background Technology

[0002] In urban wastewater treatment plants, traditional testing technologies have some limitations in practical applications. The time required from sampling to obtaining results is relatively long, which means that the test results cannot reflect the current state of the wastewater in real time. After the morning water consumption peak, a large amount of domestic sewage carrying impurities enters the sedimentation tank, which may lead to faster sludge accumulation at the bottom of the tank and a sudden increase in sludge concentration. The entire process of testing using traditional methods, including water sample transportation, instrument preheating, filtration, drying, and waiting, takes at least 2-3 hours. When the test results show that the sludge concentration has exceeded the reasonable range, 3-4 hours have passed since the parameter fluctuation occurred, which increases the processing pressure on the filtration unit and may even lead to short-term effluent turbidity exceeding the standard.

[0003] Furthermore, in the complex on-site environment and operating procedures of wastewater treatment plants, various external factors can easily lead to deviations in test results, making it difficult to consistently ensure data accuracy. If the actual turbidity exceeds the standard but the test value shows that it is qualified, it will lead to the failure to adjust the operating parameters of the filtration unit in a timely manner, increasing the environmental risks of wastewater discharge. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to provide a real-time detection system for wastewater treatment water quality parameters based on deep learning, so as to realize accurate real-time detection of wastewater treatment water quality parameters, timely assessment and early warning of pollution level and emergency response, and improve the operating efficiency of wastewater treatment process.

[0005] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:

[0006] Firstly, a real-time monitoring system for wastewater quality parameters based on deep learning, comprising:

[0007] The data acquisition module is used to collect multi-source dynamic data in real time during the wastewater treatment process through a distributed sensor network;

[0008] The feature reconstruction module is used to reconstruct the feature space of multi-source dynamic data and generate dynamic correction parameters through temporal correlation analysis.

[0009] The learning prediction module is used to input dynamically corrected parameters into a pre-trained multi-task deep learning model, evaluate the influence of each feature variable through parameter contribution analysis, and dynamically adjust the feature importance allocation using an adaptive weighting mechanism to obtain the adjusted feature representation.

[0010] The parameter prediction module is used to predict the concentration of multiple key effluent water quality parameters in real time based on the adjusted feature representation, and obtain the concentration prediction value.

[0011] The assessment and early warning module is used to assess the degree of wastewater pollution in real time based on the concentration prediction value and compare the prediction value with the preset safety threshold. If the prediction value is greater than the threshold, the corresponding emergency response mechanism is triggered, and the assessment results and early warning information are transmitted to the central monitoring platform through the process control communication protocol.

[0012] The control and adjustment module is used to determine the final set values ​​of the control parameters of the wastewater treatment process based on real-time evaluation results and uploaded data, combined with a multi-objective strategy with energy consumption and water quality compliance as the core constraints, so as to realize real-time detection and stable control of effluent water quality.

[0013] Furthermore, feature space reconstruction is performed on multi-source dynamic data, and dynamic correction parameters are generated through temporal correlation analysis, including:

[0014] Multi-source dynamic data is standardized and denoised preprocessed to obtain preprocessed standardized time-series data.

[0015] Based on standardized time series data, a sliding window mechanism is used to segment the time series data and construct a multivariate time series sample set.

[0016] Multi-source feature fusion is performed on a multivariate time series sample set, and principal component analysis is performed on the fused high-dimensional features to achieve feature dimensionality reduction and reconstruction, resulting in a low-dimensional dense feature representation.

[0017] Based on low-dimensional dense feature representation, time-series correlation analysis is used to calculate the correlation coefficients between each water quality variable and the operational variable at different lag times, forming a dynamic correlation matrix;

[0018] The dynamic correlation matrix is ​​analyzed to generate dynamic correction parameters for real-time correction.

[0019] Furthermore, dynamically adjusted parameters are input into a pre-trained multi-task deep learning model. The influence of each feature variable is evaluated through parameter contribution analysis, and an adaptive weighting mechanism is used to dynamically adjust the feature importance allocation to obtain the adjusted feature representation, including:

[0020] The dynamic correction parameters are fused with the high-dimensional temporal feature matrix at the feature level to form an enhanced feature tensor.

[0021] The enhanced feature tensor is input into the pre-trained multi-task deep learning model, and the weight distribution of each feature variable on different attention heads is calculated using the multi-head self-attention mechanism in the model to generate the initial contribution score matrix of each feature variable.

[0022] An aggregation analysis was performed on the initial contribution score matrix in the time series dimension. The importance of each feature variable was normalized using a normalization calculation method. Based on the calculation results, a dynamic weight coefficient vector for each feature variable was generated.

[0023] The dynamic weight coefficient vector is weighted element-wise with the feature representation of the corresponding time step to obtain the enhanced temporal feature representation.

[0024] The enhanced temporal feature representation is subjected to cross-channel feature fusion, and a gating mechanism is used to regulate the information flow of different feature channels to generate the final adjusted feature representation.

[0025] Furthermore, the enhanced feature tensor is input into the pre-trained multi-task deep learning model, and the multi-head self-attention mechanism in the model is used to calculate the weight distribution of each feature variable on different attention heads, generating an initial contribution score matrix for each feature variable, including:

[0026] Through multiple parallel linear transformation layers in the multi-head self-attention mechanism, the input features are mapped to different feature subspaces to obtain the query vector, key vector and value vector corresponding to each subspace;

[0027] Based on the query vector and key vector, the attention weight of each position in the feature sequence to all positions is calculated in each feature subspace, and the subspace attention weight distribution reflecting the local dependency is obtained.

[0028] The attention weight distributions of each subspace are weighted, fused, and normalized to aggregate the output information of all attention heads and generate a global attention weight distribution that represents the correlation of global features.

[0029] Based on the global attention weight distribution, calculate the initial importance score of each feature variable for the prediction task of multiple effluent water quality parameters;

[0030] All initial importance scores are integrated to construct a two-dimensional contribution score matrix for the prediction task, which includes behavioral feature variables.

[0031] Furthermore, based on the adjusted feature representation, the concentrations of several key effluent water quality parameters are predicted in real time to obtain predicted concentration values, including:

[0032] The final adjusted feature representation is input into the multi-scale feature extraction process. By extracting features at different time scales, a feature representation including features at multiple time scales is obtained.

[0033] Multi-timescale feature representations are input into the feature fusion processing stage, and a unified multi-scale fused feature representation is generated through feature weighted fusion operation.

[0034] The multi-scale fused feature representation is input into multiple parallel water quality parameter prediction processing branches. Each processing branch receives the same features and is specifically responsible for the prediction task of one water quality parameter.

[0035] In each prediction processing branch, temporal convolution is used to perform deep feature extraction on the input features to obtain a high-dimensional feature mapping representation;

[0036] The high-dimensional feature map is input to the regression output processing layer, and the feature representation is converted into the concentration prediction value of the corresponding water quality parameter through nonlinear transformation.

[0037] Furthermore, the degree of wastewater pollution is assessed in real time based on the predicted concentration values, and these values ​​are compared with preset safety thresholds. If the predicted value exceeds the threshold, a corresponding emergency response mechanism is triggered, and the assessment results and early warning information are transmitted to the central monitoring platform via a process control communication protocol, including:

[0038] Preset safe threshold ranges for each key water quality parameter and construct a multi-level early warning threshold system;

[0039] Based on a multi-level early warning threshold system, the predicted concentration value is compared and analyzed with the safety threshold to generate an indicator of the water quality parameter exceeding the standard.

[0040] Based on the severity of the exceeding status indicator, the corresponding level of emergency response procedure is triggered, and the corresponding emergency control measures are implemented;

[0041] It records the predicted values ​​of all water quality parameters, the status of exceeding standards, and the emergency measures implemented in real time, and generates a complete pollution assessment report based on the recorded results;

[0042] The pollution assessment report, early warning information, and real-time forecast data are packaged into a standard format data transmission packet and sent to the central monitoring platform through the process control communication protocol.

[0043] Furthermore, based on real-time assessment results and uploaded data, and combined with a multi-objective strategy centered on energy consumption and water quality compliance, the final set values ​​of control parameters for the wastewater treatment process are determined to achieve real-time monitoring and stable control of effluent quality, including:

[0044] With energy consumption and water quality compliance as the core objectives, a multi-objective scheme is constructed, and various constraints in the wastewater treatment operation process are determined simultaneously.

[0045] Based on a multi-objective scheme, dynamic analysis is performed using real-time water quality parameter prediction results to determine the final adjustment values ​​of the control parameters.

[0046] The final adjustment values ​​are converted into specific control signals and transmitted to the corresponding execution equipment at the wastewater treatment site;

[0047] Based on the executed control operations, a closed-loop control method is adopted. According to the difference between the real-time monitored effluent water quality data and the preset target value, the control parameter adjustment values ​​are continuously fed back and corrected to achieve real-time operation of the sewage treatment process and stable control of effluent water quality.

[0048] Furthermore, based on a multi-objective scheme and combined with real-time water quality parameter prediction results, dynamic analysis is performed to determine the final adjustment values ​​of the control parameters, including:

[0049] Based on a multi-objective scheme, the operational constraints and the weight configuration of each objective are dynamically adjusted according to the real-time water quality parameter prediction results.

[0050] A multi-objective optimization algorithm is used to solve for the control parameters, resulting in a set of solutions that characterize the final equilibrium relationship between different objectives.

[0051] Based on the actual operating strategy, a final balancing scheme is selected from the solution set to determine the final adjustment values ​​of the control parameters.

[0052] In a second aspect, a computing device includes:

[0053] One or more processors;

[0054] A storage device for storing one or more programs that, when executed by one or more processors, enable the one or more processors to implement the system.

[0055] Thirdly, a computer-readable storage medium storing a program that, when executed by a processor, implements the system.

[0056] The above-described solution of the present invention has at least the following beneficial effects:

[0057] By collecting multi-source dynamic data in real time through a distributed sensor network, and combining it with standardized noise reduction, sliding window time-series segmentation, and principal component analysis dimensionality reduction, this approach can comprehensively capture key wastewater information, eliminate redundant interference, and optimize the feature space. This reduces the problems of messy data acquisition and low feature utilization in traditional methods. Relying on a pre-trained multi-task deep learning model, and combining it with a multi-head self-attention mechanism to analyze the contribution of feature variables, the importance of features is dynamically adjusted through an adaptive weighting mechanism. After multi-scale feature extraction and parallel prediction branches, real-time and accurate prediction of the concentrations of multiple key effluent water quality parameters is achieved, effectively reducing prediction errors and minimizing the reliance on experience inherent in traditional methods. The system addresses prediction bias caused by a single model. Based on a pre-set multi-level early warning threshold system, it quickly compares the predicted concentration value with the safety threshold, promptly generates an exceedance status indicator, and triggers the corresponding level of emergency response mechanism. Simultaneously, it transmits the assessment report and early warning information to the central monitoring platform in real time through the process control communication protocol, reducing the risk of pollution spread and improving the safety and controllability of the wastewater treatment process. With energy consumption and water quality compliance as the core, a multi-objective strategy is constructed. The system dynamically adjusts the operating constraints and target weights based on real-time assessment results. The control parameters are solved through a multi-objective optimization algorithm and continuously corrected through closed-loop control, achieving the dual goals of improving wastewater treatment quality and saving energy. Attached Figure Description

[0058] Figure 1 This is a schematic diagram of a real-time monitoring system for wastewater treatment water quality parameters based on deep learning, provided by an embodiment of the present invention.

[0059] Figure 2 This is a schematic diagram of the process for real-time prediction of the concentration of multiple key effluent water quality parameters based on the adjusted feature representation provided by an embodiment of the present invention, to obtain the concentration prediction value. Detailed Implementation

[0060] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0061] like Figure 1 As shown, an embodiment of the present invention proposes a real-time detection system for wastewater treatment water quality parameters based on deep learning, comprising:

[0062] The data acquisition module is used to collect multi-source dynamic data in real time during the wastewater treatment process through a distributed sensor network;

[0063] The feature reconstruction module is used to reconstruct the feature space of multi-source dynamic data and generate dynamic correction parameters through temporal correlation analysis.

[0064] The learning prediction module is used to input dynamically corrected parameters into a pre-trained multi-task deep learning model, evaluate the influence of each feature variable through parameter contribution analysis, and dynamically adjust the feature importance allocation using an adaptive weighting mechanism to obtain the adjusted feature representation.

[0065] The parameter prediction module is used to predict the concentration of multiple key effluent water quality parameters in real time based on the adjusted feature representation, and obtain the concentration prediction value.

[0066] The assessment and early warning module is used to assess the degree of wastewater pollution in real time based on the concentration prediction value and compare the prediction value with the preset safety threshold. If the prediction value is greater than the threshold, the corresponding emergency response mechanism is triggered, and the assessment results and early warning information are transmitted to the central monitoring platform through the process control communication protocol.

[0067] The control and adjustment module is used to determine the final set values ​​of the control parameters of the wastewater treatment process based on real-time evaluation results and uploaded data, combined with a multi-objective strategy with energy consumption and water quality compliance as the core constraints, so as to realize real-time detection and stable control of effluent water quality.

[0068] In this embodiment of the invention, multi-source dynamic data is collected in real time through a distributed sensor network. Combined with standardized noise reduction, sliding window time-series segmentation, and principal component analysis dimensionality reduction, this approach comprehensively captures key wastewater information while eliminating redundant interference and optimizing the feature space. This reduces the problems of cluttered data collection and low feature utilization associated with traditional methods. Relying on a pre-trained multi-task deep learning model, and combining it with a multi-head self-attention mechanism to analyze the contribution of feature variables, the importance of features is dynamically adjusted through an adaptive weighting mechanism. After multi-scale feature extraction and parallel prediction branches, real-time and accurate prediction of the concentrations of multiple key effluent water quality parameters is achieved, effectively reducing prediction errors and minimizing the impact of traditional methods. Prediction biases caused by reliance on experience and a single model are addressed by a pre-set multi-level early warning threshold system. This system rapidly compares predicted concentration values ​​with safe thresholds, promptly generates exceedance status indicators, and triggers corresponding emergency response mechanisms. Simultaneously, assessment reports and early warning information are transmitted to the central monitoring platform in real time via a process control communication protocol. This reduces the risk of pollution spread and improves the safety and controllability of the wastewater treatment process. A multi-objective strategy is constructed with energy consumption and water quality compliance as the core objectives. Operational constraints and objective weights are dynamically adjusted based on real-time assessment results. Control parameters are solved through a multi-objective optimization algorithm and continuously corrected through closed-loop control, achieving the dual goals of improving wastewater treatment quality and saving energy.

[0069] In a preferred embodiment of the present invention, feature space reconstruction of multi-source dynamic data and generation of dynamic correction parameters through temporal correlation analysis may include:

[0070] In this embodiment of the invention, multi-source dynamic data undergoes standardization and noise reduction preprocessing to obtain preprocessed standardized time-series data. Specifically, this includes: first, determining the specific types of multi-source dynamic data. These data all originate from a distributed sensor network at the wastewater treatment site, including sludge concentration, turbidity, and COD concentration reflecting water quality status, and influent flow rate, aeration flow rate, chemical dosage, and water temperature reflecting process operation. Each type of data is continuously acquired at a frequency of one collection point per minute. During standardization, each data type is calculated separately. First, the values ​​of all collection points for that type of data over the past 24 hours are statistically analyzed. These values ​​are summed and divided by the total number of collection points to obtain the average value for that type of data. Then, the difference between each collection point's value and the average value is calculated. The squares of all differences are summed and divided by the total number of collection points to obtain the variance. The square root of the variance is then used to obtain the standard deviation. Finally, the average value is subtracted from the value of each collection point in that type of data, and the resulting difference is divided by the standard deviation. This calculation eliminates the dimensional differences between different data types, such as sludge concentration being in mg / L and flow rate being in m³ / s. 3 The difference caused by different / h values; the noise reduction preprocessing adopts the moving average method. For each type of data, a sliding window containing 5 consecutive acquisition points is set. That is, each time the current acquisition point and the previous 4 acquisition points are selected, a total of 5 values ​​are selected. The sum of these 5 values ​​is divided by 5 to obtain the average value. The average value is used to replace the original value of the current acquisition point, thereby filtering out abnormal values ​​caused by instantaneous voltage fluctuations and on-site airflow interference from the sensor. Finally, standardized time series data of each data type at different time points are obtained.

[0071] Based on standardized time-series data, a sliding window mechanism is used for time-series segmentation to construct a multivariate time-series sample set. Specifically, this involves: based on various types of standardized time-series data, and considering the fluctuation patterns of water quality parameters during wastewater treatment (e.g., sludge concentration tends to change significantly within 30 minutes after the morning water usage peak), a sliding window duration of 30 minutes is set, meaning each window contains standardized data from 30 consecutive minute collection points. Simultaneously, a window sliding step of 5 minutes is set, meaning the window moves every 5 minutes. Starting from the first collection point, the first window containing data from minutes 1 to 30 is generated; then, starting from minute 6, a window containing data from minutes 6 to 35 is generated, and so on. Each window not only contains the values ​​from 30 collection points of all data types but also indicates the corresponding time interval, such as 08:00-08:30. All generated windows are arranged chronologically, with each window serving as an independent sample. All samples together constitute a multivariate time-series sample set, ensuring that each sample in the set fully reflects the dynamic changes of multiple parameters within a specific time period.

[0072] Multi-source feature fusion is performed on a multivariate time series sample set, and principal component analysis is conducted on the fused high-dimensional features to achieve feature dimensionality reduction and reconstruction, resulting in a low-dimensional dense feature representation. Specifically, this involves: performing multi-source feature fusion on each sample in the multivariate time series sample set. First, the data of different types within the sample are spliced ​​together according to the collection time order to form a basic feature sequence, such as arranging turbidity data for 30 minutes first, followed by aeration flow rate data for 30 minutes; then, according to the wastewater treatment process logic, the cross-feedback features between different types of data are calculated. For example, the aeration flow rate value at the same collection point is multiplied by the dosage value to obtain a feature reflecting the synergistic input of aeration and chemicals per unit time; the turbidity value is divided by the water temperature value to obtain a feature reflecting the correlation between turbidity and temperature; and the influent flow rate value is multiplied by the COD concentration value to obtain a feature reflecting the total COD load per unit time. Through this type of calculation, the dispersed single-source data are integrated into a high-dimensional feature vector containing basic and cross-feedback features. Principal component analysis is then performed on the high-dimensional feature vector formed after fusion, first targeting the sample... For all samples in this set, the high-dimensional feature vectors are used to calculate the covariance of each feature dimension with all other feature dimensions. This involves first calculating the average of all sample values ​​in two feature dimensions, then subtracting the average of the first dimension from the value of each sample, multiplying this by the subtraction of the average of the second dimension, and summing the results for all samples. This summation is then divided by the total number of samples, forming a covariance matrix. Next, the eigenvalues ​​and eigenvectors of this covariance matrix are solved. All eigenvalues ​​are arranged in descending order, and the eigenvalues ​​are accumulated sequentially until the sum accounts for more than 85% of the total sum of all eigenvalues. At this point, the accumulation stops, and the corresponding eigenvectors are selected. Finally, matrix multiplication is performed between the high-dimensional feature vector of each sample and the selected eigenvectors. Each element in the high-dimensional feature vector of each sample is multiplied by the element of the corresponding eigenvector, and all products are summed. The result is a low-dimensional dense feature representation after dimensionality reduction and reconstruction. This representation retains the key information from the high-dimensional features while removing redundant information.

[0073] Based on low-dimensional dense feature representation, time-series correlation analysis is used to calculate the correlation coefficients between water quality variables and manipulated variables at different lag times, forming a dynamic correlation matrix. Specifically, this involves: first, distinguishing between water quality variables and manipulated variables based on low-dimensional dense feature representation. Water quality variables include turbidity, sludge concentration, and COD concentration; manipulated variables include aeration flow rate, chemical dosage, and influent flow rate. Considering the reaction cycle of the wastewater treatment process, such as the 5-20 minute time required for water quality changes after aeration adjustment to manifest, lag times of 5 minutes, 10 minutes, 15 minutes, and 20 minutes are set. Time-series correlation analysis is then used to calculate the correlation coefficients between the two at different lag times. Specifically, taking a water quality variable (e.g., turbidity) and a manipulated variable (e.g., aeration flow rate) as examples, the values ​​of all samples in the turbidity dimension are selected to form a turbidity value sequence, and the values ​​of all samples in the aeration flow rate dimension are selected to form an aeration flow rate value sequence. For a lag time of 5 minutes... The process involves mapping each sample value in the turbidity numerical sequence to a sample value in the aeration flow rate numerical sequence that is 5 minutes earlier in time. For example, the turbidity value at the 10th minute corresponds to the aeration flow rate value at the 5th minute. The covariance of these two sets of corresponding values ​​is calculated, followed by the standard deviations of the turbidity numerical sequence and the aeration flow rate numerical sequence. The covariance is then divided by the product of the two standard deviations to obtain the correlation coefficient between turbidity and aeration flow rate at a lag of 5 minutes. Using the same method, the correlation coefficients between the water quality variable and the manipulated variable at lags of 10, 15, and 20 minutes are calculated, as well as the correlation coefficients between all water quality variables and all combinations of manipulated variables at each lag time. These coefficients are arranged in a structure where row = water quality variable, column = manipulated variable, and layer = lag time. For example, the first row corresponds to turbidity, the first column corresponds to aeration flow rate, and the first layer corresponds to 5 minutes. This position stores the correlation coefficient between turbidity and aeration flow rate at a lag of 5 minutes, ultimately forming a dynamic correlation matrix.

[0074] The dynamic correlation matrix is ​​analyzed to generate dynamic correction parameters for real-time adjustments. Specifically, the analysis involves: first, screening correlation coefficients with absolute values ​​greater than 0.6. These coefficients correspond to combinations of water quality variables and manipulated variables, and lag times, indicating a significant temporal correlation. For example, the absolute value of the correlation coefficient between aeration flow rate and COD concentration at a 10-minute lag is greater than 0.6, consistent with the process logic of aeration promoting microbial COD degradation. Then, the number of strong correlations between each manipulated variable and all water quality variables at each lag time is counted; that is, the number of coefficients with absolute values ​​greater than 0.6 in the column corresponding to that manipulated variable. A higher number of strong correlations indicates a stronger influence of the manipulated variable on water quality changes. The more widespread the influence of the variable, the greater its base weight value is assigned. For example, if the strong correlation count of aeration flow is 3 times and the strong correlation count of chemical dosage is 1 time, then the base weight value of aeration flow is higher than that of chemical dosage. Next, the weights are adjusted based on wastewater treatment process experience to better match the correlation between lag time and water quality change response. For example, if the influence of aeration flow on COD concentration is most significant at a lag of 10 minutes, the weight of the corresponding manipulated variable is increased by a certain proportion. Finally, the adjusted weight value of each manipulated variable is multiplied by the corresponding feature value in the low-dimensional dense feature representation to obtain the corrected feature value of the manipulated variable. The corrected feature values ​​of all manipulated variables are integrated to form a dynamic correction parameter for real-time correction.

[0075] Standardization eliminates the dimensional differences of multi-source data, avoiding analytical biases caused by different units. Noise reduction filters out abnormal data generated by instantaneous sensor interference, making the data more consistent with the actual state of the wastewater treatment process. The sliding window mechanism transforms continuous time-series data into samples with temporal locality. The setting of window time length and step size can fully capture the short-term fluctuation patterns of water quality parameters. The construction of the sample set alleviates the limitation of traditional detection in not being able to capture dynamic changes in a timely manner. Multi-source feature fusion integrates the correlation information between water quality and operating parameters through cross-feature calculation. Principal component analysis reduces data dimensionality while retaining key information, avoiding analytical lag caused by excessive complexity of high-dimensional data, and providing efficiency support for real-time detection.

[0076] In a preferred embodiment of the present invention, dynamically adjusted parameters are input into a pre-trained multi-task deep learning model. The influence of each feature variable is evaluated through parameter contribution analysis, and an adaptive weighting mechanism is used to dynamically adjust the feature importance allocation to obtain the adjusted feature representation. This may include:

[0077] In this embodiment of the invention, the dynamic correction parameters are fused with the high-dimensional time-series feature matrix at the feature level to form an enhanced feature tensor. Specifically, this includes: first, determining the specific composition of the dynamic correction parameters and the high-dimensional time-series feature matrix. The dynamic correction parameters are generated in the early stage through time-series correlation analysis and are correction values ​​for key operational variables in the wastewater treatment process. For example, the aeration flow correction value is calculated based on the correlation strength between aeration flow and COD concentration, and the chemical dosage correction value is generated based on the correlation law between chemical dosage and sludge concentration. Each correction parameter corresponds to an operational variable, and is calculated at one data point per minute. The frequency records form a one-dimensional sequence that perfectly matches the time step; the high-dimensional time series feature matrix is ​​composed of all the raw monitoring data collected by the distributed sensor network. The rows of the matrix correspond to different types of features, including water quality features such as turbidity, sludge concentration, COD concentration, and ammonia nitrogen concentration, and operational features such as influent flow rate, aeration flow rate, chemical dosage, and water temperature. The columns of the matrix correspond to the time step. For example, the first column is the data for the first minute, the second column is the data for the second minute, and a total of 30 columns are contained in the monitoring data for the most recent 30 minutes. Each cell stores the raw monitoring value of the corresponding feature at the corresponding time step.

[0078] During feature-level fusion, data alignment is performed first. Using the time step as a baseline, the data for each time step of the dynamically corrected parameters is matched one-to-one with the corresponding operational feature data at the same time step in the high-dimensional time-series feature matrix. For example, the corrected aeration flow rate value at minute 5 corresponds to the original value in column 5 of the aeration flow rate row in the high-dimensional time-series feature matrix, and the corrected dosage value at minute 8 corresponds to the original value in column 8 of the dosage row. This ensures complete synchronization in the time dimension, avoiding fusion deviations due to time misalignment. Subsequently, feature-by-feature fusion calculation is performed, fusing only operational features. Water quality features retain their original values, as they are directly related to the prediction target and require no additional correction. The specific calculation method is the original value of the operational feature plus the corresponding dynamic correction parameter value. For example, the original value of the aeration flow rate at minute 10 is 2.5 m³ / s. 3 / h, the aeration flow rate correction value for this time step is 0.3m³ / h. 3 / h, the merged value is 2.5m 3 / h+0.3m 3 / h=2.8m 3 / h; The original value of the dosage at the 15th minute was 1.2 kg / h, the corresponding correction value was 0.2 kg / h, and the fused value was 1.2 kg / h + 0.2 kg / h = 1.4 kg / h.

[0079] After fusion, an enhanced feature tensor is constructed. The fused operational feature data and the water quality feature data retaining the original values ​​are reorganized into a three-dimensional structure of time step-feature type-data value. For example, the first dimension is the time step, with a total of 30 steps, corresponding to 30 minutes. The second dimension is the feature type, with a total of 8 types, including 4 water quality features and 4 fused operational features. The third dimension is the corresponding data value. Finally, an enhanced feature tensor with dimensions of 30×8×1 is formed. This tensor contains both the basic information of the original monitoring data and the correction information reflecting the correlation strength of variables.

[0080] The enhanced feature tensor is input into a pre-trained multi-task deep learning model. The multi-head self-attention mechanism within the model is used to calculate the weight distribution of each feature variable across different attention heads, generating an initial contribution score matrix for each feature variable. This involves mapping the input features to different feature subspaces through multiple parallel linear transformation layers within the multi-head self-attention mechanism, obtaining the query vector, key vector, and value vector for each subspace. Based on the query vector and key vector, the attention weights of each position in the feature sequence to all positions are calculated in each feature subspace, resulting in a subspace attention weight distribution reflecting local dependencies. The attention weight distributions of each subspace are then weighted, fused, and normalized to aggregate the output information from all attention heads. Information is used to generate a global attention weight distribution representing the correlation of global features; based on the global attention weight distribution, the initial importance score of each feature variable for multiple effluent water quality parameter prediction tasks is calculated; all initial importance scores are integrated to construct a two-dimensional contribution score matrix for behavioral feature variables listed as prediction tasks, specifically including: training data preparation, collecting historical data from the past 12 months, including water quality monitoring data every 5 minutes, actual detection values ​​of COD concentration, turbidity, and sludge concentration, manipulated variable data, influent flow rate, aeration flow rate, chemical dosage, water temperature, environmental data, room temperature, and influent pH value, covering approximately 100,000 sets of samples; data preprocessing is performed to remove outliers caused by sensor malfunctions, such as sudden turbidity spikes. For values ​​exceeding 50 NTU, missing values ​​are filled with the average of three adjacent time steps to ensure data integrity. The model network structure employs a progressive structure: input layer - multi-head self-attention layer - convolutional layer - fully connected layer - output layer. The input layer receives a feature tensor with dimensions of 60 time steps (corresponding to 5 hours) × 1 feature type (10, including water quality, operational, and environmental features). Each input data point is standardized and adjusted using the historical mean and standard deviation of each feature to ensure data range consistency. The multi-head self-attention layer contains eight parallel attention heads, each processing the input features independently. Each attention head has a different linear transformation rule, implemented using different weight matrices. These weight matrices are used during training. The process is continuously optimized to capture the correlation between features from different dimensions. For example, attention head 1 focuses on capturing the correlation between aeration flow rate and COD concentration, while attention head 2 focuses on capturing the correlation between dosage and sludge concentration. The convolutional layer uses three temporal convolutional kernels with kernel sizes of 3, 5, and 7, respectively, to capture the feature change patterns within 3 minutes, 5 minutes, and 7 minutes. Convolution operations are performed on the output of the multi-head self-attention layer to extract deeper temporal features and reduce interference from irrelevant information. The fully connected layer contains two hidden layers. The first layer has 128 neurons, and the second layer has 64 neurons. Non-linear activation functions, such as the ReLU function, are used to process the features output by the convolutional layer to achieve non-linear transformation of features and enhance the model's ability to fit complex relationships.The output layer contains three output nodes, corresponding to the predicted values ​​of COD concentration, turbidity, and sludge concentration, respectively. Each node outputs the prediction result through a linear activation function, ensuring that the predicted values ​​conform to the numerical range of the actual water quality parameters.

[0081] The model training process adopts a batch training + iterative optimization approach, dividing historical data into a training set (70,000 sets) and a validation set (30,000 sets) in a 7:3 ratio. The mean squared error between the predicted value and the actual detected value is used as the loss function to measure the degree of deviation in the model's prediction. Gradient descent algorithms, such as the Adam algorithm, are used to adjust the weight parameters of each layer of the model. Each iteration uses 256 sets of samples for training. When the loss function value of the validation set no longer decreases after 10 consecutive iterations, training is stopped. At this point, the model reaches its final state and has stable multi-task prediction capabilities.

[0082] After inputting the enhanced feature tensor (30×8×1 dimensions) into the pre-trained model, the multi-head self-attention layer processes it according to the following process: vector transformation. For each feature (a total of 8) in the enhanced feature tensor, in each attention head, a query vector (Q), a key vector (K), and a value vector (V) are generated through independent linear transformation. Taking the aeration flow feature and the first attention head as an example, the linear transformation process is to multiply the vector composed of the data of the feature at 30 time steps with the three preset weight matrices of the attention head (corresponding to Q, K, and V respectively) in sequence (multiplying each element separately and then summing them) to obtain Q vector, K vector, and V vector of length 30. The 8 features generate a total of 8×8×3=192 vectors in 8 attention heads (8 features × 3 types of vectors × 8 attention heads).

[0083] Similarity calculation and weight distribution generation: In each attention head, the similarity between the Q vector of each feature and the K vectors of all 8 features is calculated. Taking the Q vector of aeration flow rate in the first attention head as an example, the calculation method is to multiply the first element of the aeration flow rate Q vector by the first element of the turbidity K vector, add the second element of the aeration flow rate Q vector multiplied by the second element of the turbidity K vector, ..., add the 30th element of the aeration flow rate Q vector multiplied by the 30th element of the turbidity K vector, and obtain the similarity value between the two. In the same way, the similarity between the aeration flow rate Q vector and the other 7 feature K vectors is calculated, resulting in a total of 8 similarity values. Then, these 8 similarity values ​​are normalized, and each similarity value is divided by the sum of the 8 similarity values ​​to obtain the weight distribution of aeration flow rate on the other 8 features under this attention head (8 weight values, with a sum of 1). The larger the weight value, the stronger the correlation between the feature and the aeration flow rate.

[0084] Attention head output integration: In each attention head, the weight distribution of each feature is multiplied by the corresponding feature's V vector. Each weight value is multiplied by the element at the corresponding position in the V vector, and all multiplication results are summed to obtain the feature association information under that attention head, a vector of length 30. The eight attention heads generate a total of eight feature association information vectors. These eight vectors are concatenated along the feature dimension to form a vector of length 30 × 8 = 240, obtaining the summary result of the weight distribution of each feature variable across different attention heads. Initial contribution score matrix construction: The summary result of the weight distribution is arranged with rows = feature variables and columns = prediction task. The structure is organized as follows: rows contain 8 features: turbidity, sludge concentration, COD concentration, ammonia nitrogen concentration, influent flow rate, aeration flow rate, chemical dosage, and water temperature; columns contain 3 prediction tasks: COD concentration prediction, turbidity prediction, and sludge concentration prediction. Each element in the matrix is ​​the average weight of that feature for the corresponding prediction task across all attention heads. For example, the element in the COD concentration prediction column of the aeration flow rate row is the sum of the weight values ​​of aeration flow rate for COD concentration prediction across the 8 attention heads, divided by 8. This results in an 8-row, 3-column initial contribution score matrix that intuitively reflects the initial influence of each feature on each prediction task.

[0085] A time-series aggregation analysis is performed on the initial contribution score matrix. Normalization is used to normalize the importance of each feature variable, and a dynamic weight coefficient vector for each feature variable is generated based on the calculation results. Specifically, this includes: first, performing a time-series aggregation analysis; for each element in the initial contribution score matrix, i.e., each feature-prediction task combination, collecting the score data of that combination at all time steps. Taking the aeration flow rate-COD concentration prediction combination as an example, the enhanced feature tensor contains 30 time steps, and the initial contribution score matrix shows the weight coefficient vector for each feature variable at each time step. Each time step has a score value, such as 0.25 for minute 1, 0.23 for minute 2, ..., 0.27 for minute 30. Collect all 30 scores, calculate their average, and add the 30 scores together to get the total, such as 0.25 + 0.23 + ... + 0.27 = 7.2. Then divide the total by the total number of time steps, 30, to get the time-series average score, 7.2 ÷ 30 = 0.24. In the same way, calculate the time-series average score for all combinations of the 8 features and 3 prediction tasks, forming an 8-row, 3-column time-series average score matrix.

[0086] Then, normalization calculations are performed. For each prediction task (column), the sum of the time-series average scores of all features in that column is first calculated. Taking the COD concentration prediction column as an example, the time-series average scores of the eight features are 0.24 (aeration flow rate), 0.18 (dosage), 0.15 (turbidity), 0.12 (sludge concentration), 0.10 (influent flow rate), 0.08 (ammonia nitrogen concentration), 0.07 (water temperature), and 0.06 (other interfering features), with a sum of 0.24 + 0.18 + 0.15 + 0.12 + 0.10 + 0.08 + 0.07 + 0.06 = 1.0; then divide the time-series average score of each feature by the sum of the columns to obtain the normalized importance score of that feature on the prediction task. For example, the normalized score of aeration flow rate = 0.24 ÷ 1.0 = 0.24, and the normalized score of dosage = 0.18 ÷ 1.0 = 0.18. The sum of the normalized scores of all features on the same prediction task is 1, ensuring that the importance of different features is comparable.

[0087] Finally, a dynamic weight coefficient vector is generated. The normalized importance scores of each feature on the three prediction tasks are arranged in the order of the tasks: COD concentration prediction, turbidity prediction, and sludge concentration prediction. This forms the dynamic weight coefficient vector of the feature. For example, the dynamic weight coefficient vector of aeration flow rate is [0.24, 0.15, 0.19], which corresponds to the normalized scores of the three prediction tasks. The dynamic weight coefficient vector of turbidity is [0.15, 0.28, 0.22]. Each vector can accurately reflect the difference in the importance of the feature to different prediction tasks.

[0088] The enhanced time-series feature representation is obtained by performing an element-wise weighted operation between the dynamic weight coefficient vector and the feature representation of the corresponding time step. Specifically, this involves: first, determining the feature representation of the corresponding time step. In the enhanced feature tensor, the feature representation of each time step is a vector composed of the data values ​​of all eight features for that time step. For example, the feature representation of the 10th minute is [28 NTU (turbidity), 3500 mg / L (sludge concentration), 45 mg / L (COD concentration), 12 mg / L (ammonia nitrogen concentration), 150 mg / L (sludge ... 3 / h (inlet flow rate), 2.8m 3 [Aeration flow rate after fusion, 1.4 kg / h (dosage after fusion), 22℃ (water temperature)], each element corresponds to a specific value of a feature at that time step; during element-wise weighted calculation, for each time step's feature representation vector, multiplication is performed with the dynamic weight coefficient vector corresponding to each feature according to the prediction task-feature correspondence. For the COD concentration prediction task, the value of each feature in the feature representation of that time step is multiplied by the normalized score corresponding to the COD concentration prediction in the dynamic weight coefficient vector of that feature; for example, the aeration flow rate value at the 10th minute is 2.8 m³ / h. 3 / h, multiplied by the 0.24 corresponding to the COD prediction in its dynamic weight coefficient vector, yields 2.8 × 0.24 = 0.672; the turbidity value 28 NTU, multiplied by the 0.15 corresponding to the COD prediction, yields 28 × 0.15 = 4.2; in the same way, the multiplication operation of the 8 features is completed to obtain 8 weighted values.

[0089] For the turbidity prediction task, the value of each feature in the feature representation at that time step is multiplied by the normalized score corresponding to the turbidity prediction in the dynamic weight coefficient vector of that feature; for example, a turbidity value of 28 NTU. Multiplying by the turbidity prediction value of 0.28, we get 28 × 0.28 = 7.84; multiplying the sludge concentration value of 3500 mg / L by the turbidity prediction value of 0.20, we get 3500 × 0.20 = 700; similarly, we perform the multiplication operation on the 8 features; for the sludge concentration prediction task, we repeat the above logic, multiplying each feature value by the normalized score of its corresponding task, to obtain 8 weighted values; after weighting all features, we organize the 8 weighted values ​​of the same time step and the same prediction task according to feature order to form the enhanced time-series feature representation of that time step on the prediction task; then, in time order, we integrate the enhanced representations of all time steps on the 3 prediction tasks from minute 1 to minute 30, finally obtaining the overall enhanced time-series feature representation. In this representation, the feature values ​​that are important to the prediction task are significantly amplified, while the influence of secondary features is weakened, which is more conducive to the accurate prediction of the subsequent model.

[0090] The enhanced temporal feature representation is subjected to cross-channel feature fusion, and a gating mechanism is used to regulate the information flow of different feature channels to generate the final adjusted feature representation. Specifically, this includes: firstly, dividing the feature channels. Based on the functional differences of feature types, the enhanced temporal feature representation is divided into three feature channels: a water quality feature channel, containing enhanced time-series data of four features: turbidity, sludge concentration, COD concentration, and ammonia nitrogen concentration; an operational feature channel, containing enhanced time-series data of three features: influent flow rate, aeration flow rate, and chemical dosage; and an environmental feature channel, containing enhanced time-series data of one feature: water temperature. The time-series data of each channel contains values ​​of 30 time steps, forming a two-dimensional data structure of channel-time step, such as a 4×30 dimension for the water quality feature channel; then, a gating unit is constructed. The gating value is calculated, and a separate gating unit is set for each feature channel. The core function of the gating unit is to determine the importance of the information of the channel to the prediction task. The specific calculation process is as follows: Channel data statistics: Collect the values ​​of all features in a certain channel at all time steps. For example, the water quality feature channel contains 4 features × 30 time steps = 120 values. Summarize all these values. Calculate the average influence of the channel: Add the summed values ​​to get the total value of the channel. For example, the total value of the water quality feature channel = 28 + 3500 + 45 + 12 + ... + other time step values ​​= 48000. Then divide the total value by the total number of values ​​(120) to get the average value of the channel (48000 ÷ 120 = 400). This average value reflects the overall information intensity of the channel.

[0091] To set gate thresholds, based on practical experience in wastewater treatment processes and the impact of historical data on prediction accuracy, a gate threshold is set for each channel. The threshold for the water quality characteristic channel is set to 350, as water quality characteristics are directly related to the prediction target; a lower threshold ensures more effective information passes through. The threshold for the operational characteristic channel is set to 200, and the threshold for the environmental characteristic channel is set to 150, as environmental characteristics have a smaller impact; a higher threshold filters redundant information. The gate value is then determined by comparing the average value of the channel with the gate threshold. If the average value is greater than the threshold, it indicates that the information from that channel is important for prediction, and the gate value is set to 1, allowing all information within the channel to pass through completely. If the average value is less than the threshold, it indicates that there is a lot of redundant information in that channel, and the gate value is set to 0.3, allowing only 30% of the information to pass through. For example, if the average value of the water quality characteristic channel is 400 > 350, the gate value is set to... 1. If the average value of an environmental feature channel is 180 > 150, the gate value is set to 1. If the average value of an operational feature channel is 180 < 200, the gate value is set to 0.3. Finally, cross-channel feature fusion is performed by multiplying the enhanced time-series data of each channel by the gate value of that channel to obtain the filtered channel data. For example, if the gate value of the operational feature channel is 0.3, then all values ​​of that channel are multiplied by 0.3. Then, the filtered data of the three channels are added together according to the time step-feature dimension. For example, the weighted value of the water quality feature channel at the 10th minute (4.2 + 700 + ...) is added to the weighted value of the operational feature channel (0.672 + ...) and the weighted value of the environmental feature channel (22 × 0.3 = 6.6) to obtain the fused feature value of that time step. The fused feature values ​​of all time steps are integrated in chronological order to finally generate the adjusted feature representation.

[0092] By combining the dynamic correction parameter, which reflects the strength of the correlation between variables, with the original monitoring data, the feature information is made more consistent with the actual operation logic of the sewage treatment process, avoiding prediction bias caused by one-sided feature information. The construction of the pre-trained multi-task deep learning model, through a multi-layer structure of multiple attention heads, temporal convolution, and fully connected layers, comprehensively captures the complex correlation and temporal change patterns between features. The initial contribution score matrix generated by the multi-head self-attention mechanism clearly quantifies the impact of each feature on the prediction task, improving the objectivity of feature analysis.

[0093] like Figure 2 As shown, in a preferred embodiment of the present invention, based on the adjusted feature representation, the concentrations of multiple key effluent water quality parameters are predicted in real time to obtain predicted concentration values, which may include:

[0094] In this embodiment of the invention, the final adjusted feature representation is input into a multi-scale feature extraction process. By extracting features at different time scales, a feature representation including features at multiple time scales is obtained. Specifically, the final adjusted feature representation is a two-dimensional data structure. The horizontal axis represents time steps, with a total of 30 steps corresponding to the most recent 30 minutes, one time step per minute. The vertical axis represents feature types, with a total of 8 types, including turbidity, sludge concentration, COD concentration, ammonia nitrogen concentration, influent flow rate, aeration flow rate, chemical dosage, and water temperature. Each cell stores the specific values ​​of the corresponding time step and feature, such as turbidity of 28 NTU at the 5th minute and aeration flow rate of 2.8 m³ / min at the 10th minute. 3 / h; The purpose of multi-scale feature extraction is to capture the changing patterns across different time dimensions during wastewater treatment. Therefore, three time scales are set, each corresponding to a different period of change.

[0095] Short-term (5-minute) extraction is used to capture instantaneous fluctuations in water quality parameters, such as a short-term increase in turbidity caused by a sudden increase in influent flow rate. A sliding window method is employed, with a window length of 5 time steps (5 minutes) and a sliding step size of 1 time step (1 minute). Each feature is processed separately. Taking turbidity as an example, starting from the first time step, turbidity values ​​from the first to the fifth minute are taken, assuming they are 25 NTU, 26 NTU, 27 NTU, 28 NTU, and 29 NTU respectively. These five values ​​are then added together. The total is 135 NTU. The total is then divided by 5 to obtain the average turbidity of the window, which is 27 NTU. This average value is used as the turbidity feature value of the third time step (the middle time step of the window) on the short-term scale. Then the window slides to the second to the sixth minute and the above calculation is repeated to obtain the feature value of the fourth time step. This process continues until the window covers the 26th to the 30th minute, generating a total of 26 short-term scale time steps. Each feature generates 26 values, resulting in a short-term scale feature representation of 26 time steps × 8 features.

[0096] Intermediate-scale (15-minute) extraction is used to capture the phased trends of water quality parameters, such as the continuous decrease in COD concentration within 15 minutes after the aeration flow rate is adjusted. The window length is 15 time steps, and the sliding step size is 3 time steps. Taking COD concentration as an example, the first window takes the COD values ​​from the 1st to the 15th minute. Assuming the total is 675 mg / L, dividing by 15 gives an average of 45 mg / L, which is used as the feature value of the 8th time step in the intermediate scale, the middle time step of the window. The window slides to the 4th to the 18th minute, and the average is calculated to obtain the feature value of the 11th time step. The sliding continues until the window covers the 16th to the 30th minute, generating a total of 10 intermediate-scale time steps, forming an intermediate-scale feature representation of 10 time steps × 8 features.

[0097] Long-term (30-minute) extraction is used to capture the overall stable state of water quality parameters, such as the average level of sludge concentration throughout the day. The window length is 30 time steps (30 minutes), and the sliding step size is 5 time steps (5 minutes). Taking sludge concentration as an example, the first window takes the sludge concentration values ​​from the 1st to the 30th minute. Assuming the total is 105,000 mg / L, dividing by 30 gives an average of 3,500 mg / L, which is used as the feature value of the 15th time step of the long-term scale. The window slides to the 6th to the 35th minute, but only 30 minutes of data are actually available. The average of the 6th to the 30th minute is calculated to obtain the feature value of the 20th time step. The window continues to slide, generating a total of 6 long-term time steps, forming a long-term feature representation of 6 time steps × 8 features. After completing the extraction of the three scales, a multi-time-scale feature representation containing short-term, medium-term, and long-term features is obtained. Each scale retains 8 core feature types, only the number of time steps is different.

[0098] The multi-timescale feature representations are input into the feature fusion processing stage. Through feature weighted fusion operations, a unified multi-scale fused feature representation is generated. Specifically, this includes: first, determining the fusion weights for each timescale; by analyzing historical data from the past 6 months, the impact of different three scale features on prediction accuracy is statistically analyzed. The short-term scale can promptly capture sudden changes, such as a sudden increase in influent flow caused by heavy rain, and contributes the most to the timeliness of real-time prediction, with a weight of 0.4; the medium-term scale can reflect the continuous impact after operational adjustments, such as the gradual change in sludge concentration after chemical dosing, and contributes the second most, with a weight of 0.35; the long-term scale can reflect the overall stable trend, such as the average fluctuation of water temperature throughout the day, and contributes the least, with a weight of 0.25.

[0099] Weighted fusion requires aligning time steps before numerical calculations. There are 26 time steps for short-term, 10 for medium-term, and 6 for long-term. The latter two need to be adjusted to 26 time steps. Taking the medium-term scale as an example, the original 10 time steps correspond to the 3rd, 6th, 9th...27th time steps of the short-term scale. Missing time steps are filled with the average of two adjacent medium-term feature values. For example, the medium-term feature value of the 4th short-term time step is obtained by adding the feature values ​​of the 3rd and 6th medium-term time steps and dividing by 2. The long-term scale is also interpolated to 26 time steps by averaging adjacent values ​​to ensure complete matching of the three scales in the time dimension. Element-wise weighted calculation is performed. For the aligned features of the three scales, calculations are performed according to the same time step and feature type. Taking the aeration flow rate of the 10th time step as an example, the aeration flow rate value of the short-term scale is 3.0 m³ / s. 3 / h, multiplied by a weight of 0.4, equals 1.2m. 3 / h; the corresponding value at the mesoscale is 2.8m. 3 / h, multiplied by 0.35, gives 0.98m 3 / h; the corresponding value on a long-term scale is 2.5m.3 / h, multiplied by 0.25, gives 0.625m 3 / h; Add these three results together: 1.2 + 0.98 + 0.625 = 2.805m 3 / h is used as the characteristic value of the aeration flow rate at that time step after fusion; a unified feature representation is generated by performing the above calculation on all 26 time steps and 8 features, and finally forming a unified multi-scale fusion feature representation of 26 time steps × 8 features. This representation includes both instantaneous change details and integrates stage trends and overall state.

[0100] The multi-scale fusion feature representation is input into multiple parallel water quality parameter prediction processing branches. Each processing branch receives the same features and is specifically responsible for predicting one type of water quality parameter. Specifically, three parallel prediction processing branches are set up to predict COD concentration, turbidity, and sludge concentration, respectively. These three parameters are the core indicators for achieving effluent standards in wastewater treatment. Traditional detection methods suffer from lag; for example, COD concentration requires 2 hours of laboratory testing, while real-time prediction has the highest demand. The structure of each branch is completely identical to ensure unified prediction logic. Each branch structure includes a feature receiving mode, a deep extraction mode, and an output mode. The processing logic of each mode is the same, such as extraction rules and calculation methods. Only the output mode corresponds to different parameters. Feature input is synchronized. The multi-scale fusion feature representation is transmitted to the three branches simultaneously through data replication, ensuring that each branch receives the exact same feature data at the same time, such as all values ​​of 26 time steps × 8 features. This avoids asynchronous prediction results due to differences in input time and meets the requirement of simultaneous output of multiple parameters in real-time detection.

[0101] In each prediction processing branch, temporal convolution is used to extract deep features from the input features to obtain a high-dimensional feature mapping representation. Specifically, temporal convolution is used to capture deep temporal correlations between features, such as the pattern that COD concentration begins to decrease after about 5 minutes of increased aeration flow. The processing procedure for each branch is as follows: Convolutional layer settings include two temporal convolutional layers. The first layer has 64 convolutional kernels, each covering 3 consecutive time steps; the second layer has 128 convolutional kernels, also covering 3 time steps. The stride of both layers is 1 to ensure that the number of time steps remains unchanged at 26 after processing. The first convolutional operation, taking the COD prediction branch as an example, uses a fused feature representation as the input, 26 time steps × 8 features. For the first convolutional kernel, starting from the first time step, the values ​​of 8 features from the first to the third minute are taken, and each value is multiplied by the convolutional kernel. The weights corresponding to the positions of the kernels are assigned, such as turbidity multiplied by a weight of 0.2 in the first minute and aeration flow rate multiplied by a weight of 0.3 in the second minute. All these products are summed, and then the bias value of the kernel is added. This bias value, determined through historical data, yields a feature mapping value. The kernel slides along the time steps until the 26th time step, generating 26 feature mapping values. The 64 kernels generate a total of 26 time-step × 64 feature mappings. These are then filtered, setting mapping values ​​less than 0 to 0 and retaining positive values ​​to obtain the first layer convolution output. The second layer convolution operation uses the first layer output (26 × 64) as input. 128 kernels perform 3-time-step sliding convolutions on each of the 64 feature mappings, with each kernel generating 26 mapping values, ultimately forming a 26-time-step × 128 feature mapping result. This result is also filtered to obtain a high-dimensional feature mapping representation.

[0102] The high-dimensional feature map representation is input to the regression-output processing layer. A nonlinear transformation converts the feature representation into the concentration prediction value of the corresponding water quality parameter. Specifically, the regression-output processing layer converts the high-dimensional feature map into specific water quality parameter concentration values. It consists of two connection processing layers and one output processing layer. The first connection processing layer contains 128 processing units, each connected to all elements of the high-dimensional feature map (26 time steps × 128 feature maps = 3200 elements). Each unit is calculated by multiplying each of the 3200 elements by the corresponding connection weight, summing all products, adding the unit's bias value, and then... The first layer of filtering sets values ​​less than 0 to 0, resulting in 128 processing results. The second layer of connection processing contains 64 processing units, each connected to the 128 results from the first layer. The calculation method is the same as above: multiply by weights, sum, add bias, and filter to obtain 64 more concise results. The output processing contains one output unit, connected to the 64 results from the second layer. The calculation method is to multiply each of the 64 results by its corresponding weight, sum them, and add a bias to obtain the final concentration prediction value. For example, the COD prediction branch outputs 42 mg / L, the turbidity branch outputs 25 NTU, and the sludge concentration branch outputs 3400 mg / L.

[0103] Multi-scale feature extraction covers the changing patterns across different time dimensions, making the feature information more comprehensively aligned with the actual wastewater treatment process, providing a foundation for accurate prediction. Weighted fusion integrates effective information from various scales, avoiding the one-sidedness of single-scale features, improving feature effectiveness, reducing prediction bias caused by incomplete information, and improving the unstable accuracy of traditional detection methods.

[0104] In a preferred embodiment of the present invention, the degree of wastewater pollution is assessed in real time based on the concentration prediction value, and the prediction value is compared with a preset safety threshold. If the prediction value is greater than the threshold, a corresponding emergency response mechanism is triggered, and the assessment result and early warning information are transmitted to the central monitoring platform through a process control communication protocol. This may include:

[0105] In this embodiment of the invention, a safety threshold range is preset for each key water quality parameter, and a multi-level early warning threshold system is constructed. Specifically, this includes: first, determining the key water quality parameters that need to be focused on for control; combining the parameter types that are prone to exceeding standards in the daily operation of sewage treatment plants and whose traditional detection methods are most lagging, finally selecting three core parameters: COD concentration, turbidity, and sludge concentration. Turbidity is prone to deviation from the actual measured value due to the settling of suspended impurities in the water sample; sludge concentration detection requires drying and weighing, which takes more than 1 hour. Real-time control of these three parameters is crucial to avoid exceeding the effluent standards; COD concentration is calculated based on historical operating data from the past 12 months, dividing the day into four periods: morning peak (6:00-9:00, influent contains a large amount of domestic sewage impurities), off-peak (9:00-18:00, stable influent), evening peak (18:00-21:00, similar to the morning peak), and night (21:00-6:00 the next day, low influent flow). For each time period, the COD concentration detection value of the corresponding time period of the day is taken, and the average value and fluctuation range are calculated. The average value of the morning peak is 38 mg / L, with a fluctuation of ±6 mg / L; the average value of the off-peak is 35 mg / L, with a fluctuation of ±5 mg / L; the average value of the evening peak is 37 mg / L, with a fluctuation of ±6 mg / L; and the average value of the night is 32 mg / L, with a fluctuation of ±4 mg / L. Taking into account the upper limit of the fluctuation of all time periods, the value after the maximum fluctuation (38+6=44 mg / L) is taken, and a 10% safety margin is reserved (44×0.9≈40 mg / L). Finally, the basic range of the safe threshold for COD concentration is set to 0-40 mg / L.

[0106] The average turbidity during the morning peak is 4.2 NTU, with a fluctuation of ±1.2 NTU; the average during the off-peak is 3.5 NTU, with a fluctuation of ±0.8 NTU; the average during the evening peak is 4.0 NTU, with a fluctuation of ±1.0 NTU; and the average during the night is 3.0 NTU, with a fluctuation of ±0.5 NTU. Taking the value after the maximum fluctuation (4.2 + 1.2 = 5.4 NTU), and reserving an 8% safety margin (5.4 × 0.92 ≈ 5 NTU), the basic range of the turbidity safety threshold is set to 0-5 NTU.

[0107] The sludge concentration was combined with the carrying capacity limit of the sedimentation tank filtration unit (exceeding 4000 mg / L easily leads to filter membrane clogging). Historical data showed that the sludge concentration range during normal operation was 2000-3000 mg / L, with an average of 2800 mg / L during the morning peak, fluctuating by ±200 mg / L; an average of 2500 mg / L during the off-peak, fluctuating by ±150 mg / L; an average of 2700 mg / L during the evening peak, fluctuating by ±180 mg / L; and an average of 2300 mg / L at night, fluctuating by ±100 mg / L. The upper limit of normal operation (3000 mg / L) was taken as the upper limit of the basic range of the safety threshold, and the lower limit was taken as the lowest historical normal operation value (2000 mg / L). Finally, the basic range of the safe threshold for sludge concentration was set as 2000-3000 mg / L.

[0108] Based on the baseline range of safe thresholds and historical statistics on exceedance risks, a four-level early warning threshold system is constructed. The logic and specific ranges for each level are as follows: Normal level: Parameter values ​​are completely within the baseline range of safe thresholds. At this time, the wastewater treatment process is stable and no control measures are required. The corresponding range is COD concentration 0-40 mg / L, turbidity 0-5 NTU, and sludge concentration 2000-3000 mg / L. Mild warning level: Parameter values ​​exceed the baseline range of safe thresholds but do not exceed 90% of the national standard or equipment capacity limit. At this time, the process experiences slight fluctuations and requires minor adjustments to operating parameters. Based on historical data, if no adjustments are made within this range, the probability of parameters rising to a higher warning level within one hour is approximately 30%. The corresponding range is COD concentration 40-45 mg / L (45 mg / L is 90% of the national standard of 50 mg / L), turbidity 5-9 NTU (9 NTU is 90% of the equipment's stable treatment limit of 10 NTU), and sludge concentration 3000-3600 mg / L (3600 mg / L is the maximum concentration of sludge per filter). The first level of warning is when the parameter value exceeds 90% of the national standard or equipment carrying capacity limit (4000 mg / L), but does not reach the limit value. At this time, the process fluctuation is obvious, and control measures need to be strengthened to avoid exceeding the standard. The classification is based on the probability that the parameter will exceed the limit value within 30 minutes if no adjustment is made within this range. The corresponding range is COD concentration 45-50 mg / L, turbidity 9-10 NTU, and sludge concentration 3600-4000 mg / L. The second level of warning is when the parameter value exceeds the national standard or equipment carrying capacity limit. At this time, there is already a risk of environmental emission or equipment damage, and an emergency response mechanism needs to be activated. The corresponding range is COD concentration > 50 mg / L, turbidity > 10 NTU, and sludge concentration > 4000 mg / L. The warning thresholds at all levels and the corresponding risk probabilities and adjustment suggestions are entered into the system database to form a multi-level warning threshold system that can be called in real time. Each parameter's threshold at each level is associated with a unique identification code. For example, the COD mild warning is identified as COD-L1, which facilitates rapid matching later.

[0109] Based on a multi-level early warning threshold system, the predicted concentration values ​​are compared and analyzed with safety thresholds to generate indicators of water quality parameters exceeding standards. Specifically, this involves: first, retrieving the constructed multi-level early warning threshold system from the system, and simultaneously obtaining the predicted concentration values ​​of key parameters, such as COD (48 mg / L), turbidity (9 NTU), and sludge concentration (3600 mg / L). The process follows a logic of single-parameter comparison, grading, and indicator generation. For example, with a COD predicted value of 48 mg / L, it is first compared with the normal threshold of 0-40 mg / L; 48 mg / L is greater than 40 mg / L, indicating it exceeds the normal range. Next, it is compared with the mild warning level of 40-45 mg / L; 48 mg / L is greater than 45 mg / L, indicating it exceeds the mild range. Finally, it is compared with the moderate warning level of 45-50 mg / L; 48 mg / L falls within this range, and the comparison stops. The initial assessment is that the levels are moderately excessive. Similarly, the predicted turbidity value of 9 NTU is compared with the thresholds for each level. It is greater than 5 NTU for the normal level, greater than 8 NTU for the mild level, and falls within the moderate level (8-10 NTU), thus it is determined to be moderately excessive. The predicted sludge concentration value of 3600 mg / L is compared with the thresholds for each level. It is greater than 3000 mg / L for the normal level, greater than 3500 mg / L for the mild level, and falls within the moderate level (3500-4000 mg / L), thus it is determined to be moderately excessive. For the graded assessment confirmation, the initial assessment results for each parameter are verified a second time. The verification logic is to take the average predicted value over five time steps before and after the predicted value and compare it again with the corresponding level threshold. For example, if the predicted COD value is 48 mg / L, and the average predicted value over five time steps is 47 mg / L, it still falls within the moderate warning level (45-50 mg / L), thus confirming the assessment result is correct. If the predicted value of a parameter is at the boundary between two threshold levels, such as COD... For a value of 45 mg / L, the predicted value trend over three time steps is taken. If the trend is upward, it is judged as moderate; if the trend is downward, it is judged as mild, to avoid misjudgment due to instantaneous fluctuations. The exceedance status label is generated in the format of parameter name-warning level-predicted value. For example, COD corresponds to COD-moderate exceedance-48 mg / L, turbidity corresponds to turbidity-moderate exceedance-9 NTU, and sludge concentration corresponds to sludge concentration-moderate exceedance-3600 mg / L. The label must include the specific predicted value to facilitate reference to the degree of numerical deviation when formulating subsequent emergency measures. All labels are stored in the system log in real time and displayed in a pop-up window on the local monitoring interface.

[0110] Based on the severity of the exceedance status indicator, the corresponding level of emergency response procedure is triggered, and corresponding emergency control measures are implemented. Specifically, this includes: first, establishing a correspondence table between exceedance level, emergency procedure, and control measures to ensure that different severity levels of exceedance can be matched with precise response plans. The specific execution process is as follows: Emergency procedure matching: Determine the warning level based on the exceedance status indicator. If it is a mild exceedance, such as COD 42 mg / L, trigger a mild emergency response procedure; if it is a moderate exceedance, such as COD 48 mg / L, turbidity 9 NTU, and sludge concentration 3600 mg / L in this case, trigger a moderate emergency response procedure; if it is a severe exceedance, such as COD 55 mg / L, trigger a severe emergency response procedure; Emergency control measure calculation and execution: Under the moderate emergency response procedure, for moderate COD exceedance (48 mg / L), implement aeration flow rate adjustment measures. The calculation method is current aeration flow rate × 1.15. If the current aeration flow rate is 3.0 m³ / L... 3 / h, the adjusted flow rate is 3.0 × 1.15 = 3.45 m³ / h. 3 / h, the system sends a command to the aeration valve controller to adjust the valve opening to the corresponding flow rate position; for moderate turbidity exceeding the standard (9NTU), the dosage adjustment measures are implemented, calculated as current dosage × 1.2. If the current dosage is 1.5kg / h, the adjusted dosage is 1.5 × 1.2 = 1.8kg / h. A control signal is sent to the dosing pump to adjust the pump's operating frequency to achieve the target dosage.

[0111] For sludge concentration moderately exceeding the standard (3600 mg / L), an extension of settling time is implemented. The calculation method is current settling time × 1.1. If the current settling time is 2.0 hours, the adjusted settling time will be 2.0 × 1.1 = 2.2 hours. This extension is achieved by modifying the switching interval of the effluent valve in the settling tank. For implementation feedback, after each control measure is implemented, the system must obtain feedback signals from the implementing equipment within one minute, such as the actual opening degree of the aeration valve and the actual frequency of the dosing pump, to confirm whether the measure has been implemented. If the feedback signal indicates that the equipment is not operating as instructed, such as the aeration valve opening not reaching the target value, the system automatically retryes sending the command and triggers an equipment fault alarm, notifying maintenance personnel to conduct on-site inspection. If the feedback is normal, the implementation time and actual execution parameters (e.g., 3.45m) are recorded. 3 The execution time for the / h aeration rate is 14:32:10).

[0112] The system records all predicted values, exceedance statuses, and implemented emergency measures for water quality parameters in real time, and generates a complete pollution assessment report based on the recorded results. Specifically, this includes: first, determining the information dimensions to be recorded in real time to ensure complete data support for subsequent traceability and assessment; the specific process is as follows: real-time information recording, including recording time (accurate to the second, e.g., 14:32:00), parameter names (COD, turbidity, sludge concentration), predicted concentration values ​​(48 mg / L, 9 NTU, 3600 mg / L), exceedance status indicators (moderate exceedance, moderate exceedance, moderate exceedance), triggered emergency procedures (moderate emergency handling procedure), and implemented emergency measures (adjusting aeration flow rate to 3.45 m³ / h). 3 The data includes: dosage adjusted to 1.8 kg / h, sedimentation time extended to 2.2 hours; implementation time of the measures (14:32:10, 14:32:12, 14:32:15); and predicted parameter values ​​3 minutes after implementation (46 mg / L, 8.5 NTU, 3550 mg / L). All records are stored chronologically, with each record associated with a unique log number (e.g., LOG202405201432) for easy retrieval. A pollution assessment report is generated 5 minutes after implementation to ensure a preliminary reflection of the measures' effectiveness. The report structure is consistent with... The report content is as follows: The header includes the report number, such as REP202405201437, the generation time (14:37:00), and the wastewater treatment plant section number (e.g., Section A); an overview of the exceedances, summarizing the number of parameters exceeding the standard (3), the number of parameters exceeding the standard at each level (3 moderate exceedances, no mild or severe exceedances), and the duration of the exceedances (from the predicted exceedance at 14:30 to 14:37, lasting 7 minutes); parameter details, explaining the predicted value, exceedance level, emergency measures, and their effects for each parameter, such as a predicted COD value of 48 mg / L (moderate exceedance), and adjusting the aeration flow rate to 3.45 m³ / L. 3 / h, after 3 minutes the predicted value dropped to 46mg / L, a decrease of 2mg / L; Emergency measures summary, listing all implemented measures, implementation time and equipment feedback status, such as the aeration flow adjustment implemented at 14:32:10, with normal equipment feedback; Preliminary effect assessment, judging the effect based on the parameter change trend after the measures are implemented, if all parameter predicted values ​​show a downward trend and the gap with the upper limit of the moderate warning level threshold narrows, the emergency measures are effective, the report is automatically saved as a document after generation, and is also backed up locally in the system to ensure that the data is not lost.

[0113] The pollution assessment report, early warning information, and real-time forecast data are packaged into a standard format data transmission packet using the process control communication protocol and sent to the central monitoring platform. Specifically, this involves: first, determining the process control communication protocol type; and then selecting the Modbus RTU protocol based on the data transmission requirements of the wastewater treatment plant's industrial site. This protocol is suitable for real-time data transmission between industrial devices, has strong anti-interference capabilities, and can meet the stable transmission requirements in complex on-site environments. The specific process is as follows: data packaging and encapsulation. The pollution assessment report, early warning information, and real-time forecast data are packaged according to the structure of data packet header - data type identifier - core data area - checksum. The data packet header (8 bytes) consists of the first 6 bytes being the sending device number (e.g., STP001A, identifying wastewater treatment equipment in section A), and the last 2 bytes being the length of the core data area (e.g., the core data area is 200 bytes, and the last 2 bytes of the header are identified as 0xC8). The data type identifier (2 bytes) is 0x01 for the pollution assessment report, 0x02 for the early warning information, and 0x03 for the real-time forecast data. Since this packaging contains three types of data, three identifiers are added sequentially. Identifiers; Core data area, filled with content in the order of data type identifiers. Pollution assessment reports are filled in text-encoded format (such as report number, summary of exceedance, etc.). Early warning information is filled with the name and level of the exceedance parameter (such as COD - moderate exceedance). Real-time prediction data is filled with the parameter name and corresponding predicted value (such as COD: 46mg / L). Check code (2 bytes), calculated as the sum of all bytes in the header of the data packet + the sum of all bytes in the data type identifier + the sum of all bytes in the core data area, then taking the remainder after dividing by 256 to obtain the check code. For example, if the sum of the header bytes is 180, the sum of the data type identifier bytes is 6, and the sum of the core data area bytes is 850, the total is 180 + 6 + 850 = 1036, 1036 ÷ 256 = 4...12, and the check code is 0x0C.

[0114] After data is packaged and sent to the central monitoring platform, the system establishes a TCP connection with the platform via industrial Ethernet. Once the connection is successful, data packets are sent every 30 seconds. After sending, the system waits for a successful reception signal from the platform. If no feedback is received within 10 seconds, the system automatically retryes sending, up to a maximum of 3 times. If all 3 attempts fail, the system triggers a transmission failure alarm and temporarily stores the data packets locally, resending them once the network is restored. After receiving the data packets, the central monitoring platform verifies the data integrity using a checksum. If the verification is successful, the system parses and displays the data (e.g., displaying an over-limit warning or an assessment report on the platform interface). If the verification fails, the system requests a retransmission, ensuring that information is transmitted to the central control terminal in real time and accurately.

[0115] Precise comparison and label generation, through secondary verification and trend analysis, avoid misjudgments caused by instantaneous fluctuations or instrument errors in traditional testing, ensuring that no exceeding status is missed or falsely reported. This reduces the environmental risk of actual exceeding of standards but passing the test in traditional testing, providing a reliable basis for subsequent emergency handling. Tiered emergency measures, through clear calculation logic and equipment linkage, achieve rapid response after exceeding standards, avoiding the lag of waiting for test results for re-adjustment in traditional testing, reducing the duration of parameter exceeding standards, and lowering the risk of filter unit overload and effluent exceeding standards.

[0116] In a preferred embodiment of the present invention, based on real-time evaluation results and uploaded data, and combined with a multi-objective strategy with energy consumption and water quality compliance as core constraints, the final set values ​​of the control parameters for the wastewater treatment process are determined to achieve real-time detection and stable control of the effluent quality. This can include:

[0117] In this embodiment of the invention, a multi-objective scheme is constructed with energy consumption and water quality compliance as the core objectives, and various constraints in the wastewater treatment operation process are determined simultaneously. Specifically, this includes: first, defining the specific meaning of the two core objectives, and then refining the objective content based on the actual operational needs of the wastewater treatment plant. The energy consumption objective focuses on the three types of equipment with the highest energy consumption in the wastewater treatment process: aeration system (approximately 40% energy consumption), dosing pump (approximately 20%), and sedimentation tank agitator (approximately 15%). The objective is to minimize the total energy consumption of these three types of equipment while ensuring water quality compliance. Specifically, baseline energy consumption values ​​are determined by statistically analyzing energy consumption data from the past 12 months: average energy consumption of the aeration system is 1200 kWh / day, dosing pump 500 kWh / day, and agitator 300 kWh / day, with a total baseline energy consumption of 2000 kWh / day. The multi-objective scheme also sets a range for energy consumption fluctuations. The water quality compliance target should not exceed ±10% of the baseline value, i.e., 1800-2200 kWh / day. The target, combined with safety thresholds, clarifies the compliance requirements for key parameters: COD concentration stable at 0-40 mg / L, turbidity at 0-5 NTU, and sludge concentration at 2000-3000 mg / L. Simultaneously, parameter fluctuations should be controlled to no more than 5% per hour (e.g., COD concentration rising from 35 mg / L to 36.75 mg / L within this range) to avoid drastic fluctuations that could cause a sudden increase in the load on subsequent treatment units. To balance the two targets, a dynamic priority adjustment mechanism is established. When water quality parameters are at a normal level, the energy consumption target has a higher priority (allowing energy consumption to drop to 90% of the baseline value). When water quality parameters enter a mild warning level, both priorities are equal. When entering a moderate or severe warning level, the water quality compliance target has the highest priority (allowing energy consumption to rise to 110% of the baseline value to ensure rapid compliance).

[0118] The constraints cover three categories: equipment operating limits, reagent physical properties, and process integration requirements. Specifically, the equipment operating constraints are as follows: the maximum opening degree of the aeration valve is 100% (corresponding to a maximum flow rate of 5.0 m³ / s). 3 / h), minimum opening 20% ​​(corresponding to minimum flow rate 1.0m³ / h). 3 / h), to avoid negative pressure in the pipeline due to excessively low opening; the maximum dosing rate of the dosing pump is 3.0 kg / h (exceeding this value easily leads to waste of chemicals and secondary pollution), and the minimum is 0.5 kg / h (below this value, effective flocculation cannot be formed); the agitator speed range of the sedimentation tank is 30-60 rpm (below 30 rpm easily leads to sludge deposition, above 60 rpm easily breaks up the flocs). Due to the constraints of chemical characteristics, the concentration of the chemicals used must be maintained at 10%-15% (below 10% weakens the flocculation effect, above 15% easily crystallizes and clogs the pipeline). Therefore, the concentration of the chemical solution in the dosing pump must be controlled within this range. When adjusting the dosing rate, it is necessary to ensure the concentration is stable at the same time (for example, when increasing the dosing rate, replenish the chemical solution by increasing the frequency of the inlet pump of the chemical solution tank to maintain the concentration unchanged); process connection constraints, the residence time from the effluent of the aeration tank to the sedimentation tank must be controlled at 30-40 minutes. Below 30 minutes, the residence time of the sedimentation tank should be controlled at 30-40 minutes. If organic matter degradation is insufficient within minutes, and exceeds 40 minutes, it will affect the subsequent treatment rhythm. Therefore, when adjusting the aeration flow rate, the retention time must be calculated simultaneously (retention time = effective volume of aeration tank ÷ influent flow rate). If the influent flow rate is stable, changes in aeration flow rate will not affect the volume. Therefore, the focus is on monitoring fluctuations in influent flow rate. When the influent flow rate increases by 10%, the retention time is shortened, and the aeration time needs to be shortened by 5% accordingly to maintain the process rhythm. All objectives and constraints are entered into the system to form a multi-objective scheme and constraint list that can be called in real time. Each constraint is associated with a specific parameter range and prompt information when exceeding the limit. For example, if the aeration valve opening exceeds 100%, please reduce the target flow rate.

[0119] Based on a multi-objective scheme, dynamic analysis is performed using real-time water quality parameter prediction results to determine the final adjustment values ​​of control parameters. This includes dynamically adjusting operational constraints and the weight configuration of each objective based on the real-time water quality parameter prediction results; using a multi-objective optimization algorithm to solve for the control parameters, obtaining a set of solutions representing the final equilibrium relationship between different objectives; and selecting a final equilibrium scheme from the solution set according to the actual operation strategy to determine the final adjustment values ​​of the control parameters. Specifically, this includes collecting three types of data as the basis for analysis: the latest predicted water quality parameters, such as COD 42 mg / L, turbidity 6 NTU, and sludge concentration 3100 mg / L, all at the mild warning level; and the current control parameter values ​​(aeration flow rate 3.0 m³ / h). 3 / h, dosage 1.5kg / h, agitator speed 40 rpm; current energy consumption data (aeration system 1100kWh / day, dosing pump 450kWh / day, agitator 280kWh / day, total energy consumption 1830kWh / day, within the 90%-100% range of the baseline); dynamic analysis needs to be combined with the priority of multi-objective schemes. The current level is mild warning level, and the priorities of the two objectives are equal. Assess the balance between water quality compliance and energy consumption under the current parameters. COD 42mg / L is close to the upper limit of mild warning level (45mg / L), turbidity 6NTU is in the middle of mild warning level (5-9NTU), and sludge concentration 3100mg / L is in the lower limit of mild warning level (3000-3600mg / L). The overall water quality is trending towards the moderate warning level; the current total energy consumption of 1830kWh / day is lower than the baseline value, and there is room to increase energy consumption to improve water quality.

[0120] The control parameters were adjusted and calculated, including the aeration flow rate. The goal was to reduce the COD concentration to below 40 mg / L, while ensuring energy consumption did not exceed 10% of the baseline value. Historical data shows that when the COD concentration was between 40-45 mg / L, a 5% increase in aeration flow rate resulted in a decrease of approximately 1 mg / L in COD concentration. Currently, the COD is 42 mg / L, requiring a decrease of 2 mg / L. Therefore, the aeration flow rate needs to be increased by 10% (5% × 2). The current flow rate is 3.0 m³ / h. 3 / h, calculate the adjusted flow rate: 3.0 + (3.0 × 10%) = 3.3m³ 3 / h, check constraints, 3.3m 3The valve opening is 66% (maximum 100%), which is within the allowable range. The adjusted aeration system energy consumption is expected to increase by 10% (from 1100 kWh / day to 1210 kWh / day), but remains within 110% of the baseline value of 1200 kWh / day (1320 kWh / day), meeting the constraints. The dosage adjustment aims to reduce turbidity to below 5 NTU. Historical data shows that when turbidity is between 5-9 NTU, a 10% increase in dosage can reduce turbidity by approximately 0.5 NTU. The current turbidity is 6 NTU, requiring a 1 NTU reduction; therefore, the dosage needs to be increased by 20% (10% × 2). The current dosage is 1.5 kg / h, and the adjusted dosage will be 1.5 kg / h. + (1.5 × 20%) = 1.8 kg / h. Checking the constraints, 1.8 kg / h is lower than the maximum 3.0 kg / h, and the frequency of the liquid tank inlet pump is adjusted simultaneously (from 30 Hz to 36 Hz) to maintain a reagent concentration of 12% (within the 10%-15% range), meeting the constraints. The energy consumption of the dosing pump is expected to increase by 20% (from 450 kWh / day to 540 kWh / day), within 110% of the baseline value of 500 kWh / day (550 kWh / day). The agitator speed is adjusted to reduce the sludge concentration to below 3000 mg / L. Historical data shows that when the sludge concentration is between 3000-3600 mg / L, for every 5 rpm increase in speed, the sludge settling speed increases, and the concentration can decrease by approximately 100 mg / L. The current concentration is 3100 mg / L, requiring a decrease of 100 mg / L, hence the speed increase of 5 rpm. The current rotation speed is 40 rpm. After adjustment, it will be 40 + 5 = 45 rpm. Checking the constraint, 45 rpm falls within the 30-60 rpm range, which meets the constraint. The agitator energy consumption is expected to increase by 15% (from 280 kWh / day to 322 kWh / day), which is within 110% of the baseline value of 300 kWh / day (330 kWh / day). The total energy consumption after adjustment is calculated as 1210 (aeration) + 540 (chemical dosing) + 322 (agitation) = 2072 kWh / day, which is within 110% of the baseline value of 2000 kWh / day (2200 kWh / day), meeting the energy consumption constraint. The predicted water quality parameters after adjustment are COD 40 mg / L (normal grade), turbidity 5 NTU (normal grade), and sludge concentration 3000 mg / L (normal grade), meeting the water quality standards. Therefore, the final adjustment value is determined to be an aeration flow rate of 3.3 m³ / h. 3 / h, dosage 1.8kg / h, stirrer speed 45 rpm.

[0121] The final adjusted values ​​are converted into specific control signals and transmitted to the corresponding actuators at the wastewater treatment site. Specifically, each type of actuator has preset parameter values ​​and signal value calibration trends, established through historical debugging data to ensure accurate conversion, and aeration flow rate (3.3m³ / h). 3The flow rate ( / h) is converted into a valve opening signal. The calibration trend of the aeration valve shows that the flow rate and opening are linearly related, 1.0m 3 / h corresponds to a 20% opening, 5.0m 3 / h corresponds to 100% opening, that is, every 1m 3 / h corresponds to a 20% opening ((100%-20%)÷(5.0-1.0)=20% / m) 3 / h); 3.3m 3 The opening degree corresponding to / h is calculated as follows: 20% + (3.3-1.0) × 20% = 20% + 46% = 66%; converted to an electrical signal, the valve controller receives a 0-10V voltage signal, 0V corresponds to 0% opening, 10V corresponds to 100% opening, and 66% opening corresponds to a voltage signal of 10V × 66% = 6.6V; the dosage (1.8kg / h) is converted into a dosing pump frequency signal. The calibration trend of the dosing pump shows that the dosage and operating frequency are linearly related: 0.5kg / h corresponds to 10Hz, 3.0kg / h corresponds to 50Hz, that is, every 0.1kg / h corresponds to 1.6Hz ((50-10) ÷ (3.0-0.5) = 16Hz / kg / h, that is, 0.1kg / h corresponds to 1.6Hz). The frequency calculation corresponding to 1.8kg / h is: 10Hz + (1.8-0.5) × 16Hz / kg / h = 10Hz. +20.8Hz = 30.8Hz, rounded to 31Hz. The dosing pump receives pulse signals from 0-50Hz, and 31Hz is within the effective range. The stirrer speed (45 rpm) is converted into a motor current signal. The stirrer motor calibration trend shows that the speed and current are linearly related: 30 rpm corresponds to 2A, 60 rpm corresponds to 5A, that is, each 1 rpm corresponds to 0.1A ((5-2)÷(60-30)=0.1A / rpm). The current calculation for 45 rpm is 2A + (45-30)×0.1A / rpm = 2A + 1.5A = 3.5A. The motor controller receives a current signal from 0-5A, and 3.5A is within the effective range.

[0122] The converted signals are categorized by device type and encapsulated into device-recognizable instruction formats. Aeration valve instructions include device number (V01), target opening degree (66%), signal voltage (6.6V), and execution time (immediate). Dosing pump instructions include device number (P02), target frequency (31Hz), dosing concentration (12%), and execution time (immediate). Agitator instructions include device number (M03), target rotation speed (45 rpm), target current (3.5A), and execution time (immediate). Instructions are simultaneously transmitted to the controllers of each device via the Modbus RTU protocol. Within 10 seconds of transmission, the system receives a confirmation message indicating successful signal reception. If a device fails to respond (e.g., dosing pump P02 does not respond), the system immediately retryes the transmission (retry interval 1 second, maximum 3 times) to ensure all control signals are accurately delivered to the executing devices.

[0123] Based on the executed control operations, a closed-loop control method is adopted. The control parameters are continuously adjusted and corrected according to the difference between the real-time monitored effluent water quality data and the preset target values, achieving real-time operation of the wastewater treatment process and stable control of the effluent water quality. Specifically, the system collects actual effluent water quality data every minute. COD concentration, turbidity, and sludge concentration are obtained through online sensors installed at the sedimentation tank outlet. These are compared with target values ​​(COD ≤ 40 mg / L, turbidity ≤ 5 NTU, sludge concentration 2000-3000 mg / L) to calculate the difference. In the first minute, the monitored data is: COD 41 mg / L, turbidity 5.2 NTU, sludge concentration 3050 mg / L. The difference calculations are: COD difference = 41 - 40 = 1 mg / L (exceeding the target by 1 mg / L); turbidity difference = 5.2 - 5 = 0.2 NTU (exceeding the target by 0.2 NTU); sludge concentration difference = 3050 - 3000 = 50 mg / L (exceeding the target by 50 mg / L).

[0124] Based on the magnitude of the difference, the control parameters are adjusted according to the logic of fine-tuning for small differences, medium-tuning for medium differences, and large-tuning for large differences. For a COD difference of 1 mg / L (small difference), historical data shows that a 1 mg / L difference requires a 2% adjustment of the aeration flow rate; the current aeration flow rate is 3.3 m³ / h. 3 / h, after correction 3.3 + (3.3 × 2%) = 3.3 + 0.066 = 3.366m 3 / h≈3.37m 3 / h; Turbidity difference of 0.2 NTU (small difference), a difference of 0.2 NTU requires a fine adjustment of the dosage by 3%, the current dosage is 1.8 kg / h, after correction 1.8 + (1.8 × 3%) = 1.8 + 0.054 = 1.854 kg / h ≈ 1.85 kg / h; Sludge concentration difference of 50 mg / L (small difference), a difference of 50 mg / L requires a fine adjustment of the agitator speed by 2 rpm, the current speed is 45 rpm, after correction 45 + 2 = 47 rpm; If the difference reaches a medium difference (such as a COD difference of 3 mg / L), the adjustment range is doubled (aeration flow rate adjustment of 4%); If it reaches a large difference (such as a COD difference of 5 mg / L), the adjustment range is increased to 3 times (aeration flow rate adjustment of 6%) to ensure rapid reduction of the difference.

[0125] The corrected parameter values ​​were repeated during the signal conversion and transmission process and sent to the execution equipment. Monitoring data at the 2-minute mark showed COD 40.5 mg / L, turbidity 5.1 NTU, and sludge concentration 3020 mg / L, with differences of 0.5 mg / L, 0.1 NTU, and 20 mg / L respectively. Further fine-tuning was then performed (aeration flow rate increased to 3.39 m³ / h). 3 (The dosage was increased to 1.87 kg / h, and the rotation speed was increased to 48 rpm). At the 3-minute monitoring point, COD was 40 mg / L, turbidity was 5 NTU, and sludge concentration was 3000 mg / L. All differences were 0, reaching the target value, and correction was stopped. Thereafter, the system monitored every minute. If parameters fluctuated within ±5% of the target value (e.g., COD 38-42 mg / L), the current control parameters were maintained. If the fluctuation exceeded the range, the above feedback correction process was repeated to ensure that the effluent quality remained stable within the target range for a long period, achieving real-time closed-loop control of the wastewater treatment process.

[0126] Multi-objective schemes and constraints reduce the one-sidedness of traditional wastewater treatment that prioritizes water quality over energy consumption or vice versa. Dynamic analysis and parameter optimization alleviate the problems of reliance on experience-based adjustments and insufficient precision in traditional control. Adjustment values ​​are calculated based on real-time data and historical patterns, making parameter settings more accurate. This ensures that water quality meets standards quickly while avoiding energy waste. Through continuous feedback correction, it can quickly respond to various disturbances and maintain long-term water quality stability, avoiding the defects of large water quality fluctuations in traditional operation.

[0127] Embodiments of the present invention also provide a computing device, including: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method described above. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.

[0128] Embodiments of the present invention also provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the method described above. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.

[0129] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A deep learning-based real-time detection system for sewage treatment water quality parameters, characterized in that, include: The data acquisition module is used to collect multi-source dynamic data in real time during the wastewater treatment process through a distributed sensor network; The feature reconstruction module is used to reconstruct the feature space of multi-source dynamic data and generate dynamic correction parameters through temporal correlation analysis, including: Multi-source dynamic data is standardized and denoised preprocessed to obtain preprocessed standardized time-series data. Based on standardized time series data, a sliding window mechanism is used to segment the time series data and construct a multivariate time series sample set. Multi-source feature fusion is performed on a multivariate time series sample set, and principal component analysis is performed on the fused high-dimensional features to achieve feature dimensionality reduction and reconstruction, resulting in a low-dimensional dense feature representation. Based on low-dimensional dense feature representation, time-series correlation analysis is used to calculate the correlation coefficients between each water quality variable and the operational variable at different lag times, forming a dynamic correlation matrix; The dynamic correlation matrix is ​​analyzed to generate dynamic correction parameters for real-time correction. The learning prediction module is used to input dynamically corrected parameters into a pre-trained multi-task deep learning model, evaluate the influence of each feature variable through parameter contribution analysis, and dynamically adjust the feature importance allocation using an adaptive weighting mechanism to obtain the adjusted feature representation. The parameter prediction module is used to predict the concentration of multiple key effluent water quality parameters in real time based on the adjusted feature representation, and obtain the concentration prediction value. The assessment and early warning module is used to assess the degree of wastewater pollution in real time based on the concentration prediction value and compare the prediction value with the preset safety threshold. If the prediction value is greater than the threshold, the corresponding emergency response mechanism is triggered, and the assessment results and early warning information are transmitted to the central monitoring platform through the process control communication protocol. The control and adjustment module is used to determine the final set values ​​of the control parameters of the wastewater treatment process based on real-time evaluation results and uploaded data, combined with a multi-objective strategy with energy consumption and water quality compliance as the core constraints, so as to realize real-time detection and stable control of effluent water quality. 2.The deep learning-based real-time detection system for water quality parameters of sewage treatment according to claim 1, characterized in that, The dynamically adjusted parameters are input into the pre-trained multi-task deep learning model. The influence of each feature variable is evaluated through parameter contribution analysis, and an adaptive weighting mechanism is used to dynamically adjust the feature importance allocation to obtain the adjusted feature representation, including: The dynamic correction parameters are fused with the high-dimensional temporal feature matrix at the feature level to form an enhanced feature tensor. The enhanced feature tensor is input into the pre-trained multi-task deep learning model, and the weight distribution of each feature variable on different attention heads is calculated using the multi-head self-attention mechanism in the model to generate the initial contribution score matrix of each feature variable. An aggregation analysis was performed on the initial contribution score matrix in the time series dimension. The importance of each feature variable was normalized using a normalization calculation method. Based on the calculation results, a dynamic weight coefficient vector for each feature variable was generated. The dynamic weight coefficient vector is weighted element-wise with the feature representation of the corresponding time step to obtain the enhanced temporal feature representation. The enhanced temporal feature representation is subjected to cross-channel feature fusion, and a gating mechanism is used to regulate the information flow of different feature channels to generate the final adjusted feature representation.

3. The real-time monitoring system for wastewater quality parameters based on deep learning according to claim 2, characterized in that, The enhanced feature tensor is input into a pre-trained multi-task deep learning model. The multi-head self-attention mechanism within the model is used to calculate the weight distribution of each feature variable across different attention heads, generating an initial contribution score matrix for each feature variable, including: Through multiple parallel linear transformation layers in the multi-head self-attention mechanism, the input features are mapped to different feature subspaces to obtain the query vector, key vector and value vector corresponding to each subspace; Based on the query vector and key vector, the attention weight of each position in the feature sequence to all positions is calculated in each feature subspace, and the subspace attention weight distribution reflecting the local dependency is obtained. The attention weight distributions of each subspace are weighted, fused, and normalized to aggregate the output information of all attention heads and generate a global attention weight distribution that represents the correlation of global features. Based on the global attention weight distribution, calculate the initial importance score of each feature variable for the prediction task of multiple effluent water quality parameters; All initial importance scores are integrated to construct a two-dimensional contribution score matrix for the prediction task, which includes behavioral feature variables.

4. The real-time monitoring system for wastewater quality parameters based on deep learning according to claim 3, characterized in that, Based on the adjusted feature representation, the concentrations of several key effluent water quality parameters are predicted in real time, yielding predicted concentration values, including: The final adjusted feature representation is input into the multi-scale feature extraction process. By extracting features at different time scales, a feature representation including features at multiple time scales is obtained. Multi-timescale feature representations are input into the feature fusion processing stage, and a unified multi-scale fused feature representation is generated through feature weighted fusion operation. The multi-scale fused feature representation is input into multiple parallel water quality parameter prediction processing branches. Each processing branch receives the same features and is specifically responsible for the prediction task of one water quality parameter. In each prediction processing branch, temporal convolution is used to perform deep feature extraction on the input features to obtain a high-dimensional feature mapping representation; The high-dimensional feature map is input to the regression output processing layer, and the feature representation is converted into the concentration prediction value of the corresponding water quality parameter through nonlinear transformation.

5. The real-time monitoring system for wastewater treatment water quality parameters based on deep learning according to claim 4, characterized in that, The degree of wastewater pollution is assessed in real time based on the concentration prediction value, and the prediction value is compared with the preset safety threshold. If the predicted value exceeds the threshold, the corresponding emergency response mechanism is triggered, and the assessment results and early warning information are transmitted to the central monitoring platform via the process control communication protocol, including: Preset safe threshold ranges for each key water quality parameter and construct a multi-level early warning threshold system; Based on a multi-level early warning threshold system, the predicted concentration value is compared and analyzed with the safety threshold to generate an indicator of the water quality parameter exceeding the standard. Based on the severity of the exceeding status indicator, the corresponding level of emergency response procedure is triggered, and the corresponding emergency control measures are implemented; It records the predicted values ​​of all water quality parameters, the status of exceeding standards, and the emergency measures implemented in real time, and generates a complete pollution assessment report based on the recorded results; The pollution assessment report, early warning information, and real-time forecast data are packaged into a standard format data transmission packet and sent to the central monitoring platform through the process control communication protocol.

6. The real-time monitoring system for wastewater treatment water quality parameters based on deep learning according to claim 5, characterized in that, Based on real-time assessment results and uploaded data, and combined with a multi-objective strategy centered on energy consumption and water quality compliance, the final set values ​​of control parameters for the wastewater treatment process are determined to achieve real-time monitoring and stable control of effluent quality, including: With energy consumption and water quality compliance as the core objectives, a multi-objective scheme is constructed, and various constraints in the wastewater treatment operation process are determined simultaneously. Based on a multi-objective scheme, dynamic analysis is performed using real-time water quality parameter prediction results to determine the final adjustment values ​​of the control parameters. The final adjustment values ​​are converted into specific control signals and transmitted to the corresponding execution equipment at the wastewater treatment site; Based on the executed control operations, a closed-loop control method is adopted. According to the difference between the real-time monitored effluent water quality data and the preset target value, the control parameter adjustment values ​​are continuously fed back and corrected to achieve real-time operation of the sewage treatment process and stable control of effluent water quality.

7. The real-time monitoring system for wastewater treatment water quality parameters based on deep learning according to claim 6, characterized in that, Based on a multi-objective scheme, dynamic analysis is performed using real-time water quality parameter prediction results to determine the final adjustment values ​​of the control parameters, including: Based on a multi-objective scheme, the operational constraints and the weight configuration of each objective are dynamically adjusted according to the real-time water quality parameter prediction results. A multi-objective optimization algorithm is used to solve for the control parameters, resulting in a set of solutions that characterize the final equilibrium relationship between different objectives. Based on the actual operating strategy, a final balancing scheme is selected from the solution set to determine the final adjustment values ​​of the control parameters.

8. A computing device, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the system as described in any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program that, when executed by a processor, implements the system as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Sewage treatment water quality monitoring automatic control method based on multi-task learning

    CN114386579A

  • Water quality monitoring system and method for environmental protection

    CN117077075A