A Multi-Parameter Water Quality Anomaly Detection Method for Urban Water Supply Networks Based on Uncertainty

By constructing a bi-branch conditional diffusion model and a Bayesian time-series update method for detecting water quality anomalies in urban water supply networks, the problem of distinguishing between real anomalies and reconstruction uncertainties in existing technologies has been solved, and stable water quality anomaly detection has been achieved.

CN123116104APending Publication Date: 2026-11-17DALIAN UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611604933.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-16
Publication Date
2026-11-17

Smart Images

  • Figure CN123116104A_ABST
    Figure CN123116104A_ABST
Patent Text Reader

Abstract

This invention provides a multi-parameter water quality anomaly detection method for urban water supply networks based on uncertainty, belonging to the field of urban water supply network water quality monitoring and intelligent diagnosis technology. First, water quality data is acquired and preprocessed to obtain a preprocessed water quality data sequence, which is then divided into a training set, a validation set, and a test set. Pollution events are constructed based on the test set. Second, a water quality probabilistic reconstruction model based on a conditional diffusion model is constructed. Autocorrelation analysis is used to determine the conditional windows of the local historical reconstruction branch and the periodic historical reconstruction branch in the bi-branch conditional diffusion model, and probabilistic reconstruction is performed on the same target window. Third, a comprehensive anomaly score is obtained. Finally, a Bayesian sequential update is performed, and the updated pollution event probability is compared with an alarm threshold to output the pollution event detection result. This invention enables the detection of water quality anomalies by comparing the uncertainty differences of different historical condition reconstructions for the same time period.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of urban water supply network water quality monitoring and intelligent diagnosis technology, and relates to a method for detecting multi-parameter water quality anomalies in urban water supply networks based on uncertainty. Background Technology

[0002] Urban water supply networks are characterized by their wide spatial distribution, frequent changes in operating conditions, and the coupling of various water quality parameters. To achieve timely detection of pollution events in the network, online water quality sensors are typically deployed at key nodes to continuously monitor multiple water quality parameters such as residual chlorine, turbidity, pH, conductivity, and water temperature. The water quality status of the network is affected by multiple uncertainties, including sensor noise, changes in operating conditions, and complex dynamic water quality processes. Single observations are insufficient to accurately characterize the boundaries of the normal state, easily leading to misjudgments or missed detections of anomalies. Therefore, it is necessary to construct a method that can fully exploit spatiotemporal correlation features and achieve reliable anomaly identification to address the problem of water quality status characterization under multi-parameter coupling and dynamic uncertainty conditions.

[0003] To address the aforementioned issues, Chinese invention patent CN111191855B proposes a method for identifying and warning of water quality anomalies based on multivariate time-series water quality data from a pipe network. This method constructs a water quality anomaly detection model: preprocessing monitoring data and simulating anomaly events, establishing a multi-index prediction model, optimizing thresholds through residual analysis, and combining temporal Bayesian updates to achieve anomaly probability assessment and pollution event alarm. However, this method does not consider the potential impact of sensor noise, zero-point drift, communication delays, and inconsistent sampling times at different monitoring points on the monitoring data. In addition, Chinese invention patent CN115470850B proposes a method for identifying and warning of water quality anomalies based on spatiotemporal water quality data from a pipe network. First, adjacent stations with similar trends in the pipe network are grouped and preprocessed; then, an adversarial network is constructed and trained until convergence; anomaly scores are constructed using a generator and discriminator, and thresholds are selected; the pollution probability at each time point is calculated and smoothed; finally, the probabilities of single and multiple stations are fused to obtain the combined event probability. However, this method mainly focuses on the spatiotemporal correlation between data and usually outputs a single predicted value or a single reconstructed value, which is difficult to describe the multimodal probability distribution that may be formed under normal water quality conditions under the same operating conditions.

[0004] Furthermore, online monitoring data from urban water supply networks can be affected by sensor noise, zero-point drift, missing data, communication delays, and inconsistent sampling times at different monitoring points. If the anomaly detection model cannot simultaneously provide the reliability of the reconstructed results, large reconstruction errors may originate from actual water quality anomalies, or from uncertainties in the normal state itself, or from a decline in observation quality, making it difficult to form a stable and reliable alarm basis. Some supervised learning methods also require a sufficient number and variety of anomaly samples. However, anomaly events in actual pipe networks occur infrequently, have complex causes, and are costly to label. Insufficient anomaly samples limit the applicability of such methods.

