A water plant equipment leakage detection method and system based on spatiotemporal feature fusion
Patent Information
- Application Number
- CN202611308506.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-27
- Publication Date
- 2026-11-03
AI Technical Summary
Existing water plant leakage detection technologies suffer from low time alignment accuracy, insufficient spatiotemporal feature mining, weak anti-interference ability in identifying minute leaks, and difficulty in distinguishing between genuine and false anomalies, resulting in high missed detection rates and high false judgment rates, making it impossible to achieve accurate leakage detection.
By acquiring the flow sequences and pipeline spatial distances of upstream and downstream nodes, calculating the water flow transmission time delay for time series correction, combining Kalman filtering and dynamic time warping algorithms for data denoising and feature extraction, and using a support vector machine model for anomaly classification and identification, deep fusion of spatiotemporal features is achieved.
It has achieved automated and precise detection of water plant equipment leakage, reduced the rate of missed detection and false detection, adapted to complex water conveyance conditions, and met the refined operation and maintenance needs of smart water plants.
Smart Images

Figure CN123028767A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of equipment condition monitoring, and in particular relates to a method and system for detecting leakage in water plant equipment based on spatiotemporal feature fusion. Background Technology
[0002] Water plant pipelines and storage equipment are the core pressure-bearing and water-transporting carriers of municipal water supply systems. These equipment operate under continuous pressure, fluid flow, and fluctuating environmental temperatures, making them highly susceptible to hidden faults such as minute leaks, joint seepage, and minor pipe wall damage. These leaks initially lack obvious visual characteristics, are minimal in volume, and are difficult to detect through manual inspections. Over time, this not only wastes water resources and reduces the efficiency of the pipeline network, but also easily induces secondary risks such as pipeline corrosion, cavity collapse, and equipment structural damage, seriously affecting the stability and operational safety of the water plant's water supply.
[0003] Currently, water plant leak detection generally relies on traditional methods such as fixed-point pressure monitoring, instantaneous flow rate comparison, and video image recognition for fault screening. Among these, traditional flow rate difference comparison methods often use fixed threshold judgment mechanisms, relying solely on the flow rate difference at a single moment to determine anomalies. This ignores the spatial time delay characteristics and temporal dynamic evolution of water flow transmission in pipelines, and cannot adapt to the temporal offset problems caused by pipeline topology distance, hydraulic resistance, and flow delay. Minor leak characteristics are easily masked by operating condition fluctuations, water usage disturbances, equipment start-up and shutdown, etc., resulting in high false negative rates and poor anti-interference capabilities.
[0004] Conventional image recognition detection methods rely on static image feature extraction, making it difficult to capture the subtle dynamic flow characteristics in the early stages of leakage. They also have poor adaptability to complex on-site environments such as low light, water mist, and equipment obstruction. At the same time, existing detection technologies generally suffer from insufficient spatial topological correlation and inadequate temporal feature mining, failing to achieve deep fusion of spatiotemporal multidimensional features. This makes it difficult to accurately distinguish between real leakage and normal operating condition fluctuations, leading to frequent misjudgments and false alarms. Summary of the Invention
[0005] Therefore, it is necessary to address the technical problems of low timing alignment accuracy, insufficient spatiotemporal feature mining, weak anti-interference ability for identifying minor leaks, and difficulty in distinguishing between genuine and false anomalies in existing water plant leakage detection methods. A method and system based on spatiotemporal feature fusion should be provided to achieve accurate hydraulic timing correction, deep spatiotemporal feature fusion, and accurate identification of hidden leaks.
[0006] Firstly, this application provides a water plant equipment leakage detection method based on spatiotemporal feature fusion, including:
[0007] The system obtains the first flow sequence of the upstream node and the second flow sequence of the downstream node in the water pipeline, and also obtains the pipeline spatial distance between the upstream and downstream nodes and the average water flow velocity in the pipeline.
[0008] The transmission time delay of water flow from the upstream node to the downstream node is calculated based on the pipe space distance between the upstream and downstream nodes and the average transmission speed of water flow in the pipe.
[0009] Time offset compensation is performed on the initial sampling time of the first flow sequence based on the transmission time delay to obtain a third flow sequence that is aligned with the time axis of the second flow sequence.
[0010] The flow difference between the third flow sequence and the second flow sequence at the same compensated sampling time is calculated time by time to generate a continuous initial flow difference sequence.
[0011] The Kalman filter algorithm is used to filter out noise and smooth the initial flow difference sequence to obtain the denoised target flow difference sequence.
[0012] The dynamic time warping algorithm is used to extract the temporal fluctuation features of the target flow difference sequence, and extract the difference feature sequence that represents the magnitude and rate of change of the flow difference.
[0013] The fluctuation amplitude features in the difference feature sequence are compared with the normal fluctuation threshold. If the fluctuation amplitude features exceed the normal fluctuation threshold, the corresponding time period in the target flow difference sequence is located and marked as an abnormal fluctuation segment.
[0014] The difference features corresponding to the abnormal fluctuation segments are input into a pre-trained support vector machine classification model for classification and identification, to determine the true leakage state corresponding to the abnormal fluctuation segments, and the leakage detection results are output.
[0015] In one embodiment, the transmission time delay of water flow from the upstream node to the downstream node is calculated based on the pipe spatial distance between the upstream and downstream nodes and the average transmission speed of the water flow in the pipe, including:
[0016] Obtain the equivalent roughness of the pipe wall and the cross-sectional parameters of the water passage between upstream and downstream nodes.
[0017] The cross-sectional parameters of the water passage include the hydraulic radius of the pipe and the initial average transmission velocity of the water flow in the pipe.
[0018] Based on the equivalent roughness of the pipe wall and the parameters of the water passage section, the hydraulic gradient along the pipeline is calculated using the hydraulic gradient calculation formula:
[0019]
[0020] in, The hydraulic gradient along the pipeline; The initial average transmission velocity of the water flow inside the pipe; This refers to the equivalent roughness of the pipe wall; The hydraulic radius of the cross-section of the pipeline through which water flows.
[0021] The real-time water temperature parameters of the water in the pipeline are obtained, and the fluid kinematic viscosity is calculated based on the empirical relationship between the kinematic viscosity of clear water and water temperature.
[0022] The Reynolds number of the water flow is calculated by combining the fluid kinematic viscosity, the initial average transport velocity of the water flow in the pipe, and the hydraulic radius of the pipe cross-section.
[0023]
[0024] in, The Reynolds number of the water flow; The initial average transmission velocity of the water flow inside the pipe; The hydraulic radius of the pipeline's cross-section; is the kinematic viscosity of the fluid.
[0025] The friction coefficient of the pipeline is calculated using an empirical formula based on the equivalent roughness of the pipe wall, the hydraulic radius of the pipeline cross-section, and the Reynolds number of the flow.
[0026]
[0027] in, This refers to the friction coefficient along the pipeline. This refers to the equivalent roughness of the pipe wall; For pipe diameter, ;
[0028] If the friction coefficient of the pipeline is greater than the friction coefficient threshold, the friction coefficient of the pipeline, the equivalent roughness of the pipe wall, and the hydraulic radius of the pipeline cross-section are input into the pre-trained random forest regression model, and the velocity correction coefficient is output. The initial average transmission velocity of the water flow in the pipe is corrected by the velocity correction coefficient to obtain the target transmission velocity.
[0029] If the friction coefficient along the pipeline is not greater than the friction coefficient threshold, then the initial average transmission speed of the water flow in the pipe is directly determined as the target transmission speed.
[0030] Based on the pipeline distance and the target transmission speed, the transmission time delay of water flow from the upstream node to the downstream node is calculated using the transmission delay formula.
[0031] In one embodiment, time offset compensation is performed on the initial sampling time of the first traffic sequence based on the transmission time delay to obtain a third traffic sequence aligned with the time axis of the second traffic sequence, including:
[0032] The timing offset of the first traffic sequence relative to the second traffic sequence is determined based on the transmission time delay.
[0033] The original sampling time, corresponding flow value, and time series offset of the first flow sequence are input into a pre-trained random forest interpolation model to perform time series interpolation reconstruction on the first flow sequence, resulting in a reconstructed flow sequence with a higher time resolution than the original sequence.
[0034] Obtain the sampling clock reference for the second flow sequence; the sampling clock reference includes the unified sampling timestamp system and fixed sampling interval of the downstream node flow meters.
[0035] The reconstructed flow sequence is mapped along a time axis and the flow value at the corresponding time is extracted based on the sampling clock reference to generate an initial aligned sequence.
[0036] Verify whether each sampling time of the initial alignment sequence corresponds one-to-one with the sampling time of the second flow sequence. If they match, then the initial alignment sequence is determined as the third flow sequence.
[0037] In one embodiment, a dynamic time warping algorithm is used to extract time-series fluctuation features from the target flow difference sequence, extracting a difference feature sequence characterizing the magnitude and rate of change of the flow difference, including:
[0038] Obtain the denoised target flow difference sequence and the normal operating condition baseline flow difference sequence.
[0039] The dynamic time warping algorithm is used to align the target flow difference sequence and the baseline flow difference sequence in time, and the optimal time warping path is obtained.
[0040] Based on the optimal time warping path, the deviation magnitude of the target sequence relative to the reference sequence at each alignment time is calculated to generate a fluctuation amplitude sequence.
[0041] Calculate the rate of change of amplitude between adjacent moments in the fluctuation amplitude sequence to obtain the rate change sequence.
[0042] When there is a period in the rate change sequence that exceeds the preset rate of change threshold, the fluctuation amplitude sequence corresponding to the period is fused with the rate change sequence to generate the difference feature sequence for the corresponding period.
[0043] In one embodiment, the difference features corresponding to the abnormal fluctuation segments are input into a pre-trained support vector machine classification model for classification and identification to determine the true leakage state corresponding to the abnormal fluctuation segments, and the leakage detection results are output, including:
[0044] Obtain the difference features corresponding to abnormal fluctuation segments in the target flow difference sequence; the difference features include fluctuation amplitude features and rate change features.
[0045] The difference features are normalized to obtain a multidimensional feature vector corresponding to the abnormal fluctuation segment.
[0046] The multidimensional feature vectors are input into a pre-trained support vector machine binary classification model for computation, and the initial leakage judgment result and classification confidence score corresponding to the abnormal fluctuation segment are output.
[0047] If the classification confidence level is greater than the confidence threshold, the initial leakage determination result is determined as the actual leakage state.
[0048] If the classification confidence level is not greater than the confidence level threshold, then the abnormal fluctuation segment is determined to be a normal operating condition fluctuation.
[0049] When a true leakage condition is determined, the corresponding target leakage level is obtained by matching the fluctuation amplitude characteristics of the abnormal fluctuation segment with the preset leakage level mapping rules.
[0050] Obtain the spatial coordinates of the pipeline interval corresponding to the upstream and downstream monitoring nodes of the abnormal fluctuation segment.
[0051] By combining the target leakage level, the spatial coordinates of the pipeline section, and the time interval corresponding to the abnormal fluctuation segment, leakage detection results including leakage location, leakage level, and time of occurrence are generated and output.
[0052] In one embodiment, the support vector machine binary classification model uses normal operating condition fluctuation samples and leakage samples as the training set, and employs a Gaussian radial basis kernel function to map to a high-dimensional feature space to solve for the optimal classification hyperplane. Its decision function is:
[0053]
[0054] in, This represents the total number of support vectors obtained during training. For the corresponding number Lagrange multipliers of the support vectors; Here are the labels for the training samples, where Mark the leaked samples, Label samples exhibiting fluctuations under normal operating conditions; The bias term for the optimal classification hyperplane; The Gaussian kernel function is expressed as:
[0055] in The kernel width parameter. Let be the 2-norm of the vector.
[0056] In one embodiment, the classification confidence score is calculated using the following formula:
[0057]
[0058] in, The classification confidence score is represented by a higher value, indicating greater reliability of the classification result.
[0059] Secondly, this application also provides a water plant equipment leakage detection system based on spatiotemporal feature fusion, the system comprising:
[0060] The transmission delay calculation module is used to obtain the first flow sequence of the upstream node and the second flow sequence of the downstream node in the water transmission pipeline, and at the same time obtain the pipeline spatial distance between the upstream and downstream nodes and the average transmission speed of the water flow in the pipe; it is also used to calculate the transmission time delay of the water flow from the upstream node to the downstream node based on the pipeline spatial distance between the upstream and downstream nodes and the average transmission speed of the water flow in the pipe.
[0061] The difference sequence construction module is used to compensate for the time offset of the initial sampling time of the first flow sequence based on the transmission time delay, so as to obtain a third flow sequence that is aligned with the time axis of the second flow sequence; it is also used to calculate the flow difference between the third flow sequence and the second flow sequence at the same compensated sampling time step by step, so as to generate a continuous initial flow difference sequence.
[0062] The difference feature extraction module is used to perform noise filtering and smoothing on the initial flow difference sequence using the Kalman filter algorithm to obtain the denoised target flow difference sequence; it is also used to extract the time-series fluctuation features of the target flow difference sequence using the dynamic time warping algorithm to extract the difference feature sequence that characterizes the magnitude and rate of change of the flow difference.
[0063] The leakage status determination module is used to compare the fluctuation amplitude features in the difference feature sequence with the normal fluctuation threshold. If the fluctuation amplitude features exceed the normal fluctuation threshold, the corresponding time period in the target flow difference sequence is located and marked as an abnormal fluctuation segment. It is also used to input the difference features corresponding to the abnormal fluctuation segment into a pre-trained support vector machine classification model for classification and identification, determine the true leakage status corresponding to the abnormal fluctuation segment, and output the leakage detection result.
[0064] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method described above.
[0065] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the aforementioned method.
[0066] The aforementioned water plant equipment leakage detection method, system, computer equipment, and storage medium based on spatiotemporal feature fusion first collect a first flow sequence corresponding to the upstream node and a second flow sequence corresponding to the downstream node of the water transmission pipeline. Simultaneously, the pipeline spatial distance and average water flow velocity within the pipeline are acquired for the upstream and downstream nodes. The upstream and downstream water flow transmission time delay is calculated based on the pipeline spatial distance and water flow velocity. Based on the obtained transmission time delay, the initial sampling time of the first flow sequence is offset compensation. Time alignment is completed using the time axis of the second flow sequence as a reference to obtain a third flow sequence that matches the actual water flow transmission pattern. Under a unified compensation sampling time, the flow difference between the third flow sequence and the second flow sequence is calculated time-by-time to generate a continuous and complete initial flow difference sequence. A Kalman filter algorithm is used to filter noise and smooth the initial flow difference sequence, eliminating invalid noise data caused by sensor acquisition errors and pipeline network operating condition disturbances, resulting in a target flow difference sequence with stronger stability and more prominent effective features. On this basis, a dynamic time warping algorithm is used to mine the temporal features of the target flow difference sequence, extracting a multidimensional difference feature sequence that objectively reflects the amplitude and rate of flow fluctuation. The fluctuation amplitude features in the difference feature sequence are compared with a preset normal fluctuation threshold to filter and locate abnormal periods exceeding the threshold, which are then marked as abnormal fluctuation segments. Finally, the multidimensional difference features corresponding to the abnormal fluctuation segments are input into a pre-trained support vector machine classification model to complete the classification and identification of the true and false abnormal signals, accurately determine the actual leakage status of the pipeline during the corresponding period, and output complete leakage detection results.
[0067] This invention overcomes the shortcomings of traditional water plant leak detection methods, such as time-series misalignment, single-feature characteristics, and weak anti-interference capabilities, through a hierarchical technical architecture that integrates spatiotemporal registration correction, data noise reduction, multi-dimensional temporal feature extraction, and intelligent classification and recognition. Based on the actual hydraulic transmission characteristics of the pipeline, this invention aligns the flow sequence temporally, eliminating detection errors caused by spatial transmission lag and ensuring the authenticity and validity of flow difference data. Filtering algorithms optimize the quality of time-series data, preserving subtle flow change characteristics corresponding to minor leaks and effectively improving the detection capability for minor leaks. Dynamic time warping algorithms are used to mine the amplitude and rate characteristics of flow fluctuations, achieving a refined characterization of the dynamic evolution of leaks and overcoming the limitations of fixed threshold detection. A support vector machine model is used to distinguish between genuine and false anomalies, effectively differentiating between actual pipeline leaks and disturbances from routine operating conditions such as water usage fluctuations and equipment adjustments, reducing the false positive and false negative rates of leak detection. The overall solution achieves automated and precise detection of leaks in water plant pipelines, adapting to complex water transmission conditions and meeting the practical application needs of refined operation and maintenance in smart water plants. Attached Figure Description
[0068] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0069] Figure 1 A flowchart of a water plant equipment leakage detection method based on spatiotemporal feature fusion provided in an embodiment of the present invention;
[0070] Figure 2 This is a structural block diagram of a water plant equipment leakage detection system based on spatiotemporal feature fusion, provided in an embodiment of the present invention. Detailed Implementation
[0071] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0072] In one embodiment, such as Figure 1 As shown, this application provides a water plant equipment leakage detection method based on spatiotemporal feature fusion, which may include the following steps:
[0073] Step S101: Obtain the first flow sequence of the upstream node and the second flow sequence of the downstream node in the water transmission pipeline, and at the same time obtain the pipeline spatial distance between the upstream and downstream nodes and the average transmission speed of the water flow in the pipe.
[0074] Specifically, flow acquisition terminals are deployed at upstream and downstream monitoring points along the water plant's transmission pipeline. Real-time flow data is continuously collected at fixed sampling intervals, and structured first and second flow sequences are generated, each carrying a corresponding original sampling timestamp. Simultaneously, static parameters and real-time hydraulic operating parameters of the transmission pipeline are read. The static parameters represent the actual pipeline laying distance between the upstream and downstream monitoring nodes, while the real-time hydraulic parameters represent the average water flow velocity within the pipeline under steady-state transmission conditions.
[0075] Step S102: Calculate the transmission time delay of water flow from the upstream node to the downstream node based on the pipe space distance between the upstream and downstream nodes and the average transmission speed of water flow in the pipe.
[0076] Furthermore, the water medium within the pipeline cannot instantaneously transmit flow changes synchronously. Flow fluctuations generated upstream require a fixed transmission time to propagate to the downstream monitoring location; this transmission time is the transmission time delay. This step, based on the obtained pipeline spatial distance and average water flow velocity within the pipe, quantitatively solves for the precise transmission time delay parameter using a physical time delay calculation formula. This parameter is an objective physical quantity of hydraulic transmission in the pipeline, used to characterize the inherent temporal deviation of upstream and downstream flow data.
[0077] Step S103: Based on the transmission time delay, perform time offset compensation on the initial sampling time of the first flow sequence to obtain a third flow sequence that is aligned with the time axis of the second flow sequence.
[0078] The first flow sequence is real-time data collected upstream. Due to the lag in water flow transmission, the flow status corresponding to its sampling time needs a fixed delay to be reflected downstream. Therefore, the original first flow sequence and the second flow sequence have a time synchronization problem, and direct comparison will produce spurious differences. This step uses the sampling clock and time axis of the second flow sequence as a unified reference. By utilizing the obtained transmission time delay, all initial sampling times of the first flow sequence are uniformly offset and corrected, so that the corrected upstream flow data time sequence matches the actual water flow propagation law. After correction and alignment, a third flow sequence is generated. The third flow sequence has a completely consistent time reference with the second flow sequence, satisfying the prerequisite for time-by-time data comparison.
[0079] Step S104: Calculate the flow difference between the third flow sequence and the second flow sequence at the same compensation sampling time step, and generate a continuous initial flow difference sequence.
[0080] After time alignment, the sampling times of the third flow sequence correspond one-to-one with those of the second flow sequence, with no time discrepancies. This step iterates through all uniformly compensated sampling times, and at each identical time node, calculates the difference between the flow rate values of the third and second flow sequences. The flow difference results for all times are then arranged chronologically to form a continuous, equally spaced, and time-corresponding initial flow difference sequence. This sequence objectively reflects the real-time flow loss changes upstream and downstream of the water pipeline and serves as the fundamental raw data for judging pipeline leakage anomalies.
[0081] Step S105: The Kalman filter algorithm is used to filter out noise and smooth the initial flow difference sequence to obtain the denoised target flow difference sequence.
[0082] In actual water supply scenarios at water plants, factors such as sensor acquisition errors, fluctuations in pipeline water pressure, instantaneous water load changes, and equipment start-up and shutdown disturbances can cause the initial flow difference sequence to contain a large amount of high-frequency random noise. The subtle loss characteristics corresponding to minute leaks are easily masked by this noise, leading to subsequent identification failures. This step utilizes the state prediction and observation update iteration mechanism of Kalman filtering to perform global noise reduction and temporal smoothing on the initial flow difference sequence, filtering out random abrupt noise and invalid interference components, retaining the true low-frequency variation trend of the flow difference, and improving the signal-to-noise ratio of the time-series data. After filtering, a target flow difference sequence with higher stability and more realistic features is obtained.
[0083] Step S106: The dynamic time warping algorithm is used to extract the temporal fluctuation features of the target flow difference sequence, and the difference feature sequence representing the magnitude and rate of change of the flow difference is extracted.
[0084] The target flow difference sequence is one-dimensional time-series data. Relying solely on numerical magnitude cannot distinguish between steady-state deviations and dynamic anomalies, making it difficult to identify slow, gradual, and minute leaks. This step employs a dynamic time warping algorithm to overcome the limitations of fixed-time-series matching. It performs flexible time-series matching and feature decomposition on the target flow difference sequence, extracting two types of core features: first, the flow fluctuation amplitude characteristic representing the strength of the anomaly; and second, the flow change rate characteristic representing the speed of the anomaly's evolution. This transforms the single time-series data into a multi-dimensional difference feature sequence containing amplitude and rate, enabling a refined characterization of the dynamic changes in pipeline flow anomalies.
[0085] Step S107: Compare the fluctuation amplitude features in the difference feature sequence with the normal fluctuation threshold. If the fluctuation amplitude features exceed the normal fluctuation threshold, locate the corresponding time period in the target flow difference sequence and mark it as an abnormal fluctuation segment.
[0086] Based on the flow fluctuation range under normal water supply conditions at the water plant, a fixed normal fluctuation threshold is pre-defined. This threshold is used to define abnormal flow losses caused by disturbances and leakage under normal operating conditions. This step iterates through the fluctuation amplitude characteristics of the difference feature sequence point by point, comparing the real-time amplitude values with the normal fluctuation threshold. When the fluctuation amplitude continuously exceeds the threshold within a consecutive time period, it is determined that there is abnormal flow loss during that period. The time interval corresponding to the target flow difference sequence is accurately located, and this interval is marked as an abnormal fluctuation segment. This step only filters suspected abnormal time periods, retaining normal time period data and discarding it, thus achieving coarse localization of abnormal areas.
[0087] Step S108: Input the difference features corresponding to the abnormal fluctuation segment into the pre-trained support vector machine classification model for classification and identification, determine the true leakage state corresponding to the abnormal fluctuation segment, and output the leakage detection result.
[0088] The abnormal fluctuation segments obtained after initial threshold screening include both continuous flow loss caused by genuine pipeline leakage and pseudo-abnormal fluctuations such as water usage fluctuations, valve adjustments, and network disturbances. A single threshold cannot distinguish between true and false fluctuations. This step inputs the multi-dimensional difference features corresponding to the abnormal fluctuation segments into an offline pre-trained support vector machine classification model. Relying on the model's high-dimensional feature classification capabilities, it learns the feature differences between genuine leakage and normal operating condition disturbances, and accurately classifies and identifies the anomaly type. The model outputs the final judgment result, distinguishing whether the current time period is a genuine leakage state or a normal operating condition state, and outputs a complete pipeline leakage detection result by combining temporal and spatial information.
[0089] The aforementioned water plant equipment leakage detection method based on spatiotemporal feature fusion first collects the flow sequences, pipeline spatial distance, and water flow transmission velocity of upstream and downstream nodes of the water transmission pipeline, and calculates the transmission time delay of the water flow within the pipe section. Based on the transmission time delay, time-series offset compensation is applied to the upstream flow sequence to align the time axes of the upstream and downstream flow sequences. Then, based on the aligned flow data, the flow difference is calculated time-by-time to generate an initial flow difference sequence. Kalman filtering is used to denoise and smooth the initial difference sequence, removing acquisition noise and operational disturbances to obtain a target flow difference sequence with a high signal-to-noise ratio. Dynamic time warping algorithm is used to mine the temporal features of the target flow difference sequence, extracting the flow fluctuation amplitude and rate of change to form a difference feature sequence. Abnormal fluctuation segments are filtered and located by setting a preset normal fluctuation threshold. Finally, the difference features of the abnormal segments are input into a pre-trained support vector machine model to complete the anomaly classification and identification, accurately determine the pipeline leakage status, and output the detection results.
[0090] This invention employs a hierarchical architecture of spatiotemporal registration, data denoising, multidimensional feature extraction, and intelligent classification, solving the problems of temporal misalignment, single feature set, and poor anti-interference capability in traditional detection methods. By combining pipeline hydraulic characteristics to achieve temporal alignment, this invention eliminates detection errors caused by spatial transmission lag, effectively preserving the subtle flow characteristics of minute leaks. Through dual-dimensional temporal feature mining, it overcomes the limitations of fixed threshold detection, accurately depicting the dynamic evolution of leaks. Relying on a machine learning classification mechanism, it distinguishes between real leaks and fluctuations under normal operating conditions, effectively reducing the missed detection rate and false detection rate. This invention is adaptable to the complex water transmission conditions of water plants, enabling automated and precise detection of pipeline leaks, meeting the application needs of refined operation and maintenance in smart water plants.
[0091] In one embodiment, calculating the transmission time delay of water flow from the upstream node to the downstream node based on the pipe spatial distance between the upstream and downstream nodes and the average transmission speed of water flow in the pipe may include the following steps:
[0092] Step S201: Obtain the equivalent roughness of the pipe wall and the cross-sectional parameters of the water passage between upstream and downstream nodes.
[0093] Among them, the cross-sectional parameters of the water passage include the hydraulic radius of the pipe and the initial average transmission velocity of the water flow in the pipe.
[0094] Step S202: Based on the equivalent roughness of the pipe wall and the parameters of the water passage section, the hydraulic gradient along the pipe is calculated using the hydraulic gradient calculation formula.
[0095]
[0096] in, The hydraulic gradient along the pipeline; The initial average transmission velocity of the water flow inside the pipe; This refers to the equivalent roughness of the pipe wall; The hydraulic radius of the cross-section of the pipeline through which water flows.
[0097] Step S203: Obtain the real-time water temperature parameters of the water in the pipe, and calculate the fluid kinematic viscosity based on the empirical relationship between the kinematic viscosity of clean water and water temperature.
[0098] Step S204: The Reynolds number of the water flow is calculated by combining the fluid kinematic viscosity, the initial average water flow velocity in the pipe, and the hydraulic radius of the pipe's cross-section.
[0099]
[0100] in, The Reynolds number of the water flow; The initial average transmission velocity of the water flow inside the pipe; The hydraulic radius of the pipeline's cross-section; is the kinematic viscosity of the fluid.
[0101] Step S205: Based on the equivalent roughness of the pipe wall, the hydraulic radius of the pipe cross-section, and the Reynolds number of the flow, the pipe friction coefficient is calculated using the empirical formula for the friction coefficient.
[0102]
[0103] in, This refers to the friction coefficient along the pipeline. This refers to the equivalent roughness of the pipe wall; For pipe diameter, ;
[0104] Step S206: If the friction coefficient of the pipeline is greater than the friction coefficient threshold, the friction coefficient of the pipeline, the equivalent roughness of the pipe wall and the hydraulic radius of the pipeline water passage section are input into the pre-trained random forest regression model, and the flow velocity correction coefficient is output. The initial average transmission velocity of the water flow in the pipe is corrected by the flow velocity correction coefficient to obtain the target transmission velocity.
[0105] Step S207: If the friction coefficient along the pipe is not greater than the friction coefficient threshold, then the initial average transmission speed of the water flow in the pipe is directly determined as the target transmission speed.
[0106] Step S208: Based on the pipeline space distance and the target transmission speed, the transmission time delay of water flow from the upstream node to the downstream node is calculated using the transmission delay formula.
[0107] Specifically, in calculating the time delay of water flow in a pipeline, the hydraulic characteristics of the pipeline and the physical properties of the water are introduced to achieve dynamic correction of the flow velocity, thereby improving the accuracy of the transmission delay calculation. First, the equivalent roughness of the pipe wall and the cross-sectional parameters of the water passage for the upstream and downstream pipe sections are obtained. These cross-sectional parameters include the hydraulic radius of the pipeline and the initial average flow velocity within the pipe. These parameters characterize the frictional characteristics of the pipe wall and the geometric characteristics of the flow. Based on these fundamental hydraulic parameters, the hydraulic gradient along the pipeline is obtained by combining the standard hydraulic gradient calculation logic. This gradient reflects the head loss intensity along the pipeline during transport. This method simultaneously collects real-time water temperature data within the pipe and calculates the corresponding kinematic viscosity based on the objective law of water properties changing with temperature. The kinematic viscosity is a necessary fundamental parameter for determining the flow regime and calculating flow resistance. Combining the kinematic viscosity, the initial flow velocity, and the hydraulic radius of the pipeline, the Reynolds number, which characterizes the flow state, is calculated. Based on the equivalent roughness of the pipe wall, the hydraulic radius of the pipe, and the Reynolds number of the flow, the pipe friction coefficient is obtained by combining empirical calculation logic of pipe friction resistance. This coefficient comprehensively reflects the combined hindering effect of pipe wall friction and water flow turbulence on water transmission. This method presets a fixed resistance coefficient threshold as the operating condition discrimination standard. When the calculated friction coefficient is greater than the preset threshold, it indicates that the current pipe friction loss and water flow turbulence have a significant impact, and there is a significant deviation in the initial water flow velocity. In this case, the friction coefficient, the equivalent roughness of the pipe wall, and the hydraulic radius of the pipe are input into a pre-trained random forest regression model. The model outputs a velocity correction coefficient adapted to the current hydraulic conditions to correct the initial average water flow velocity, obtaining the corrected target transmission velocity. When the friction coefficient is not greater than the threshold, it is determined that the current pipe resistance has a small impact, the initial water flow velocity meets the calculation accuracy requirements, and the initial average water flow velocity is directly used as the target transmission velocity. Finally, based on the actual pipeline spatial distance between upstream and downstream pipe sections and the target transmission speed after correction, the accurate water flow transmission time delay is calculated, and the time delay parameters required for upstream and downstream flow timing alignment are solved.
[0108] This embodiment addresses the insufficient accuracy of traditional fixed-velocity calculations for transmission delay by establishing a dynamic velocity correction mechanism based on hydraulic resistance characteristics and changes in water temperature and physical properties. Traditional delay calculations often rely on fixed empirical velocity, neglecting actual operating conditions such as pipe wall roughness wear, cross-sectional geometric constraints, water temperature and viscosity variations, and turbulent flow states, leading to inherent systematic errors in timing alignment. This invention introduces quantitative calculations of multiple hydraulic parameters, including hydraulic gradient, Reynolds number, and friction factor, comprehensively covering the influence of pipe geometry, water body physical characteristics, and water flow characteristics on the water delivery velocity, achieving accurate quantification of water transmission resistance. Simultaneously, a threshold discrimination mechanism distinguishes between conventional low-resistance and high-resistance disturbance conditions. Under complex resistance conditions, a machine learning model is employed to perform adaptive velocity correction, avoiding delay deviations caused by a single fixed velocity. This method enables dynamic adaptive updating of water delivery speed based on pipeline status, water body status, and flow status, effectively improving the calculation accuracy of water flow transmission delay. It provides accurate time series basic data for subsequent flow sequence time alignment, flow difference calculation, and leakage feature extraction, reducing detection errors caused by time series misalignment from the source and significantly improving the overall accuracy and operational adaptability of water plant pipeline micro-leakage detection.
[0109] In one embodiment, time offset compensation is performed on the initial sampling time of the first traffic sequence based on the transmission time delay to obtain a third traffic sequence aligned with the time axis of the second traffic sequence. This may include the following steps:
[0110] Step S301: Determine the timing offset of the first traffic sequence relative to the second traffic sequence based on the transmission time delay.
[0111] Step S302: Input the original sampling time, corresponding flow value and time series offset of the first flow sequence into the pre-trained random forest interpolation model to perform time series interpolation reconstruction on the first flow sequence, and obtain a reconstructed flow sequence with a time resolution higher than the original sequence.
[0112] Optionally, machine learning interpolation can be used to address the issues of sparse original flow sampling intervals and inaccurate matching of sampling points after offset, achieving refined reconstruction of upstream flow time-series curves. Conventional fixed sampling devices output discrete time-series data with fixed sampling intervals and limited resolution. Direct time offsetting results in a large number of missing data points in time gaps, making precise alignment at each time step impossible. This invention employs an offline pre-trained random forest time-series interpolation model. The model uses the original sampling time, corresponding flow value, and time-series offset as joint input features to learn the nonlinear evolution law of continuous flow changes over time. Through multi-decision tree ensemble regression prediction, the model fits and interpolates the flow values at unknown times between the original discrete sampling points, completing the continuous flow information within the offset gaps. Ultimately, it generates a reconstructed flow sequence with higher time-series sampling density and more continuous change curves, effectively improving the temporal resolution of upstream flow time-series data.
[0113] Let the upstream original discrete flow time series sample be... ,in This is the original sampling time. For the corresponding flow rate value, This represents the time series offset. The random forest model uses... Using the input feature set, multiple decision trees are trained in parallel and their results are fused to optimize the encryption time. Output predicted flow value This ultimately forms a high-density reconstructed flow sequence. .
[0114] Step S303: Obtain the sampling clock reference for the second flow sequence; the sampling clock reference includes the unified sampling timestamp system and fixed sampling interval of the downstream node flow meters.
[0115] Step S304: Map the reconstructed flow sequence to the time axis and extract the flow value at the corresponding time according to the sampling clock reference to generate an initial aligned sequence.
[0116] Based on a unified downstream sampling clock reference, all downstream standard sampling time points are determined. All standard time points are traversed, and the corresponding flow values are matched in the high-resolution reconstructed flow sequence. For cases where a standard time point happens to exist within a reconstructed sampling point, the value is directly taken. For cases where the standard time point lies between reconstructed sampling points, the value is accurately taken based on the continuous variation pattern fitted by the model, completing time-by-time data matching. Finally, an initial alignment sequence that perfectly matches the downstream clock system in terms of time sequence dimension is generated, achieving preliminary time sequence synchronization of upstream and downstream flow data.
[0117] Step S305: Verify whether each sampling time of the initial alignment sequence corresponds one-to-one with the sampling time of the second flow sequence. If they match, then determine the initial alignment sequence as the third flow sequence.
[0118] Specifically, based on the solved water flow transmission time delay, high-precision time-series registration and data alignment of upstream and downstream flow sequences are achieved. First, based on the transmission time delay, the overall time-series offset of the upstream first flow sequence relative to the downstream second flow sequence is quantified. This offset characterizes the inherent time deviation between the two flow sequences due to the water flow transmission lag. To address the problems of low sampling resolution in the original flow sequence and the inability to accurately match sampling points after offset, this invention inputs the original sampling time, corresponding flow value, and determined time-series offset of the first flow sequence into a pre-trained random forest interpolation model. The model performs time-series interpolation and curve reconstruction on the discrete original flow data, supplementing it with continuous flow change data and generating a reconstructed flow sequence with a higher time resolution than the original acquisition sequence. Subsequently, the sampling clock reference corresponding to the downstream node flowmeter is obtained. This clock reference includes a unified downstream timestamp system and a fixed sampling interval, serving as a standard reference system for global time-series alignment. Using the downstream sampling clock reference as a unified standard, global time-axis mapping is performed on the reconstructed high-resolution flow sequence. Flow values at corresponding times are extracted one by one according to the fixed downstream sampling time, generating an initial alignment sequence with preliminary matching. Finally, a consistency check is performed on all sampling times of the initial alignment sequence to determine whether each sampling time corresponds one-to-one with the sampling time of the second flow sequence. Under the condition that the times are completely matched, the initial alignment sequence is determined as the third flow sequence that has completed spatiotemporal correction, thereby achieving accurate time synchronization of upstream and downstream flow data.
[0119] This embodiment addresses the technical problems of traditional fixed timestamp alignment methods, such as sampling point misalignment, low timing matching accuracy, and inability to adapt to the lag conditions in hydraulic transmission. Traditional timing alignment relies solely on direct offset matching of original sampling points. Limited by the fixed sampling interval of the equipment, it cannot cover the gradual flow change information within the offset gap, easily causing distortion in flow difference calculations and affecting the accuracy of subsequent leakage feature extraction. This invention improves the temporal resolution of the upstream flow sequence through machine learning interpolation reconstruction, compensating for data gaps caused by hardware sampling intervals, and fully reconstructing the flow timing change process. Simultaneously, it completes global mapping and time verification using a unified downstream sampling clock reference, ensuring a unified timing reference for upstream and downstream flow data and strict correspondence of sampling times. This timing alignment method adapts to the dynamic transmission characteristics of pipeline water flow, eliminates system errors caused by asynchronous sampling and timing offsets, and improves the accuracy and reliability of flow data matching.
[0120] In one embodiment, a dynamic time warping algorithm is used to extract time-series fluctuation features from the target flow difference sequence. Extracting the difference feature sequence, which characterizes the magnitude and rate of change of the flow difference, may include the following steps:
[0121] Step S401: Obtain the denoised target flow difference sequence and the normal operating condition baseline flow difference sequence.
[0122] Let the denoised target flow difference sequence be:
[0123]
[0124] The normal operating condition baseline flow rate difference sequence is as follows:
[0125]
[0126] In the formula, The length of the target sequence. The length of the reference sequence; For the target sequence The flow rate difference at each sampling time, For the benchmark sequence number The flow rate difference at each sampling time.
[0127] Step S402: The dynamic time warping algorithm is used to align the target flow difference sequence and the baseline flow difference sequence in time, and the optimal time warping path is obtained.
[0128] Indicatively, for any two sampling points in the sequence and The timing deviation distance between the two is defined as:
[0129]
[0130] In the formula, For the target sequence Point and reference sequence The absolute deviation distance of the point.
[0131] Build size is Cumulative cost matrix The matrix elements are calculated using the following recursive formula:
[0132]
[0133] Boundary conditions: The elements in the first row and first column of the matrix are solved recursively according to the one-way cumulative rule.
[0134] By backtracking the cumulative cost matrix, the optimal time warped path that satisfies the monotonicity and continuity constraints is obtained:
[0135]
[0136] Constraints:
[0137] Monotonicity: and .
[0138] Continuity: and .
[0139] In the formula, The total length of the optimal path. For the first on the path Each alignment point corresponds to a target sequence index. , benchmark sequence index .
[0140] Step S403: Based on the optimal time warping path, calculate the deviation amplitude of the target sequence relative to the reference sequence at each alignment time, and generate the fluctuation amplitude sequence.
[0141] Based on the time alignment relationship of the optimal path, the deviation magnitude of the target sequence relative to the reference sequence is calculated point by point to generate the fluctuation amplitude sequence:
[0142]
[0143] Among them, the first The fluctuation amplitude at each alignment time is:
[0144]
[0145] In the formula, For the first At each alignment moment, the absolute fluctuation amplitude of the target flow difference relative to the normal baseline.
[0146] Step S404: Calculate the rate of change of amplitude between adjacent moments in the fluctuation amplitude sequence to obtain the rate change sequence.
[0147] By performing a difference operation on the fluctuation amplitude sequence between adjacent time points, the rate of change of amplitude per unit time is calculated to obtain the rate change sequence:
[0148]
[0149] Among them, the first The rate of change of amplitude at time t is:
[0150]
[0151] In the formula, For the first The rate of change of the magnitude of the flow rate difference at any given time; This is a fixed sampling time interval for the aligned sequence.
[0152] Step S405: When there is a time period in the rate change sequence that exceeds the preset rate of change threshold, the fluctuation amplitude sequence corresponding to the time period and the rate change sequence are fused to generate the difference feature sequence of the corresponding time period.
[0153] The preset rate of change threshold is ,when The system determines that the given moment belongs to an abnormal fluctuation period; it then extracts the fluctuation amplitude and rate of change from all moments within the abnormal period, concatenates these features, and generates a difference feature sequence. , of which The feature vector at time step is:
[0154]
[0155] The final difference feature sequence is:
[0156]
[0157] In the formula, These are the start and end time indexes for the abnormal fluctuation period, respectively.
[0158] Specifically, the target flow difference sequence after noise reduction is first read, while a preset normal operating condition baseline flow difference sequence is retrieved. The baseline flow difference sequence is standard flow fluctuation data collected under stable operating conditions with no pipeline leakage, serving as a reference standard for normal fluctuations. For the two time series sequences with inconsistent lengths and fluctuation rhythms, a dynamic time warping algorithm is used to perform flexible time alignment. The algorithm iterates through the time matching relationship between the two sequences using dynamic programming to find the optimal time warping path that satisfies the constraints of time continuity and monotonicity, achieving morphological matching and time correction between the target flow difference sequence and the baseline flow difference sequence. Based on the point-by-point matching relationship corresponding to the optimal time warping path, the characteristic moments of the two sequences are aligned, and the deviation amplitude of the target flow difference relative to the baseline flow difference at each alignment moment is calculated. This is then organized according to the time sequence to generate a fluctuation amplitude sequence that characterizes the strength of abnormal fluctuations. Based on the fluctuation amplitude sequence, the degree of amplitude change per unit time is calculated using the amplitude difference between adjacent time nodes, resulting in a rate change sequence that characterizes the speed of flow fluctuation evolution. This invention uses a preset fixed rate of change threshold to distinguish between normal slow fluctuations and abrupt abnormal fluctuations. It traverses all time periods of the rate change sequence, filters out abnormal time periods where the rate value exceeds the threshold, extracts the fluctuation amplitude data and rate change data of the corresponding time period, performs joint feature fusion, and constructs a difference feature sequence that simultaneously includes fluctuation intensity and dynamic change characteristics, thus completing the accurate extraction of multidimensional features of leakage anomalies.
[0159] This embodiment utilizes the flexible temporal matching capability of the dynamic time warping algorithm to solve the feature comparison distortion problems caused by nonlinear scaling, fluctuation time sequence misalignment, and inconsistent sequence lengths in flow time series data. Traditional single-threshold, single-dimensional feature extraction methods rely solely on the magnitude of instantaneous differences to determine anomalies, failing to distinguish between steady-state deviations, slow operating condition fluctuations, and dynamic anomalies caused by leakage. The gradual changes in minute leakage characteristics are easily masked. This invention simultaneously extracts two-dimensional features: fluctuation amplitude and rate of change, respectively covering the static intensity and dynamic evolution trend of the anomaly, achieving a comprehensive characterization of leakage anomalies. By filtering abnormal periods using a rate threshold and then performing feature fusion, normal, stable fluctuation data is effectively eliminated, while high-value anomaly feature information is retained, reducing computational interference in subsequent classification and identification. This technical process improves the depth and completeness of temporal feature mining, enhances the extraction capability of weak features from minute and slowly changing leakage, and effectively distinguishes between normal operating condition fluctuations and true leakage anomalies.
[0160] In one embodiment, the difference features corresponding to the abnormal fluctuation segments are input into a pre-trained support vector machine classification model for classification and identification to determine the true leakage state corresponding to the abnormal fluctuation segments and output the leakage detection results. This may include the following steps:
[0161] Step S501: Obtain the difference features corresponding to the abnormal fluctuation segments in the target flow difference sequence; the difference features include fluctuation amplitude features and rate change features.
[0162] Optionally, the difference feature is composed of the fluctuation amplitude feature and rate change feature extracted by dynamic time warping. Let the alignment time index interval corresponding to the abnormal fluctuation period be... During the period The original two-dimensional features at each alignment time are:
[0163]
[0164] In the formula, For the first The fluctuation amplitude at any given time, For the first The rate of change of amplitude at any given time.
[0165] Step S502: Perform dimension normalization on the difference features to construct a multidimensional feature vector corresponding to the abnormal fluctuation segment.
[0166] To eliminate the dimensional differences between different feature dimensions and improve the convergence speed and accuracy of the classification model, a min-max normalization method is used to linearly map each feature dimension to... The normalization formula for the interval is:
[0167]
[0168] In the formula, For the first Time of the first Normalized values of dimensional features; The original feature values of the corresponding dimension ( Corresponding fluctuation amplitude, (corresponding rate change);
[0169] , These are the maximum and minimum values of the feature in that dimension within the model training set, respectively.
[0170] After normalization, a multidimensional feature vector set of abnormal fluctuation segments is constructed: .
[0171] Step S503: Input the multidimensional feature vector into the pre-trained support vector machine binary classification model for calculation, and output the initial leakage judgment result and classification confidence of the abnormal fluctuation segment.
[0172] Step S504: If the classification confidence level is greater than the confidence level threshold, the initial leakage judgment result is determined as the actual leakage state.
[0173] Step S505: If the classification confidence level is not greater than the confidence level threshold, then the abnormal fluctuation segment is determined to be a normal operating condition fluctuation.
[0174] The initial leakage determination result is output through the sign of the decision function: when At that time, it was initially determined to be a leak; when Initially, the fluctuation was considered normal. To quantify the reliability of the classification results, the decision values were mapped to the classification hyperplane using the Sigmoid function, based on the geometric margin between the feature vectors and the classification hyperplane. The interval is used to obtain the classification confidence score.
[0175] Step S506: When the condition is determined to be a real leakage state, the corresponding target leakage level is obtained by matching the fluctuation amplitude characteristics of the abnormal fluctuation segment with the preset leakage level mapping rule.
[0176] When a genuine leakage is identified, the average fluctuation amplitude during the abnormal fluctuation period is first calculated:
[0177]
[0178] Based on the average fluctuation amplitude, leakage levels are matched using a preset multi-level threshold mapping rule. The hierarchical mapping rule is as follows:
[0179]
[0180] In the formula, To match the target leakage level; The preset graded amplitude threshold is pre-calibrated based on the rated flow of the water plant pipeline and operation and maintenance management standards; These correspond to four levels: minor leakage, slight leakage, moderate leakage, and severe leakage, each with a different priority for maintenance and handling.
[0181] Step S507: Obtain the spatial coordinates of the pipeline interval corresponding to the upstream and downstream monitoring nodes to which the abnormal fluctuation segment belongs.
[0182] Step S508: Combine the target leakage level, the spatial coordinates of the pipeline section, and the time interval corresponding to the abnormal fluctuation segment to generate and output leakage detection results including leakage location, leakage level, and time of occurrence.
[0183] Obtain the set of spatial coordinates of the pipeline section corresponding to the upstream and downstream monitoring nodes to which the abnormal fluctuation segment belongs. Combined with the time intervals corresponding to abnormal fluctuations With the target leakage level Generate structured leakage detection results:
[0184]
[0185] The leakage detection results include the spatial location of the leakage, the severity level of the leakage, and the time range of the occurrence. These results can be directly pushed to the water plant operation and maintenance monitoring terminal to support accurate inspection and graded handling.
[0186] Specifically, the difference features corresponding to each abnormal fluctuation segment within the target flow difference sequence are first extracted. These difference features uniformly include two types of basic data: fluctuation amplitude features representing the strength of loss and rate change features representing the speed of abnormal evolution. Since the physical dimensions and numerical ranges of these two types of features differ significantly, directly inputting them into the model would cause an imbalance in classification weights. Therefore, dimensionality normalization is performed on all difference features to eliminate dimensional interference. The two sets of processed features are then combined to construct a multi-dimensional feature vector corresponding to the abnormal fluctuation segment. This multi-dimensional feature vector is input into an offline-trained support vector machine binary classification model for computation. The model outputs the initial leakage judgment label and quantified classification confidence score for the abnormal segment. The confidence score is used to measure the reliability of the classification result. A pre-set confidence threshold is used as the boundary for determining whether a leak is genuine or not. If the calculated classification confidence score is greater than this threshold, the current classification result is considered sufficiently credible, and the initial leakage judgment result is recognized as a genuine leakage state. If the classification confidence score is not greater than this threshold, the fluctuation is determined to be caused by normal operating conditions such as water usage regulation and pipeline pressure disturbance, and is not considered pipeline leakage. When the identification result indicates a genuine leak, a preset leak level mapping rule is invoked, and the unique target leak level is obtained by matching the fluctuation amplitude characteristics of the abnormal segment. This level quantifies the severity of the leak. Simultaneously, the upstream and downstream monitoring nodes corresponding to the abnormal fluctuation segment are read, and the spatial coordinates of the pipe section between the two sets of nodes are retrieved. These coordinates are used to locate the physical pipe section where the leak occurred. Finally, the target leak level, the spatial coordinates of the pipe section, and the complete time interval corresponding to the abnormal fluctuation segment are integrated to generate and output a structured leak detection result. The detection result fully includes three core pieces of information: the location of the leak, the severity level of the leak, and the duration of the leak.
[0187] This embodiment addresses the shortcomings of traditional leak identification methods, which rely solely on single threshold judgments, cannot quantify anomaly confidence levels, and lack tiered location output. By normalizing dimensions to unify the data distribution of different features, it avoids the reduction in classification model accuracy due to dimensional differences and improves the utilization efficiency of multi-dimensional features. It utilizes a support vector machine model to perform nonlinear feature classification and introduces a confidence threshold for secondary screening, effectively filtering low-confidence false anomaly signals and significantly reducing the probability of false leak alarms under complex on-site conditions. After identifying a real leak, this solution quantifies the leak level based on fluctuation amplitude, providing maintenance personnel with differentiated inspection and handling guidelines, moving beyond a simple conclusion of whether or not a leak exists. Simultaneously, it binds pipeline spatial coordinates with the anomaly time interval, achieving synchronous output of three-dimensional information on leak fault time, space, and severity.
[0188] In one embodiment, the support vector machine binary classification model uses normal operating condition fluctuation samples and leakage samples as the training set, and employs a Gaussian radial basis kernel function to map to a high-dimensional feature space to solve for the optimal classification hyperplane. Its decision function is:
[0189]
[0190] in, This represents the total number of support vectors obtained during training. For the corresponding number Lagrange multipliers of the support vectors; Here are the labels for the training samples, where Mark the leaked samples, Label samples exhibiting fluctuations under normal operating conditions; The bias term for the optimal classification hyperplane; The Gaussian kernel function is expressed as:
[0191] in The kernel width parameter. Let be the 2-norm of the vector.
[0192] This embodiment employs a support vector machine binary classification model with a Gaussian radial basis function kernel to identify leakage anomalies. The kernel function maps low-dimensional nonlinear difference features to a high-dimensional linearly separable space, constructing an optimal classification hyperplane to accurately separate fluctuating samples from leakage samples. Compared to traditional linear classification and fixed threshold discrimination methods, this model effectively fits the nonlinear correlations of multidimensional features such as flow fluctuation amplitude and rate of change, fully exploring the latent feature differences of minute leaks. It possesses stronger feature discrimination capabilities for complex, non-stationary water plant flow time-series data, effectively improving the generalization ability and adaptability of leakage anomaly identification.
[0193] In one embodiment, the classification confidence score is calculated using the following formula:
[0194]
[0195] in, The classification confidence score is represented by a higher value, indicating greater reliability of the classification result.
[0196] This embodiment transforms the model's decision output into quantifiable classification confidence scores through a Sigmoid mapping method, achieving a numerical representation of the reliability of the classification results. Traditional support vector machines only output binary judgment results, failing to distinguish between highly reliable anomalies and suspected false anomalies. This embodiment performs secondary verification of the classification results through quantified confidence scores, effectively filtering out interference from operating conditions with high feature similarity and low discrimination confidence, avoiding misjudgments and false alarms caused by a single hard classification result, and further improving the accuracy and stability of pipeline leakage detection results.
[0197] In one embodiment, such as Figure 2 As shown, this application also provides a water plant equipment leakage detection system based on spatiotemporal feature fusion, the system may include:
[0198] The transmission delay calculation module 601 is used to obtain the first flow sequence of the upstream node and the second flow sequence of the downstream node in the water transmission pipeline, and at the same time obtain the pipeline spatial distance between the upstream and downstream nodes and the average transmission speed of the water flow in the pipe; it is also used to calculate the transmission time delay of the water flow from the upstream node to the downstream node based on the pipeline spatial distance between the upstream and downstream nodes and the average transmission speed of the water flow in the pipe.
[0199] The difference sequence construction module 602 is used to perform time offset compensation on the initial sampling time of the first flow sequence based on the transmission time delay to obtain a third flow sequence aligned with the time axis of the second flow sequence; it is also used to calculate the flow difference between the third flow sequence and the second flow sequence at the same compensated sampling time step by step to generate a continuous initial flow difference sequence.
[0200] The difference feature extraction module 603 is used to perform noise filtering and smoothing on the initial flow difference sequence using the Kalman filter algorithm to obtain the denoised target flow difference sequence; it is also used to extract the time-series fluctuation features of the target flow difference sequence using the dynamic time warping algorithm to extract the difference feature sequence that characterizes the magnitude and rate of change of the flow difference.
[0201] The leakage status determination module 604 is used to compare the fluctuation amplitude features in the difference feature sequence with the normal fluctuation threshold. If the fluctuation amplitude features exceed the normal fluctuation threshold, the corresponding time period in the target flow difference sequence is located and marked as an abnormal fluctuation segment. It is also used to input the difference features corresponding to the abnormal fluctuation segment into a pre-trained support vector machine classification model for classification and identification, determine the true leakage status corresponding to the abnormal fluctuation segment, and output the leakage detection result.
[0202] The aforementioned water plant equipment leakage detection system based on spatiotemporal feature fusion comprises a transmission delay calculation module, a difference sequence construction module, a difference feature extraction module, and a leakage status determination module, working together to form a complete automated leakage detection data processing chain. The transmission delay calculation module is responsible for basic data acquisition and physical delay calculation. It collects two flow sequences from upstream and downstream nodes of the water pipeline, simultaneously acquiring the spatial distance of the pipe section and the average transmission velocity of the water flow within the pipe. Based on the hydraulic transmission characteristics of the pipeline, it calculates the transmission time delay between upstream and downstream flows, providing basic parameters for time-series data correction. The difference sequence construction module, relying on the calculated transmission time delay, compensates for the time-series offset of the upstream flow sequence's sampling time, aligning the time axes of the upstream and downstream flow sequences to obtain a flow sequence with a unified time-series benchmark. Through time-by-time flow difference calculation, it generates a continuous and complete initial flow difference sequence, quantifying the real-time flow loss during pipeline water transmission. The difference feature extraction module is responsible for data denoising and deep feature mining. It uses a Kalman filter algorithm to remove acquisition noise and operational disturbances from the initial flow difference sequence, obtaining a stable and reliable target flow difference sequence. Then, a dynamic time warping algorithm is used to extract time-series fluctuation features, acquiring a multi-dimensional difference feature sequence that characterizes the amplitude and rate of change of the flow difference. The leakage status determination module performs anomaly screening and intelligent identification. By comparing the difference feature sequence with a preset normal fluctuation threshold, it locates and marks abnormal fluctuation segments that exceed the fluctuation range. The multi-dimensional difference features of these abnormal segments are input into a pre-trained support vector machine classification model for accurate classification and identification, distinguishing between true leakage status and normal operational fluctuations, and finally outputting complete pipeline leakage detection results.
[0203] This embodiment, through a multi-module, layered, and interconnected architecture, standardizes the entire process logic from raw data acquisition, time-series deviation correction, data noise reduction and purification, multi-dimensional feature mining to intelligent leakage detection. It solves the technical problems of traditional leakage detection, such as asynchronous timing, high data noise interference, limited feature representation, and difficulty in distinguishing between genuine and false anomalies. The modules are tightly integrated, and the data flow is closed-loop and controllable. Physical hydraulic time delay correction eliminates timing matching errors caused by pipeline spatial transmission lag. Filtering improves the signal-to-noise ratio of time-series data, and dynamic time-series feature mining overcomes the limitations of traditional fixed-threshold detection, enabling precise capture of the dynamic evolution characteristics of minute leaks. Simultaneously, machine learning classification mechanisms achieve refined identification of abnormal signals, effectively reducing the leakage and false detection rates under complex water plant operating conditions. The entire system has a clear hierarchical architecture and strong data processing logic, adaptable to the changing operating conditions of water pipelines, achieving automated, accurate, and stable detection of water pipeline leakage status, meeting the practical application needs of refined operation and maintenance in smart water plants.
[0204] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0205] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps of the water plant equipment leakage detection method based on spatiotemporal feature fusion as described above.
[0206] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.
[0207] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The components described as separate parts may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this disclosure according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0208] The above-described embodiments are merely illustrative of several implementation methods of the embodiments of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the embodiments of this application, and these modifications and improvements all fall within the protection scope of the embodiments of this application.
Claims
1. A method for detecting leakage in water plant equipment based on spatiotemporal feature fusion, characterized in that, The method includes: The first flow sequence of the upstream node and the second flow sequence of the downstream node of the water transmission pipeline are obtained, and the spatial distance between the upstream and downstream nodes and the average transmission speed of the water flow in the pipeline are also obtained. The transmission time delay of water flow from the upstream node to the downstream node is calculated based on the spatial distance between the upstream and downstream nodes and the average transmission speed of the water flow in the pipe. Based on the transmission time delay, time offset compensation is performed on the initial sampling time of the first traffic sequence to obtain a third traffic sequence that is aligned with the time axis of the second traffic sequence; The flow difference between the third flow sequence and the second flow sequence at the same compensated sampling time is calculated time by time to generate a continuous initial flow difference sequence; The initial flow difference sequence is noise-filtered and smoothed using the Kalman filter algorithm to obtain the denoised target flow difference sequence. The dynamic time warping algorithm is used to extract the temporal fluctuation features of the target flow difference sequence, and the difference feature sequence representing the magnitude and rate of change of the flow difference is extracted. The fluctuation amplitude features in the difference feature sequence are compared with the normal fluctuation threshold. If the fluctuation amplitude features exceed the normal fluctuation threshold, the corresponding time period in the target flow difference sequence is located and marked as an abnormal fluctuation segment. The difference features corresponding to the abnormal fluctuation segments are input into a pre-trained support vector machine classification model for classification and identification to determine the true leakage state corresponding to the abnormal fluctuation segments and output the leakage detection results.
2. The method according to claim 1, characterized in that, The step of calculating the transmission time delay of water flow from the upstream node to the downstream node based on the pipe spatial distance between the upstream and downstream nodes and the average transmission speed of the water flow in the pipe includes: Obtain the equivalent roughness of the pipe wall and the cross-sectional parameters of the water passage between the upstream and downstream nodes; The cross-sectional parameters of the water passage include the hydraulic radius of the pipe and the initial average transmission velocity of the water flow in the pipe. Based on the equivalent roughness of the pipe wall and the parameters of the water passage section, the hydraulic gradient along the pipeline is calculated using the hydraulic gradient calculation formula: in, The hydraulic gradient along the pipeline; The initial average transmission velocity of the water flow inside the pipe; This refers to the equivalent roughness of the pipe wall; The hydraulic radius of the pipeline's cross-section; The real-time water temperature parameters of the water in the pipeline are obtained, and the fluid kinematic viscosity is calculated based on the empirical relationship between the kinematic viscosity of clean water and water temperature. The Reynolds number of the water flow is calculated by combining the fluid kinematic viscosity, the initial average water flow velocity in the pipe, and the hydraulic radius of the pipe cross-section. in, The Reynolds number of the water flow; The initial average transmission velocity of the water flow inside the pipe; The hydraulic radius of the pipeline's cross-section; The fluid's kinematic viscosity; Based on the equivalent roughness of the pipe wall, the hydraulic radius of the pipe cross-section, and the Reynolds number of the water flow, the pipe friction coefficient is calculated using an empirical formula for the friction coefficient. in, This refers to the friction coefficient along the pipeline. This refers to the equivalent roughness of the pipe wall; For pipe diameter, ; If the friction coefficient of the pipeline is greater than the friction coefficient threshold, the friction coefficient of the pipeline, the equivalent roughness of the pipe wall and the hydraulic radius of the pipeline cross section are input into the pre-trained random forest regression model, and the flow velocity correction coefficient is output. The initial average transmission velocity of the water flow in the pipe is corrected by the flow velocity correction coefficient to obtain the target transmission velocity. If the friction coefficient of the pipeline is not greater than the friction coefficient threshold, then the initial average transmission speed of the water flow in the pipe is directly determined as the target transmission speed. Based on the pipeline spatial distance and the target transmission speed, the transmission time delay of water flow from the upstream node to the downstream node is calculated using the transmission delay formula.
3. The method according to claim 1, characterized in that, The step of compensating for the time offset of the initial sampling time of the first traffic sequence based on the transmission time delay to obtain a third traffic sequence aligned with the time axis of the second traffic sequence includes: Based on the transmission time delay, determine the time offset of the first traffic sequence relative to the second traffic sequence; The original sampling time, corresponding flow value, and time offset of the first flow sequence are input into a pre-trained random forest interpolation model to reconstruct the first flow sequence by time interpolation, resulting in a reconstructed flow sequence with a higher time resolution than the original sequence. Obtain the sampling clock reference for the second flow sequence; the sampling clock reference includes a unified sampling timestamp system and a fixed sampling interval for the downstream node flow meters; The reconstructed flow sequence is mapped along a time axis and the flow value at the corresponding time is extracted according to the sampling clock reference to generate an initial aligned sequence. Verify whether each sampling time of the initial alignment sequence corresponds one-to-one with the sampling time of the second flow sequence. If they match, then the initial alignment sequence is determined as the third flow sequence.
4. The method according to claim 1, characterized in that, The dynamic time warping algorithm is used to extract time-series fluctuation features from the target flow difference sequence, extracting a difference feature sequence that characterizes the magnitude and rate of change of the flow difference, including: Obtain the denoised target flow difference sequence and the normal operating condition baseline flow difference sequence; The target flow difference sequence and the baseline flow difference sequence are time-aligned using a dynamic time warping algorithm to obtain the optimal time warping path. Based on the optimal time warping path, the deviation magnitude of the target sequence relative to the reference sequence at each alignment time is calculated to generate a fluctuation amplitude sequence. Calculate the rate of change of amplitude between adjacent moments in the fluctuation amplitude sequence to obtain the rate change sequence; When there is a time period in the rate change sequence that exceeds a preset rate change threshold, the fluctuation amplitude sequence corresponding to the time period is fused with the rate change sequence to generate a difference feature sequence for the corresponding time period.
5. The method according to claim 1, characterized in that, The step of inputting the difference features corresponding to the abnormal fluctuation segments into a pre-trained support vector machine classification model for classification and identification, determining the true leakage state corresponding to the abnormal fluctuation segments, and outputting leakage detection results includes: Obtain the difference features corresponding to the abnormal fluctuation segments in the target flow difference sequence; the difference features include fluctuation amplitude features and rate change features; The difference features are normalized to obtain a multidimensional feature vector corresponding to the abnormal fluctuation segment. The multidimensional feature vector is input into a pre-trained support vector machine binary classification model for computation, and the initial leakage judgment result and classification confidence corresponding to the abnormal fluctuation segment are output. If the classification confidence level is greater than the confidence level threshold, then the initial leakage determination result is determined as the actual leakage state; If the classification confidence level is not greater than the confidence level threshold, then the abnormal fluctuation segment is determined to be a normal operating condition fluctuation. When the actual leakage state is determined, the corresponding target leakage level is obtained by matching the fluctuation amplitude characteristics of the abnormal fluctuation segment with the preset leakage level mapping rule. Obtain the spatial coordinates of the pipeline section corresponding to the upstream and downstream monitoring nodes to which the abnormal fluctuation segment belongs; By combining the target leakage level, the spatial coordinates of the pipeline section, and the time interval corresponding to the abnormal fluctuation segment, leakage detection results including leakage location, leakage level, and time of occurrence are generated and output.
6. The method according to claim 5, characterized in that, The support vector machine binary classification model uses normal operating condition fluctuation samples and leakage samples as the training set. It employs a Gaussian radial basis kernel function to map to a high-dimensional feature space to solve for the optimal classification hyperplane. Its decision function is: in, This represents the total number of support vectors obtained during training. For the corresponding number Lagrange multipliers of the support vectors; Here are the labels for the training samples, where Mark the leaked samples, Label samples exhibiting fluctuations under normal operating conditions; The bias term for the optimal classification hyperplane; The Gaussian kernel function is expressed as: in The kernel width parameter. Let be the 2-norm of the vector.
7. The method according to claim 5, characterized in that, The classification confidence score is calculated using the following formula: in, The classification confidence score is represented by a higher value, indicating greater reliability of the classification result.
8. A water plant equipment leakage detection system based on spatiotemporal feature fusion, characterized in that, The system includes: The transmission delay calculation module is used to obtain the first flow sequence of the upstream node and the second flow sequence of the downstream node in the water transmission pipeline, and at the same time obtain the pipeline spatial distance between the upstream and downstream nodes and the average transmission speed of the water flow in the pipe; it is also used to calculate the transmission time delay of the water flow from the upstream node to the downstream node based on the pipeline spatial distance between the upstream and downstream nodes and the average transmission speed of the water flow in the pipe. The difference sequence construction module is used to perform time offset compensation on the initial sampling time of the first flow sequence based on the transmission time delay to obtain a third flow sequence aligned with the time axis of the second flow sequence; it is also used to calculate the flow difference between the third flow sequence and the second flow sequence at the same compensated sampling time step by step to generate a continuous initial flow difference sequence. The difference feature extraction module is used to perform noise filtering and smoothing on the initial flow difference sequence using the Kalman filter algorithm to obtain the denoised target flow difference sequence; it is also used to perform time-series fluctuation feature extraction on the target flow difference sequence using the dynamic time warping algorithm to extract the difference feature sequence that characterizes the magnitude and rate of change of the flow difference. The leakage status determination module is used to compare the fluctuation amplitude features in the difference feature sequence with the normal fluctuation threshold. If the fluctuation amplitude features exceed the normal fluctuation threshold, the corresponding time period in the target flow difference sequence is located and marked as an abnormal fluctuation segment. It is also used to input the difference features corresponding to the abnormal fluctuation segment into a pre-trained support vector machine classification model for classification and identification, determine the true leakage status corresponding to the abnormal fluctuation segment, and output the leakage detection result.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.
