Sewage discharge anomaly detection method based on multi-modal fusion and deep reinforcement learning
Through the method based on multimodal fusion and deep reinforcement learning, the problems of low accuracy and low intelligence in sewage discharge abnormality detection are solved, and high accuracy and high intelligence abnormality detection are achieved.
Patent Information
- Application Number
- CN202510381255.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-06-27
AI Technical Summary
The prior art has problems such as low accuracy, poor adaptability, insufficient real-time and low intelligence in the detection of sewage discharge abnormalities.
The sewage discharge anomaly detection method based on multimodal fusion and deep reinforcement learning is adopted to make abnormal judgments by collecting sewage discharge data in real time, constructing multimodal feature vectors, extracting time series features, and constructing a deep reinforcement learning model.
It improves the accuracy and intelligence of sewage discharge abnormality detection, enhances the real-time and adaptability of detection, and can accurately detect abnormal pollutant concentrations in sewage discharge.
Smart Images

Figure CN120217256A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of environmental monitoring and intelligent data processing, and particularly to a method for detecting abnormal sewage discharge based on multi-modal fusion and deep reinforcement learning. Background Art
[0002] In the field of sewage discharge monitoring, traditional technical means usually deploy various sensors at the sewage outlets of enterprises, such as ammonia nitrogen sensors based on electrochemical principles, flow sensors using ultrasonic Doppler principles, etc., to collect sewage discharge data including ammonia nitrogen (measured concentration and discharge volume), total phosphorus, chemical oxygen demand, total nitrogen, pH value, hourly flow, wastewater discharge volume, and minute flow. The data is first transmitted to the local data acquisition terminal, and then stored locally in Excel format or uploaded to the data server at regular time intervals. Then, the data stored in the Excel spreadsheet file is used to determine whether there is an abnormality in the sewage discharge of the enterprise.
[0003] Currently, there are mainly three categories of methods for judging abnormalities using Excel data:
[0004] ① Single-index threshold judgment: Different standards are formulated for enterprises in different industries, and fixed parameter abnormality judgment thresholds are set according to the corresponding standards. For example, if the measured concentration of ammonia nitrogen emissions in the chemical industry exceeds 50 mg / l, it is determined to be over-standard.
[0005] This method ignores the correlation and dynamic changes of multi-modal data. Enterprises can use means such as diluting sewage to avoid detection. Moreover, the flow threshold judgment cannot distinguish normal fluctuations from abnormal discharges, and false alarms and missed detections are likely to occur;
[0006] ② Simple statistical analysis: In the detection of hidden pipe phenomena, the average overall discharge volume of the enterprise is statistically calculated monthly, and then this average is compared with the same period in history. If the reduction exceeds the preset ratio, it is determined to be abnormal.
[0007] When judging data similarity abnormalities, this method only calculates the simple ratio or slope of adjacent data points, without excluding the influence of normal periodic changes and data noise, resulting in low accuracy. Moreover, this method does not deeply analyze the characteristics of the flow time series and its correlation with other indicators, and is easily misjudged due to interference such as seasonal fluctuations in enterprise production;
[0008] ③ Rule-based equipment abnormality judgment: Judgments are made based on the data output by the sewage detection equipment installed at the sewage outlets of enterprises. However, relying entirely on the sewage detection equipment to judge whether the sewage discharge of enterprises meets the standards has great uncertainty. Because monitoring staff cannot accurately distinguish whether the equipment has failed at the monitoring center far from the sewage outlet. Once the equipment fails, it is difficult for monitoring staff to obtain correct detection results and it is simply impossible to accurately judge the sewage discharge of enterprises.
[0009] In summary, in the prior art, there are problems such as low accuracy, poor adaptability, insufficient real-time performance, and low degree of intelligence in the detection of abnormal sewage discharge from enterprises. Summary of the Invention
[0010] The purpose of the present invention is to address the corresponding deficiencies in the prior art by providing a method for detecting abnormal sewage discharge based on multi-modal fusion and deep reinforcement learning. Focusing on solving the key problems of low detection accuracy and low degree of intelligence, the method deeply explores the internal relationships of sewage discharge data with the help of multi-modal fusion technology, and combines deep reinforcement learning algorithms to automatically learn abnormal detection strategies, achieving accurate and intelligent detection of abnormal sewage discharge. At the same time, it enhances the real-time performance and adaptability of the detection. The aim is to accurately detect abnormal pollutant concentrations in sewage discharge through innovative algorithms and technical means, thereby determining whether enterprises comply with regulations for sewage discharge, and conducting effective environmental protection and supervision, so as to ensure the implementation of environmental supervision requirements and ecological environment safety.
[0011] The purpose of the present invention is achieved by the following solutions:
[0012] A method for detecting abnormal sewage discharge based on multi-modal fusion and deep reinforcement learning includes the following steps:
[0013] 1) Use various sensors to collect sewage discharge data in real time, and perform data cleaning and normalization on the sewage discharge data;
[0014] 2) Construct the characteristics of pollutant emissions per unit flow, establish a linear regression model between the pH value and the pollutant concentration, extract the regression coefficient as the interaction feature between the pH value and the pollutant concentration, and construct a multi-modal feature vector;
[0015] 3) Extract the time series characteristics from the flow data and the pollutant concentration data;
[0016] 4) Use the time series characteristics in the flow data and the pollutant concentration data, as well as the multi-modal feature vector, to construct a fusion feature vector;
[0017] 5) Construct a deep reinforcement learning model as a sewage anomaly judgment model, and the state space of this sewage anomaly judgment model includes enterprise production status information, the current fusion feature vector, and the historical trend of the fusion feature vector;
[0018] 6) Construct multivariate rules for sewage anomaly judgment, and combine the output results of the sewage anomaly judgment model to detect and judge the sewage discharge situation of enterprises.
[0019] Preferably, in step 1), the specific process of using various sensors to collect sewage discharge data in real time and performing data cleaning and normalization on the sewage discharge data is as follows:
[0020] 1-1) Obtain enterprise sewage discharge data in real time through several different types of sensors;
[0021] 1-2) Calculate the moving average value and standard deviation of sewage discharge data within the past 24 hours by the moving average method, identify suspected outliers in combination with the 3σ criterion, and correct the outliers by the quadratic polynomial interpolation method;
[0022] 1-3) Normalize the sewage discharge data.
[0023] Preferably, in step 2), the multi-modal feature vector is constructed as follows:
[0024] 2-1) Construct the pollutant emission characteristics under unit flow by the weighted average method;
[0025] 2-2) Use the multiple regression analysis method to establish a linear regression model between the pH value and the pollutant concentration, explore the interaction characteristics between pH and the pollutant concentration, and extract the regression coefficients as the interaction characteristics between the pH value and the pollutant concentration;
[0026] 2-3) Combine the interaction characteristics between the pH value and the pollutant concentration, and the pollutant emission characteristics under unit flow to form a multi-modal feature vector.
[0027] Preferably, in step 3), extract the time series characteristics in the flow data and the pollutant concentration data, specifically including:
[0028] 3-1) Dynamically adjust the window size according to the flow variance to extract the time series characteristics in the flow data;
[0029] 3-2) Perform wavelet transform on the pollutant concentration data, decompose the low-frequency and high-frequency coefficients, and use the calculated high-frequency energy and low-frequency periodic characteristics as the time series characteristics in the pollutant concentration data.
[0030] Preferably, in step 4), the construction of the fusion feature vector specifically includes:
[0031] 4-1) Use the time series characteristics in the flow data and the pollutant concentration data, and the multi-modal feature vector to form a fusion data matrix;
[0032] 4-2) Use the principal component analysis (PCA) to reduce the dimension of the fusion data matrix;
[0033] 4-3) Use the linear discriminant analysis (LDA) to further extract the discriminant features in the fusion data matrix to form a fusion feature vector.
[0034] Preferably, in step 5), the construction of the sewage anomaly judgment model includes:
[0035] 5-1) Construct the state space of a deep reinforcement learning model by using enterprise production status information (such as current intensity, temperature), the current fusion feature vector, and the historical trend of the fusion feature vector (for example, exponential weighted moving average calculation).
[0036] 5-2) Design a DQN agent with residual connections as the agent of the deep reinforcement learning model, calculate the Q value using an adaptive ELU activation function, and combine a differential reward function.
[0037] 5-3) Optimize the deep reinforcement learning model using a prioritized experience replay mechanism and a distributed training strategy, and update the parameters of the deep reinforcement learning model using the Adam algorithm until the deep reinforcement learning model meets the usage requirements.
[0038] 5-4) Use the deep reinforcement learning model that meets the usage requirements as the sewage anomaly judgment model.
[0039] Preferably, in step 6), the multi - rule for sewage anomaly judgment detects and determines the enterprise's sewage discharge situation by combining the output result of the sewage anomaly judgment model, specifically including:
[0040] 6-1) Dynamically set the pollutant concentration threshold range according to historical data and process change factor (γ), and judge whether the enterprise has the situation of "abnormal sewage discharge" by combining the size relationship between the pollutant concentration and the pollutant concentration threshold and the output result of the sewage anomaly judgment model.
[0041] 6-2) Calculate the proportion of low - frequency energy of the flow data through FFT, and judge whether the enterprise has the situation of "hidden pipe discharge" by combining the flow reduction ratio and the output result of the sewage anomaly judgment model.
[0042] 6-3) Fit the pollutant concentration curve before and after exceeding the standard, calculate the curvature change rate, and judge whether the enterprise has the situation of "abnormal data steep drop" by combining the output result of the sewage anomaly judgment model.
[0043] 6-4) Calculate the time - series similarity distance using the DTW algorithm, and judge whether the enterprise has the situation of "abnormal data similarity" by combining the output result of the sewage anomaly judgment model.
[0044] 6-5) Calculate the equipment data stability index based on Allan variance, and judge whether the enterprise has the situation of "equipment failure" by combining the output result of the sewage anomaly judgment model.
[0045] The beneficial effects of the present invention are as follows:
[0046] I. The overall architecture combining multi - modal data fusion and deep reinforcement learning
[0047] The present invention constructs a sewage discharge anomaly detection system architecture that tightly integrates multi-modal data fusion technology with deep reinforcement learning algorithms. The fusion covers the construction of features of multi-source data such as pollutant concentrations (ammonia nitrogen, total phosphorus, chemical oxygen demand, total nitrogen), pH value, flow rate (hourly flow rate, minute flow rate), the extraction of time series features, and the fusion processing combining PCA and LDA. And a brand-new deep reinforcement learning environment (integrated feature vectors, change trends, enterprise production status), an agent with residual connections and adaptive activation functions, a differential reward function, and a training mechanism based on prioritized experience replay and distributed training are carefully designed.
[0048] Since the present invention integrates multi-source data, comprehensively mines information related to enterprise sewage discharge, and uses a deep reinforcement learning model to automatically learn complex anomaly patterns, it overcomes the limitations of traditional methods that are difficult to handle complex anomalies such as data tampering, hidden pipe discharge, and concealed equipment failures, greatly improves the detection accuracy and intelligence level, and can adapt to the changes of different industries and enterprises. For example, for different discharge characteristics and process adjustments in the chemical and textile industries, the model can adaptively learn and optimize the detection strategy.
[0049] II. Fine Design of the Deep Reinforcement Learning Model
[0050] 2.1 Environment construction: Quantify and normalize enterprise production process parameters (such as electroplating bath current intensity, temperature, etc.) and incorporate them into the state space. At the same time, use EWMA to calculate the change trend of the integrated feature vector to make the decision-making information of the agent more comprehensive;
[0051] 2.2 Agent design: Adopt an improved architecture of DQN with a residual connection structure (a specific multi-layer fully connected neural network structure and an adaptive ELU activation function) to enhance the network's learning and expression capabilities;
[0052] 2.3 Reward function design: Set differential reward values for different anomaly determination types. For example, the correct determination of hidden pipe discharge anomaly rewards +20, and the wrong determination rewards -10, etc., so as to guide the model to focus on key anomalies;
[0053] 2.4 Training mechanism: The prioritized experience replay mechanism based on priorities (determine the sample priorities according to rewards, novelty, etc.) and the distributed training technology (parallel training on multiple GPU servers and regularly synchronizing parameters), combined with the Adam optimization algorithm and the learning rate decay strategy, can accelerate the model convergence, improve the training efficiency, and enable the model to quickly and accurately learn the anomaly detection strategy. For example, when facing the discharge characteristics or process changes of new enterprises, it can quickly adjust the detection strategy to reduce false positives and false negatives.
[0054] III. Feature Construction and Fusion Strategy in Multi-modal Data Fusion
[0055] 3.1 Feature construction: The weighted average method (determining weights based on flow stability) is used to calculate the pollutant emission characteristics per unit flow, and multiple regression analysis is applied to construct the interaction characteristics between pH and pollutant concentration, enabling the constructed features to more accurately reflect the internal relationships in the data;
[0056] 3.2 Time series feature extraction: For minute flow and hour flow, variable window sliding window technology (determining the window size according to flow fluctuations) is used to calculate features such as the mean value, and wavelet transform is applied to the pollutant concentration data to extract features, effectively capturing the dynamic changes in the data;
[0057] 3.3 Data fusion: First, PCA is used for dimensionality reduction (calculating the covariance matrix, solving eigenvalues and eigenvectors, and selecting eigenvectors for projection), and then LDA analysis is performed. In this way, by combining PCA and LDA, the discriminative power of the features is enhanced, enabling the fused feature vectors to better distinguish normal and abnormal emissions. For example, it is more sensitive and accurate in detecting abnormal changes in flow or concentration mutations, reducing the false alarm rate.
[0058] IV. Multivariate rule system for anomaly detection and determination
[0059] This multivariate rule system analyzes anomalies from multiple dimensions. Methods such as dynamic thresholds are more in line with the actual situation of enterprises. Each determination method complements and verifies each other, improving the detection accuracy and reliability. For example, when judging concealed pipe emissions or equipment failures, by integrating the results of multiple methods, misjudgments can be effectively avoided, and abnormal emission sources and types can be accurately identified. Specifically, it includes:
[0060] 4.1 Unfair means for enterprises to deceive the regulatory authorities regarding data usually include fabricating sensor data or adding a large amount of compliant tap water to the sewage to achieve the purpose of forging sewage data. Ultimately, it is all about increasing the sewage discharge volume while keeping the monitored component content unchanged, so that the overall sewage data detected by the sewage discharge anomaly detection equipment meets the requirements of the regulatory authorities.
[0061] This invention additionally sets up a data anomaly judgment unit for judging sewage data. In this way, the dynamic threshold setting method can be adopted. In the data anomaly judgment unit, a dynamic threshold is set according to the enterprise's past data and process changes, used to compare the current sewage data with the standard value, thereby determining whether the enterprise fabricates sewage data, effectively preventing the enterprise from maliciously creating "perfect" data and ensuring that sewage data anomalies can be quickly and accurately identified.
[0062] 4.2 Enterprises, in order to evade supervision, privately lay concealed pipes for discharging sewage (the phenomenon of concealed pipes). The sewage flow discharged from these concealed pipes will not be included in the data for the regulatory authorities' detection of sewage discharge anomalies, greatly affecting the accuracy of the regulatory authorities' detection of enterprises' sewage discharge anomalies.
[0063] In addition to calculating the average of the overall emissions on a monthly basis, the present invention also uses the Fast Fourier Transform (FFT) to transform the flow data into the frequency domain and analyze the spectral characteristics of the flow data, so as to accurately determine whether there is a hidden pipeline phenomenon in the enterprise, thereby further ensuring the accuracy of the detection of abnormal sewage emissions.
[0064] 4.3 When many enterprises build sewage drainage channels, they will privately install sewage detection devices. When it is found that the sewage emissions do not meet the emission requirements of the regulatory authorities, many improper technical means will be adopted to forcibly reduce the content of substances that do not meet the requirements in the sewage before the regulatory authorities issue rectification opinions, so as to avoid being ordered to rectify by the regulatory authorities. For example, chemical agents are directly added to the sewage to neutralize the components that do not meet the requirements in the sewage, so as to reduce the content of these excessive components in the sewage. However, this method of directly dumping chemical agents will cause greater damage to the environment and is an act strictly prohibited by the regulatory authorities.
[0065] However, when the privately installed sewage detection device of the enterprise detects that the sewage emissions do not meet the requirements, the sewage emission abnormal detection equipment installed by the regulatory authorities usually has been able to obtain the excessive emission data of the enterprise's sewage. The present invention judges whether the enterprise has these illegal behaviors by using the non-linear regression analysis method to obtain the pollutant concentration curve before and after the excessive emission data, and further determines whether the enterprise's sewage emissions comply with the regulations.
[0066] 4.4 Through the detection of abnormal sewage emissions, the regulatory authorities learn that some enterprises do not meet the sewage emission requirements and will issue an order for limited-time rectification to these enterprises. However, many enterprises usually adopt improper technical means for rectification. For example, chemical agents are directly added to the sewage to neutralize the components that do not meet the requirements in the sewage, so as to reduce the content of these excessive components in the sewage and make the sewage emissions meet the rectification requirements. However, this method of directly dumping chemical agents will cause greater damage to the environment and is an act strictly prohibited by the regulatory authorities.
[0067] The present invention adopts a method combining relative change amount and absolute change amount, and judges whether the enterprise has adopted non-standard rectification means by detecting the concentration change before and after rectification.
[0068] In order to prevent enterprises from tampering with sensor data, resulting in the regulatory authorities being unable to accurately judge whether the enterprise's sewage emissions meet the requirements through sewage data and the artificial intelligence model, in addition to calculating the similarity between the fusion feature vectors of data in different time periods, the present invention also introduces time series similarity analysis, and uses the Dynamic Time Warping (DTW) algorithm to calculate the similarity distance between two time series data for the determination of data similarity anomalies.
[0069] 4.6 Adopt Allan variance analysis to analyze the stability index of the sewage anomaly detection equipment, so as to facilitate the monitoring personnel to promptly eliminate equipment failures and ensure accurate judgment of sewage anomalies.
[0070] Explanation of terms:
[0071] PCA (Principal Component Analysis): It is a statistical method for data dimensionality reduction and feature extraction. By means of linear transformation, the coordinate axis (principal component) in the direction of the largest data variance is found to project the data, reducing the dimension and retaining information for operations such as analysis.
[0072] LDA (Linear Discriminant Analysis): A supervised linear classification and dimensionality reduction technique. It searches for the projection direction to separate different category data as much as possible in the projected space and cluster the same category data, which is used for preprocessing of classification tasks.
[0073] ELU (Exponential Linear Unit): An activation function of neural networks. When the input is less than 0, it outputs an exponentially decaying negative number, and when it is greater than or equal to 0, it outputs linearly. The parameters can be adaptively adjusted during training to alleviate the problem of neuron "death".
[0074] EWMA (Exponentially Weighted Moving Average): A method for processing time series data. It performs weighted average on historical data, and the weights decay exponentially with the distance from the current moment in time, which is used for trend prediction, etc.
[0075] DQN (Deep Q-Network): An algorithm that combines deep learning and reinforcement learning. It uses a deep neural network to approximately estimate the Q-value function, which is used to solve reinforcement learning decision-making problems, such as enabling an agent to learn game strategies.
[0076] FFT (Fast Fourier Transform): An algorithm for efficiently calculating the discrete Fourier transform. It transforms a signal from the time domain to the frequency domain to analyze the frequency components, which is used in various fields such as audio and image processing.
[0077] DTW (Dynamic Time Warping): An algorithm for comparing the similarity of two time series. It solves the problem of time series deformation on the time axis and finds the optimal matching path, which is used in fields such as speech recognition.
[0078] Hidden Pipe Phenomenon: Hidden pipes in sewage discharge refer to the concealed pipes privately laid by enterprises or individuals to evade supervision for discharging sewage. These pipes are usually not easily discovered by environmental protection departments and the public. They may be hidden underground, inside buildings, or covered by other objects. For example, some factories lay hidden pipes underground in the factory area and then lead them to nearby rivers or sewers to directly discharge untreated or substandard sewage. It is particularly noteworthy that the sewage flow discharged from these hidden pipes cannot be known to the regulatory authorities. Description of the Drawings
[0079] Figure 1 is the flowchart of the present invention;
[0080] Figure 2 is the process schematic diagram of the embodiment of the present invention;
[0081] Figure 3 is the algorithm anomaly recognition process of the time series data in the embodiment of the present invention. Detailed Embodiment
[0082] As Figure 1 shown, a sewage discharge anomaly detection method based on multi-modal fusion and deep reinforcement learning includes the following steps:
[0083] 1) Use various sensors to collect sewage discharge data in real time, and perform data cleaning and normalization processing on the sewage discharge data. The specific process is as follows:
[0084] 1-1) Obtain enterprise sewage discharge data in real time through several different types of sensors;
[0085] 1-2) Calculate the moving average value and standard deviation of the sewage discharge data in the past 24 hours through the moving average method, identify suspected outliers in combination with the 3σ criterion, and use the quadratic polynomial interpolation method to correct the outliers;
[0086] 1-3) Perform normalization processing on the sewage discharge data.
[0087] 2) Construct the pollutant emission characteristics under the unit flow rate, establish a linear regression model between the pH value and the pollutant concentration, extract the regression coefficient as the interaction characteristic between the pH value and the pollutant concentration, and construct a multi-modal feature vector. The construction method of the multi-modal feature vector is as follows:
[0088] 2-1) Use the weighted average method to construct the pollutant emission characteristics under the unit flow rate;
[0089] 2-2) Use the multiple regression analysis method to establish a linear regression model between the pH value and the pollutant concentration, explore the interaction characteristics between pH and the pollutant concentration, and extract the regression coefficient as the interaction characteristic between the pH value and the pollutant concentration;
[0090] 2 - 3) Combine the interaction characteristics of pH value and pollutant concentration, and the pollutant emission characteristics under unit flow rate to form a multi - modal feature vector.
[0091] 3) Extract the time - series characteristics from the flow rate data and pollutant concentration data, specifically including:
[0092] 3 - 1) Dynamically adjust the window size according to the flow rate variance to extract the time - series characteristics from the flow rate data;
[0093] 3 - 2) Perform wavelet transform on the pollutant concentration data, decompose the low - frequency and high - frequency coefficients, and use the calculated high - frequency energy and low - frequency periodic characteristics as the time - series characteristics of the pollutant concentration data.
[0094] 4) Use the time - series characteristics in the flow rate data and pollutant concentration data, as well as the multi - modal feature vector, to construct a fused feature vector. The construction of the fused feature vector specifically includes:
[0095] 4 - 1) Use the time - series characteristics in the flow rate data and pollutant concentration data, as well as the multi - modal feature vector, to form a fused data matrix;
[0096] 4 - 2) Use principal component analysis (PCA) to reduce the dimension of the fused data matrix;
[0097] 4 - 3) Use linear discriminant analysis (LDA) to further extract the discriminative features in the fused data matrix to form a fused feature vector.
[0098] 5) Construct a deep reinforcement learning model as a sewage anomaly judgment model:
[0099] 5 - 1) Use the enterprise production status information (such as current intensity, temperature), the current fused feature vector, and the historical trend of the fused feature vector (such as exponentially weighted moving average calculation) to construct the state space of a deep reinforcement learning model;
[0100] 5 - 2) Design a DQN agent with residual connections as the agent of the deep reinforcement learning model, calculate the Q - value using an adaptive ELU activation function, and combine a differential reward function;
[0101] 5 - 3) Use a priority experience replay mechanism and a distributed training strategy to optimize the deep reinforcement learning model, and update the parameters of the deep reinforcement learning model using the Adam algorithm until the deep reinforcement learning model meets the usage requirements;
[0102] 5 - 4) Use the deep reinforcement learning model that meets the usage requirements as a sewage anomaly judgment model.
[0103] 6) Construct multivariate rules for sewage anomaly judgment, and detect and determine the sewage discharge situation of enterprises by combining the output results of the sewage anomaly judgment model, specifically including:
[0104] 6-1) Dynamically set the pollutant concentration threshold range according to historical data and process change factors (γ), and judge whether the enterprise has the situation of "abnormal sewage discharge" according to the relationship between the pollutant concentration and the pollutant concentration threshold, combined with the output results of the sewage anomaly judgment model;
[0105] 6-2) Calculate the proportion of low-frequency energy of flow data through FFT, and judge whether the enterprise has the situation of "hidden pipe discharge" by combining the flow reduction ratio and the output results of the sewage anomaly judgment model;
[0106] 6-3) Fit the pollutant concentration curves before and after exceeding the standard, calculate the curvature change rate, and judge whether the enterprise has the situation of "abnormal data steep drop" by combining the output results of the sewage anomaly judgment model;
[0107] 6-4) Use the DTW algorithm to calculate the time series similarity distance, and judge whether the enterprise has the situation of "abnormal data similarity" by combining the output results of the sewage anomaly judgment model;
[0108] 6-5) Calculate the equipment data stability index based on Allan variance, and judge whether the enterprise has the situation of "equipment failure" by combining the output results of the sewage anomaly judgment model.
[0109] According to the above steps, as Figure 2 、 Figure 3 shown, the following are the embodiments:
[0110] S1, Collect sewage data using various sensors, and perform data cleaning and normalization processing on the sewage data, specifically as follows:
[0111] S11, Real-time monitor the sewage data at the sewage discharge outlet of the enterprise through various sensors.
[0112] For example:
[0113] S111, Measure the actual ammonia nitrogen concentration using an ammonia nitrogen sensor;
[0114] S112, Calculate the ammonia nitrogen emission of the enterprise sewage by multiplying the flow sensor and the actual ammonia nitrogen concentration;
[0115] S113, Collect flow data using a flow sensor, which is divided into hourly flow (flow h) and minute flow (flow m);
[0116] S114, Measure the total phosphorus concentration, chemical oxygen demand, and total nitrogen concentration in the sewage using an optical sensor and an electrochemical sensor;
[0117] S115. Obtain the pH value of the sewage in real time using a pH sensor.
[0118] Here, taking the measured ammonia nitrogen concentration as an example, the method of data cleaning and normalization of sewage data will be explained in detail:
[0119] S12. In the data cleaning stage, process the sewage data using the moving average method respectively.
[0120] S121. First, calculate the moving average value and the moving standard deviation
[0121]
[0122] In the formula, represents the measured ammonia nitrogen concentration value collected at time point i, where i ∈ [t - 23, t], covering the ammonia nitrogen concentration data for each hour within the past 24 hours; represents the moving average value; represents the moving standard deviation.
[0123] S122. Based on the moving average value and the moving standard deviation of the measured ammonia nitrogen concentration in the past 24 hours, determine whether the measured ammonia nitrogen concentration in the sewage is abnormal:
[0124] If the measured ammonia nitrogen concentration at a certain moment satisfies then it is determined that the measured ammonia nitrogen concentration at this moment is not a "suspected outlier";
[0125] If the measured ammonia nitrogen concentration at a certain moment satisfies then it is determined that this data point is a "suspected outlier".
[0126] S123. Use the interpolation method based on data trend to correct all suspected outliers. The correction method for each suspected outlier is as follows:
[0127] S1231. Select 5 data points before and after the suspected outlier respectively and obtain the trend equation through quadratic polynomial fitting:
[0128]
[0129] In the formula, It is the measured ammonia nitrogen concentration data after correction. a, b, and c are the coefficients obtained by fitting and are solved by the least squares method.
[0130] S1232, define the moment corresponding to the suspected outlier as t = 0, construct a local data environment with the suspected outlier as the core, and take t = 0 as the time reference. This can clearly present the relative positions of the front and back data points and facilitate the determination of coefficients a, b, and c using the least squares method.
[0131] When the value of a obtained by substituting t = 0 into the equation is the correction result of the outlier after comprehensively considering the local data trend, it can exclude the interference of the suspected outlier, and finally obtain the measured ammonia nitrogen concentration after correction.
[0132] S13, the normalization process of the measured ammonia nitrogen concentration data is as follows:
[0133] S131, first analyze the historical data distribution of the measured ammonia nitrogen concentration data and perform preprocessing according to the historical data distribution:
[0134] S1311, if the measured ammonia nitrogen concentration data is right-skewed, logarithmic transformation is used to perform preprocessing on the measured ammonia nitrogen concentration data.
[0135] S1312, if the measured ammonia nitrogen concentration data is not right-skewed, logarithmic transformation is not used to perform preprocessing on the measured ammonia nitrogen concentration data.
[0136] S132, then, determine the historical minimum value min(N r ) and the historical maximum value max(N r ) of the measured ammonia nitrogen concentration data, and perform normalization according to the following formula:
[0137]
[0138] In the formula, is the measured ammonia nitrogen concentration data after normalization, represents the measured ammonia nitrogen concentration collected at time point t, min(N r ) represents the minimum value in the historical data of the measured ammonia nitrogen concentration, and max(N r ) represents the maximum value in the historical data of the measured ammonia nitrogen concentration;
[0139] Similarly, other index data (such as total phosphorus concentration, chemical oxygen demand, etc.) of the present invention are all subjected to data cleaning and normalization using similar methods.
[0140] S2. Use the weighted average method to construct the pollutant emission characteristics per unit flow, and use multiple regression analysis to explore the interaction characteristics between pH and pollutant concentration to construct multi-modal characteristics.
[0141] Here, taking the ammonia nitrogen emission as an example, the method of constructing the ammonia nitrogen emission characteristics per unit flow (i.e., ammonia nitrogen emission characteristics per unit flow) using sewage data, and using multiple regression analysis to explore the interaction characteristics between pH and ammonia nitrogen concentration (i.e., ammonia nitrogen concentration - pH value interaction characteristics) to construct multi-modal characteristics will be explained in detail:
[0142] S21. In the feature construction stage, for the calculation of ammonia nitrogen emission characteristics per unit flow, considering the influence of flow fluctuations on concentration measurement, the weighted average method is used as follows:
[0143] Let the data points of flow rate and ammonia nitrogen emissions in the past 1 hour be n. Then calculate the weights and the ammonia nitrogen emission characteristics per unit flow according to the following formula:
[0144]
[0145] In the formula, Q h,i represents the i-th flow data point in the past 1 hour; represents the average value of the flow rate in the past 1 hour; ∈ = 0.01 represents a very small value to prevent the denominator from being zero. F N / Q,t is the ammonia nitrogen emission characteristics per unit flow, represents the corresponding ammonia nitrogen emission data point; w i is the weight, and the weight w i is determined according to the stability of the flow rate. The more stable the flow rate, the greater the weight.
[0146] S22. When constructing the interaction characteristics between pH and ammonia nitrogen concentration, the multiple regression analysis method is used as follows:
[0147] S221. Collect a large number of historical data points Establish a linear regression model with regression coefficients to be determined as follows:
[0148]
[0149] In the formula, represents the corresponding ammonia nitrogen concentration value; pH j represents the pH value of the j-th historical data point; β0, β1 are the regression coefficients of the linear regression model;
[0150] S222. Solve the regression coefficients β0, β1 of the linear regression model by the least squares method, and use the regression coefficient β1 as the ammonia nitrogen concentration - pH value interaction characteristic F pH-N .
[0151] S223, combine the ammonia nitrogen unit flow emission characteristics with the interaction characteristics F of ammonia nitrogen concentration and pH value pH-N by weighted summation to obtain the multi-modal feature vector M, and the calculation formula is as follows:
[0152] M = c1F N / Q,t + c2F pH-N
[0153] In the formula, c1 represents the weight of the ammonia nitrogen unit flow emission characteristics; c2 is the weight of the interaction characteristics F of ammonia nitrogen concentration and pH value pH-N of F.
[0154] S3. For the flow rate data (i.e., flow rate m) collected per minute, use the variable window sliding window technique to extract time series features, and use wavelet transform to extract time series features from the pollutant concentration data.
[0155] S31. Use the variance of the flow rate data to represent the magnitude of the flow rate fluctuation, and set the size of the sliding window according to the magnitude of the flow rate fluctuation:
[0156] S311. When the variance of the flow rate data is large, that is, the flow rate fluctuation is large, set the size of the sliding window to 5 minutes;
[0157] S312. When the variance of the flow rate data is small, that is, the flow rate fluctuation is small, set the size of the sliding window to 30 minutes;
[0158] S313. Extract time series features according to the set window size.
[0159] Here, taking the calculation of the mean time series feature of the flow rate m as an example, the mean time series feature of the flow rate m is obtained within the sliding window according to the following formula:
[0160]
[0161] In the formula, μQ m,t represents the mean time series feature of the flow rate m calculated within the sliding window; Q m,i represents the data points of the flow rate m within the sliding window; k is the size of the sliding window;
[0162] S32. Use wavelet transform to extract the time series features of the pollutant concentration data.
[0163] Here, still taking the ammonia nitrogen concentration data as an example.
[0164] S321. Decompose the ammonia nitrogen concentration data into wavelet coefficients of different scales, and assume that the decomposed low-frequency coefficient is a n and the high-frequency coefficient is d n ;
[0165] S322, extract the time series features of the concentration data by analyzing a n and d n For example:
[0166] Calculate the energy E of the high-frequency coefficients d = ∑ i (d i ) 2 The change in energy reflects the mutation of the concentration data.
[0167] Calculate the periodic characteristics of the low-frequency coefficients:
[0168]
[0169] In the formula, N is the number of low-frequency coefficients, k is the frequency component serial number, a n is the low-frequency coefficient sequence; is the complex exponential function, used to transform the time-domain signal (low-frequency coefficient sequence) to the frequency domain.
[0170] S33, data fusion stage, adopt the fusion method combining principal component analysis (PCA) and linear discriminant analysis (LDA).
[0171] S331, first, perform PCA dimensionality reduction on the data matrix X composed of the constructed multi-modal feature vectors and the extracted time series features.
[0172] S332, calculate the covariance matrix Σ of the data matrix X, and solve its eigenvalues λ i and eigenvectors v i ;
[0173] If there are m sewage samples, and each sample measures p multi-modal features and q time series features, the data matrix X is an m×(p + q), which can be expressed as:
[0174]
[0175] In the formula, x ij represents the j-th multi-modal feature value of the i-th sewage sample; x i(p+k) represents the k-th time series feature value of the i-th sewage sample.
[0176] The covariance matrix Σ is an n×n matrix, and the calculation formula is:
[0177]
[0178] In the formula, X kDenote the k-th row vector of the data matrix X, i.e., the feature vector of the k-th sewage sample (including multi-modal features and time series features).
[0179] For example, X3 = [x 31 , x 32 ,..., x 3p , x 3(p+1) , x 3(p+2) ,..., x 3(p+q) ;
[0180] While denotes the mean vector of all sewage samples. For example, the (p + 2)-th element of is the mean of the ammonia nitrogen concentration of all sewage samples at the second time point; m is the number of sewage samples.
[0181] The eigenvalue λ i and the covariance matrix Σ satisfy the following relationship:
[0182]
[0183] In the formula, λ i is the i-th eigenvalue of the covariance matrix Σ, and v i is the corresponding eigenvector.
[0184] S333. Sorting by the eigenvalue magnitude, select the eigenvectors corresponding to the top p eigenvalues to form the projection matrix W PCA , and project the data into the low-dimensional space Y = XW PCA ;
[0185] S334. Then, perform LDA analysis on the low-dimensional space Y, calculate the within-class scatter matrix S w and the between-class scatter matrix S b , solve the generalized eigenvalue problem S b w = λS w w, and obtain the eigenvector w i ;
[0186] S335. Select the top q eigenvectors w i to form the projection matrix W LDA , and obtain the fused feature vector Z = YW LDA ;
[0187] S4. Incorporate the historical change trend of the fused feature vector Z, the enterprise production status information, and the current fused feature vector Z into the construction of the deep reinforcement learning model state space.
[0188] S41. In terms of environment construction, taking a certain electroplating enterprise as an example, the definition of the state space takes into account the particularity of the enterprise's production process. In addition to the fused feature vector at the current moment, for the change trend of the fused feature vector within the past 1 hour, the exponentially weighted moving average (EWMA) method is used for calculation, as follows:
[0189] S411. Let the fused feature vector be X t =(x 1,t ,x 2,t ,...,x m,t ), then the calculation formula of EWMA is:
[0190] Δμ X,t =αX t +(1 - α)Δμ X,t-1
[0191] In the formula, α = 0.2 is the weighting coefficient; X t represents the fused feature vector at the current moment; Δμ X,t-1 is the change trend value of the fused feature vector at the previous moment; Δμ X,t is the change trend value at the current moment obtained by weighted summation of the fused feature vector X t at the current moment and the change trend value Δμ X,t-1 at the previous moment.
[0192] S412. The enterprise production status information includes parameters such as the current intensity I t and temperature T t of the electroplating bath. After normalizing these parameters, they are incorporated into the state space. The normalization formula for the current intensity is:
[0193]
[0194] In the formula, I t represents the current intensity of the electroplating bath of the electroplating enterprise at the current moment; min(I) and max(I) are respectively the minimum and maximum values of the historical current intensity; is the normalized current intensity.
[0195] S5. Design a DQN agent with a residual connection structure, calculate the Q value using the adaptive ELU function, construct a differential reward function, and establish and train a sewage anomaly judgment model based on prioritized experience replay, distributed training, and the Adam optimization algorithm. The specific method is as follows:
[0196] S51. Introduce a residual connection structure into the multi - layer fully connected neural network, and design the agent using the improved architecture of the deep Q - network (DQN).
[0197] The network structure of the agent includes 3 hidden layers, and each hidden layer has 128 neurons.
[0198] It should be noted that the present invention adopts an adaptive ELU (Exponential Linear Unit) activation function in the Q-value calculation function, and its expression is:
[0199]
[0200] In the formula, x is the input of the neuron; α is a constant greater than 0, and in this formula, it takes 0.1; e is the natural constant (about 2.71828).
[0201] For example, let the network input be the state vector s t , and the network parameter be θ, the Q-value calculation function is as follows:
[0202]
[0203] In the formula, s t represents the state vector of the network input; w j , v jk , b j , c i are the weight and bias parameters of the network, and v jk is used to perform a linear transformation on the state vector s k ; b j is the bias term; f(x) is the adaptive ELU activation function; a i represents the corresponding action.
[0204] S52. In the design of the reward function, different rewards are established for different types of sewage anomaly judgments.
[0205] S521. If it is determined that there is an abnormal hidden pipe discharge and there is indeed a hidden pipe discharge in the actual situation, the reward is r1 = +20;
[0206] S522. If the determination is incorrect, the reward is r2 = -10.
[0207] S523. For the action of suggesting further inspection, if an anomaly is indeed found in the subsequent inspection, the reward is r3 = +8, otherwise the reward is r4 = -5.
[0208] S53. During the model training process, a priority-based experience replay mechanism is adopted.
[0209] S531. Set the size of the experience replay buffer to 10,000 samples;
[0210] S532. According to factors such as the reward size and novelty of the samples, calculate the priority P of the samples according to the following rules i :
[0211] Samples with larger rewards and greater differences from the stored samples have higher priorities.
[0212] Finally, a trained sewage anomaly judgment model is obtained, which can be used for anomaly detection of the sewage discharge situation of enterprises.
[0213] However, in the actual detection work of the regulatory department, not only the presence of excessive components in the sewage discharged by enterprises is an abnormal situation of sewage discharge, but there are also various improper means of attempting to deceive the regulatory department with data. The present invention combines multiple algorithms with artificial intelligence models to maximize the avoidance of enterprises deceiving the regulatory department when there is an anomaly in sewage discharge, as follows:
[0214] S6. Based on a combination of multiple methods such as dynamic threshold setting, flow spectrum analysis, nonlinear regression, double-threshold judgment, similarity and DTW algorithms, and Allan variance analysis, the output results of the sewage anomaly judgment model are used to detect and determine the abnormal situation of enterprise sewage discharge, as follows:
[0215] S61. The improper means for enterprises to deceive the regulatory department with data usually include fabricating sensor data or adding a large amount of compliant tap water to the sewage to achieve the purpose of forging sewage data. Ultimately, it is all about increasing the sewage discharge volume while keeping the monitored component content unchanged, so that the overall sewage data monitored by the sewage discharge anomaly detection equipment meets the requirements of the regulatory department.
[0216] The present invention additionally sets up a data anomaly judgment unit for judging sewage data. In this way, the dynamic threshold setting method can be adopted. In the data anomaly judgment unit, a dynamic threshold is set according to the enterprise's past data and process changes to compare the current sewage data with the standard value, so as to judge whether the enterprise fabricates sewage data, effectively preventing the enterprise's behavior of maliciously creating "perfect" data and ensuring that sewage data anomalies can be quickly and accurately identified.
[0217] Taking the measured concentration of chemical oxygen demand (COD) of this textile enterprise as an example, according to the average concentration within the past month The standard deviation σ of the concentration COD And the recent production process changes (such as whether to change dyes, etc., represented by a process change factor. If there are major process changes, γ = 1.5; if there are no changes, γ = 1), dynamically determine the dynamic threshold range at the current moment.
[0218] S611. Let the upper limit of the dynamic threshold be T upper And the lower limit of the dynamic threshold be T lower The calculation formula is:
[0219]
[0220] In the formula, represents the average concentration of the measured chemical oxygen demand (COD) of the textile enterprise in the past month; σ COD represents the standard deviation; γ is the process change factor (γ = 1.5 for major process changes, γ = 1 for no changes); T upprr is the upper limit of the measured COD concentration threshold determined according to the average concentration, standard deviation, and process change factor, and T lower is the lower limit of the measured COD concentration threshold determined according to the average concentration, standard deviation, and process change factor.
[0221] When the measured COD concentration in the fused feature vector of the input data exceeds this dynamic threshold range, or the output result of the sewage anomaly judgment model is "abnormal action", it should be determined that the sewage discharge of the enterprise is abnormal (that is, the real-time data deviates too far from the standard value).
[0222] Only when the output result of the sewage anomaly judgment model is not "abnormal action" and the measured COD concentration in the fused feature vector of the input data is within this dynamic threshold range, can it be considered that the sewage discharge of the enterprise is not abnormal (that is, the deviation between the real-time data and the standard value is within the error tolerance range).
[0223] S62. For enterprises to evade supervision, they privately lay hidden pipes for sewage discharge (the phenomenon of hidden pipes). The sewage flow discharged from these hidden pipes will not be included in the data for the supervision department to detect sewage discharge anomalies, which greatly affects the accuracy of the supervision department's detection of enterprises' sewage discharge anomalies.
[0224] In addition to calculating the average of the overall emissions on a monthly basis, the present invention also uses the fast Fourier transform (FFT) to convert the flow data into the frequency domain and analyze the spectral characteristics of the flow data to accurately determine whether there is a hidden pipe phenomenon in the enterprise, thereby further ensuring the accuracy of the sewage discharge anomaly detection.
[0225] S621. Let the flow data sequence be Q m,t (t = 1, 2,..., n), and the spectral sequence F Q (k) (k = 1, 2,..., n) is obtained after the FFT transformation;
[0226] S622. Calculate the energy ratio E of the low-frequency components (the first 10% frequency components) according to the following formula low :
[0227]
[0228] In the formula, represents the total energy of the low-frequency components; represents the total energy of the entire spectrum.
[0229] S623. According to the calculated energy proportion E low , combined with the output result of the sewage anomaly judgment model, determine whether the sewage discharge of the enterprise is abnormal:
[0230] If E low continuously increases within a month, by calculating the difference between adjacent weeks, if the differences for three consecutive weeks are all greater than 0.1, and the reduction ratio of the monthly average flow compared to the historical monthly average flow exceeds 35%, and at the same time the output result of the sewage anomaly judgment model is "abnormal hidden pipe discharge", then it is determined that there is a hidden pipe phenomenon in the current enterprise's sewage discharge.
[0231] If the output result of the sewage anomaly judgment model is not "abnormal hidden pipe discharge", and the situation judged using the energy proportion E low is also consistent with the output result of the sewage anomaly judgment model, then it can be determined that there is no hidden pipe phenomenon in the current enterprise's sewage discharge.
[0232] In practical applications, if the output result of the sewage anomaly judgment model is inconsistent with the situation reflected by the energy proportion E low , it should be considered that there is a hidden pipe phenomenon in the current enterprise's sewage discharge, and staff should be dispatched in a timely manner for on-site verification.
[0233] S63. When many enterprises build sewage drainage channels, they will privately install sewage detection devices. When it is found that the sewage discharge does not meet the discharge requirements of the regulatory department, they will use many improper technical means to forcibly reduce the substances in the sewage that do not meet the requirements before the regulatory department issues a rectification opinion to avoid being ordered to rectify by the regulatory department. For example, directly adding chemical agents to the sewage to neutralize the components in the sewage that do not meet the requirements, so as to reduce the content of these excessive components in the sewage. However, this method of directly pouring chemical agents will cause greater damage to the environment and is an act strictly prohibited by the regulatory department.
[0234] However, when the privately installed sewage detection device of the enterprise detects that the sewage discharge does not meet the requirements, the sewage discharge anomaly detection equipment installed by the regulatory department usually can already obtain the excessive data of the enterprise's sewage discharge. The present invention uses the non - linear regression analysis method to obtain the pollutant concentration curve before and after the excessive data to judge whether the enterprise has these illegal behaviors and further determine whether the enterprise's sewage discharge meets the regulations.
[0235] S631. Let the concentration data points before exceeding the standard be (t1, C1), (t2, C2),..., (t m , C m ), then the concentration data points after exceeding the standard are (t m+1 , C m+1 ), (t m+2 , Cm+2 ),...,(t n ,C n ),
[0236] S632, use the quadratic polynomial C(t)=a + bt + ct 2 for fitting, and solve the coefficients a, b, and c by the least squares method.
[0237] S633, calculate the curvature K of the curve and the curvature change rate Δ K according to the following formula:
[0238]
[0239] In the formula, C′(t) is the first derivative of the curve, C″(t) is the second derivative, K n is the curvature at a certain moment after exceeding the standard, and K m is the curvature at a certain moment before exceeding the standard.
[0240] If Δ K < -1.0 and the output result of the sewage anomaly judgment model is "abnormal sharp drop of data after exceeding the standard", it is determined that there is an abnormal sharp drop of data after exceeding the standard in the current enterprise's sewage discharge.
[0241] That is to say, if Δ K ≥ -1.0 and the output result of the sewage anomaly judgment model is not "abnormal sharp drop of data after exceeding the standard", it can be judged that there is no abnormal sharp drop of data after exceeding the standard in the current enterprise's sewage discharge.
[0242] In actual applications, there may be a situation where Δ K ≥ -1.0, but the output result of the sewage anomaly judgment model is "abnormal sharp drop of data after exceeding the standard". There may also be a situation where the output result of the sewage anomaly judgment model is not "abnormal sharp drop of data after exceeding the standard", but Δ K < -1.0. As long as there is a contradiction between the two results, it should be considered that there is an abnormal sharp drop of data after exceeding the standard in the current enterprise's sewage discharge, and staff should be dispatched in a timely manner for on-site verification.
[0243] S64, through sewage discharge anomaly detection, the regulatory department learns that some enterprises will be ordered to rectify within a time limit due to non-compliant sewage discharge. However, many enterprises usually use improper technical means for rectification. For example, directly adding chemical agents to the sewage to neutralize the non-compliant components in the sewage to reduce the content of these exceeded components in the sewage and make the sewage discharge meet the rectification requirements. However, this method of directly dumping chemical agents will cause greater damage to the environment and is an act strictly prohibited by the regulatory department.
[0244] The present invention adopts a method combining relative change amount and absolute change amount, and determines whether the enterprise has adopted non-compliant rectification means by detecting the concentration change before and after rectification.
[0245] S641. Calculate the concentration change amount ΔC according to the following formula:
[0246] ΔC = C post - C pre
[0247] In the formula, ΔC is the concentration change amount, C pre is the concentration before rectification, and C post is the concentration after rectification;
[0248] S642. According to the concentration change amount ΔC, combined with the output result of the sewage anomaly judgment model, judge whether the sewage discharge of the current enterprise is abnormal:
[0249] If and |ΔC| > 30mg / l, and the output result of the sewage anomaly judgment model is "abnormal concentration change", it is determined that the concentration change before and after the rectification of the current enterprise is too large and there is an anomaly.
[0250] Of course, in practical applications, regardless of whether the output result of the sewage anomaly judgment model is "abnormal concentration change", as long as and |ΔC| > 30mg / l, the current rectification situation of the current enterprise should be determined to be abnormal. Unless, at the same time, the three conditions of "the output result of the sewage anomaly judgment model is not abnormal concentration change" and "|ΔC| ≤ 30mg / l" are satisfied, it will be considered that the current rectification situation of the current enterprise belongs to the normal situation.
[0251] S65. In order to prevent the enterprise from tampering with the sensor data, resulting in the regulatory department being unable to accurately judge whether the sewage discharge of the enterprise meets the requirements through the sewage data and the artificial intelligence model, in addition to calculating the similarity between the fusion feature vectors of the data in different time periods, the present invention also introduces time series similarity analysis, and uses the dynamic time warping (DTW) algorithm to calculate the similarity distance between two time series data to determine the anomaly of data similarity.
[0252] S651. Let the fusion feature vectors of the data in two different time periods be X = (x1, x2,..., x m ,) and Y = (y1, y2,..., yy m ,), and the DTW distance calculation formula is:
[0253]
[0254] Wherein, DTW(X, Y) is the similarity distance between the fused feature vector X and the fused feature vector Y, x i , y i represent the elements in the feature vector; m and n represent the dimensions of the feature vector; w is a warping path from X to Y, and d(w i ) is the Euclidean distance function of the corresponding points on the path.
[0255] S652. According to the calculated similarity distance DTW and combined with the output result of the sewage anomaly judgment model, judge whether the sewage discharge of the current enterprise is abnormal:
[0256] If the similarity distance DTW is within the threshold range of (0.25, 0.90), and the output result of the sewage anomaly judgment model is not "data similarity anomaly", it is determined that the data similarity of the sewage discharge of the current enterprise is normal.
[0257] However, even if the similarity distance DTW is within the threshold range of (0.25, 0.90), once the output result of the sewage anomaly judgment model is "data similarity anomaly", or even if the output result of the sewage anomaly judgment model is not "data similarity anomaly", but the similarity distance DTW exceeds the threshold upper limit of 0.90 or the DTW distance is less than the threshold lower limit of 0.25, the data similarity of the sewage discharge of the current enterprise should be determined to be in an abnormal state.
[0258] Of course, if the output result of the sewage anomaly judgment model is "data similarity anomaly", and the similarity distance DTW exceeds the threshold upper limit of 0.90 or the DTW distance is less than the threshold lower limit of 0.25, then the data similarity of the sewage discharge of the current enterprise must also be determined to be in an abnormal state.
[0259] S66. Use the Allan variance to analyze the stability index of the sewage anomaly detection device, so as to facilitate the monitoring personnel to timely eliminate equipment failures and ensure accurate sewage anomaly judgment. Specifically as follows:
[0260] When the data output by the sewage anomaly detection device shows a fixed value feature for more than 15 consecutive days, the Allan variance analysis method is used to calculate the stability index of the data.
[0261] S661. Let the data sequence be Z = (z1, z2,..., z N ), and the Allan variance calculation formula is:
[0262]
[0263] Wherein, σ 2 (τ) is the stability index of the sewage anomaly detection device, τ is the time interval, z i , z i+1, z i+2 are all data in the data sequence Z; N is the number of data groups in the data sequence Z. If the sampling is carried out continuously for 15 days, then N = 15;
[0264] S662, set τ = 1 day, and calculate the stability index of the sewage anomaly detection device according to the above Allan variance calculation formula;
[0265] S663, obtain the device anomaly judgment result according to the stability index of the sewage anomaly detection device:
[0266] If the stability index σ 2 (τ) ≥ 0.003, and the output result of the sewage anomaly judgment model is not "suspected device anomaly", then the final judgment result is "the device is in normal state";
[0267] If the stability index σ 2 (τ) < 0.003, or the output result of the sewage anomaly judgment model is "suspected device anomaly", then the judgment result is "device failure". When the device fails, it is necessary to dispatch a special person to repair the device to ensure the normal progress of the sewage discharge anomaly detection of the enterprise.
[0268] It should be noted that the output result of the sewage anomaly judgment model is obtained by inputting the data into the trained model after preprocessing and multi-modal data fusion in the real-time monitoring and data input stage, and is not obtained according to historical data. Historical data is only used for the training of the sewage anomaly judgment model.
[0269] The above are only the preferred embodiments of the present invention and are not used to limit the present invention. Any modifications made by those skilled in the art without departing from the spirit of the present invention fall within the protection scope of the present invention.
Claims
1. A sewage discharge anomaly detection method based on multimodal fusion and deep reinforcement learning, characterized in that: The following steps are involved: 1) Use various sensors to collect sewage discharge data in real time, and perform data cleaning and normalization on the sewage discharge data; 2) Construct the pollutant emission characteristics under unit flow, establish a linear regression model of pH value and pollutant concentration, extract the regression coefficient as the interaction feature of pH value and pollutant concentration, and construct a multimodal feature vector; 3) Extract time series features from flow data and pollutant concentration data; 4) Using the time series features in flow data and pollutant concentration data, as well as multimodal feature vectors, a fusion feature vector is constructed; 5) Construct a deep reinforcement learning model as a sewage anomaly judgment model, the state space of which includes enterprise production status information, current fused feature vectors, and historical trends of fused feature vectors; 6) Construct multivariate rules for sewage anomaly judgment, and detect and judge the sewage discharge situation of enterprises based on the output results of the sewage anomaly judgment model.
2. The method for detecting abnormal wastewater discharge according to claim 1, characterized in that: In step 1), various sensors are used to collect sewage discharge data in real time, and the specific process of data cleaning and normalization is as follows: 1-1) Obtain enterprise wastewater discharge data in real time through several different types of sensors; 1-2) Calculate the moving average and standard deviation by the moving average method, and use the interpolation method to correct outliers; 1-3) Normalize the sewage discharge data.
3. The method for detecting abnormal wastewater discharge according to claim 1, characterized in that: In step 2), the multimodal feature vector is constructed as follows: 2-1) Use the weighted average method to construct the pollutant emission characteristics under unit flow; 2-2) Use multiple regression analysis to establish a linear regression model of pH value and pollutant concentration, explore the interactive characteristics of pH and pollutant concentration, and extract the regression coefficient as the interactive characteristics of pH value and pollutant concentration; 2-3) Combine the interaction characteristics of pH value and pollutant concentration, as well as the characteristics of pollutant emission under unit flow rate to form a multimodal feature vector.
4. The method for detecting abnormal wastewater discharge according to claim 1, characterized in that: In step 3), the time series features in the flow data and pollutant concentration data are extracted, including: 3-1) Dynamically adjust the window size according to the traffic variance to extract the time series features in the traffic data; 3-2) Perform wavelet transform on pollutant concentration data to decompose low-frequency and high-frequency coefficients, and use the calculated high-frequency energy and low-frequency periodic characteristics as time series features in the pollutant concentration data.
5. The method for detecting abnormal wastewater discharge according to claim 1, characterized in that: In step 4), the construction of the fusion feature vector specifically includes: 4-1) Using the time series features in flow data and pollutant concentration data, as well as multimodal feature vectors, a fusion data matrix is formed; 4-2) Use principal component analysis (PCA) to reduce the dimension of the fusion data matrix; 4-3) Linear discriminant analysis (LDA) is used to further extract the discriminative features in the fused data matrix to form a fused feature vector.
6. The method for detecting abnormal wastewater discharge according to claim 1, characterized in that: In step 5), the construction of the sewage abnormality judgment model includes: 5-1) Using the enterprise production status information, the current fused feature vector, and the historical trend of the fused feature vector, construct a state space of a deep reinforcement learning model; 5-2) Design a DQN agent with residual connections as the agent of the deep reinforcement learning model, and use the adaptive ELU activation function to calculate the Q value and construct a differentiated reward function; 5-3) Use the priority experience replay mechanism and distributed training strategy to optimize the deep reinforcement learning model, and use the Adam algorithm to update the parameters of the deep reinforcement learning model until the deep reinforcement learning model meets the usage requirements; 5-4) The deep reinforcement learning model that meets the usage requirements is used as the sewage anomaly judgment model.
7. The method for detecting abnormal wastewater discharge according to claim 1, characterized in that: In step 6), the multivariate rules for sewage anomaly judgment are combined with the output results of the sewage anomaly judgment model to detect and judge the sewage discharge of the enterprise, specifically including: 6-1) Dynamically set the pollutant concentration threshold range based on historical data and process change factors, and determine whether the enterprise has "abnormal sewage discharge" based on the relationship between the pollutant concentration and the pollutant concentration threshold, combined with the output results of the sewage anomaly judgment model; 6-2) Calculate the proportion of low-frequency energy in the flow data through FFT, and combine the flow reduction ratio and the output results of the sewage anomaly judgment model to determine whether the enterprise has "dark pipe discharge"; 6-3) Fit the pollutant concentration curve before and after exceeding the standard, calculate the curvature change rate, and combine the output results of the sewage anomaly judgment model to determine whether the enterprise has a "data steep drop anomaly"; 6-4) Use the DTW algorithm to calculate the time series similarity distance, and combine it with the output results of the sewage anomaly judgment model to determine whether the enterprise has "data similarity anomaly"; 6-5) Calculate the equipment data stability index based on the Allan variance, and combine it with the output results of the sewage anomaly judgment model to determine whether the company has "equipment failure".