[0005] Therefore, how to utilize water quality time series data to learn the joint probability distribution of normal water quality under different time conditions and operating conditions, in the presence of sensor noise, hydraulic fluctuations and frequent changes in operating conditions, simultaneously quantify reconstruction errors and reconstruction uncertainties during the detection process, and form continuously accumulating anomalous evidence through Bayesian time series updates and multi-parameter fusion, is an urgent technical problem to be solved in the multi-parameter water quality anomaly detection of urban water supply networks. Summary of the Invention

[0006] The technical problem this invention aims to solve is: addressing the shortcomings of existing urban water supply network anomaly detection methods, such as difficulty in characterizing the complex probability distribution of normal water quality, difficulty in distinguishing between real anomalies and reconstructed uncertainties, and insufficient stability of single-moment alarm results. This invention provides a multi-parameter water quality anomaly detection method for urban water supply networks based on uncertainty. By comparing the uncertainty differences of the same time period reconstructed under different historical conditions, this invention can achieve water quality anomaly detection.

[0007] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: A multi-parameter water quality anomaly detection method for urban water supply networks based on uncertainty includes the following steps: The first step is water quality data acquisition and preprocessing, resulting in a preprocessed water quality data sequence, which is then divided into training, validation, and test sets.

[0008] Water quality data and their corresponding times are acquired from multiple water quality sensors at the monitoring nodes of the water supply network, and preprocessed, including time alignment, removal of abnormal communication values, and handling of missing values.

[0009] The second step is to construct contamination events based on the test set obtained in the first step.

[0010] Step 2.1, define the water quality data in the test set as follows: According to the time of the pollution incident and duration A pollution disturbance with Gaussian variation characteristics is added to the water quality data of the test set to obtain the water quality data after the pollution event is added; as shown in the following formula: (1) (2) in, This indicates that during the pollution incident, the first... i The water quality indicators are in the first The pollution disturbance values ​​superimposed at each time step; Indicates the direction of change after the impact of pollution; Indicates the intensity of a pollution incident; Indicates the time step in the ongoing pollution event; Indicates the number of times under normal operating conditions Standard deviation of each water quality indicator; Indicates the duration of a pollution incident; The probability density function representing the normal distribution; The independent variable represents the probability density function of the normal distribution; It represents the standard deviation of a normal distribution.

[0011] Step 2.2: Set multiple groups of pollution event intensities. and duration The combination of these elements is processed, and step 2.1 is executed to obtain the pollution events corresponding to each combination, i.e., multiple pollution detection scenarios.

[0012] The third step involves constructing a water quality probability reconstruction model based on the preprocessed water quality data sequence obtained in the first step. This model learns the conditional probability distribution of the target time window through forward diffusion and conditional inverse denoising, as detailed below: Step 3.1: Train the conditional diffusion model based on the training set obtained in Step 1. Divide the water quality data sequence in the training set according to a preset time step. The resulting data segments are then truncated into target time windows according to the preset time step. and historical condition windows that provide reconstruction conditions .

[0013] Step 3.2, target time window Proceeding with forward diffusion, in the... In each expansion step, Gaussian noise is gradually added to the target time window according to the following formula: (3) in: Indicates the target time window; The diffusion model is represented in the first... Noisy data obtained at each time step; From the first step to the second Step 1: How much of the original information in the target window is still retained? It is random Gaussian noise.

[0014] Step 3.3, Construct a historical condition window As a condition. Training parameters are The water quality probability reconstruction model of the conditional diffusion model of noise is established according to the following formula from the first... The diffusion step to the 1st Conditional inverse denoising distribution for each diffusion step: (4) in, This indicates a historical conditions window that provides reconstruction conditions; For the first step in the reverse diffusion process The target sequence obtained by step reconstruction; For training parameters A defined conditional reverse transition probability distribution.

[0015] Step 3.4: Start executing step 3.3 from the Gaussian noise state; conditional reverse denoising, generate M posterior reconstruction samples for the same target time window, and calculate the posterior mean, posterior standard deviation and posterior probability distribution of each water quality index at each sampling time based on the M posterior reconstruction samples.

[0016] The fourth step involves constructing a two-branch conditional diffusion model based on the conditional diffusion model built in the third step and the training set obtained in the first step. Autocorrelation analysis is used to determine the conditional windows for the local historical reconstruction branch and the periodic historical reconstruction branch in the two-branch conditional diffusion model. The two reconstruction branches are then jointly trained, and the trained branches are used to perform probability reconstruction on the same target window, yielding the posterior mean, posterior standard deviation, and probability distribution differences for the two sets of posterior reconstructed samples. The details are as follows: Step 4.1: Perform autocorrelation analysis on the water quality indicators in the training set. Within one week, determine the historical condition window length of the two reconstruction branches based on the time length corresponding to the peak value of the autocorrelation coefficient of each water quality indicator.

