Sewage toxicity early warning device based on deep learning and control method
By using a deep learning-based wastewater toxicity early warning device, the toxicity of wastewater can be monitored and analyzed in real time, solving the problems of delayed toxicity identification and false alarms in wastewater treatment plants. This enables rapid and accurate toxicity early warning and quantitative assessment, supporting the stable operation of wastewater treatment plants.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-26
- Publication Date
- 2026-04-14
AI Technical Summary
Existing wastewater treatment plants struggle to quickly and accurately identify and quantify influent toxicity, leading to delayed early warnings, high false alarm rates, and an inability to take timely countermeasures, thus affecting the stable operation of wastewater treatment plants.
A wastewater toxicity early warning device based on deep learning is adopted, including a microbial reaction module, a monitoring module, a data storage and management module, a deep learning early warning module, and a PLC control module. By monitoring dissolved oxygen concentration and specific oxygen consumption rate in real time, and using a deep learning model to analyze toxicity impact, it can achieve online intelligent early warning and quantification of toxicity level.
It enables rapid and accurate early warning of wastewater toxicity, reduces false alarm rate, eliminates the cumbersome process of offline verification, provides quantitative toxicity assessment, supports timely process control, and ensures the safe and stable operation of wastewater treatment plants.
Smart Images

Figure CN121862229A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a wastewater toxicity early warning device and control method based on deep learning, belonging to the field of wastewater treatment technology. Background Technology
[0002] To understand and monitor influent water quality and facilitate real-time optimization of wastewater treatment process parameters, wastewater treatment plants primarily monitor conventional pollutant indicators such as chemical oxygen demand (COD), ammonia nitrogen, total nitrogen (TNO), and total phosphorus (TP) online. However, the actual sources of influent to wastewater treatment plants are diverse and complex, with a high proportion of industrial wastewater. Furthermore, inadequate urban drainage systems can lead to frequent instances of unauthorized discharge, posing a threat to the stable operation of wastewater treatment plants. When the influent contains heavy metals, persistent toxic organic compounds, and high salinity, it can impact wastewater treatment processes based on the activated sludge method. The treatment capacity of the biological treatment units is inhibited by these toxic substances, severely affecting their biological nitrogen and phosphorus removal and organic matter degradation capabilities, resulting in economic losses and the risk of exceeding discharge standards for the wastewater treatment plant.
[0003] Currently, wastewater treatment plants primarily rely on two methods to monitor influent toxicity: First, indirect assessment based on online physicochemical indicators (such as influent pH and effluent ammonia nitrogen). The core principle is not direct detection of toxic substances, but rather monitoring changes in key physicochemical parameters closely related to influent water quality produced by the microbial community (activated sludge) during normal metabolism. This allows for inverse inference about whether metabolic activity is inhibited, thus indirectly determining the presence of potentially toxic or inhibitory substances in the influent. Conventional online monitoring equipment mainly measures chemical indicators such as pH, dissolved oxygen, turbidity, ammonia nitrogen, chemical oxygen demand (COD), total nitrogen, and total phosphorus. These parameters only reflect the concentration level of the water body, while toxicity is determined by the inhibitory effect of specific harmful substances (such as heavy metals, pesticides, industrial organic toxins, and sudden toxic shocks) on microorganisms or organisms. Therefore, these conventional online monitoring devices cannot identify wastewater toxicity, cannot directly and quickly reflect influent toxicity, and are prone to delayed early warnings. Second, offline testing, such as luminescent bacteria toxicity detection, proton change toxicity detection, and ATP fluorescence detection. The principle behind luminescent bacterial toxicity detection is based on the characteristic that specific bacterial species (such as Vibrio fischeri and luminescent bacillus) continuously emit light during normal metabolism. When the water sample contains toxic substances, the bacterial metabolic enzyme system (especially enzymes related to luminescence) is inhibited or damaged, leading to a decrease in luminescence intensity. The stronger the toxicity, the higher the luminescence inhibition rate. By measuring the change in luminescence intensity before and after contact with the water sample or compared with the control group using a precision photometer, the toxicity can be quantitatively calculated (usually expressed as equivalent toxic substance concentration or inhibition rate percentage). However, this method only reflects the overall toxicity of the water body and cannot identify the specific toxic substance. Moreover, this method requires high bacterial activity and has a large fluctuation in sensitivity. Proton change toxicity detection is based on radiation or high-energy particle environments. High-energy proton beams generate secondary ionization and free radicals in water or other media, which in turn damage biomolecules (such as DNA and proteins). The toxicity of water bodies to radioactive or high-energy particles can be assessed by measuring changes in cell or microbial survival rates, DNA damage markers, or metabolites (such as ATP and lactate dehydrogenase) after proton irradiation. However, this method involves expensive experimental equipment and high costs, and the detection process involves high-energy radiation, requiring strict operational safety standards. Furthermore, this method is insensitive to low doses or mixed contamination (non-radiochemical toxicity), limiting its applicability. ATP fluorescence detection is based on the reaction of ATP from all living cells in the water sample with a specific luciferase-luciferin reagent, producing biofluorescence proportional to the ATP concentration. By measuring the fluorescence intensity, the total amount or total activity of live microorganisms in the sample can be quantified. In toxicity testing, the changes in ATP content after activated sludge contact with control and test water samples are compared. If the test water sample shows a significant decrease in ATP content, it indicates that the toxic substance inhibits the metabolic activity of microorganisms or causes cell death, thus allowing for the estimation of the toxicity level.While these methods are relatively effective, they take several hours and have a delayed response time, making it impossible to provide real-time early warnings and hindering wastewater treatment plant operators from taking timely countermeasures.
[0004] Therefore, developing a device and control method that can quickly, accurately, and intelligently predict influent toxicity and assess its degree of inhibition is of great significance for ensuring the safe and stable operation of wastewater treatment plants. Summary of the Invention
[0005] To address the aforementioned problems, this invention provides a wastewater toxicity early warning device and control method based on deep learning. This device and control method can quickly identify wastewater toxicity and effectively solve the problems of high false alarm rate, delayed warning, reliance on offline verification, and inability to quantify toxicity levels in existing toxicity early warning methods. It also features real-time monitoring, high sensitivity, strong stability, and convenient operation.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: a wastewater toxicity early warning device based on deep learning, which includes a microbial reaction module, a monitoring module, a data storage and management module, a deep learning early warning module, a toxicity assessment module, and a PLC control module.
[0007] The microbial reaction module is used to provide a mixing and reaction process between wastewater and activated sludge microorganisms. This module includes a reactor, influent pump, aeration pump, aeration disc, flat sheet membrane, effluent pump, overflow port, and sample retention solenoid valve. The reactor is a cylindrical reactor containing activated sludge microorganisms, which react under specific conditions. The influent pump, sample retention solenoid valve, aeration pump, and effluent pump are located outside the reactor. The influent pump is connected to the reactor via an influent pipe, with the connection point above the reactor bottom, 0.5-1 cm from the bottom. The sample retention solenoid valve is connected to the influent pipe between the influent pump and the reactor via a sample retention tube, used to automatically collect raw influent samples upon specific commands. The aeration pump is connected to the reactor via an aeration pipe, with the connection point above the reactor bottom, 0.5-1 cm from the bottom. The bottom 1-2cm; the aeration pipe extends into the reactor and connects to the aeration disc; the aeration pump supplies air to the activated sludge microorganisms in the reactor through the aeration pipe and aeration disc, creating aerobic conditions for microbial reaction, and at the same time plays a stirring role, so that the activated sludge microorganisms in the reactor are in a completely mixed state; one end of the flat sheet membrane extends vertically into the reactor, 2-4cm away from the aeration disc, and the other end is connected to the effluent pump outside the reactor; the flat sheet membrane is used to achieve solid-liquid separation and retain the activated sludge microorganisms in the reactor; the overflow port is located 2cm away from the top of the reactor.
[0008] The monitoring module monitors the dissolved oxygen concentration of the mixture in the reactor in real time through an online dissolved oxygen probe installed inside the reactor, and calculates the real-time specific oxygen uptake rate (SOUR) value.
[0009] The data storage and management module is used to store time-series data to build a database. The data storage includes the original dissolved oxygen (DO), SOUR time-series data, and the ammonia utilization rate (AUR) obtained from offline nitrification rate experiments corresponding to the short-term change sequence of SOUR after the warning is triggered.
[0010] The deep learning early warning module provides the runtime environment for deep learning models, implementing modeling, data preprocessing, model training, validation, and wastewater toxicity early warning. When the solubility urinate (SOUR) triggers the early warning threshold, the module retrieves the SOUR change sequence within a period T after the early warning from the data storage module, while simultaneously storing water samples. Offline nitrification rate experiments are conducted on the stored water samples to confirm toxicity and its severity. The ammonia utilization rate (AUR) result is correlated with the corresponding SOUR change sequence and stored in the database. The accumulated labeled data is used to train a deep learning model, enabling it to identify toxic shocks based on the SOUR change sequence after exceeding the threshold. The trained model is deployed, and when the SOUR exceeds the early warning threshold, the model analyzes the subsequent change sequence to directly determine and issue an early warning of toxic shocks, achieving online intelligent early warning.
[0011] The toxicity assessment module is used to build a SOUR-AUR relationship model based on historical data. After identifying toxic shocks online, the toxicity of wastewater is predicted based on the real-time SOUR value through the SOUR-AUR relationship model.
[0012] The PLC control module is interconnected with the monitoring module, the deep learning early warning module, and the toxicity assessment module. It is also connected to the influent pump, sample retention solenoid valve, aeration pump, and effluent pump in the microbial reaction module. It is used to perform graded alarms and process control based on monitoring signals, intelligent diagnostic results, and toxicity assessment.
[0013] Based on the aforementioned deep learning-based wastewater toxicity early warning device, this invention provides a deep learning-based wastewater toxicity early warning and control method, which includes a model training phase and an online application phase.
[0014] The model training phase includes the following steps: Step S1: Start the microbial reaction module, continuously input the wastewater to be tested into the reactor through the influent pump, and maintain the dissolved oxygen in the reactor within the set range (e.g., 2.0-4.0 mg / L) through the aeration pump, so that the activated sludge microorganisms are in a stable mixed state.
[0015] Step S2: The online dissolved oxygen probe collects the dissolved oxygen concentration of the mixture in the reactor in real time. Based on the change in dissolved oxygen concentration, the monitoring module calculates the specific oxygen consumption rate in real time and stores the collected raw dissolved oxygen data and SOUR time series data in the data storage and management module.
[0016] Step S3: The device uses a preset primary warning threshold based on SOUR time-series data ( Determine if an alarm has been triggered: like If so, return to step S1 and continue monitoring; like This will trigger the following three parallel operations simultaneously: (1) Event Log: The data storage and management module records the time and initial SOUR value of the event exceeding the limit; (2) Sequence extraction: Extract the SOUR time series within a fixed duration T (e.g., 10 seconds) after the occurrence of the exceeding event from the data stream to form a short-term variation sequence. ;in This represents the moment when the standard was exceeded. Represents the sampling interval. Represents the sequence length; (3) Automatic sampling: The PLC control module immediately sends an opening command to the sampling solenoid valve, so that it opens for a preset time, thereby automatically collecting and saving a sample of the original influent impact water at the time of triggering the warning in the sampling bottle.
[0017] Step S4: Conduct nitrification rate experiments on the shock water samples obtained in Step S3 under offline conditions, compare the measured AUR values with the typical normal AUR range of the wastewater treatment system under stable operating conditions, and generate toxicity labels. If the AUR value is significantly lower than the lower limit of the normal range (e.g., below 80% of the normal value), the water sample is determined to be "toxic," and it corresponds to the short-term variation sequence of the SOUR. Assign toxicity labels Conversely, if it does not, it is judged as "non-toxic" and assigned a toxicity label. .
[0018] Step S5: Collect labeled data generated during the wastewater treatment process and standardize it. Then, divide the standardized data into training set and validation set. Furthermore, the short-term variation sequence of SOUR during the wastewater treatment process. and toxicity label As a sample pair This constitutes the original dataset; Furthermore, all short-term variation sequences of SOUR in the training set are standardized to eliminate dimensions and accelerate model convergence. The standardized expression is:
[0019] in, and , respectively, are the mean and standard deviation of all SOUR short-term variation sequences in the training set.
[0020] Furthermore, the standardization of the training set is reused. and The short-term variation sequences of SOUR in the validation set are standardized in the same way as those in the training set to ensure that the data distribution of the validation set is consistent with that of the training set, avoid data leakage, and ensure that the validation results can truly reflect the generalization ability of the model.
[0021] Step S6: Construct an Attention-LSTM deep learning model and input the SOUR short-term change sequence (normalized in Step S5) into the model. Extract temporal features through multi-layer LSTM units, assign weights to features at different time steps through the attention layer, and finally output the final wastewater toxicity probability value through a fully connected layer and a sigmoid function. , representing the probability of the toxic shock corresponding to the sequence predicted by the model; Furthermore, the Attention-LSTM deep learning model includes an input layer, an LSTM layer, an attention layer, and a fully connected output layer; The input layer is used to receive the standardized short-term variation sequence of SOUR. ; LSTM layers are used to capture the long-term time dependence of short-term SOUR sequences. The formula for calculating the time step t for a single LSTM cell is as follows: Input Gate:
[0022] Forgotten Gate:
[0023] Output gate:
[0024] Candidate memory cells:
[0025] Renew memory cells:
[0026] Output hidden state:
[0027] in, For the sigmoid function, It is the hyperbolic tangent function. This represents element-wise multiplication. Representative input The weight matrix to the input gate, The input represents the current time step, i.e., the feature vector of the SOUR short-term change sequence at time t. Represents the previous hidden state The weight matrix to the input gate, This represents the output hidden state of the previous time step, representing the short-term memory of the LSTM at time t-1, which is passed to the current step to provide historical information. The bias term representing the input gate. Representative input The weight matrix to the forget gate, Represents the previous hidden state The weight matrix to the forget gate, The bias term representing the forgetting gate. Representative input The weight matrix to the output gate, Represents the previous hidden state The weight matrix to the output gate, The bias term representing the output gate. Representative input The weight matrix of candidate memory cells, Represents the previous hidden state The weight matrix of candidate memory cells, Bias terms representing candidate memory cells; The attention layer is used to access the hidden states of the LSTM across all time steps. Assign attention weights This allows the model to focus on key changes in the sequence; among which, attention weights The expression is:
[0028]
[0029]
[0030] in, This is a trainable background vector. The trainable parameters representing the attention layer, Representing the hidden state at time step t of the LSTM, it represents the short-term memory characteristics of the SOUR sequence at that time and serves as the "evaluation object" of the attention layer. The trainable parameters of the attention layer represent the bias term for feature transformation, and the adjustment term represents the training parameters of the attention layer. The activation threshold Representative vector The transpose of , i.e., the column vector corresponding to the t-th time step. The transposed row vector Representative vector The transpose of , i.e., the column vector corresponding to the j-th time step. The transposed row vector Represents the weighted context vector; The fully connected output layer is used to weight the context vector. Input to the fully connected layer, through Linear transformation and After bias adjustment and normalization using the Sigmoid function, the final prediction of toxicity probability is obtained. The calculation formula is as follows:
[0031] Furthermore, the standardized training set from step S5 is used as input, along with the corresponding toxicity labels. To supervise the signal, binary cross-entropy is used as the loss function L for model training, where the expression for the loss function L is:
[0032] Where N represents the total number of samples in the training set, that is, the total number of "labeled SOUR sequence samples" used in this model training. An adaptive moment estimation (Adam) optimizer algorithm is employed to iteratively update model parameters through backpropagation to minimize the loss function. During training, a validation set is used to monitor model performance and prevent overfitting.
[0033] Step S7: Establish a SOUR-AUR toxicity relationship model to achieve online assessment of wastewater toxicity; Furthermore, all toxicity tags are extracted from the data storage and management module as toxic ( Sample data; Furthermore, using the initial SOUR value at which these samples trigger the alert as the independent variable x, and its corresponding toxicity level y, the toxicity level formula is as follows:
[0034] Furthermore, a nonlinear regression method (least squares fitting of an exponential function) was used to fit the data, establishing a quantitative relationship model between the SOUR value and the degree of toxicity inhibition y:
[0035] in, The proportional coefficient representing the exponential term primarily affects the magnitude of change in the degree of toxicity inhibition, y. The decay coefficient representing the exponential term controls the rate at which SOUR affects the degree of toxicity inhibition, y. Represents a constant term; This leads to the SOUR-AUR toxicity relationship model for online assessment of wastewater toxicity.
[0036] The online application phase of the model includes the following steps: Step 1: Model Deployment and Real-time Monitoring; The trained SOUR-AUR toxicity relationship model is deployed in the deep learning early warning module, and the device enters a fully automatic online monitoring and early warning mode to monitor SOUR in real time. When the SOUR exceeds the limit, the sequence is extracted and automatically sampled (for possible subsequent model iteration training).
[0037] Step 2: Intelligent early warning and toxicity identification; Furthermore, when the SOUR value exceeds the warning threshold and a short-term SOUR change sequence is extracted... Then, immediately perform the same standardized process as during the training phase; Furthermore, the standardized SOUR short-term variation sequence Input the deployed deep learning model for forward inference; Furthermore, if If the deep learning warning module determines that the impact is "confirmed toxicity" and generates a high-level warning signal; like If the event is not detected, the deep learning early warning module will determine it as "normal fluctuation or unconfirmed shock", only record the event, and not trigger advanced alarms.
[0038] Step 3: Toxicity assessment and prediction; When the determination in step 2 is "confirmed toxicity impact", the toxicity assessment module is activated. This module reads the initial SOUR value that triggered this warning and substitutes it into the SOUR-AUR toxicity relationship model established in step S7. It then calculates and outputs a predicted wastewater toxicity level y in real time, thereby quantifying the potential impact of the current influent toxicity on the biological treatment system.
[0039] Step 4: Implement hierarchical control; The PLC control module receives warning signals from the deep learning early warning module and predicted wastewater toxicity values from the toxicity assessment module; based on the preset graded control strategy, it recommends that operators perform corresponding operations: A. Mandatory Item: Trigger advanced alarm devices such as sound and light to notify operations personnel.
[0040] B. Conditional Execution Item: Process intervention based on predicted toxicity level y: Toxicity level y < 30% (mild): It is recommended that operators monitor the changes in ammonia nitrogen concentration in the latter part of the aerobic tank of the biological treatment system. 0%≤Toxicity level y<60% (Moderate): It is recommended that operators reduce the influent volume to reduce the load of toxic influent; at the same time, aeration can be increased and external reflux can be improved to enhance the shock resistance of the biological treatment system. Toxicity level y≥60% (severe): It is recommended that operators implement emergency plans, such as stopping water intake, switching the water intake to the accident water tank, and activating the emergency dosing system; After completing the control action, the system automatically returns to the real-time monitoring status, forming a closed loop of "monitoring-analysis-decision-control".
[0041] The present invention provides a wastewater toxicity early warning device and control method based on deep learning, which has the following beneficial effects: (1) Intelligent and accurate early warning: By analyzing the short-term dynamic change pattern after the SOUR trigger threshold through deep learning model, it can effectively distinguish between real toxic shock and normal water quality fluctuation. It can respond to sewage containing heavy metals, pesticides, electroplating pollutants and unknown toxic substances. It has broad spectrum and comprehensive toxicity monitoring capabilities, overcomes the inherent defects of traditional detection methods that are single detection and cannot reflect the degree of toxicity, greatly reduces the detection cycle and false alarm rate, and achieves rapid and accurate early warning. (2) Elimination of offline verification: After the deep learning model has been fully trained and verified, the system can automatically identify toxicity, eliminating the tedious and time-consuming offline experiments. This effectively solves the problems of long cycle, high cost and poor timeliness of traditional offline toxicity detection methods, and realizes the online, automated and intelligent toxicity monitoring and early warning. (3) Quantifying the degree of toxicity: An innovative correlation model between SOUR and AUR was established, which can quickly predict the specific degree of inhibition of toxicity on the biochemical treatment system of sewage treatment plant based on the online SOUR value, providing a quantitative basis for operators to take targeted control strategies. Attached Figure Description
[0042] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0043] Figure 1 This is a schematic diagram of a wastewater toxicity early warning device based on deep learning, provided in Embodiment 1 of the present invention. Figure 2 The following is a flowchart of a wastewater toxicity early warning and control method based on deep learning, provided in Embodiment 2 of the present invention. Figure 3 This is a schematic diagram of the Attention-LSTM model structure in a deep learning-based wastewater toxicity early warning and control method provided in Embodiment 2 of the present invention. In the diagram, 1: Reactor, 2: Inlet pump, 3: Inlet pipe, 4: Aeration pump, 5: Aeration pipe, 6: Aeration disc, 7: Flat sheet membrane, 8: Outlet pump, 9: Outlet pipe, 10: Overflow port, 11: Online dissolved oxygen probe, 12: Monitoring module, 13: Data storage and management module, 14: Deep learning early warning module, 15: Toxicity assessment module, 16: PLC control module, 17: Sample retention solenoid valve, 18: Sample retention tube. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
[0045] Example 1 This embodiment provides a wastewater toxicity early warning device based on deep learning. See [link to documentation]. Figure 1 The device includes a microbial reaction module, a monitoring module 12, a data storage and management module 13, a deep learning early warning module 14, a toxicity assessment module 15, and a PLC control module 16.
[0046] The microbial reaction module is used to provide a mixture and reaction of wastewater and activated sludge microorganisms. This module includes a reactor 1, an influent pump 2, an aeration pump 4, an aeration disc 6, a flat sheet membrane 7, an effluent pump 8, an overflow port 10, and a sample retention solenoid valve 17. Reactor 1 is a cylindrical reactor containing activated sludge microorganisms, which react under specific conditions. The influent pump 2, sample retention solenoid valve 17, aeration pump 4, and effluent pump 8 are located outside reactor 1. The influent pump 2 is connected to reactor 1 via an influent pipe 3, which is positioned above the bottom of reactor 1, 0.5-1 cm from the bottom. The sample retention solenoid valve 17 is connected to the influent pipe 3 between the influent pump 2 and reactor 1 via a sample retention tube 18, used to automatically collect raw influent water samples upon specific instructions. The aeration pump 4 is connected to reactor 1 via an aeration pipe 5, which is positioned below the bottom of reactor 1. The aeration pipe 5 extends into the reactor 1 and connects to the aeration disc 6. The aeration pump 4 supplies air to the activated sludge microorganisms in the reactor 1 through the aeration pipe 5 and the aeration disc 6, creating aerobic conditions for microbial reaction and also acting as a stirrer to ensure that the activated sludge microorganisms in the reactor 1 are completely mixed. One end of the flat sheet membrane 7 extends vertically into the reactor 1, 2-4 cm above the aeration disc 6, and the other end is connected to the effluent pump 8 outside the reactor 1. The flat sheet membrane 7 is used to achieve solid-liquid separation and retain the activated sludge microorganisms in the reactor. The overflow port 10 is located 2 cm from the top of the reactor 1.
[0047] The monitoring module 12 monitors the dissolved oxygen concentration of the mixture in the reactor 1 in real time through the online dissolved oxygen probe 11 installed inside the reactor 1, and calculates the real-time specific oxygen consumption rate (SOUR) value.
[0048] The data storage and management module 13 is used to store time-series data to build a database. The data storage includes the original DO and SOUR time-series data and the offline nitrification rate experimental verification results (AUR) corresponding to the short-term change sequence of SOUR after the warning is triggered.
[0049] The deep learning early warning module 14 provides the operating environment for the deep learning model, implementing modeling, data preprocessing, model training, validation, and wastewater toxicity early warning. When the SOUR triggers the early warning threshold, the module retrieves the SOUR change sequence within a period T after the early warning from the data storage module, while simultaneously storing water samples. Offline nitrification rate experiments are conducted on the stored water samples to confirm toxicity and its degree, and the results (AUR) are associated with the corresponding SOUR change sequence and stored in the database. The accumulated labeled data is used to train the deep learning model, enabling it to identify toxicity shocks based on the change sequence after the SOUR exceeds the threshold. The trained model is deployed, and when the SOUR exceeds the early warning threshold, the model analyzes the subsequent change sequence to directly determine and issue an early warning of toxicity shocks, achieving online intelligent early warning.
[0050] The toxicity assessment module 15 is used to establish a SOUR-AUR relationship model based on historical data. After online identification of toxic shock, the toxicity of wastewater is predicted based on the real-time SOUR value through the SOUR-AUR relationship model.
[0051] The PLC control module 16 is interconnected with the monitoring module 12, the deep learning early warning module 14, and the toxicity assessment module 15, and is also connected to the influent pump 2, the sample retention solenoid valve 17, the aeration pump 4, and the effluent pump 8 in the microbial reaction module. It is used to perform graded alarms and process control based on monitoring signals, intelligent diagnostic results, and toxicity assessment.
[0052] This embodiment provides a wastewater toxicity early warning device based on deep learning, enabling real-time prediction of wastewater toxicity.
[0053] Example 2 This embodiment provides a control method for a wastewater toxicity early warning device based on deep learning. This control method is implemented based on the device described in Embodiment 1, and the specific process of the method is as follows: Figure 2 As shown. First, model training is carried out, including online data monitoring and triggering, feature sequence extraction and sample retention, offline validation and data annotation, database construction and model training; then, the mature model is applied online, including real-time monitoring and intelligent diagnosis, intelligent decision-making and early warning, toxicity quantification and response suggestions; Based on the aforementioned deep learning-based wastewater toxicity early warning device, this invention provides a deep learning-based wastewater toxicity early warning and control method, which includes a model training phase and an online application phase.
[0054] The model training phase includes the following steps: Step S1: Start the microbial reaction module, continuously input the wastewater to be tested into the reactor through the influent pump, and maintain the dissolved oxygen in the reactor within the set range (e.g., 2.0-4.0 mg / L) through the aeration pump, so that the activated sludge microorganisms are in a stable mixed state.
[0055] Step S2: The online dissolved oxygen probe collects the dissolved oxygen concentration of the mixture in the reactor in real time. Based on the change in dissolved oxygen concentration, the monitoring module calculates the specific oxygen consumption rate (SOUR) in real time and stores the collected raw dissolved oxygen data and SOUR time series data in the data storage and management module.
[0056] Step S3: The device uses a preset primary warning threshold based on SOUR time-series data ( Determine if an alarm has been triggered: like If so, return to step S1 and continue monitoring; like This will trigger the following three parallel operations simultaneously: (1) Event Log: The data storage and management module records the time and initial SOUR value of the event exceeding the limit; (2) Sequence extraction: Extract the SOUR time series within a fixed duration T (e.g., 10 seconds) after the occurrence of the exceeding event from the data stream to form a short-term variation sequence. ;in This represents the moment when the standard was exceeded. Represents the sampling interval. Represents the sequence length; (3) Automatic sampling: The PLC control module immediately sends an opening command to the sampling solenoid valve, so that it opens for a preset time, thereby automatically collecting and saving a sample of the original influent impact water at the time of triggering the warning in the sampling bottle.
[0057] Step S4: Perform an offline nitrification rate (AUR) experiment on the shock water sample obtained in Step S3. Compare the measured AUR values with the typical normal AUR range of the wastewater treatment system under stable operating conditions and generate a toxicity label. If the AUR value is significantly lower than the lower limit of the normal range (e.g., below 80% of the normal value), the water sample is determined to be "toxic," and it corresponds to the short-term variation sequence of the SOUR. Assign toxicity labels Conversely, if it does not, it is judged as "non-toxic" and assigned a toxicity label. .
[0058] Step S5: Collect labeled data generated during the wastewater treatment process and standardize it. Then, divide the standardized data into training set and validation set. Short-term variation sequence of SOUR during wastewater treatment and toxicity label As a sample pair This constitutes the original dataset; All short-term variation sequences of SOUR in the training set are standardized to eliminate dimensions and accelerate model convergence. Then, the standardized sequences from the training set are reused. and The short-term variation sequences of SOUR in the validation set are standardized in exactly the same way as those in the training set. This ensures that the data distribution in the validation set is consistent with that in the training set, avoids data leakage, and ensures that the validation results accurately reflect the model's generalization ability. The standardization expression is:
[0059] in, and , respectively, are the mean and standard deviation of all SOUR short-term variation sequences in the training set.
[0060] Step S6: Construct an Attention-LSTM deep learning model, and input the SOUR and short-term change sequence (normalized in Step S5) into the model. Extract temporal features through multi-layer LSTM units, assign weights to features at different time steps through the attention layer, and finally output the final wastewater toxicity probability value through a fully connected layer and a sigmoid function. , representing the probability of the toxic shock corresponding to the sequence predicted by the model; The structure of the Attention-LSTM deep learning model is as follows: Figure 3 As shown, it includes an input layer, an LSTM layer, an attention layer, and a fully connected output layer; The input layer is used to receive the standardized short-term variation sequence of SOUR. ; LSTM layers are used to capture the long-term time dependence of short-term SOUR sequences. The formula for calculating the time step t for a single LSTM cell is as follows: Input Gate:
[0061] Forgotten Gate:
[0062] Output gate:
[0063] Candidate memory cells:
[0064] Renew memory cells:
[0065] Output hidden state:
[0066] in, For the sigmoid function, It is the hyperbolic tangent function. This represents element-wise multiplication. Representative input The weight matrix to the input gate, The input represents the current time step, i.e., the feature vector of the SOUR short-term change sequence at time t. Represents the previous hidden state The weight matrix to the input gate, This represents the output hidden state of the previous time step, representing the short-term memory of the LSTM at time t-1, which is passed to the current step to provide historical information. The bias term representing the input gate. Representative input The weight matrix to the forget gate, Represents the previous hidden state The weight matrix to the forget gate, The bias term representing the forgetting gate. Representative input The weight matrix to the output gate, Represents the previous hidden state The weight matrix to the output gate, The bias term representing the output gate. Representative input The weight matrix of candidate memory cells, Represents the previous hidden state The weight matrix of candidate memory cells, Bias terms representing candidate memory cells; The attention layer is used to access the hidden states of the LSTM across all time steps. Assign attention weights This allows the model to focus on key changes in the sequence; among which, attention weights The expression is:
[0067]
[0068]
[0069] in, This is a trainable background vector. The trainable parameters representing the attention layer, Representing the hidden state at time step t of the LSTM, it represents the short-term memory characteristics of the SOUR sequence at that time and serves as the "evaluation object" of the attention layer. The trainable parameters of the attention layer represent the bias term for feature transformation, and the adjustment term represents the training parameters of the attention layer. The activation threshold Representative vector The transpose of , i.e., the column vector corresponding to the t-th time step. The transposed row vector Representative vector The transpose of , i.e., the column vector corresponding to the j-th time step. The transposed row vector Represents the weighted context vector; The fully connected output layer is used to weight the context vector. Input to the fully connected layer, through Linear transformation and After bias adjustment and normalization using the Sigmoid function, the final prediction of toxicity probability is obtained. The calculation formula is as follows:
[0070] Using the standardized training set from step S5 as input, and the corresponding toxicity labels... To supervise the signal, binary cross-entropy is used as the loss function L for model training, where the expression for the loss function L is:
[0071] Where N represents the total number of samples in the training set, that is, the total number of “labeled SOUR sequence samples” used in this model training; An adaptive moment estimation (Adam) optimizer algorithm is employed to iteratively update model parameters through backpropagation to minimize the loss function. During training, a validation set is used to monitor model performance and prevent overfitting.
[0072] Step S7: Establish a SOUR-AUR toxicity relationship model to achieve online assessment of wastewater toxicity; Extract all toxicity tags as toxic from the data storage and management module. Sample data; Using the initial SOUR value when these samples trigger the alert as the independent variable x, and its corresponding toxicity level y, the toxicity level formula is as follows:
[0073] A nonlinear regression method (least squares fitting of an exponential function) was used to fit the data to establish a quantitative relationship model between the SOUR value and the degree of toxicity inhibition y:
[0074] in, The proportional coefficient representing the exponential term primarily affects the magnitude of change in the degree of toxicity inhibition, y. The decay coefficient representing the exponential term controls the rate at which SOUR affects the degree of toxicity inhibition, y. Represents a constant term; This leads to the SOUR-AUR toxicity relationship model for online assessment of wastewater toxicity.
[0075] The online application phase of the model includes the following steps: Step 1: Model Deployment and Real-time Monitoring; The trained SOUR-AUR toxicity relationship model is deployed in the deep learning early warning module, and the device enters a fully automatic online monitoring and early warning mode to monitor SOUR in real time. When the SOUR exceeds the limit, the sequence is extracted and automatically sampled (for possible subsequent model iteration training).
[0076] Step 2: Intelligent early warning and toxicity identification; When the SOUR value exceeds the warning threshold and the short-term change sequence of SOUR is extracted. Then, immediately perform the same standardized process as during the training phase; The standardized SOUR short-term variation series Input the deployed deep learning model for forward inference; like If the deep learning warning module determines that the impact is "confirmed toxicity" and generates a high-level warning signal; like If the event is not detected, the deep learning early warning module will determine it as "normal fluctuation or unconfirmed shock", only record the event, and not trigger advanced alarms.
[0077] Step 3: Toxicity assessment and prediction; When the determination in step 2 is "confirmed toxicity impact", the toxicity assessment module is activated. This module reads the initial SOUR value that triggered this warning and substitutes it into the SOUR-AUR toxicity relationship model established in step S7. It then calculates and outputs a predicted wastewater toxicity level y in real time, thereby quantifying the potential impact of the current influent toxicity on the biological treatment system.
[0078] Step 4: Implement hierarchical control; The PLC control module receives warning signals from the deep learning early warning module and predicted wastewater toxicity values from the toxicity assessment module; based on the preset graded control strategy, it recommends that operators perform corresponding operations: A. Mandatory Item: Trigger advanced alarm devices such as sound and light to notify operations personnel.
[0079] B. Conditional Execution Item: Process intervention based on predicted toxicity level y: Toxicity level y < 30% (mild): It is recommended that operators monitor the changes in ammonia nitrogen concentration in the latter part of the aerobic tank of the biological treatment system. 0%≤Toxicity level y<60% (Moderate): It is recommended that operators reduce the influent volume to reduce the load of toxic influent; at the same time, aeration can be increased and external reflux can be improved to enhance the shock resistance of the biological treatment system. Toxicity level y≥60% (severe): It is recommended that operators implement emergency plans, such as stopping water intake, switching the water intake to the accident water tank, and activating the emergency dosing system; After completing the control action, the system automatically returns to the real-time monitoring status, forming a closed loop of "monitoring-analysis-decision-control".
[0080] Some steps in the embodiments of the present invention can be implemented using software, and the corresponding software program can be stored in a readable storage medium, such as an optical disc or a hard disk.
[0081] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A control method for a wastewater toxicity early warning device based on deep learning, characterized in that, The control method includes a model training phase and an online application phase; The model training phase includes constructing an Attention-LSTM deep learning model, predicting wastewater toxicity based on the short-term change sequence of SOUR during wastewater treatment, and establishing a SOUR-AUR toxicity relationship model to quantify wastewater toxicity. The online application phase includes performing corresponding operations based on the output of the model training phase.
2. The control method according to claim 1, characterized in that, The model training phase includes: Step S1: Obtain the change sequence after SOUR exceeds the standard during the sewage treatment process, and label and standardize it to construct the original dataset and divide it into training set and validation set; Step S2: Construct an Attention-LSTM deep learning model and input the standardized SOUR short-term change sequence from step S1 into the Attention-LSTM deep learning model to train the model; Step S3: Establish a SOUR-AUR toxicity relationship model to enable online assessment of wastewater toxicity.
3. The control method according to claim 2, characterized in that, The SOUR change sequence collected in step S1 is The criteria for determining whether the standard is exceeded are: ,in, This represents the moment when the standard was exceeded. Represents the sampling interval. Represents the sequence length; After the standard is exceeded, the wastewater toxicity early warning device automatically collects and saves a copy of the original influent impact water sample at the time the early warning was triggered. The labeling in step S1 refers to conducting a nitrification rate experiment on the obtained shock water sample, comparing the measured AUR value with the range of AUR values under normal operating conditions of the wastewater toxicity early warning device, and generating a toxicity label based on the comparison results. When the AUR value is below 80% of the normal value, it is judged as toxic and a toxicity label is assigned to the corresponding SOUR variation sequence. Conversely, if it does not, it is determined to be non-toxic and assigned a toxicity label. ; The standardized expression in step S1 is: in, and These are the mean and standard deviation of all SOUR variation sequences in the training set, respectively.
4. The control method according to claim 3, characterized in that, The Attention-LSTM deep learning model in step S2 includes an input layer, an LSTM layer, an attention layer, and a fully connected output layer. The Attention-LSTM deep learning model extracts temporal features through several LSTM layers. The attention layer assigns weights to features at different time steps. Finally, the model outputs the final wastewater toxicity probability value through a fully connected layer and a sigmoid function. .
5. The control method according to claim 4, characterized in that, The input layer is used to receive the standardized SOUR short-term variation sequence. ; The LSTM layer is used to capture the long-term time dependence of short-term SOUR sequences. The formula for calculating the time step t for a single LSTM cell is as follows: Input Gate: Forgotten Gate: Output gate: Candidate memory cells: Renew memory cells: Output hidden state: in, For the sigmoid function, It is the hyperbolic tangent function. This represents element-wise multiplication. Representative input The weight matrix to the input gate, The input represents the current time step. Represents the previous hidden state The weight matrix to the input gate, This represents the hidden output state of the previous time step. The bias term representing the input gate. Representative input The weight matrix to the forget gate, Represents the previous hidden state The weight matrix to the forget gate, The bias term representing the forgetting gate. Representative input The weight matrix to the output gate, Represents the previous hidden state The weight matrix to the output gate, The bias term representing the output gate. Representative input The weight matrix of candidate memory cells, Represents the previous hidden state The weight matrix of candidate memory cells, Bias terms representing candidate memory cells; The attention layer is used to manage the hidden states of the LSTM at all time steps. Assign attention weights This allows the model to focus on key changes in the sequence; among which, attention weights The expression is: in, This is a trainable background vector. The trainable parameters representing the attention layer, This represents the hidden state of the LSTM at time step t. The trainable parameters representing the attention layer, The column vector representing the t-th time step The transposed row vector The column vector representing the j-th time step The transposed row vector Represents the weighted context vector; The fully connected output layer is used to process the weighted context vector. Input a fully connected layer, output the final predicted toxicity probability The calculation formula is as follows: in, Represents a linear transformation. This represents bias adjustment.
6. The control method according to claim 5, characterized in that, In step S2, a loss function L is used to constrain the training process. The expression of the loss function is: Where N represents the total number of samples in the training set; An adaptive estimation optimizer algorithm is used to iteratively update model parameters through backpropagation in order to minimize the loss function. During training, a validation set is used to monitor model performance.
7. The control method according to claim 6, characterized in that, In step S3, the initial SOUR value at the time of triggering the warning is used as the independent variable, and the corresponding toxicity level is used as the dependent variable to construct the following relationship: A nonlinear regression method was used to fit the data and establish a quantitative relationship model between the SOUR value and the degree of toxicity inhibition y: in, The proportional coefficient representing the exponential term primarily affects the magnitude of change in the degree of toxicity inhibition, y. The decay coefficient representing the exponential term controls the rate at which SOUR affects the degree of toxicity inhibition, y. Represents a constant term.
8. The control method according to claim 7, characterized in that, The online application phase includes: Step 1: Model Deployment and Real-time Monitoring; The trained SOUR-AUR toxicity relationship model is deployed in the wastewater toxicity early warning device, which enters a fully automatic online monitoring and early warning mode to monitor SOUR in real time and extract sequences and automatically retain samples when the SOUR exceeds the standard. Step 2: Intelligent early warning and toxicity identification; When the SOUR value exceeds the warning threshold, the SOUR change sequence is extracted and standardized. The standardized SOUR change sequence is then input into the deployed Attention-LSTM deep learning model for forward inference. like If the deep learning warning module determines that the toxicity impact is confirmed, it will generate a warning signal. like If the deep learning early warning module determines that the event is a normal fluctuation or an unconfirmed shock, it will only record the event and not trigger an alarm. Step 3: Toxicity assessment and prediction; Once the determination in step 2 is confirmed as a toxic shock, the quantified toxicity level of the wastewater is output through the SOUR-AUR toxicity level relationship model. Step 4: Implement hierarchical control; Based on the preset hierarchical control strategy, it is recommended that operations personnel perform the following actions: Operation 1: Mandatory, triggers the audible and visual alarm devices to notify operations personnel; Operation 2: Conditional execution item, process intervention based on predicted toxicity level: When the toxicity level y < 30%, it is recommended that operators monitor the changes in ammonia nitrogen concentration in the latter part of the aerobic tank of the biological treatment system. When 0% ≤ toxicity level y < 60%: it is recommended that operators perform the corresponding preset operations; When the toxicity level y ≥ 60%, it is recommended that operators implement emergency plans, such as stopping water intake, switching the water intake to the accident water tank, and activating the emergency dosing system.
9. The control method according to claim 8, characterized in that, The control method is based on a wastewater toxicity early warning device, which includes a microbial reaction module, a monitoring module, a data storage and management module, a deep learning early warning module, a toxicity assessment module, and a PLC control module. The monitoring module is used to monitor the dissolved oxygen concentration of the mixture in the microbial reaction module in real time and calculate the real-time specific oxygen consumption rate (SOUR) value. The data storage and management module is used to store time-series data to build a database. The data storage includes the original DO and SOUR time-series data and the offline nitrification rate experimental verification results corresponding to the short-term change sequence of SOUR after the warning is triggered. The deep learning early warning module is used to provide the operating environment for deep learning models, and to implement modeling, data preprocessing, model training, verification and wastewater toxicity early warning. The toxicity assessment module is used to calculate the toxicity of wastewater based on the SOUR-AUR toxicity relationship model after online identification of toxic shock. The PLC control module is interconnected with the microbial reaction module, monitoring module, deep learning early warning module, and toxicity assessment module, respectively, and is used to perform graded alarms and process control based on monitoring signals, intelligent diagnostic results, and toxicity assessment.
10. The control method according to claim 9, characterized in that, The microbial reaction module is used to provide mixing and reaction of sewage and activated sludge microorganisms, including a reactor, influent pump, aeration pump, aeration disc, flat plate membrane, effluent pump, overflow port and sample retention solenoid valve; The reactor contains activated sludge microorganisms. The influent pump, sample retention solenoid valve, aeration pump, and effluent pump are located outside the reactor. The influent pump is connected to the reactor via an influent pipe, and the sample retention solenoid valve is connected to the influent pipe between the influent pump and the reactor via a sample retention pipe, used to automatically collect raw influent water samples under specific instructions. The aeration pump is connected to the reactor via an aeration pipe, which extends into the reactor and is connected to an aeration disc. One end of the flat sheet membrane extends vertically into the reactor, and the other end is connected to the effluent pump outside the reactor. The flat sheet membrane is used to achieve solid-liquid separation and retain activated sludge microorganisms inside the reactor. The overflow port is located on the top side of the reactor.