A water supply network leakage monitoring method
Patent Information
- Application Number
- CN202411947247.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2026-10-09
AI Technical Summary
这种方法具有实时监测、自动报警的优点,但受管道材质、水流速度等因素的影响较大
[0029]通过上述技术方案,本发明能够自动化的根据采集的数据进行大数据分析,已找出对应的漏损位置,不需要人力物力,进一步本发明通过能够提取局部结构特征结合节点特征的深度学习模型,来进行供水管网的漏损位置的检测,对于深度学习模型的可解释性较差,无法有效表征具体的漏损量的问题,通过具体的优化算法,结合仿真模型进行相关的数据仿真,来查找具体的漏损量和漏损位置,根据上述技术方案,本发明能够有效的对供水管网进行有效的监测,为供水管网的管理提供较好的基础。
Smart Images

Figure CN122881010A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of pipeline network detection technology, and in particular relates to a method for monitoring leakage in water supply pipeline networks. Background Technology
[0002] With the acceleration of urbanization and population growth, the scale of urban water supply networks is constantly expanding, and the length and number of water supply pipelines are increasing year by year. However, due to various reasons such as pipeline aging, construction quality, and external damage, leakage problems in water supply networks are becoming increasingly prominent, becoming an important factor restricting urban water supply security and affecting water resource utilization efficiency. Therefore, carrying out leakage monitoring of water supply networks and timely detection and repair of leakage points are of great significance for ensuring water supply security and improving water resource utilization efficiency.
[0003] Water supply network leakage monitoring refers to the real-time monitoring and location of leaks in the water supply network using various technologies and methods, enabling timely repair measures. In recent years, with the continuous development of technologies such as the Internet of Things, big data, and cloud computing, water supply network leakage monitoring technology has also made significant progress, providing strong support for the intelligent and refined management of water supply networks.
[0004] Currently, the main methods for monitoring leakage in water supply networks include the following:
[0005] Auditory detection: This is one of the traditional methods of leak detection, which mainly relies on the experience and skills of patrol personnel to identify whether there is a leak in the pipeline using listening equipment. However, this method is greatly affected by environmental noise and the experience of patrol personnel, has low efficiency, and is difficult to find leaks buried deep underground.
[0006] Instrument detection method: This method uses specialized instruments, such as leak detectors or leak listeners, to accurately detect suspected leaks in pipelines. This method offers high sensitivity and accuracy, but it is complex to operate, requires professional personnel, and has costly equipment.
[0007] Radar detection method: This method uses radar technology to detect the condition of underground pipelines. By observing the distribution of underground objects through reflected signals, it can determine whether leaks exist. This method is suitable for detecting large-diameter pipelines and non-metallic pipelines, but the equipment cost is high and it is greatly affected by the underground medium and terrain.
[0008] Sensor technology: By installing vibration sensors or hydrophones on the pipeline, changes in the sound or vibration signals of the water flow inside the pipeline are monitored in real time to determine whether there is a leak. This method has the advantages of real-time monitoring and automatic alarm, but it is greatly affected by factors such as pipeline material and water flow velocity.
[0009] Due to the large scale, wide distribution, and complex structure of water supply networks, leakage monitoring faces the following problems: Implementing water supply network leakage monitoring technology requires a significant investment of manpower, resources, and capital, increasing operating costs; a large number of existing systems cannot be used during leakage monitoring, and traditional network monitoring methods are also inaccurate and ineffective. Summary of the Invention
[0010] To address the aforementioned technical problems, this invention proposes a method for monitoring leakage in water supply networks, thereby resolving the issues present in the prior art.
[0011] To achieve the above objectives, the present invention provides a method for monitoring leakage in a water supply network, comprising:
[0012] Acquire sensing information and sensing node location information of the water supply network, wherein the sensing information of the water supply network includes sound data, pressure data and flow data;
[0013] A detection model is constructed, wherein the detection model is a deep learning model. The detection model is used to process the sensing information and the sensing node location information to generate a predicted leakage location.
[0014] Based on the predicted leakage location, initial parameters are obtained, including the initial leakage location and the initial leakage amount. The initial parameters are then optimized using an optimization algorithm to obtain the leakage location and leakage amount of the water supply network.
[0015] Optionally, the process may further include:
[0016] By using a self-attention mechanism to weight and process sensor information, comprehensive feature data of distributed nodes is generated. The sensor node location information and comprehensive feature data are then integrated to generate the input data for the detection model.
[0017] Optionally, the detection model includes an input layer, a first convolutional layer, a second convolutional layer, a first graph convolutional layer, a second graph convolutional layer, a third graph convolutional layer, and several fully connected layers. The input layer is connected to the first convolutional layer and the first graph convolutional layer, and the first convolutional layer is connected to the second convolutional layer. The outputs of the first graph convolutional layer and the first convolutional layer are added together and then connected to the second graph convolutional layer. The second convolutional layer and the second graph convolutional layer are added together and then connected to the third graph convolutional layer. The third graph convolutional layer is sequentially connected to several fully connected layers.
[0018] Optionally, the input data is processed in the graph convolutional layer using undirected graph data, wherein the undirected graph data includes a set of nodes and a set of edges of the input data.
[0019] Optionally, the detection model can be optimized using a binary crossover loss function.
[0020] Optionally, the optimization algorithm employs an improved moth-to-a-flame algorithm.
[0021] Optionally, the process of optimizing the initial parameters using an optimization algorithm includes:
[0022] Initialize the population, which contains different individuals, where each individual is an initial parameter assigned a different value; determine the number of flames, where each flame is a group of individuals with the highest fitness.
[0023] The fitness is calculated based on the objective function. The fitness values are sorted from largest to smallest. After sorting, the corresponding number of flames is selected according to the sorting result. Based on the number of flames and the sorting result, the current best flame is obtained. The position of the individual is updated. It is determined whether the flame data satisfies the condition that there is only one flame left. If not, the position of the individual is adaptively updated. It is determined whether the maximum number of iterations has been reached. If it has been reached, the optimal moth individual, i.e., the leakage position and leakage amount, is output.
[0024] Optionally, the objective function is the weighted minimum of the differences between different sensing information and the simulated sensing data obtained from individual simulation.
[0025] Optionally, the process may further include:
[0026] Based on the sensor information and sensor node location information, a monitoring image is generated by encoding. The monitoring image is then identified by an image classification model to generate a monitoring result predicting whether a leak has occurred. When the monitoring result indicates that a leak has occurred, the operation of processing the sensor information and sensor node location information through the detection model is initiated.
[0027] Optionally, the image classification model employs a convolutional neural network.
[0028] Compared with the prior art, the present invention has the following advantages and technical effects:
[0029] Through the above technical solution, this invention can automatically perform big data analysis based on the collected data to find the corresponding leakage location without the need for manpower and material resources. Furthermore, this invention uses a deep learning model that can extract local structural features and combine them with node features to detect the leakage location of the water supply network. However, due to the poor interpretability of deep learning models and their inability to effectively represent the specific leakage amount, this invention uses a specific optimization algorithm combined with a simulation model to perform relevant data simulation to find the specific leakage amount and location. According to the above technical solution, this invention can effectively monitor the water supply network and provide a better foundation for the management of the water supply network. Attached Figure Description
[0030] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0031] Figure 1 This is a flowchart of a method according to an embodiment of the present invention;
[0032] Figure 2 This is a flowchart of the optimization algorithm according to an embodiment of the present invention;
[0033] Figure 3 This is a flowchart illustrating the model usage in an embodiment of the present invention. Detailed Implementation
[0034] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0035] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0036] like Figure 1 As shown, this embodiment provides a method for monitoring leakage in a water supply network, including:
[0037] Relevant pipeline engineering data for the water supply network is acquired, including the laying location, pipe material, diameter, and length data during pipeline construction. Based on this data, a simulation model is constructed, incorporating different sensor locations and water supply conditions during detection. Sensors are installed on the water supply network to acquire relevant sensor data, including sound, pressure, and flow data. After the simulation model is built, a deep learning model is used to identify potential leakage locations. Initial parameters are set based on these potential leakage locations, and optimization algorithms are applied to refine these initial parameters to generate the final leakage location and amount. This result guides the repair work of the corresponding water supply network.
[0038] The above technical solution is explained as follows:
[0039] The process of using deep learning models to predict locations where there may be omissions includes:
[0040] First, the location data of the pipeline network sensor data is determined. After determination, a three-dimensional point map is drawn based on the location data, and values are assigned to the distribution points, including sound, pressure, and flow rate, to generate distribution point feature values. A deep learning model is then used to identify these feature values, thus identifying the possible areas and locations of leaks.
[0041] For feature data such as sound data, stress data, and traffic data, an attention mechanism is used to assign weights to these different data types. Specifically, the attention mechanism dynamically assigns weights to the input vector V for each input data type. i Assign weights w i,j i and j represent the labels of different input vectors, and N represents the total number of input vectors for a single data point. Here, score(V i This is used to measure the relative importance of each input data point. After calculating the weighted average, the comprehensive feature data V is obtained. t :
[0042]
[0043]
[0044] The use of attention mechanisms not only effectively preserves the temporal correlation of data, but also avoids information loss that may be caused by data length limitations.
[0045] The comprehensive vector output through the attention mechanism is used to assign feature values to the distribution points. After the assignment is completed, the present invention uses a related deep learning model to learn the correlation between feature data and labels (missing locations) and uses the correlation to predict the possible locations of missing data.
[0046] In the data measured by sensors in three-dimensional space, this invention aims to predict the leakage location by using the graph structure relationship between nodes and the spatial and comprehensive feature data of the nodes themselves. The leakage amount can be obtained through subsequent optimization algorithms. The comprehensive feature data corresponding to the spatial data or position information of different nodes will have different distribution changes due to the occurrence of leakage locations. This distribution change can reflect the leakage location. However, due to the uninterpretability and black-box nature of deep learning, the interpretation of leakage locations is unclear and there are large or small errors. Therefore, in this invention, the leakage location is first obtained through deep learning, and then the final leakage location and data are specifically calculated through an interpretable optimization algorithm.
[0047] In the deep learning model of this invention, which is the detection model, a deep learning model based on graph convolutional layers (GraphLayer) and standard convolutional layers (ConvLayer) identifies the aforementioned distribution point data containing different location information and comprehensive feature data.
[0048] The detection model uses GraphLayer convolutional layers to extract local structural information of distribution points, and ConvLayer convolutional layers to extract features of individual distribution points. Then, the local structural information and single-point feature information are fused to obtain new features. Finally, the newly obtained features are used for recognition and prediction to generate the final prediction result of the missed location. The distribution points are the same nodes measured by different sensors, and their distribution points have three-dimensional spatial coordinates and comprehensive feature data calculated by the aforementioned attention mechanism. Specifically:
[0049] The detection model includes a first convolutional layer, a second convolutional layer, a first graph convolutional layer, a second graph convolutional layer, and a third graph convolutional layer. The input layer is connected to the first convolutional layer and the first graph convolutional layer, and the first convolutional layer is connected to the second convolutional layer. The outputs of the first graph convolutional layer and the first graph convolutional layer are added together and then connected to the second graph convolutional layer. The second convolutional layer and the second graph convolutional layer are added together and then connected to the third graph convolutional layer. The third graph convolutional layer is connected to a fully connected layer. To ensure accurate feature output, three fully connected layers are used.
[0050] In processing the data, this invention employs a method combining GraphLayer and ConvLayer convolutional layers to capture the complex features of network nodes. First, GraphLayer utilizes the network graph's structure and 3D distribution point data to capture local structural information between nodes. This is because GraphLayer is particularly suitable for processing data with graph structures, capturing the local distributional relationships between nodes and their neighbors. However, to preserve the unique features of each individual node, this invention also introduces ConvLayer convolutional layers. This convolutional layer is responsible for extracting the 3D position and comprehensive feature information of each isolated node, ensuring that the individual characteristics of these nodes are not obscured by the local structural information in the GraphLayer. During the fusion process, this invention employs a feature fusion strategy. Specifically, each time this invention extracts node feature information from ConvLayer, it fuses it with the local structural information captured by GraphLayer. Thus, the fused features contain both local structural information and retain the unique features of each node. This feature fusion process is repeated twice to ensure that this invention can comprehensively capture the characteristics of the data from multiple angles and levels. Finally, this invention again uses a GraphLayer convolutional layer to calculate the fused features, obtaining the final fused feature data. Therefore, the entire detection model ultimately outputs a set of fused feature data combining GraphLayer and ConvLayer. This fused feature data not only contains the unique attributes of each node but also its structural relationships with other nodes, providing a rich information foundation for subsequent prediction tasks.
[0051] The fused feature data is then fed into three consecutive fully connected layers for further processing and computation. The fully connected layers perform a non-linear transformation on the input features through a combination of weighted sums and activation functions, extracting higher-level abstract features.
[0052] Finally, after processing through three fully connected layers, the abstract features are identified and output using a linear activation function, resulting in a one-dimensional vector from the detection model. This one-dimensional vector contains all the processed and learned feature information and can be interpreted as coordinate values to represent the predicted leakage location information, generating the final predicted three-dimensional coordinate information of the leakage location.
[0053] In the convolutional layer, for each distribution point Pi (where i = 1, ..., n) in the distribution point data, its corresponding coordinates are (xi, yi, zi). The input data consists of the coordinates of the distribution points in the three-dimensional space contained within Pi and the comprehensive feature data. Let h denote the mapping function of the ConvLayer convolutional layer. Therefore, for each point Pi in the distribution point data, this invention can extract its features by applying the convolution function h, denoted as h(Pi).
[0054] After processing by each ConvLayer convolutional layer, each distribution point receives a corresponding feature representation. These feature representations are obtained by performing convolution operations and nonlinear transformations on the original coordinate data. Specifically, for all distribution points Pi (i = 1, 2, ..., n), this invention can combine the feature representations of each point to form a unified output feature set, denoted as f({Pi, ..., Pn}), where f(Pi) = σ(h(Pi)), i = 1, 2, ..., n. Here, σ represents the nonlinear activation function; this invention uses the ReLU function. The ConvLayer layer performs a mapping operation on each point through the convolution function h to obtain the feature f(Pi) of each point.
[0055] The detection model of this invention is built upon graph neural networks, which are an extension of traditional neural network models (such as convolutional neural networks, CNNs). Compared with traditional neural networks, graph neural networks can handle a wider range of data types, not limited to data with regular forms, but also effectively dealing with irregular data with complex representations. Graph convolutional networks can perform operations on points in the geometric structure of locally distributed point data to obtain the structural information of nodes and their neighboring nodes. By analyzing the local relationships between their positions and corresponding comprehensive features, the three-dimensional coordinates of the missing locations can be found. This invention uses a spectral graph convolutional network model to construct the GraphLayer convolutional layer.
[0056] Before inputting data into the GraphLayer, it is necessary not only to transform the distributed point data into an undirected graph structure, but also to use this structure to calculate feature information and local structure information about nodes and their adjacent nodes. For n nodes in the three-dimensional distributed points, let the nodes be Pi (i = 1, 2, ..., n). The graph G is obtained from the actual topology of the water supply network. Based on the spatial distance and actual connection relationship between nodes, k nodes {Pj|j = 1, 2, ..., k} and node Pi are combined to form a local geometric structure. For graph G = {V, E}: V is the set of points in graph G, representing n data points; E is the set of edges in graph G. If the edge (Pi, Pj) formed by points Pi and Pj in the node set satisfies {(Pi, Pj) | Pj ∈ {Pj|j = 1, 2, ..., k}}, then (Pi, Pj) ∈ E.
[0057] Before processing the data at the GraphLayer layer, this invention first needs to transform the distributed point data into an undirected graph structure. This transformation process involves not only the feature representation of the distributed points but also defining the graph structure using the relationships between these points. Specifically, for n nodes in the distributed point data in a three-dimensional location, this invention denotes them as Pi (where i = 1, 2, ..., n). To construct graph G, this invention determines the connection relationships between nodes based on the actual topology of the actual water supply network nodes. By setting edges for different nodes, these nodes, together with Pi, constitute a local geometric structure. This local structure reflects the spatial relationship between Pi and its neighboring nodes. Graph G consists of a vertex set V and an edge set E. Wherein: V is the set of all vertices in the graph, representing the n data points in the distributed point data. E is the set of all edges in the graph. If there is a connection between nodes Pi and Pj in the actual topology of the water supply network, then there is an edge (Pi, Pj) between them, and this edge belongs to the edge set E.
[0058] The input to a GraphLayer mainly includes two aspects: node feature descriptions and output feature matrices. For a graph structure with n nodes, each layer of a GraphLayer corresponds to an input feature matrix with dimensions n×Fin, where Fin represents the number of input features. The original node feature descriptions in a GraphLayer are usually the coordinates of all nodes and the combined feature data. That is, for each node Pi (where i = 1, 2, ..., n), its features are a three-dimensional coordinate (xi, yi, zi) and combined feature data. Therefore, when a GraphLayer is used as the first layer of a graph neural network, its input feature matrix will directly consist of these coordinates and combined feature data. The undirected graph constructed from points distributed in three dimensions can be transformed into an undirected graph structure using certain methods. This undirected graph structure can be represented by a Laplacian matrix L, which is an important mathematical representation of a graph. The Laplacian matrix L is defined as L = DA, where A is the adjacency matrix and D is the degree matrix (a diagonal matrix where each element Dii represents the degree of node i, i.e., the number of edges connected to it). The Laplacian matrix L contains structural information about the graph, which can be used to effectively transmit and aggregate the feature information of nodes in graph neural networks.
[0059] In GraphLayer, the convolution kernel function Fq(L) is used for related processing, which operates on the Laplacian matrix L of the graph. Given the input graph structure data X (feature matrix), which includes the 3D coordinates and comprehensive features of the nodes of the water supply network, the output Y of the graph convolution can be calculated using this function, i.e., Y = Fq(L)X. The Laplacian matrix L can usually be decomposed into the form of eigenvalues and eigenvectors, i.e., L = UΛU^T. Here, U is a matrix composed of orthonormal eigenvectors of L, whose column vectors μi (where i = 1, 2, ..., n) are orthonormal eigenvectors of L; Λ is a diagonal matrix whose diagonal elements λi (where i = 1, 2, ..., n) are the eigenvalues of L. To perform the graph convolution operation more efficiently, the input feature matrix X can be transformed to the basis space defined by U, i.e., x = U T X. Then, the convolution kernel function Fq(Λ) is applied to the feature space to obtain Fq(Λ)x. Finally, the result is transformed back to the original space, i.e., Y = UFq(Λ)x. Here, Fq(Λ) is usually a parameterized function, where η represents the parameters of the convolution kernel. These parameters can be optimized through learning algorithms to extract useful features during graph convolution.
[0060] Before the final output of its GraphLayer convolutional layer, it needs to be processed by a related activation function. The final output y = σ(Fq(L)X), where σ represents a non-linear activation function. This invention uses the ReLU function.
[0061] The feature fusion of its GraphLayer and ConvphLayer convolutional layers is represented as: y=σ[∑(Fq(L)X)]+σ(h(Pi)), where Pi∈Y', and Y' is the input data of the previous ConvphLayer convolutional layer. Pi represents the input data of the ConvphLayer convolutional layer, X represents the input data of the previous GraphLayer convolutional layer, and L represents the Laplacian matrix of graph G.
[0062] In GraphLayer, convolution operations do not require pre-computation but are performed directly on the data. In these GraphLayer layers, the Laplacian matrix L is shared, meaning it is identical across different layers of the network and is used to capture the structural information of the graph. The order K of the GraphLayer's convolution kernel Fq(L) determines the size of the receptive field during the convolution operation. The receptive field refers to the size of the region on the input feature map that a point on the output feature map of a layer in the network can see. In the context of graph convolution, the receptive field refers to the set of nodes directly or indirectly connected (through at most K hops) to the central vertex. Taking a node Pi in distributed point data as an example, when the order K of the convolution kernel is set to 2, the convolution operation Fq(L) aggregates the feature information of all nodes directly connected to Pi and indirectly connected (through at most two intermediate nodes). Thus, Pi's new features will include the feature information of its local neighborhood. For the GraphLayer's convolution kernel order K, if K=5 is chosen, then during the convolution process, each point will aggregate the feature information of nodes at most 5 hops away, thereby obtaining a broader neighborhood feature representation. This representation is very useful for capturing local structure and contextual information in graph structures, which helps improve the accuracy of the final prediction results.
[0063] Finally, the output of the third graph convolution is input into the fully connected layer. The output of the third graph convolution includes local feature information and single-point information of distributed nodes. Through higher-level combination processing of the above information, the combined high-level features are finally identified through a linear activation function to predict the coordinates of possible leakage locations.
[0064] Having explained the principles of convolutional layers and graph convolutional layers, the specific structure of this invention will now be described in detail. In the detection model, the input data consists of the coordinate data and comprehensive feature data of each sensor node in the water supply network. The first graph convolutional layer processes the input data to obtain first structural information. This structural information is the local structural information of the distributed point graph structure, or the structural information combining multi-node feature data. The first convolutional layer then processes the input data to obtain first single-point feature information, which is the feature information of a single point. The first structural information and the first single-point feature information are then fused, i.e., added together. The fusion result is used as the next graph convolution. The input of the first layer ensures that the resulting features simultaneously contain local structural information and individual point feature information. The second convolutional layer processes the fusion result to obtain the second structural information. The second convolutional layer processes the first feature information to obtain the second single-point feature information. The second structural information and the second single-point feature information are then fused again. The result of this second fusion is input into the third convolutional layer to obtain feature fusion data. The feature fusion data contains both the feature information of each point and local structural information. The feature fusion data is then processed by a fully connected layer for higher-order feature extraction and combination. A non-linear activation function is used to predict the output, which ultimately outputs the coordinates of the possible location of water supply network leakage.
[0065] The choice of optimization objective directly affects the effectiveness of model training. The optimization objective of this model is to minimize the binary cross-entropy loss, allowing the model to fine-tune its weights to improve prediction results. The specific loss function is defined as follows:
[0066]
[0067] Where N is the number of training samples, y i It is the label corresponding to the i-th training set. This is the predicted label from the model. By minimizing this loss, the model's predicted values gradually approach the true label values, thereby improving the overall prediction performance.
[0068] After determining the coordinates of potential water supply network leaks, an optimization algorithm is used to set the leak location as the initial position. Corresponding parameters are set for this initial position, including the leak area and location. The initial point of the leak location is randomly selected around the initial location. Multiple points are randomly selected within this area, and based on the selected points and their locations, an improved "moth to a flame" algorithm is used for iterative calculations to generate the final leak location and leakage amount.
[0069] In this content, an initial population is first generated based on the initial position. The population contains different individuals, and each individual contains the location and amount of leakage.
[0070] Where the objective function is
[0071] f(x)=min∑[W1*(S-S') 2 +W2*(G-G') 2 +W2*(K-K') 2 ]
[0072] Where S, G, and K represent the actual collected sound, pressure, and flow values, and S', G', and K' represent the simulated sound, pressure, and flow values of the simulation model during the iteration process. The leakage location and leakage amount corresponding to the individual are simulated in the water supply network simulation model. Sensor points are set at the corresponding locations in the simulation model, and the data is obtained by acquiring the data from the simulation sensor points. W1, W2, and W3 correspond to the weights of their respective data categories.
[0073] The constraints are that the sound, pressure, and flow rate do not exceed preset thresholds.
[0074] The fitness function is used to calculate the fitness value of the moth, and the fitness values are sorted to obtain the flame value. The first value is taken as the optimal value of the current population. The moth first updates its position, and then updates it again through relevant flight strategies.
[0075] Among these, the selection of a logarithmic spiral as the primary mechanism for moths to update their positions is as follows:
[0076] Mi = Di·e bθ ·cos(2πθ)+Fj
[0077] Where b is a constant used to define the shape of the logarithmic spiral; θ is a random number between [-1, 1]; Mi represents the i-th moth, i.e., an individual; Fj represents the j-th flame; Di represents the distance between the i-th moth and the j-th flame, which is a constant of the logarithmic spiral shape; the formula is: Di=|Fj-Mi|;
[0078] To achieve adaptive updates, the above method for updating the moth's position is adaptively updated using inertia weights:
[0079] Mi = Di·e bθ ·cos(2πθ)+ω·Fj
[0080] Here, ω represents the inertia weight, borrowed from the inertia weight concept of the particle swarm optimization algorithm. The larger ω is, the greater the search intensity of the algorithm globally; the smaller ω is, the higher the search accuracy of the algorithm locally.
[0081]
[0082] Where t is the current iteration number; T is the maximum iteration number; and a and d are constants.
[0083] The Moth to Flame optimization algorithm simulates the natural behavior of moths seeking a light source (i.e., a flame) for optimization search. In this algorithm, each moth represents a potential solution, while the flame represents the optimal or suboptimal solution found. The core of the algorithm is how the moth adjusts its flight path based on the brightness of the flame (i.e., the fitness of the solution). Specifically, the moth's flight path is designed as a spiral, simulating the moth's behavior of approaching the light source (flame). The shape and length of the spiral path are controlled by a convergence constant θ. The value of θ determines the speed and direction of the moth's flight towards the flame: when θ is close to -1, the moth approaches the flame more quickly, i.e., moves rapidly towards the brightest flame (optimal solution). When θ is close to 1, the moth moves more slowly, maintaining a certain distance from the flame, and conducting a broader search. In the algorithm initialization phase, moths are randomly distributed in the search space, and the fitness value of their initial positions is calculated. Then, the flames are sorted according to their fitness values, with the best flame (i.e., the solution with the highest fitness) at the front and the worst flame at the back. During the iteration process, each moth updates its position using a spiral flight formula based on the position of its corresponding flame (i.e., the flame assigned according to its fitness ranking). In this way, the first moth (the one with the highest fitness) quickly moves towards the brightest flame (the optimal solution), while the last moth (the one with the lowest fitness) moves relatively slowly, searching for potential better solutions in the search space. Through this mechanism, the MFO algorithm effectively balances local and global searches in the search space, avoiding getting trapped in local optima and thus improving optimization performance.
[0084] To improve the efficiency of finding the optimal solution, an adaptive reduction mechanism for the flame is proposed. When the final iteration is reached, the only remaining flame represents the global optimal solution. The formula for the adaptive reduction mechanism is as follows:
[0085] FN = round(Nt*(N-1) / T)
[0086] In the formula: N is the initial number of flames; t is the current iteration number; T is the maximum number of iterations; and FN represents the number of flames during the iteration process.
[0087] The process of updating the position again includes:
[0088]
[0089] Where the superscript t represents the update count, rand() represents a random number, and Levy represents the corresponding Levy step size.
[0090]
[0091] Where β is a constant, μ ~ N(0, σ 2 v ~ N(0, 1);
[0092]
[0093] Where Г() represents the standard gamma function.
[0094] Based on the above, the optimized method flow of this invention includes:
[0095] First, initialize the population, which contains different individuals (moths). Then, initialize the constant parameters in the formulas of the different processes mentioned above. Determine the number of flames. Calculate the fitness according to the objective function, setting the fitness as the reciprocal of the objective function. Sort the fitness values from largest to smallest. After sorting, select the corresponding number of flames based on the sorting results. Store the individuals in the fitness ranking as flames, and update them according to the individual update method, or moth position update method. Determine if the flame data satisfies the condition of having only one remaining. If not, adaptively update the moth positions. Determine if the maximum number of iterations has been reached. If it has, output the optimal moth individual, i.e., the missing position and missing amount.
[0096] like Figure 2 As shown, the above scheme will be explained in detail with specific steps:
[0097] 1) Initialize the population, which contains several different individuals. Each individual contains the leakage location and leakage amount. The leakage location is determined based on the initial location predicted by the deep learning model. The initial location and the surrounding randomly selected locations are used as the initial individuals. The leakage amount is randomly generated by random numbers. The random variation range of the leakage amount is less than the water supply volume of the water supply network.
[0098] Initialize the constant parameters in the above formula, where the constant parameters are set based on manual experience or calculation.
[0099] Set the relevant objective function, constraints, and corresponding fitness:
[0100] The objective function is:
[0101] f(x)=min∑[W1*(S-S') 2 +W2*(G-G') 2 +W2*(K-K') 2 ]
[0102] Where S, G, and K represent the actual collected sound, pressure, and flow values, and S', G', and K' represent the simulated sound, pressure, and flow values of the simulation model during the iteration process. The leakage location and amount corresponding to each individual data point are simulated in the water supply network simulation model. Sensor points are set at the corresponding locations in the simulation model, and data is acquired by obtaining data from these simulated sensor points. W1, W2, and W3 correspond to the weights of their respective data categories. These weights can be set based on the weights of the aforementioned attention mechanism or on human experience. It is recommended that the weight for S (sound data) be significantly smaller than the weights of other data.
[0103] 2) The number of flames is determined, and the formula for the adaptive reduction mechanism is as follows:
[0104] FN = round(Nt*(N-1) / T)
[0105] In the formula: N is the initial number of flames; t is the current iteration number; T is the maximum number of iterations; and FN represents the number of flames during the iteration process.
[0106] 3) Calculate the fitness of different individuals based on the objective function. The fitness is set as the reciprocal of the objective function: its fitness is g = 1 / f(x). The higher the fitness, the better the quality of the individual.
[0107] The fitness values are sorted from largest to smallest. After sorting, the corresponding number of flames is selected according to the sorting result. Individuals in the fitness ranking are used as flames. The number of flames is calculated according to the above formula. The current best flame is stored. The best flame is the individual with the highest fitness value in the individual flame ranking.
[0108] 4) Update according to the individual update method described above, or the moth position update method. During the update process, first use the initial position update method:
[0109] Mi = Di·e bθ ·cos(2πθ)+Fj
[0110] Where b is a constant used to define the shape of the logarithmic spiral; θ is a random number between [-1, 1]; Mi represents the i-th moth, i.e., an individual; Fj represents the j-th flame; Di represents the distance between the i-th moth and the j-th flame, which is a constant of the logarithmic spiral shape; the formula is: Di=|Fj-Mi|;
[0111] 5) After the update, the moth locations will be updated again:
[0112]
[0113] Where the superscript t represents the update count, rand() represents a random number, and Levy represents the corresponding Levy step size.
[0114]
[0115] Where β is a constant, set to 1.5, μ~N(0, σ 2 v ~ N(0, 1);
[0116]
[0117] Where Г() represents the standard gamma function.
[0118] 6) Determine if there is only one flame data remaining; if so, output the final result directly.
[0119] 7) If the conditions are not met, then the moth's position will be updated adaptively.
[0120] The above method for updating the moth's position is adaptively updated using inertia weights:
[0121] Mi = Di·e bθ ·cos(2πθ)+ω·Fj
[0122] Here, ω represents the inertia weight, borrowed from the inertia weight concept of the particle swarm optimization algorithm. The larger ω is, the greater the search intensity of the algorithm globally; the smaller ω is, the higher the search accuracy of the algorithm locally.
[0123]
[0124] Where t is the current iteration number; T is the maximum iteration number; and a and d are constants.
[0125] 8) Determine if the maximum number of iterations has been reached. If not, repeat steps 2-7 above. If it has been reached, output the optimal moth individual, i.e., the location and amount of leakage.
[0126] Through the above technical solution, this invention uses a deep learning model that can extract local structural features and combine them with node features to detect the leakage location of water supply networks. However, due to the poor interpretability of deep learning models and their inability to effectively represent the specific leakage amount, this invention uses a specific optimization algorithm combined with a simulation model to perform relevant data simulation to find the specific leakage amount and location. According to the above technical solution, this invention can effectively monitor water supply networks and provide a better foundation for the management of water supply networks.
[0127] This invention also provides a leakage prediction method, which encodes the pipeline network: based on different locations in the pipeline network, corresponding image data of the pipeline network is generated; based on the different planar positions of the pipeline network sensor nodes, the corresponding pixels of their planar images are determined; blank areas are filled with blank pixels; and based on the sound, pressure, and flow rates in the sensor data, the RGB values are assigned values by adding coefficients or other linear transformation methods to generate the feature image corresponding to the pipeline network. Relevant recognition can be performed through a relevant image classification model. At the same time, combined with a lightweight structure, the computational load of the network is reduced, making it a tool for routine work monitoring.
[0128] The method described above for encoding water supply networks into images can be recognized using existing image classification networks. It can be used by training the system with the encoded images and the corresponding labels indicating whether there are any omissions or defects.
[0129] like Figure 3 As shown, for daily use, the data in the pipeline network is encoded into monitoring images in real time, and the monitoring images are transmitted to the prediction model. When the prediction model predicts a leak, the subsequent detection model and optimization algorithm are activated to monitor specific leaks in daily operations.
[0130] The coded images of the water supply network and the corresponding labels indicating whether there is leakage are used as the training and testing sets.
[0131] After the above data is prepared, recognition is performed using a simple neural network. The neural network model includes an input layer, a feature encoder, and a softmax classifier output layer. The output of the input layer is connected to the input of the feature encoder, and the output of the feature encoder is connected to the input of the softmax classifier. The feature encoder includes a first convolutional layer, a first normalization layer, a first ReLU activation layer, a second convolutional layer, a second normalization layer, a second ReLU activation layer, a third convolutional layer, a third normalization layer, and a third ReLU activation layer, connected in sequence. The softmax classifier includes a global average pooling layer, a fully connected layer, and a softmax layer.
[0132] In a further embodiment, the parameter settings of the feature encoder are as follows;
[0133] The first convolutional layer has 32 feature maps for its output feature data, a 3×3 convolutional filter size, 1 padding, and a stride of 1; the first normalization layer has 32 feature maps for its output feature data; the first ReLU activation layer has 32 feature maps for its output feature data; the second convolutional layer has 32 feature maps for its output feature data, a 3×3 convolutional filter size, 1 padding, and a stride of 1; the second normalization layer has 32 feature maps for its output feature data; the second ReLU activation layer has 32 feature maps for its output feature data; the third convolutional layer has 32 feature maps for its output feature data, a 3×3 convolutional filter size, 1 padding, and a stride of 1; the second normalization layer has 32 feature maps for its output feature data; the third activation layer has 32 feature maps for its output feature data.
[0134] In a further embodiment, the parameters of the Softmax classifier are set as follows:
[0135] The global average pooling layer has 32 feature maps in its output feature data; the fully connected layer has 64 feature maps in its output feature data; and the Softmax layer has 14 feature maps in its output data.
[0136] In a further embodiment, the prediction model is trained using the aforementioned training set; the trained prediction model is obtained, specifically including:
[0137] The weight parameter set of the prediction model is initialized using the weight initialization method to initialize the prediction model.
[0138] Construct the cross-entropy loss function for the prediction model; use the training set as the input feature data for the first convolutional layer, which includes encoded images of the water supply network; calculate the output feature data of the first convolutional layer and output it to the i-th output feature map data of the first convolutional layer.
[0139]
[0140] Among them, W M1 This is the convolution filter matrix in the first convolutional layer. The elements of this matrix are the weights in the weight set Θ, and * indicates the convolution operation.
[0141] The output feature data of the first convolutional layer is used as the i-th input feature map data of the first normalized layer in the prediction model, and the n-th output feature map data of this layer is calculated according to the following formula.
[0142] In the formula, f represents the output feature data of the first normalization layer for the features of the k-th training sample. CBN (·) represents the normalization operation.
[0143] The output feature data of the first normalized layer is used as the i-th input feature map data of the first ReLU activation layer in the prediction model, and the i-th output feature map data of this layer is calculated according to the following formula.
[0144]
[0145] Among them, f RELU (·) is the activation function of the modified linear unit (ReLU);
[0146] The first ReLU activation layer is used as the input feature data of the second convolutional layer. The output feature data of the second convolutional layer is calculated and output to the i-th output feature map data of the second convolutional layer.
[0147]
[0148] Among them, W M2 This is the convolution filter matrix in the second convolutional layer. The elements of this matrix are the weights in the weight set Θ, and * indicates the convolution operation.
[0149] The output feature data of the second convolutional layer is used as the i-th input feature map data of the second normalized layer in the prediction model, and the n-th output feature map data of this layer is calculated according to the following formula.
[0150] In the formula, f represents the output feature data of the second normalized layer representing the features of the k-th training sample. CBN (·) represents the normalization operation;
[0151] The output feature data of the second normalized layer is used as the i-th input feature map data of the first activation layer in the prediction model, and the i-th output feature map data of this layer is calculated according to the following formula.
[0152] Among them, f ReLU (·) is the activation function of the modified linear unit (ReLU);
[0153] The second ReLU activation layer is used as the input feature data of the second convolutional layer. The output feature data of the third convolutional layer is calculated and output to the i-th output feature map data of the third convolutional layer.
[0154] Among them, W M3 This is the convolution filter matrix in the third convolutional layer. The elements of this matrix are the weights in the weight set Θ, and * indicates the convolution operation.
[0155] The output feature data of the third convolutional layer is used as the i-th input feature map data of the third normalized layer in the prediction model, and the i-th output feature map data of this layer is calculated according to the following formula.
[0156] In the formula, f represents the output feature data of the third normalized layer for the features of the i-th training sample. CBN (·) represents the normalization operation;
[0157] The output feature data of the third normalization layer is used as the i-th input feature map data of the third activation layer in the prediction model, and the i-th output feature map data of this layer is calculated according to the following formula.
[0158] f i p3 =f ReLU (f i b2 )
[0159] Among them, f ReLU (·) is the activation function of the modified linear unit (ReLU);
[0160] The output feature data of the third ReLU activation layer is used as the i-th input feature map data of the global average pooling layer in the Softmax classifier, and the i-th output feature map data of this layer is calculated according to the following formula.
[0161]
[0162] Among them, f CGAP (·) represents the global average pooling operation.
[0163] The output feature data of the global average pooling layer is used as the input feature map data of the i-th fully connected layer in the Softmax classifier, and the output feature map data of the i-th layer is calculated according to the following formula. .
[0164]
[0165] Among them, f CFC (·) represents a fully connected layer operation.
[0166] The output feature data of the fully connected layer is used as the i-th input feature map data of the Softmax layer in the Softmax classifier, and the i-th output feature map data p of this layer is calculated according to the following formula. i .
[0167]
[0168] Where, p k f represents the probability that the output prediction of the Softmax classifier output layer for the features of the i-th training sample will have any omissions. CSoftmax (·) represents the Softmax function.
[0169] The prediction model uses the cross-entropy loss function; then the initialized prediction model is trained, and the partial derivative of the loss value with respect to each weight parameter in the weight parameter set is calculated; the weight parameters are updated by backpropagation based on gradient descent and the partial derivative values to obtain the updated weight parameters; an updated weight parameter set is established based on all the updated weight parameters, and the cross-entropy loss function is recalculated based on the updated weight set until the loss function converges to obtain the updated weight set.
[0170] In this invention, the prediction model of the training set is trained using the test set, and the real-time encoded monitoring image is input into the pre-trained feature encoder, and then into the classifier to output whether there is any omission.
[0171] The above are merely preferred embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for monitoring leakage in a water supply network, characterized in that, include: Acquire sensing information and sensing node location information of the water supply network, wherein the sensing information of the water supply network includes sound data, pressure data and flow data; A detection model is constructed, wherein the detection model is a deep learning model. The detection model is used to process the sensing information and the sensing node location information to generate a predicted leakage location. Based on the predicted leakage location, initial parameters are obtained, including the initial leakage location and the initial leakage amount. The initial parameters are then optimized using an optimization algorithm to obtain the leakage location and leakage amount of the water supply network.
2. The method according to claim 1, characterized in that, Before processing by the detection model, the following steps are also included: By using a self-attention mechanism to weight and process sensor information, comprehensive feature data of distributed nodes is generated. The sensor node location information and comprehensive feature data are then integrated to generate the input data for the detection model.
3. The method according to claim 2, characterized in that, The detection model includes an input layer, a first convolutional layer, a second convolutional layer, a first graph convolutional layer, a second graph convolutional layer, a third graph convolutional layer, and several fully connected layers. The input layer is connected to the first convolutional layer and the first graph convolutional layer, and the first convolutional layer is connected to the second convolutional layer. The outputs of the first graph convolutional layer and the first graph convolutional layer are added together and then connected to the second graph convolutional layer. The second convolutional layer and the second graph convolutional layer are added together and then connected to the third graph convolutional layer. The third graph convolutional layer is connected to several fully connected layers in sequence.
4. The method according to claim 3, characterized in that, In the graph convolutional layer, the input data is processed using undirected graph data, which includes the set of nodes and the set of edges of the input data.
5. The method according to claim 1, characterized in that, The detection model is optimized using a binary crossover loss function.
6. The method according to claim 1, characterized in that, The optimization algorithm adopts an improved moth-to-a-flame algorithm.
7. The method according to claim 1, characterized in that, The process of optimizing the initial parameters using an optimization algorithm includes: Initialize the population, which contains different individuals, where each individual is an initial parameter assigned a different value; determine the number of flames, where each flame is a group of individuals with the highest fitness. The fitness is calculated based on the objective function. The fitness values are sorted from largest to smallest. After sorting, the corresponding number of flames is selected according to the sorting result. Based on the number of flames and the sorting result, the current best flame is obtained. The position of the individual is updated. It is determined whether the flame data satisfies the condition that there is only one flame left. If not, the position of the individual is adaptively updated. It is determined whether the maximum number of iterations has been reached. If it has been reached, the optimal moth individual, i.e., the leakage position and leakage amount, is output.
8. The method according to claim 7, characterized in that, The objective function is the weighted minimum of the differences between different sensing information and the simulated sensing data obtained from individual simulation.
9. The method according to claim 1, characterized in that, Before processing by the detection model, the following steps are also included: Based on the sensor information and sensor node location information, a monitoring image is generated by encoding. The monitoring image is then identified by an image classification model to generate a monitoring result predicting whether a leak has occurred. When the monitoring result indicates that a leak has occurred, the operation of processing the sensor information and sensor node location information through the detection model is initiated.
10. The method according to claim 9, characterized in that, The image classification model uses a convolutional neural network.