[0017] Step 4.2: Based on the historical condition window lengths of the two reconstruction branches determined in Step 4.1, the data sequence before the target time window in the preset segment is used as the historical condition window of the local historical reconstruction branch. Data from the day before the target window is taken from the preset segment as the historical condition window of the periodic historical reconstruction branch, and the region adjacent to the target time window is masked.

[0018] Step 4.3: Input the two reconstruction branches from step 4.2 into the water quality probabilistic reconstruction model based on the conditional diffusion model constructed in step 3 to establish a two-branch conditional diffusion model for characterizing the continuous and periodic variation patterns of water quality.

[0019] Step 4.4: The two-branch conditional diffusion model established in Step 4.3 is trained using diffusion noise loss, sequence reconstruction loss, and two-branch consistency loss constraints. The joint objective function for training is as follows: (5) in, For the loss of diffused noise, For sequence reconstruction loss, This represents the consistency loss due to two branches. Weights for sequence reconstruction loss; The weights are used for the consistency loss in the two branches.

[0020] Step 4.5: Based on the model training output obtained in Step 4.4, this includes the posterior mean of the local history reconstruction branch. Posterior standard deviation posterior mean of the periodic historical reconstruction branch Posterior standard deviation and differences in probability distribution .

[0021] Step 5: Input the training set. Based on the posterior mean, posterior standard deviation, and probability distribution differences of the local and periodic historical reconstruction branches obtained in Step 4, calculate the differences in posterior mean, posterior standard deviation, and probability distribution between the two reconstruction branches. Standardize the three types of difference evidence, and use this standardization to complete the fusion of anomaly evidence and multiple water quality indicators, obtaining a comprehensive anomaly score. Specifically: Step 5.1: Calculate the posterior mean difference, posterior standard deviation difference, and probability distribution difference between the local history reconstruction branch and the periodic history reconstruction branch. The calculation formulas are as follows: Posterior mean difference : (6) Posterior standard deviation difference : (7) Differences in probability distributions : (8) The difference in posterior mean is used to describe the deviation from certainty; the difference in standard deviation is used to describe the change in prediction uncertainty; and the difference in probability distribution, as KL divergence, is used to describe the change in the overall probability distribution.

[0022] Step 5.2: Considering the natural differences caused by hydraulic fluctuations, demand changes, and sensor noise during normal operation, the Robust-z method is used for standardization. The water quality data sequences from the validation set are input into steps 4.3 and 4.4. Based on step 4.5, the background evidence set of the three types of differences for each water quality indicator under normal operating conditions is obtained. The Robust-z scheme is then used to standardize the three types of differences for the three water quality indicators obtained in step 5.1 according to the following formula: (9) (10) in, Indicates water quality indicators; This indicates three types of difference indicators; Indicates a time step; Representing variables In time The above corresponds to the first The original evidence value of the anomalous evidence; Represents variables in the validation set and types of evidence The evidence, i.e., the distribution of normal background evidence; This represents the median of the distribution of normal background evidence. Indicates the median absolute deviation of evidence with normal background; This represents a very small positive integer, used to prevent MAD from being extremely small or zero; Representing variables In time Upper One-sided robustness of similar evidence; This represents the positive value truncation function.

[0023] Step 5.3: Perform weighted fusion of the three standardized difference indicators obtained in Step 5.2. (11) in, Water quality indicators Abnormal scores; The weights for the differences in the posterior means; Weights for differences in posterior standard deviation; Weights for differences in probability distributions; Step 5.4: Based on the anomaly scores of the water quality indicators obtained in Step 5.3, the anomaly scores of each water quality indicator are weighted and fused to obtain a comprehensive anomaly score. (12) in, For comprehensive anomaly scoring; For the first Weighting of abnormal scores for each water quality indicator; for Abnormal scores for each water quality indicator; For the first Water quality indicators.

