Method, device and computer-readable storage medium for predicting water flow in pipe network
Through the combination of clustering algorithm and multiple long-short-term memory network models, the problem of inaccurate water flow prediction results in pipe networks is solved, the prediction accuracy is improved, and the prediction accuracy is adapted to different environmental changes.
Patent Information
- Application Number
- CN202011533624.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-22
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2040-12-22
AI Technical Summary
The prediction results of pipe network water flow in the existing technology are inaccurate, especially when the environment changes, the prediction accuracy of a single LSTM model is low.
A clustering algorithm is used to classify the water flow characteristic data of the pipe network, and multiple long-short-term memory network models are established. Each model corresponds to a category. The total water flow is calculated through real-time data classification and accumulation to improve prediction accuracy.
It effectively improves the prediction accuracy of short-term water flow and total water flow in the pipe network, and solves the problem of insufficient prediction accuracy of a single model in different environments.
Smart Images

Figure CN112580260B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of pipe network monitoring, and in particular to a method and device for predicting water flow in a pipe network, and a computer-readable storage medium. Background Art
[0002] Studying the short-term water flow prediction method of large-scale pipeline networks can enable water companies to better understand the water flow patterns of large-scale pipeline networks, and monitor the pipeline networks in advance to see if there are pipe ruptures, leaks, etc., and then send people to check in advance to prevent major water outages.
[0003] Currently, the more common method is water flow prediction based on the LSTM algorithm. The principle of this method is relatively simple. However, there are large differences when using the same LSTM model in different environments. Using a single LSTM model when the environment changes will lead to a relatively low accuracy in the prediction results of the water flow in the pipeline network. Summary of the invention
[0004] In order to solve the above problems, the embodiments of the present invention provide a method and device for predicting water flow in a pipe network, and a computer-readable storage medium, which can solve the problem of inaccurate prediction results of water flow in a pipe network in the prior art.
[0005] An embodiment of the present invention provides a method for predicting water flow in a pipe network, comprising:
[0006] Acquire the collected water flow characteristic data of the pipe network as a sample;
[0007] Clustering the samples based on a clustering algorithm, calculating the Davidson-Borgin index under different total cluster numbers, selecting the total cluster number that minimizes the Davidson-Borgin index as the final total cluster number, and obtaining data sets corresponding to each category after clustering;
[0008] Establish k long short-term memory network models, and input the data sets corresponding to each category after clustering into the k long short-term memory network models for training, so as to obtain k types of trained long short-term memory network models, wherein each type of trained long short-term memory network model corresponds to one category, and k is equal to the final total number of clusters;
[0009] Collecting data of each pipeline of the pipeline network in real time, and inputting the data of each pipeline into the trained clustering algorithm to determine the category to which the data of each pipeline belongs;
[0010] The data of each pipeline are respectively input into the trained long short-term memory network model corresponding to the category to which the data of each pipeline belongs, so as to obtain the short-term water flow of each pipeline, and then the short-term water flow of each pipeline is accumulated to obtain the total water flow of the current large-scale pipeline network.
[0011] As an improvement of the above scheme, the sample includes multiple sample individuals, and the water flow characteristic data of the pipe network includes water pressure, water flow velocity, current water temperature, and pipe diameter. Then, each sample individual is expressed as Z = (E, V, T, M, P), wherein E is water pressure, V is water flow velocity, T is current water temperature, and M is pipe diameter.
[0012] As an improvement of the above scheme, clustering the samples based on the clustering algorithm, calculating the Davidson-Borgin index under different cluster total numbers, and selecting the cluster total number with the smallest Davidson-Borgin index as the final cluster total number, specifically includes:
[0013] Step S11, randomly selecting k sample individuals from the sample as k cluster centers, wherein each cluster center corresponds to a category, and k is the current total number of clusters;
[0014] Step S12, calculating the distances from the remaining sample individuals to the center of each class, and assigning the remaining sample individuals to each class to obtain a data set corresponding to each class, wherein the result of the assignment is that the distance from each sample individual to the class center of the class to which the sample individual belongs is smaller than the distance from the sample individual to the class centers of other classes;
[0015] Step S13, updating the class center of each class. For each class, select the sample individual with the smallest sum of distances to other sample individuals in the class as the new class center;
[0016] Step S14, repeating steps S12 to S13 until all cluster centers no longer change;
[0017] Step S15, based on the current total number of clusters, determining the Davidson-Botting Index under the current total number of clusters;
[0018] Step S16, update the k value, set K = K + 1, repeat steps S11 to S15 until k is equal to the preset value, obtain the Davidson-Borgin index under different total number of clusters, and select the total number of clusters corresponding to the minimum Davidson-Borgin index as the final total number of clusters.
[0019] As an improvement of the above solution, the method of determining the Davidson-Botting index under the current total number of clusters based on the current total number of clusters specifically includes:
[0020] The Davidson-Botting Index at the current total number of clusters is determined by the following formula:
[0021]
[0022] Among them, I DBrepresents the Davidson-Bodin index, k is the current total number of clusters, C i represents the average distance from sample individual i to the class center of the class to which it belongs, C j represents the average distance from sample individual j to the class center of the class to which it belongs, F i,j Represents the Euclidean distance between the class center of category i and the class center of category j.
[0023] Another embodiment of the present invention provides a device for predicting water flow in a pipe network, comprising:
[0024] A sample acquisition module is used to acquire the collected water flow characteristic data of the pipe network as a sample;
[0025] A clustering module is used to cluster the samples based on a clustering algorithm, calculate the Davidson-Borgin index under different cluster totals, select the cluster total that minimizes the Davidson-Borgin index as the final cluster total, and obtain the data sets corresponding to each category after clustering;
[0026] A long short-term memory model training module is used to establish k long short-term memory network models, and input the data sets corresponding to each category after clustering into the k long short-term memory network models for training, so as to obtain k types of trained long short-term memory network models, wherein each type of trained long short-term memory network model corresponds to one category, and k is equal to the final total number of clusters;
[0027] A classification determination module, used for collecting data of each pipeline of the pipeline network in real time, and inputting the data of each pipeline into the trained clustering algorithm to determine the category to which the data of each pipeline belongs;
[0028] The total water flow calculation module is used to input the data of each pipeline into the trained long short-term memory network model corresponding to the category to which the data of each pipeline belongs, obtain the short-term water flow of each pipeline, accumulate the short-term water flow of each pipeline, and obtain the total water flow of the current large-scale pipeline network.
[0029] As an improvement of the above scheme, in the sample acquisition module, the sample includes multiple sample individuals, and the water flow characteristic data of the pipe network includes water pressure, water flow velocity, current water temperature, and pipe diameter. Each sample individual is represented by Z = (E, V, T, M, P), wherein E is water pressure, V is water flow velocity, T is current water temperature, and M is pipe diameter.
[0030] As an improvement of the above solution, the clustering module specifically includes:
[0031] The cluster center selection unit is used to execute step S11: randomly select k sample individuals from the sample as k cluster centers, wherein each cluster center corresponds to a category, and k is the current total number of clusters;
[0032] The sample allocation unit is used to execute step S12: calculate the distances from the remaining sample individuals to the center of each class, and allocate the remaining sample individuals to each class to obtain a data set corresponding to each class, wherein the allocation result is that the distance from each sample individual to the class center of the class to which the sample individual belongs is smaller than the distance from the sample individual to the class center of other classes;
[0033] The class center updating unit is used to execute step S13: updating the class center of each class, and for each class, selecting the sample individual with the smallest sum of distances to other sample individuals in the class as the new class center;
[0034] The class center determination unit is used to execute step S14: repeating steps S12 to S13 until all class centers no longer change;
[0035] The Davidson-Borg index determination unit is used to execute step S15: based on the current total number of clusters, determine the Davidson-Borg index under the current total number of clusters;
[0036] The total number of clusters determination unit is used to execute step S16: update the k value, set K=K+1, repeat steps S11 to S15 until k is equal to the preset value, obtain the Davidson-Borgin index under different total number of clusters, and select the total number of clusters corresponding to the minimum Davidson-Borgin index as the final total number of clusters.
[0037] As an improvement of the above scheme, the Davidson-Borgin index determination unit is specifically used for:
[0038] The Davidson-Botting Index at the current total number of clusters is determined by the following formula:
[0039]
[0040] Among them, I DB represents the Davidson-Bodin index, k is the current total number of clusters, C i represents the average distance from sample individual i to the class center of the class to which it belongs, C j represents the average distance from sample individual j to the class center of the class to which it belongs, F i,j Represents the Euclidean distance between the class center of category i and the class center of category j.
[0041] Another embodiment of the present invention correspondingly provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the above-mentioned method for predicting water flow in the pipeline network.
[0042] A method for predicting water flow in a pipe network provided by an embodiment of the present invention comprises obtaining collected water flow characteristic data of the pipe network as samples, clustering the samples based on a clustering algorithm, calculating the Davidson-Borging index under different cluster totals, selecting the cluster total that minimizes the Davidson-Borging index as the final cluster total, and obtaining data sets corresponding to each category after clustering, establishing k long short-term memory network models, and inputting the data sets corresponding to each category after clustering into the k long short-term memory network models for training, to obtain k types of trained long short-term memory network models, wherein each type of trained long short-term memory network model corresponds to a category, k is equal to the final cluster total, and collecting data of each pipeline of the pipe network in real time, and inputting the data of each pipeline into the above-mentioned trained long short-term memory network models. In the clustering algorithm, the category to which the data of each pipeline belongs is determined, and the data of each pipeline is respectively input into the trained long short-term memory network model corresponding to the category to which the data of each pipeline belongs, so as to obtain the short-term water flow of each pipeline, and accumulate the short-term water flow of each pipeline to finally obtain the total water flow of the current large-scale pipeline network. By using the clustering algorithm to classify the pipeline network samples and inputting the data sets of each category into each long short-term memory network model, various types of trained long short-term memory models are obtained, so that the pipeline data classified into different categories can be input into the corresponding trained long short-term memory model for calculation, which solves the problem of insufficient prediction accuracy of a single long short-term memory network model under different environments, effectively improves the prediction accuracy of the short-term water flow of each pipeline, and further improves the prediction accuracy of the total water flow of the pipeline network. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 It is a flow chart of a method for predicting water flow in a pipe network provided by an embodiment of the present invention;
[0044] Figure 2 It is an architecture diagram of the model training provided by the method for predicting water flow in a pipe network provided by an embodiment of the present invention;
[0045] Figure 3 It is a structural block diagram of a device for predicting water flow in a pipe network provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0046] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0047] See also Figure 1 , which is a flow chart of a method for predicting water flow in a pipe network provided by an embodiment of the present invention.
[0048] A method for predicting water flow in a pipe network provided by an embodiment of the present invention includes:
[0049] Step S0, obtaining the collected water flow characteristic data of the pipe network as a sample;
[0050] Step S1, clustering the samples based on a clustering algorithm, calculating the Davidson-Borgin index under different cluster totals, selecting the cluster total that minimizes the Davidson-Borgin index as the final cluster total, and obtaining data sets corresponding to each category after clustering;
[0051] Step S2, establishing k long short-term memory network models, and inputting the data sets corresponding to each category after clustering into the k long short-term memory network models for training, to obtain k types of trained long short-term memory network models, wherein each type of trained long short-term memory network model corresponds to one category, and K is equal to the final total number of clusters;
[0052] Step S3, collecting data of each pipeline of the pipeline network in real time, and inputting the data of each pipeline into the trained clustering algorithm to determine the category to which the data of each pipeline belongs;
[0053] Step S4, input the data of each pipeline into the trained long short-term memory network model corresponding to the category to which the data of each pipeline belongs, obtain the short-term water flow of each pipeline, and accumulate the short-term water flow of each pipeline to obtain the total water flow of the current large-scale pipeline network.
[0054] As an optional implementation, the water flow characteristic data of the pipe network includes water pressure, water flow velocity, current water temperature, and pipe diameter, then the sample includes multiple sample individuals, each sample individual is expressed as Z = (E, V, T, M, P), wherein E is water pressure, V is water flow velocity, T is current water temperature, and M is pipe diameter.
[0055] In specific implementation, water flow characteristic data such as water pressure, water flow velocity, current water temperature and pipe diameter of multiple pipes at multiple historical moments can be collected by sensors to obtain multiple sample individuals. In order to make the samples more representative, the number of sample individuals is at least 1000.
[0056] As an optional implementation, the step S1 of "clustering the samples based on a clustering algorithm, calculating the Davidson-Borgin index under different total cluster numbers, and selecting the total cluster number that minimizes the Davidson-Borgin index as the final total cluster number" specifically includes:
[0057] Step S11, randomly selecting k sample individuals from the sample as k cluster centers, wherein each cluster center corresponds to a category, and k is the current total number of clusters;
[0058] Step S12, calculating the distances from the remaining sample individuals to the center of each class, and assigning the remaining sample individuals to each class to obtain a data set corresponding to each class, wherein the result of the assignment is that the distance from each sample individual to the class center of the class to which the sample individual belongs is smaller than the distance from the sample individual to the class centers of other classes;
[0059] Step S13, updating the class center of each class. For each class, select the sample individual with the smallest sum of distances to other sample individuals in the class as the new class center;
[0060] Step S14, repeating steps S12 to S13 until all cluster centers no longer change;
[0061] Step S15, based on the current total number of clusters, determining the Davidson-Botting Index under the current total number of clusters;
[0062] Step S16, update the k value, set K = K + 1, repeat steps S11 to S15 until k is equal to the preset value, obtain the Davidson-Borgin index under different total number of clusters, and select the total number of clusters corresponding to the minimum Davidson-Borgin index as the final total number of clusters.
[0063] Specifically, the step S12 "calculating the distances from the remaining sample individuals to the center of each cluster" is expressed by the formula |Z n -u i | 2 Calculate, where Z n represents the nth sample individual, u i Represents the i-th class center.
[0064] Specifically, the distance in step S13 "for each category, select the sample individual with the smallest sum of distances to other sample individuals in the category as the new class center" refers to the Euclidean distance between two sample individuals.
[0065] Specifically, in step S16, "until k is equal to a preset value", the preset value can be determined according to actual measurement conditions. In the embodiment of the present invention, the k value should not exceed 20.
[0066] As an optional implementation, the step S15 of "determining the Davidson-Botting index under the current total number of clusters based on the current total number of clusters" specifically includes:
[0067] The Davidson-Botting Index at the current total number of clusters is determined by the following formula:
[0068]
[0069] Among them, I DB represents the Davidson-Bodin index, k is the current total number of clusters, C i represents the average distance from sample individual i to the class center of the class to which it belongs, C j represents the average distance from sample individual j to the class center of the class to which it belongs, F i,j Represents the Euclidean distance between the class center of category i and the class center of category j.
[0070] In the embodiments of the present invention, see Figure 2 , Figure 2 : is a diagram of the model training architecture provided by the method for predicting water flow in a pipe network provided by an embodiment of the present invention. Before starting the training, 1000 sample individuals are first selected from the water flow characteristic data collected by the sensor, that is, the sample is [Z1 Z2 … Z 10000 ], and based on the K-Medoids clustering algorithm, from [Z1Z2 … Z 10000 ] randomly select k class centers u i It can be understood that k is the total number of clusters and the initial value of k is 1, and the DB index (DB index is the Davidson-Bouldin Index obtained above, the full name is Davies-Bouldin Index) under different k values is calculated by the above step S1 to [Z1 Z2 … Z 10000 ] to perform clustering, determine the final total number of clusters k, obtain k types of data, and input the k types of data into k long short-term memory network models for training, so as to obtain k types of trained long short-term memory network models.
[0071] In the specific implementation, in the step of training the long short-term memory network model, the LSTM model can be set by calling the LSTM toolkit in the neural network library Keras, wherein each LSTM model has 1000 neurons in the hidden layer and 1 neuron in the output layer. At the same time, the training set format of the LSTM model input is set to Z=(E, V, T, M, P), the number of training samples batch_size is 1000, the number of training epochs is 500, and the network model is set to randomly stop the activation value of a certain neuron with a probability of 0.5 during forward propagation, so as to make the model more generalizable. When the iteration is completed, k types of trained long short-term memory network models are obtained, and each type of trained long short-term memory network model corresponds to each category, so that each trained long short-term memory network model can adapt to different pipeline data respectively.
[0072] Specifically, the step S3 of "collecting data of each pipeline of the pipeline network in real time, and inputting the data of each pipeline into the above-mentioned trained clustering algorithm to determine the category to which the data of each pipeline belongs" should be understood as arranging sensors on each pipeline of the pipeline network to obtain water flow characteristic data N = (E, V, T, M) of each pipeline, and inputting them into the trained clustering algorithm. The trained clustering algorithm can classify the input data to determine the category to which it belongs, and the data of each pipeline input into the trained clustering algorithm can ultimately determine the category to which the data of each pipeline belongs.
[0073] The method for predicting water flow in a pipe network provided in an embodiment of the present invention is based on the K-Medoids clustering algorithm and the long short-term memory network model algorithm. It can solve the problem of insufficient robustness of traditional unsupervised clustering algorithms under abnormal data and the need to manually find the optimal K value. It also solves the problem of insufficient prediction accuracy of a single long short-term memory network model under different environments.
[0074] See also Figure 3 , which is a structural block diagram of a pipe network water flow prediction device 100 provided in accordance with an embodiment of the present invention. The pipe network water flow prediction device 100 provided in an embodiment of the present invention includes:
[0075] The sample acquisition module 1 is used to acquire the collected water flow characteristic data of the pipe network as a sample;
[0076] Clustering module 2 is used to cluster the samples based on a clustering algorithm, calculate the Davidson-Borgin index under different cluster totals, select the cluster total that minimizes the Davidson-Borgin index as the final cluster total, and obtain the data sets corresponding to each category after clustering;
[0077] The long short-term memory model training module 3 is used to establish k long short-term memory network models, and input the data sets corresponding to each category after clustering into the k long short-term memory network models for training, so as to obtain k types of trained long short-term memory network models, wherein each type of trained long short-term memory network model corresponds to one category, and k is equal to the final total number of clusters;
[0078] The classification determination module 4 is used to collect data of each pipeline of the pipeline network in real time, and input the data of each pipeline into the trained clustering algorithm to determine the category to which the data of each pipeline belongs;
[0079] The total water flow calculation module 5 is used to input the data of each pipeline into the long short-term memory network model corresponding to the category to which the data of each pipeline belongs, obtain the short-term water flow of each pipeline, accumulate the short-term water flow of each pipeline, and obtain the total water flow of the current large-scale pipeline network.
[0080] As an optional implementation, in the sample acquisition module 1, the water flow characteristic data of the pipe network includes water pressure, water flow velocity, current water temperature environment, and pipe diameter, then the sample includes multiple sample individuals, each sample individual is expressed as Z = (E, V, T, M, P), wherein E is water pressure; V is water flow velocity; T is current water temperature; and M is pipe diameter.
[0081] In specific implementation, water flow characteristic data such as water pressure, water flow velocity, current water temperature and pipe diameter of multiple pipes at multiple historical moments can be collected by sensors to obtain multiple sample individuals. In order to make the samples more representative, the number of sample individuals is at least 1000.
[0082] As an optional implementation, the clustering module 2 specifically includes:
[0083] The cluster center selection unit executes step S11: randomly selecting k sample individuals from the sample as k cluster centers, wherein each cluster center corresponds to a category, and k is the current total number of clusters;
[0084] The sample allocation unit is used to execute step S12: calculate the distances from the remaining sample individuals to the center of each class, and allocate the remaining sample individuals to each class to obtain a data set corresponding to each class, wherein the allocation result is that the distance from each sample individual to the class center of the class to which the sample individual belongs is smaller than the distance from the sample individual to the class center of other classes;
[0085] The class center updating unit is used to execute step S13: updating the class center of each class, and for each class, selecting the sample individual with the smallest sum of distances to other sample individuals in the class as the new class center;
[0086] The class center determination unit is used to execute step S14: repeating steps S12 to S13 until all class centers no longer change;
[0087] The Davidson-Borg index determination unit is used to execute step S15: based on the current total number of clusters, determine the Davidson-Borg index under the current total number of clusters;
[0088] The total number of clusters determination unit is used to execute step S16: update the k value, set K=K+1, repeat steps S11 to S15 until k is equal to the preset value, obtain the Davidson-Borgin index under different total number of clusters, and select the total number of clusters corresponding to the minimum Davidson-Borgin index as the final total number of clusters.
[0089] As an optional implementation, the Davidson-Borgin index determination unit is specifically used for:
[0090] The Davidson-Botting Index at the current total number of clusters is determined by the following formula:
[0091]
[0092] Among them, I DB represents the Davidson-Bodin index, k is the current total number of clusters, C i represents the average distance from sample individual i to the class center of the class to which it belongs, C j represents the average distance from sample individual j to the class center of the class to which it belongs, F i,j Represents the Euclidean distance between the class center of category i and the class center of category j.
[0093] Specifically, the step S12 "calculating the distances from the remaining sample individuals to each class center" performed by the class center updating unit is expressed by the formula |Z n -u i | 2 Calculate, Z n represents the nth sample individual, u i Represents the i-th class center.
[0094] Specifically, the distance in step S13 "for each category, select the sample individual with the smallest sum of distances to other sample individuals in the category as the new category center" performed by the class center updating unit refers to the Euclidean distance between two sample individuals.
[0095] Specifically, in step S16 executed by the cluster total number determination unit, “until k is equal to a preset value”, the preset value can be determined according to actual measurement conditions. In the embodiment of the present invention, the k value should not exceed 20.
[0096] In the embodiments of the present invention, see Figure 2 , Figure 2 : is a diagram of the model training architecture provided by the method for predicting water flow in a pipe network provided by an embodiment of the present invention. Before starting the training, 1000 sample individuals are first selected from the water flow characteristic data collected by the sensor, that is, the sample is [Z1 Z2 … Z 10000 ], and based on the K-Medoids clustering algorithm, from [Z1Z2 … Z 10000 ] randomly select k class centers u i It can be understood that k is the total number of clusters and the initial value of k is 1, and the DB index (DB index is the Davidson-Bouldin Index obtained above, the full name is Davies-Bouldin Index) under different k values is calculated by the above step S1 to [Z1 Z2 … Z 10000 ] to perform clustering, determine the final total number of clusters k, obtain k types of data, and input the k types of data into k long short-term memory network models for training, so as to obtain k types of trained long short-term memory network models.
[0097] In the specific implementation, in the step of training the long short-term memory network model, the LSTM model can be set by calling the LSTM toolkit in the neural network library Keras, wherein each LSTM model has 1000 neurons in the hidden layer and 1 neuron in the output layer. At the same time, the training set format of the LSTM model input is set to Z=(E, V, T, M, P), the number of training samples batch_size is 1000, the number of training epochs is 500, and the network model is set to randomly stop the activation value of a certain neuron with a probability of 0.5 during forward propagation, so as to make the model more generalizable. When the iteration is completed, K types of trained long short-term memory network models are obtained, and each type of trained long short-term memory network model corresponds to each category, so that each trained long short-term memory network model can adapt to different pipeline data respectively.
[0098] Another embodiment of the present invention provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the above steps S0 to S4.
[0099] The computer-readable storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).
[0100] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.
[0101] The above is a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for predicting water flow in a pipe network, characterized in that: include: Acquire the collected water flow characteristic data of the pipe network as a sample; wherein the water flow characteristic data of the pipe network includes water pressure, water flow velocity, current water temperature, and pipe diameter; Clustering the samples based on a clustering algorithm, calculating the Davidson-Borgin index under different total cluster numbers, selecting the total cluster number that minimizes the Davidson-Borgin index as the final total cluster number, and obtaining data sets corresponding to each category after clustering; Establish k long short-term memory network models, and input the data sets corresponding to each category after clustering into the k long short-term memory network models for training, so as to obtain k types of trained long short-term memory network models, wherein each type of trained long short-term memory network model corresponds to one category, and K is equal to the final total number of clusters; Collecting data of each pipeline of the pipeline network in real time, and inputting the data of each pipeline into the trained clustering algorithm to determine the category to which the data of each pipeline belongs; The data of each pipeline are respectively input into the trained long short-term memory network model corresponding to the category to which the data of each pipeline belongs, so as to obtain the short-term water flow of each pipeline, and then the short-term water flow of each pipeline is accumulated to obtain the total water flow of the current large-scale pipeline network.
2. The method for predicting water flow in a pipe network according to claim 1, characterized in that: The sample includes multiple sample individuals, each of which is represented by Z=(E, V, T, M, P), where E is water pressure, V is water flow velocity, T is current water temperature, and M is the diameter of the pipe.
3. The method for predicting water flow in a pipe network according to claim 2, characterized in that: The clustering algorithm is used to cluster the samples, and the Davidson-Borgin index under different cluster total numbers is calculated, and the cluster total number with the smallest Davidson-Borgin index is selected as the final cluster total number, which specifically includes: Step S11, randomly selecting k sample individuals from the sample as k cluster centers, wherein each cluster center corresponds to a category, and k is the current total number of clusters; Step S12, calculating the distances from the remaining sample individuals to the center of each class, and assigning the remaining sample individuals to each class to obtain a data set corresponding to each class, wherein the result of the assignment is that the distance from each sample individual to the class center of the class to which the sample individual belongs is smaller than the distance from the sample individual to the class centers of other classes; Step S13, updating the class center of each class. For each class, select the sample individual with the smallest sum of distances to other sample individuals in the class as the new class center; Step S14, repeating steps S12 to S13 until all cluster centers no longer change; Step S15, based on the current total number of clusters, determining the Davidson-Botting Index under the current total number of clusters; Step S16, update the k value, set K = K + 1, repeat steps S11 to S15 until k is equal to the preset value, obtain the Davidson-Borgin index under different total number of clusters, and select the total number of clusters corresponding to the minimum Davidson-Borgin index as the final total number of clusters.
4. The method for predicting water flow in a pipe network according to claim 3, characterized in that: Determining the Davidson-Botting Index based on the current total number of clusters specifically includes: The Davidson-Botting Index at the current total number of clusters is determined by the following formula: Among them, I DB represents the Davidson-Bodin index, k is the current total number of clusters, C i represents the average distance from sample individual i to the class center of the class to which it belongs, C j represents the average distance from sample individual j to the class center of the class to which it belongs, F i,j Represents the Euclidean distance between the class center of category i and the class center of category j.
5. A device for predicting water flow in a pipe network, characterized in that: include: A sample acquisition module is used to acquire the collected water flow characteristic data of the pipe network as a sample; wherein the water flow characteristic data of the pipe network includes water pressure, water flow velocity, current water temperature, and pipe diameter; A clustering module is used to cluster the samples based on a clustering algorithm, calculate the Davidson-Borgin index under different cluster totals, select the cluster total that minimizes the Davidson-Borgin index as the final cluster total, and obtain the data sets corresponding to each category after clustering; A long short-term memory model training module is used to establish k long short-term memory network models, and input the data sets corresponding to each category after clustering into the k long short-term memory network models for training, so as to obtain k types of trained long short-term memory network models, wherein each type of trained long short-term memory network model corresponds to one category, and k is equal to the final total number of clusters; A classification determination module, used for collecting data of each pipeline of the pipeline network in real time, and inputting the data of each pipeline into the trained clustering algorithm to determine the category to which the data of each pipeline belongs; The total water flow calculation module is used to input the data of each pipeline into the long short-term memory network model corresponding to the category to which the data of each pipeline belongs, obtain the short-term water flow of each pipeline, accumulate the short-term water flow of each pipeline, and obtain the total water flow of the current large-scale pipeline network.
6. The device for predicting water flow in a pipe network according to claim 5, characterized in that: In the sample acquisition module, the sample includes multiple sample individuals, each of which is represented by Z=(E, V, T, M, P), where E is water pressure, V is water flow velocity, T is current water temperature, and M is the diameter of the pipe.
7. The device for predicting water flow in a pipe network according to claim 6, characterized in that: The clustering module specifically includes: The cluster center selection unit is used to execute step S11: randomly select k sample individuals from the sample as k cluster centers, wherein each cluster center corresponds to a category, and k is the current total number of clusters; The sample allocation unit is used to execute step S12: calculate the distances from the remaining sample individuals to the center of each class, and allocate the remaining sample individuals to each class to obtain a data set corresponding to each class, wherein the allocation result is that the distance from each sample individual to the class center of the class to which the sample individual belongs is smaller than the distance from the sample individual to the class center of other classes; The class center updating unit is used to execute step S13: updating the class center of each class, and for each class, selecting the sample individual with the smallest sum of distances to other sample individuals in the class as the new class center; The class center determination unit is used to execute step S14: repeating steps S12 to S13 until all class centers no longer change; The Davidson-Borg index determination unit is used to execute step S15: based on the current total number of clusters, determine the Davidson-Borg index under the current total number of clusters; The total number of clusters determination unit is used to execute step S16: update the k value, set K=K+1, repeat steps S11 to S15 until k is equal to the preset value, obtain the Davidson-Borgin index under different total number of clusters, and select the total number of clusters corresponding to the minimum Davidson-Borgin index as the final total number of clusters.
8. The device for predicting water flow in a pipe network according to claim 7, characterized in that: The Davidson-Boulding index determination unit is specifically used for: The Davidson-Botting Index at the current total number of clusters is determined by the following formula: Among them, I DB represents the Davidson-Bodin index, k is the current total number of clusters, C i represents the average distance from sample individual i to the class center of the class to which it belongs, C j represents the average distance from sample individual j to the class center of the class to which it belongs, F i,j Represents the Euclidean distance between the class center of category i and the class center of category j.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the method for predicting the water flow of the pipe network according to any one of claims 1 to 4.