[0024] Step 6: Input the validation set and test set into the comprehensive water quality anomaly score obtained in Step 5 for normal operation and the comprehensive water quality anomaly score to be measured, respectively. Perform a Bayesian sequential update using the water quality data sequence, true positive rate, false alarm rate, and pollution event probability at the previous sampling time from the test set. Compare the updated pollution event probability with the alarm threshold and output the pollution event detection result; as detailed below: Step 6.1, based on the water quality data sequence corresponding to the comprehensive water quality anomaly score in the validation set... Quantiles determine the threshold for anomaly scoring. For the first At each sampling time, when Greater than At that time, the current abnormal state will be displayed. Record it as 1; otherwise, record the current abnormal state. We denote it as 0, thus obtaining the abnormal state sequence.

[0025] Step 6.2, Set the initial contamination event probability And based on the current abnormal state Probability of contamination events at the previous sampling time Perform a recursive update; when When =1, the probability of contamination events at the current sampling time is updated according to the following formula. : (13) in, For a moment Posterior probability of contamination; For a moment The prior probability of contamination; and These represent the true positive rate and the false positive rate, respectively.

[0026] Step 6.3: Determine the pollution alarm result. When the updated pollution event probability exceeds a set threshold, a pollution event is determined to have occurred, and an alarm result is output. The set threshold is 0.8.

[0027] The beneficial effects of this invention are as follows: (1) The present invention constructs a dual-branch conditional diffusion model, which uses the local historical reconstruction branch and the periodic historical reconstruction branch to perform probability reconstruction on the same target time window, and obtains the posterior mean, posterior standard deviation and posterior probability distribution of water quality monitoring values. By comparing the three types of difference indicators under two historical conditions, the probability fluctuation and reconstruction uncertainty under normal operation are distinguished from the actual abnormal deviation.

[0028] (2) The present invention utilizes Bayesian anomaly evidence probability update to progressively accumulate anomaly information within a continuous time window, avoiding instantaneous anomaly misjudgment caused by isolated noise, thereby effectively reducing false alarms caused by natural fluctuations in water quality, sensor noise, and data quality degradation. Attached Figure Description

[0029] Figure 1 This is a flowchart of the method of the present invention.

[0030] Figure 2 This is a schematic diagram of the input window for the residual chlorine local history reconstruction branch model.

[0031] Figure 3 This is a schematic diagram of the input window for the residual chlorine cycle history reconstruction branch model.

[0032] Figure 4 This is a schematic diagram illustrating the change of the bibranch remodeling distribution over time under uncontaminated conditions.

[0033] Figure 5 This is a schematic diagram illustrating the change of the bibranch reconstructed distribution over time under a pollution event. Figure 6 This is a schematic diagram illustrating the change in the probability of a bi-branch reconstructed contamination event over time. Detailed Implementation

[0034] The present invention will be further described below with reference to specific embodiments.

[0035] This embodiment provides a method for detecting multiple parameters of water quality anomalies in urban water supply networks with uncertainties, such as... Figure 1 As shown, it includes the following steps: The first step is water quality data acquisition and preprocessing.

[0036] Step 1.1: Obtain water quality data and its corresponding time from multiple water quality sensors at the water supply network monitoring nodes, and perform time alignment, abnormal communication value removal, and missing value processing to obtain a preprocessed water quality data sequence.

[0037] Step 1.2: Divide the pretreated water quality data sequence into training set, validation set and test set in a 6:2:2 ratio.

[0038] The second step is to construct contamination events based on the test set obtained in the first step.

[0039] Step 2.1, define the water quality data in the test set as follows: According to the time of the pollution incident and duration A pollution disturbance with Gaussian variation characteristics is added to the water quality data of the test set to obtain the water quality data after the pollution event is added; as shown in the following formula: (1) (2) in, This indicates that during the pollution incident, the first... i The water quality indicators are in the first The pollution disturbance values ​​superimposed at each time step; Indicates the direction of change after the impact of pollution; Indicates the intensity of a pollution incident; Indicates the time step in the ongoing pollution event; Indicates the number of times under normal operating conditions Standard deviation of each water quality indicator; Indicates the duration of a pollution incident; The probability density function representing the normal distribution; The independent variable represents the probability density function of the normal distribution; The standard deviation represents the normal distribution, which is set to 1 in this embodiment.

[0040] Step 2.2: Set multiple groups of pollution event intensities. and duration The combination of these elements is processed, and step 2.1 is executed to obtain 150 pollution events corresponding to each combination, i.e., 150 pollution detection scenarios.

[0041] The third step involves constructing a water quality probability reconstruction model based on the preprocessed water quality data sequence obtained in the first step. This model learns the conditional probability distribution of the target time window through forward diffusion and conditional inverse denoising, as detailed below: Step 3.1: Train the conditional diffusion model based on the training set obtained in Step 1. Divide the water quality data sequence in the training set into segments according to a preset time step of 456. Then, truncate each segment into target time windows with a preset time step of 24. And a historical condition window with 432 time steps to provide reconstruction conditions. .

[0042] Step 3.2, target time window Proceeding with forward diffusion, in the... In each expansion step, Gaussian noise is gradually added to the target time window according to the following formula: (3) in: Indicates the target time window; The diffusion model is represented in the first... Noisy data obtained at each time step; From the first step all the way to the... Step 1: How much of the original information in the target window is still retained? It is random Gaussian noise.

[0043] Step 3.3, Construct a historical condition window As a condition. Training parameters are The water quality probability reconstruction model of the conditional diffusion model of noise is established according to the following formula from the first... The diffusion step to the 1st Conditional inverse denoising distribution for each diffusion step: (4) in, This indicates a historical conditions window that provides reconstruction conditions; For the first step in the reverse diffusion process The target sequence obtained by step reconstruction; For training parameters A defined conditional reverse transition probability distribution.

[0044] Step 3.4: Start executing step 3.3 from the Gaussian noise state; conditional reverse denoising, generate 30 posterior reconstruction samples for the same target time window, and calculate the posterior mean, posterior standard deviation and posterior probability distribution of each water quality index at each sampling time based on the 30 posterior reconstruction samples.

[0045] The fourth step involves constructing a two-branch conditional diffusion model based on the conditional diffusion model built in the third step and the training set obtained in the first step. Autocorrelation analysis is used to determine the conditional windows for the local historical reconstruction branch and the periodic historical reconstruction branch in the two-branch conditional diffusion model. The two reconstruction branches are then jointly trained, and the trained branches are used to perform probability reconstruction on the same target window, yielding the posterior mean, posterior standard deviation, and probability distribution differences for the two sets of posterior reconstructed samples. The details are as follows: Step 4.1: Perform autocorrelation analysis on the water quality indicators in the training set. Within one week, determine the historical condition window lengths of the local historical reconstruction branch and the periodic historical reconstruction branch as 72 time steps and 288 time steps, respectively, based on the time length corresponding to the peak value of the autocorrelation coefficient of each water quality indicator.

[0046] Step 4.2, based on the historical condition window lengths of the two reconstructed branches determined in Step 4.1, such as... Figure 2The data sequence of 72 time steps prior to the target time window, shown as 24 time steps, serves as the historical condition window for the local history reconstruction branch. Figure 3 As shown, the data of the day before the target window is taken from the preset 24 time steps as the historical condition window of the periodic history reconstruction branch, and the 144 time step regions adjacent to the target time window are masked.

[0047] Step 4.3: Input the two reconstruction branches from step 4.2 into the water quality probabilistic reconstruction model based on the conditional diffusion model constructed in step 3 to establish a two-branch conditional diffusion model for characterizing the continuous and periodic variation patterns of water quality.

[0048] Step 4.4: The two-branch conditional diffusion model established in Step 4.3 is trained using diffusion noise loss, sequence reconstruction loss, and two-branch consistency loss constraints. The joint objective function for training is as follows: (5) in, For the loss of diffused noise, For sequence reconstruction loss, This represents the consistency loss due to two branches. Weights for sequence reconstruction loss; The weights are used for the consistency loss in the two branches.

[0049] Step 4.5, as follows Figure 4 and Figure 5 The model training output obtained from step 4.4, as shown, includes: the posterior mean of the local history reconstruction branch. Posterior standard deviation posterior mean of the periodic historical reconstruction branch Posterior standard deviation and differences in probability distribution (Not shown in the image).

[0050] Step 5: Input the training set. Based on the posterior mean, posterior standard deviation, and probability distribution differences of the local and periodic historical reconstruction branches obtained in Step 4, calculate the differences in posterior mean, posterior standard deviation, and probability distribution between the two reconstruction branches. Standardize the three types of difference evidence, and use this standardization to complete the fusion of anomaly evidence and multiple water quality indicators, obtaining a comprehensive anomaly score. Specifically: Step 5.1: Calculate the posterior mean difference, posterior standard deviation difference, and probability distribution difference between the local history reconstruction branch and the periodic history reconstruction branch. The calculation formulas are as follows: Posterior mean difference : (6) Posterior standard deviation difference : (7) Differences in probability distributions : (8) The difference in posterior mean is used to describe the deviation from certainty; the difference in standard deviation is used to describe the change in prediction uncertainty; and the difference in probability distribution, as KL divergence, is used to describe the change in the overall probability distribution.

[0051] Step 5.2: Considering the natural differences caused by hydraulic fluctuations, demand changes, and sensor noise during normal operation, the Robust-z method is used for standardization. The water quality data sequences from the validation set are input into steps 4.3 and 4.4. Based on step 4.5, the background evidence set of the three types of differences for each water quality indicator under normal operating conditions is obtained. The Robust-z scheme is then used to standardize the three types of differences for the three water quality indicators obtained in step 5.1 according to the following formula: (9) (10) in, Indicates water quality indicators; This indicates three types of difference indicators; Indicates a time step; Representing variables In time The above corresponds to the first The original evidence value of the anomalous evidence; Represents variables in the validation set and types of evidence The evidence, i.e., the distribution of normal background evidence; This represents the median of the distribution of normal background evidence. Indicates the median absolute deviation of evidence with normal background; This represents a very small positive integer, used to prevent MAD from being extremely small or zero; Representing variables In time Upper One-sided robustness of similar evidence; This represents the positive value truncation function.

[0052] Step 5.3: Perform weighted fusion of the three standardized difference indicators obtained in Step 5.2. (11) in, Water quality indicators Abnormal scores; This is the weight of the difference in posterior means, 0.45; It is the weight of the difference in posterior standard deviation, 0.45; This is the probability distribution difference weight, 0.1; Step 5.4: Based on the anomaly scores of the water quality indicators obtained in Step 5.3, the anomaly scores of each water quality indicator are weighted and fused to obtain a comprehensive anomaly score. (12) in, For comprehensive anomaly scoring; For the first The weights of the abnormal scores for each water quality indicator are as follows: the weight of the abnormal score for residual chlorine is 0.4, the weight of the abnormal score for turbidity is 0.3, and the weights of the abnormal scores for pH and conductivity are 0.15. for Abnormal scores for each water quality indicator; For the first Water quality indicators.

[0053] Step 6: Input the validation set and test set into the comprehensive water quality anomaly score obtained in Step 5 for normal operation and the comprehensive water quality anomaly score to be measured, respectively. Perform a Bayesian sequential update using the water quality data sequence, true positive rate, false alarm rate, and pollution event probability at the previous sampling time from the test set. Compare the updated pollution event probability with the alarm threshold and output the pollution event detection result; as detailed below: Step 6.1, based on the water quality data sequence corresponding to the comprehensive water quality anomaly score in the validation set... Quantiles determine the threshold for anomaly scoring. For the first At each sampling time, when Greater than At that time, the current abnormal state will be displayed. Record it as 1; otherwise, record the current abnormal state. We denote it as 0, thus obtaining the abnormal state sequence.

[0054] Step 6.2, Set the initial contamination event probability And based on the current abnormal state Probability of contamination events at the previous sampling time Perform a recursive update; when When =1, the probability of contamination events at the current sampling time is updated according to the following formula. : (13) in, For a moment Posterior probability of contamination; For a moment The prior probability of contamination; and These represent the true positive rate and the false positive rate, respectively.

[0055] Step 6.3, determine the pollution alarm result. For example... Figure 6 As shown in Table 1, when the updated probability of a pollution event exceeds a set threshold, a pollution event is determined to have occurred, and an alarm result is output. The set threshold in this embodiment is 0.8.

[0056] Table 1: Comparison Results of Model Detection

[0057] The embodiments described above are merely illustrative of the implementation methods of the present invention, but should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the protection scope of the present invention.

Claims

1. A method for detecting multi-parameter water quality anomalies in urban water supply networks based on uncertainty, characterized in that: The multi-parameter water quality anomaly detection method for urban water supply networks includes the following steps: The first step is water quality data acquisition and preprocessing, resulting in a preprocessed water quality data sequence, which is then divided into training set, validation set, and test set. The second step is to construct contamination events based on the test set obtained in the first step. Step 2.1, define the water quality data in the test set as follows: According to the time of the pollution incident and duration Pollution perturbations with Gaussian variation characteristics are added to the water quality data of the test set to obtain water quality data after the pollution events are added; Step 2.2: Set multiple groups of pollution event intensities. and duration The combination of these elements is processed, and step 2.1 is executed to obtain the pollution events corresponding to each combination, i.e., multiple pollution detection scenarios. The third step is to construct a water quality probability reconstruction model based on the preprocessed water quality data sequence obtained in the first step, and learn the conditional probability distribution of the target time window through forward diffusion and conditional reverse denoising. The fourth step involves constructing a two-branch conditional diffusion model based on the conditional diffusion model built in the third step and the training set obtained in the first step. Autocorrelation analysis is used to determine the conditional windows of the local history reconstruction branch and the periodic history reconstruction branch in the two-branch conditional diffusion model. The two reconstruction branches are jointly trained, and the two trained reconstruction branches are used to perform probability reconstruction on the same target window to obtain the posterior mean, posterior standard deviation and probability distribution difference of the two sets of posterior reconstruction samples. The fifth step involves inputting the training set and, based on the posterior mean, posterior standard deviation, and probability distribution differences of the local historical reconstruction branch and the periodic historical reconstruction branch obtained in the fourth step, calculating the posterior mean difference, posterior standard deviation difference, and probability distribution difference between the two reconstruction branches. The three types of difference evidence are then standardized, and this standardization is used to complete the fusion of abnormal evidence and multiple water quality indicators to obtain a comprehensive abnormality score. Step 6: Input the validation set and test set into the comprehensive water quality anomaly score of normal operation and the comprehensive water quality anomaly score to be measured obtained in step 5, respectively. Use the water quality data sequence, true positive rate, false alarm rate and pollution event probability at the previous sampling time in the test set to perform Bayesian sequential update, and compare the updated pollution event probability with the alarm threshold to output the pollution event detection result.

2. The method for detecting multi-parameter water quality anomalies in urban water supply networks based on uncertainty, as described in claim 1, is characterized in that... In the first step, water quality data and their corresponding times are obtained from multiple water quality sensors at the water supply network monitoring nodes, and preprocessed. The preprocessing includes time alignment, removal of abnormal communication values, and handling of missing values.

3. The method for detecting multi-parameter water quality anomalies in urban water supply networks based on uncertainty, as described in claim 2, is characterized in that... Step 2.1 is shown in the following formula: in, This indicates that during the pollution incident, the first... i The water quality indicators are in the first The pollution disturbance values ​​superimposed at each time step; Indicates the direction of change after the impact of pollution; Indicates the intensity of a pollution incident; Indicates the time step in the ongoing pollution event; Indicates the number of times under normal operating conditions Standard deviation of each water quality indicator; Indicates the duration of a pollution incident; The probability density function representing the normal distribution; The independent variable represents the probability density function of the normal distribution; It represents the standard deviation of a normal distribution.

4. The method for detecting multi-parameter water quality anomalies in urban water supply networks based on uncertainty, as described in claim 3, is characterized in that... The third step is specifically as follows: Step 3.1: Train the conditional diffusion model based on the training set obtained in Step 1; divide the water quality data sequence in the training set according to a preset time step, and then cut the divided data segments into target time windows according to the preset time step. and historical condition windows that provide reconstruction conditions ; Step 3.2, target time window Proceeding with forward diffusion, in the... In each expansion step, Gaussian noise is gradually added to the target time window according to the following formula: in: Indicates the target time window; The diffusion model is represented in the first... Noisy data obtained at each time step; From the first step all the way to the... Step, the total amount of original information retained in the target window; It is random Gaussian noise; Step 3.3, Construct a historical condition window As a condition; training parameters are The water quality probability reconstruction model of the conditional diffusion model of noise is established according to the following formula from the first... The diffusion step to the 1st Conditional inverse denoising distribution for each diffusion step: in, This indicates a historical conditions window that provides reconstruction conditions; For the first step in the reverse diffusion process The target sequence obtained by step reconstruction; For training parameters A defined probability distribution of the reverse transition condition; Step 3.4: Start executing step 3.3 from the Gaussian noise state; conditional reverse denoising, generate M posterior reconstruction samples for the same target time window, and calculate the posterior mean, posterior standard deviation and posterior probability distribution of each water quality index at each sampling time based on the M posterior reconstruction samples.

5. The method for detecting multi-parameter water quality anomalies in urban water supply networks based on uncertainty, as described in claim 4, is characterized in that... The fourth step specifically involves: Step 4.1: Perform autocorrelation analysis on the water quality indicators in the training set respectively, and determine the historical condition window length of the two reconstruction branches based on the time length corresponding to the peak value of the autocorrelation coefficient of each water quality indicator within one week. Step 4.2: Based on the historical condition window lengths of the two reconstruction branches determined in Step 4.1, the data sequence before the target time window in the preset segment is used as the historical condition window of the local historical reconstruction branch; the data of the day before the target window is taken from the preset segment as the historical condition window of the periodic historical reconstruction branch, and the area adjacent to the target time window is masked. Step 4.3: Input the two reconstruction branches from step 4.2 into the water quality probabilistic reconstruction model based on the conditional diffusion model constructed in step 3 to establish a two-branch conditional diffusion model for characterizing the continuous and periodic variation patterns of water quality. Step 4.4: The two-branch conditional diffusion model established in Step 4.3 is trained using diffusion noise loss, sequence reconstruction loss, and two-branch consistency loss constraints. The joint objective function for training is as follows: in, For the loss of diffused noise, For sequence reconstruction loss, This represents the consistency loss due to two branches. Weights for sequence reconstruction loss; Weights for the two-branch consistency loss; Step 4.5: Based on the model training output obtained in Step 4.4, this includes the posterior mean of the local history reconstruction branch. Posterior standard deviation posterior mean of the periodic historical reconstruction branch Posterior standard deviation and differences in probability distribution .

6. The method for detecting multi-parameter water quality anomalies in urban water supply networks based on uncertainty, as described in claim 5, is characterized in that... The fifth step is specifically as follows: Step 5.1: Calculate the three water quality indicators for the local history reconstruction branch and the periodic history reconstruction branch, including the difference in posterior mean, the difference in posterior standard deviation, and the difference in probability distribution. Step 5.2: Considering the natural differences caused by hydraulic fluctuations, demand changes, and sensor noise during normal operation, the Robust-z method is used for standardization. The water quality data sequences from the validation set are input into steps 4.3 and 4.

4. Based on step 4.5, the background evidence set of the three types of differences for each water quality indicator under normal operating conditions is obtained. The Robust-z scheme is then used to standardize the three types of differences for the three water quality indicators obtained in step 5.1 according to the following formula: in, Indicates water quality indicators; This indicates three types of difference indicators; Indicates a time step; Representing variables In time The above corresponds to the first The original evidence value of the anomalous evidence; Represents variables in the validation set and types of evidence The evidence, i.e., the distribution of normal background evidence; This represents the median of the distribution of normal background evidence. Indicates the median absolute deviation of evidence with normal background; This represents a positive integer, used to prevent MAD from being extremely small or zero; Representing variables In time Upper One-sided robustness of similar evidence; This represents a function that truncates positive values. Step 5.3: Perform weighted fusion of the three standardized difference indicators obtained in Step 5.

2. in, Water quality indicators Abnormal scores; The weights for the differences in the posterior means; Weights for differences in posterior standard deviation; Weights for differences in probability distributions; Step 5.4: Based on the anomaly scores of the water quality indicators obtained in Step 5.3, the anomaly scores of each water quality indicator are weighted and fused to obtain a comprehensive anomaly score. in, For comprehensive anomaly scoring; For the first Weighting of abnormal scores for each water quality indicator; for Abnormal scores for each water quality indicator; For the first Water quality indicators.

7. The method for detecting multi-parameter water quality anomalies in urban water supply networks based on uncertainty, as described in claim 6, is characterized in that... The sixth step is specifically as follows: Step 6.1, based on the water quality data sequence corresponding to the comprehensive water quality anomaly score in the validation set... Quantiles determine the threshold for anomaly scoring. For the first At each sampling time, when Greater than At that time, the current abnormal state will be displayed. Record it as 1; otherwise, record the current abnormal state. We denote it as 0, thus obtaining the sequence of abnormal states; Step 6.2, Set the initial contamination event probability And based on the current abnormal state Probability of contamination events at the previous sampling time Perform a recursive update; when When =1, the probability of contamination events at the current sampling time is updated according to the following formula. : in, For a moment Posterior probability of contamination; For a moment The prior probability of contamination; and These are the true positive rate and the false positive rate, respectively. Step 6.3: Determine the pollution alarm result; when the updated pollution event probability exceeds the set threshold, determine that a pollution event has occurred and output the alarm result.

8. The method for detecting multi-parameter water quality anomalies in urban water supply networks based on uncertainty, as described in claim 7, is characterized in that... In step 6.3, the threshold is set to 0.8.

Citation Information

Patent Citations

  • A method for identifying and warning of water quality anomalies based on multivariate water quality time-series data from pipe networks

    CN111191855B

  • A method for identifying and warning water quality abnormal events based on spatio-temporal data of pipe network water quality

    CN115470850B