Abnormal monitoring method of building water supply and drainage flow rate based on Internet of Things technology
By collecting water flow velocity data in the building water supply and drainage system, and using clustering algorithms and anomaly calculation to adaptively determine the neighborhood K value of the water flow velocity value, the problem of insufficient accuracy of flow velocity abnormality detection in the prior art is solved, and a more efficient abnormality detection effect is achieved.
Patent Information
- Application Number
- CN202411846167.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-16
AI Technical Summary
In the prior art, when detecting flow velocity abnormality in building water supply and drainage systems, it is difficult to accurately determine the neighborhood range in the LOF algorithm, which affects the accuracy of the detection.
By collecting water flow velocity data in the pipeline of the building water supply and drainage system, the differential sequence is divided into multiple cluster clusters using a clustering algorithm without preset number of cluster clusters, the monitoring anomaly of each water flow velocity value is calculated, and the neighborhood K value of the water flow velocity value is adaptively determined based on the anomaly degree and the probability of abnormality, and then anomaly detection is performed using the LOF algorithm.
It improves the accuracy of abnormal detection of water flow velocity in the pipelines of building water supply and drainage systems, reduces false alarms caused by pipeline structural factors, and enhances the detection ability of abnormal water flow velocity values.
Smart Images

Figure CN119293528B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and specifically to a method for monitoring abnormal flow rates of building water supply and drainage based on Internet of Things technology. Background Art
[0002] The building water supply and drainage system is mainly used to meet the requirements of water supply and drainage in building production and life, including building water supply system and building drainage system. Among them, the building water supply system is a water supply system that introduces water sources such as urban water supply pipes into the building to meet the water volume, water pressure and other requirements of each water point; the main purpose of the building drainage system is to discharge sewage and wastewater in the building to a designated location for subsequent treatment. In order to ensure the normal operation of the building water supply and drainage system, it is usually necessary to monitor and analyze the flow rate data in the pipeline, timely understand the flow pattern and potential problems of the water flow in the pipeline, and monitor whether there are leakage, blockage and other abnormal conditions in the water supply and drainage process.
[0003] At present, in the process of monitoring and analyzing the flow velocity in the building water supply and drainage system, data anomaly detection algorithms are often used to detect anomalies of the water flow velocity in the pipe, such as the outlier factor detection method LOF, the isolation forest method, the probability statistics method, etc. Among them, LOF does not need to assume the probability distribution of the flow velocity data when performing anomaly detection, and is applicable to data sets of different densities. The LOF algorithm is often used to detect anomalies of the water flow velocity in the pipe. When using this algorithm to detect the water flow velocity in the pipe, due to the complexity of the pipe structure and the difference in water consumption at different water points in the building, the water flow velocity will change, and it is difficult to determine the neighborhood range in the LOF algorithm, which affects the accuracy of anomaly detection, and then leads to inaccurate detection of anomalies of the water flow velocity in the pipe of the building water supply and drainage system. Summary of the invention
[0004] In order to solve the above problems, this application provides a method for monitoring abnormal flow rate of building water supply and drainage based on Internet of Things technology. The technical solutions adopted are as follows:
[0005] Collect water flow velocity data in pipes in building water supply and drainage systems;
[0006] The monitoring abnormality of the water flow velocity value is obtained according to the distribution of each water flow velocity value in the observation window and the clustering result of the differential elements between the water flow velocity values;
[0007] A characteristic value sequence of the water flow velocity value is obtained by sorting the monitored abnormality of the water flow velocity value, the characteristic value sequence is divided into a plurality of initial characteristic segments, and the probability of the initial characteristic segment containing an abnormality is calculated based on the element distribution characteristics and position information in the initial characteristic segment;
[0008] The neighborhood K value of the water flow velocity value is obtained according to the monitoring abnormality of the water flow velocity value and the probability of inclusion of anomalies in the initial feature segment to which the water flow velocity value belongs. The abnormal water flow velocity value is obtained according to the neighborhood K value of the water flow velocity value using an anomaly detection algorithm.
[0009] Furthermore, the monitoring abnormality of the water flow velocity value is obtained according to the distribution of each water flow velocity value in the observation window and the clustering result of the differential elements between the water flow velocity values, and the specific steps include the following:
[0010] All collected water flow velocity values are organized into a velocity sequence in chronological order, a differential sequence of the velocity sequence is obtained, and the elements in the differential sequence are divided into a plurality of clusters using a clustering algorithm without presetting the number of clusters;
[0011] Set a sliding window of fixed size, and use the sliding window with each water flow velocity value as the window center point as the observation window for each water flow velocity value;
[0012] The monitoring anomaly degree of each water flow velocity value is calculated based on the distribution of elements in the observation window of each water flow velocity value and the distribution characteristics of elements in the cluster.
[0013] Furthermore, the monitoring abnormality of each water flow velocity value is calculated based on the distribution of elements in the observation window of each water flow velocity value and the distribution characteristics of elements in the cluster, and the specific steps include the following:
[0014] Determine the number of clusters where the differential elements formed by all water flow velocity values in the observation window of each water flow velocity value are located, and calculate the product of the number of clusters and the distribution variance of all elements in the observation window of each water flow velocity value as the numerator;
[0015] The reciprocal of the sum of the frequencies of the differential elements formed by all water flow velocity values in the observation window of each water flow velocity value in the differential sequence of the flow velocity sequence and the sum of the constant parameter is used as the first metric value;
[0016] The product of the first metric value and the numerator is used as the monitoring abnormality degree of each water flow velocity value.
[0017] Furthermore, the calculation of the probability of the initial feature segment containing anomalies based on the element distribution characteristics and position information in the initial feature segment includes the following specific steps:
[0018] For any initial feature segment, determine the coordinate information of the monitoring location corresponding to the water flow velocity value of each monitoring abnormality, and mark the label value of the monitoring location whose coordinate information is the turning point of the water supply and drainage pipeline in the building as 1;
[0019] Calculate the product of the distribution variance of the monitoring abnormality in each initial feature segment and the mean of the monitoring abnormality in each initial feature segment, and use the ratio of the product to the number of monitoring abnormalities in each initial feature segment as the abnormality weight of each initial feature segment;
[0020] The probability of each initial feature segment containing anomalies is determined based on the anomaly weight and the possibility that the trend difference of the monitored anomaly degree in each initial feature segment and the reference feature segment of each initial feature segment is caused by the abnormal water flow velocity value.
[0021] Furthermore, the probability of each initial feature segment containing an anomaly is determined as follows:
[0022] Calculate the Euclidean distance between the monitoring position coordinate information corresponding to any two monitoring anomaly degrees in the two initial feature segments, take the average of all Euclidean distances calculated between the two initial feature segments as the monitoring position distance between the two initial feature segments, and take the other initial feature segments corresponding to the minimum monitoring position distance between each initial feature segment as the reference feature segment of each initial feature segment;
[0023] Determine the difference between the number of monitored abnormalities in each initial feature segment and the reference feature segment of each initial feature segment;
[0024] The sum of the absolute value of the difference between the slopes of each initial feature segment and the monitoring abnormality within the reference feature segment of each initial feature segment obtained by linear fitting and the difference of the quantity is taken as the first difference value;
[0025] The product of the first difference value and the abnormal weight of each initial feature segment is taken as the numerator, and the ratio of the numerator to the number of monitoring positions with a label value of 1 in the monitoring positions corresponding to the monitoring abnormality degree in the reference feature segment of each initial feature segment is taken as the probability of containing abnormalities for each initial feature segment.
[0026] Furthermore, the method of obtaining the neighborhood K value of the water flow velocity value according to the monitoring abnormality of the water flow velocity value and the probability of abnormal inclusion of the initial feature segment to which the water flow velocity value belongs includes the following specific steps:
[0027] Screening the monitoring abnormality based on the label value of the monitoring location of each water flow velocity value, and determining the distribution influence weight of the data level of each abnormality based on the screening result;
[0028] Determine the neighborhood distance of each water flow velocity value based on the distribution influence weight of the data level to which each monitoring abnormality degree belongs and the probability of containing abnormalities of the initial feature segment to which each monitoring abnormality degree belongs;
[0029] If the neighborhood distance of the water flow velocity value is less than the preset upper limit value, the neighborhood distance of the water flow velocity value is used as the neighborhood K value of the water flow velocity value;
[0030] If the neighborhood distance of the water flow velocity value is greater than or equal to a preset upper limit value, the preset upper limit value is used as the neighborhood K value of the water flow velocity value.
[0031] Furthermore, the distribution influence weight of the data level of each abnormality degree is determined as follows:
[0032] Eliminate the monitoring anomaly degrees whose label value of the corresponding monitoring position is 1 from all monitoring anomaly degrees, use the remaining monitoring anomaly degrees to form a screening set, and use the information entropy of the monitoring anomaly degrees in the screening set as the first threshold;
[0033] In the screening set, the monitoring abnormality degrees with equal values are all regarded as the data level of one abnormality degree;
[0034] For any data level of abnormality, the difference between the first threshold and the information entropy of the remaining monitored abnormalities in the screening set after deleting the data level of each abnormality is used as the distribution influence weight of the data level of each abnormality.
[0035] Furthermore, the determination of the neighborhood distance of each water flow velocity value includes the following specific steps:
[0036] Calculate the ratio of the probability of inclusion of anomaly in the initial characteristic segment to which the monitoring anomaly degree of each water flow velocity value belongs to and the maximum value of the probability of inclusion of anomaly in all initial characteristic segments;
[0037] The rounded result of the product of the ratio and the distribution influence weight of the data level to which the monitoring abnormality of each water flow velocity value belongs is taken as the neighborhood distance of each water flow velocity value.
[0038] Furthermore, the step of dividing the feature value sequence into a plurality of initial feature segments includes the following specific steps:
[0039] The characteristic value sequence of water flow velocity values is taken as input, and the characteristic value sequence is divided into multiple subsequences using a sequence segmentation algorithm, and each subsequence is used as an initial characteristic segment.
[0040] Furthermore, the abnormal water flow velocity value is obtained by using an abnormality detection algorithm according to the neighborhood K value of the water flow velocity value, and the specific steps include the following:
[0041] All water flow velocity values and the neighborhood K values of water flow velocity values are taken as input, and the outlier factor detection LOF algorithm is used to obtain the local anomaly factor of each water flow velocity value;
[0042] A second threshold is preset, and if the local abnormal factor of the water flow velocity value is greater than the second threshold, the water flow velocity value is considered to be an abnormal water flow velocity value.
[0043] The beneficial effects of the technical solution of the present application are as follows: after the present application collects the water flow velocity data in the pipes of the water supply and drainage system according to the Internet of Things technology, since the water flow velocity value will change in different time periods, firstly, a clustering method that does not require a preset number of clusters is used to divide the differential sequence formed by the water flow velocity value into multiple clusters, so as to avoid the problem that the difference between the preset number of clusters and the actual distribution of collected data affects the accuracy of subsequent data feature analysis; secondly, by presetting an observation window for each water flow velocity value in the water flow velocity data, the difference in the water flow velocity value in the observation window and the clustering of the differential elements between the water flow velocity values in the observation window are analyzed to determine the monitoring abnormality of the water flow velocity value, and preliminarily evaluate the probability of the water flow velocity value being an abnormal value; then, combined with the water flow velocity value, the probability of the water flow velocity value being an abnormal value is evaluated. The monitoring position information is analyzed to determine whether the distribution difference of the monitoring anomaly is caused by the pipeline structure in the water supply and drainage system or the abnormal water flow velocity value, and the probability of including anomalies in each initial feature segment is determined to eliminate the probability that the water flow velocity values with higher significance in the velocity sequence caused by the pipeline structure factors are considered abnormal; subsequently, the neighborhood K value of the water flow velocity value is adaptively obtained according to the monitoring anomaly of the water flow velocity value and the probability of including anomalies in the initial feature segment to which the water flow velocity value belongs, and the water flow velocity anomaly in the pipeline of the water conservancy system is detected. When obtaining the neighborhood K value of the water flow velocity value, by dividing the monitoring anomaly into different data levels, the changes in the water flow velocity value at different monitoring locations can be better analyzed, thereby improving the accuracy of detecting abnormal water flow velocity values using the LOF algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0045] Figure 1 A flowchart of the steps of a method for monitoring abnormal flow rates of water supply and drainage in buildings based on Internet of Things technology provided in one embodiment of the present application. DETAILED DESCRIPTION
[0046] In order to further explain the technical means and effects adopted by the present application to achieve the predetermined invention purpose, the specific implementation method, structure, features and effects of the abnormal flow rate monitoring method of building water supply and drainage based on Internet of Things technology proposed by the present application are described in detail as follows in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0047] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.
[0048] The specific scheme of the abnormal flow rate monitoring method of building water supply and drainage based on Internet of Things technology provided by the present application is described in detail below with reference to the accompanying drawings.
[0049] See also Figure 1 , which shows a flowchart of a method for monitoring abnormal flow rate of building water supply and drainage based on Internet of Things technology provided by an embodiment of the present application, the method comprising the following steps:
[0050] Step S001: Collect water flow velocity data in pipes in a building water supply and drainage system.
[0051] It should be noted that the purpose of this embodiment is to perform real-time abnormal monitoring of water flow velocity data in pipes of a building water supply and drainage system. Before starting to process and analyze the data, it is necessary to collect the data first.
[0052] Specifically, water flow velocity monitoring equipment is arranged in the pipes of several building water supply and drainage systems, and a water flow velocity value of each monitoring position is outputted by the water flow velocity monitoring equipment every 5 seconds. The water flow velocity monitoring equipment includes but is not limited to a turbine water flow sensor, an ultrasonic water flow sensor, and a water flow velocity meter. The implementer can select appropriate monitoring equipment according to the size of the pipes in the building water supply and drainage system that need to monitor the flow velocity. The larger the size of the pipe, the more suitable the monitoring equipment with a large size; the smaller the size of the pipe, the smaller the monitoring equipment should be selected for easy installation. This application does not impose any special restrictions on the specific type of monitoring equipment.
[0053] Step S002: Obtain the monitoring abnormality of the water flow velocity value according to the distribution of each water flow velocity value in the observation window and the clustering result of the differential elements between the water flow velocity values.
[0054] It should be noted that when using the LOF algorithm to perform abnormal analysis on water flow velocity data, the degree of fluctuation of water flow velocity data in different time periods is different, which is related to the temperature in the pipeline and the supply and use of water resources. Changes in water flow velocity may cause certain damage to the pipeline, such as the "water hammer effect", that is, the rapid change of water flow velocity in the pipeline causes a certain impact on the pipeline. Therefore, it is necessary to monitor the abnormal water flow velocity values in time to avoid problems such as pipeline rupture caused by changes in water flow velocity.
[0055] It should be further explained that when monitoring the abnormality of water flow velocity values, it is necessary to determine the fluctuation of water flow velocity data in different time periods, so as to obtain the initial range of the neighborhood value K, and the size of the K value has a greater impact on the local density of the water flow velocity value, thereby affecting the accuracy of subsequent abnormal monitoring. The fluctuation of water flow velocity values in a short period of time has certain similarities. Therefore, the characteristic value sequence is obtained according to the monitoring abnormality of the water flow velocity value, and then the characteristic value sequence is segmented according to the change of the characteristic value sequence, and then the segmented data is analyzed to obtain the adaptive K value of each water flow velocity value.
[0056] Specifically, the steps of obtaining an observation window of each water flow velocity value in the water flow velocity data according to a preset value are as follows:
[0057] First, a sliding window with a scale of 1*T is set, and the sliding window with each water flow velocity value as the window center point is used as the observation window for each water flow velocity value. For the water flow velocity value when the sliding window is the window center point and exceeds the range of the collected water flow velocity data, the embodiment of the present application uses a quadratic linear interpolation method to interpolate and fill the data for the part that exceeds the range. Among them, linear interpolation is a common technology in the field of data processing, and the specific process will not be repeated.
[0058] It should be noted that the purpose of setting the sliding window is to analyze the local data characteristics of the water flow velocity value by using the difference between adjacent data of the water flow velocity value with a small time interval. Therefore, the size of T is set to an empirical value of 7 in the embodiment of the present application. Under the premise of being able to meet the local data characteristics of observing each water flow velocity value, in other embodiments, the implementer can set it to a suitable value, and the present application does not make any special restrictions on this.
[0059] Secondly, all collected water flow velocity values are organized into a velocity sequence in chronological order, and the differential sequence of the velocity sequence is obtained. The AP (Affinity Propagation) clustering algorithm is used to divide the elements in the differential sequence into multiple clusters. The intra-cluster differences and frequencies of the elements in the clusters are used to reflect the changing characteristics of the water flow velocity values as a whole. The AP clustering algorithm is a commonly used technology in the field of data processing, and the specific process will not be repeated here.
[0060] It should be noted that the AP clustering algorithm is a clustering algorithm that does not require the pre-setting of the number of clusters. This enables the elements in the differential sequence to be divided into different clusters according to the actual differences between the collected water flow velocity values, avoiding the situation where there is a difference between the pre-set number of clusters and the actual distribution of collected data.
[0061] It should be further explained that this embodiment only provides a method for clustering elements in the differential sequence, that is, using the AP clustering algorithm, under the premise that the clustering of elements in the differential sequence can be achieved and the number of clustering clusters is not preset, in other embodiments, the implementer may use other clustering algorithms, and this application does not impose any special restrictions on this.
[0062] Furthermore, the monitoring abnormality of each water flow velocity value is calculated by combining the observation window of each water flow velocity value and the distribution characteristics of the elements in the cluster to characterize the probability that each water flow velocity value is abnormal data. The calculation formula for the monitoring abnormality of the i-th water flow velocity value is as follows:
[0063]
[0064] In the formula, is the monitoring abnormality of the i-th water flow velocity value, is the number of clusters where the differential elements formed by all water flow velocity values in the observation window of the i-th water flow velocity value belong, is the sum of the frequencies of the differential elements formed by all water flow velocity values in the observation window of the i-th water flow velocity value in the differential sequence, is the distribution variance of all water flow velocity values within the observation window of the i-th water flow velocity value, is a tuning constant used to prevent the denominator from being 0. The value of can be any positive number not exceeding 0.01. Preferably, the empirical value of 0.001 is taken in the embodiment of the present application.
[0065] Among them, the first metric value It reflects the possibility of abnormal data distribution in the observation window of the i-th water flow velocity value. The smaller the frequency of the differential elements formed by all water flow velocity values in the observation window of the i-th water flow velocity value in the differential sequence, The smaller the value of is, the rarer the variation between all water flow velocity values in the observation window of the ith water flow velocity value is in the flow velocity sequence, and the greater the probability of abnormal water flow velocity fluctuation is; the numerator It reflects the mutation degree of all water flow velocity values in the observation window of the i-th water flow velocity value. The more serious the mutation of the water flow velocity value in the observation window, the The larger the value of , the greater the difference in the differential elements formed by all the water flow velocity values in the observation window of the i-th water flow velocity value, and the easier it is to be divided into different clusters. The larger the value of The larger the value of , the higher the probability that the i-th water flow velocity value is an abnormal value.
[0066] Step S003: obtaining a characteristic value sequence of the water flow velocity value according to the monitoring abnormality of the water flow velocity value, dividing the characteristic value sequence into a plurality of initial characteristic segments, and calculating the probability of the initial characteristic segment containing an abnormality based on the element distribution characteristics and position information in the initial characteristic segment.
[0067] Specifically, according to the above steps, the monitoring abnormality of each water flow velocity value is calculated respectively, and the characteristic value sequence of the water flow velocity value is obtained in chronological order. Due to the different location structures of different pipes in the building water supply and drainage system and the different water use and drainage requirements of water points in the building at different times, it is considered to segment the characteristic value sequence of the water flow velocity value. The data features of different segments can be used to characterize the changes of the water flow velocity value under different circumstances. First, the characteristic value sequence of the water flow velocity value is divided into several initial characteristic segments, as follows:
[0068] The characteristic value sequence of water flow velocity values is taken as input, and the BG (Bernaola Galvan) sequence segmentation algorithm is used to divide the characteristic value sequence into multiple subsequences, each subsequence is used as an initial feature segment. Sequence segmentation is a commonly used technology in the field of data processing, and the specific process is not repeated here.
[0069] It should be noted that in this embodiment, only one sequence segmentation method is provided, that is, the eigenvalue sequence is divided into multiple subsequences using BG sequence segmentation. Under the premise that the eigenvalue sequence segmentation can be achieved, in other embodiments, other sequence segmentation methods may be used, and this application does not impose any special restrictions on this.
[0070] Secondly, based on the distribution of monitoring anomalies in different initial characteristic segments and the distances between monitoring positions corresponding to the monitoring anomalies, the possibility of each initial characteristic segment containing an abnormal water flow velocity value is evaluated.
[0071] Furthermore, for any initial feature segment, the monitoring position of the water flow velocity value corresponding to each monitoring anomaly is determined, the coordinate information of the monitoring position is obtained, and each coordinate information is compared with the pipeline layout file of the water supply and drainage pipeline in the building, and the label value of the monitoring position whose coordinate information is the pipe bend is marked as 1, otherwise it is recorded as 0. In each initial feature segment, there are monitoring anomalies with a relatively stable distribution. If the number of monitoring anomalies in a certain initial feature segment is small and the intervals between the monitoring positions are not stable, the water flow velocity value in the initial feature segment may be caused by the change of flow velocity at the bend in the water supply and drainage pipeline, or it may be caused by abnormal conditions at different monitoring positions, and it is also necessary to compare and analyze with the monitoring anomalies in the remaining initial feature segments. Among them, the pipeline layout file of the water supply and drainage pipeline in the building refers to a file that records information about the pipe size, position, radius, etc. when the water supply and drainage pipeline is placed in the building. At this stage, it usually exists in the form of building information model BIM.
[0072] Specifically, the Euclidean distance between the monitoring position coordinate information corresponding to any two monitoring anomalies in the two initial feature segments is calculated, and the average of all Euclidean distances calculated between the two initial feature segments is used as the monitoring position distance between the two initial feature segments. The other initial feature segments corresponding to the minimum monitoring position distance between each initial feature segment are used as the reference feature segments of each initial feature segment.
[0073] Here, the probability of inclusion of anomalies in each initial feature segment is calculated to characterize the probability of monitoring anomalies caused by the abnormal water supply and drainage flow rate phenomenon in each initial feature segment. The calculation formula for the probability of inclusion of anomalies in the ath initial feature segment is as follows:
[0074]
[0075]
[0076] In the formula, is the abnormal weight of the a-th initial feature segment, is the number of monitored anomalies in the ath initial feature segment, is the distribution variance of the monitoring anomaly within the ath initial feature segment, is the mean value of the monitoring abnormality in the ath initial feature segment;
[0077] is the probability of the ath initial feature segment containing anomalies, , are the slope of the straight line obtained by fitting the abnormal degree monitored in the a-th initial feature segment and the reference feature segment of the a-th initial feature segment. is the difference between the number of monitored anomalies in the a-th initial feature segment and the reference feature segment of the a-th initial feature segment. It is the number of monitoring positions with label value 1 in the a-th initial feature segment and the monitoring positions corresponding to the monitoring anomaly degree in the reference feature segment of the a-th initial feature segment.
[0078] in, It represents the probability that the abnormality monitored in the ath initial feature segment is abnormal compared with the abnormal values in the other initial feature segments. The larger the value of is, the greater the probability of a larger monitoring anomaly calculated from the water flow velocity values caused by abnormal phenomena at different monitoring locations. The smaller the value of , the more prominent the distribution of monitoring anomalies in the ath initial feature segment is compared with the overall distribution of all monitoring anomalies;
[0079] First difference value It characterizes the difference characteristics of the monitoring anomaly between the ath initial feature segment and its reference feature segment under the premise of the monitoring position being close. The greater the difference in the slopes of the two fitting lines, the greater the difference in the changing trend of the monitoring anomaly between the ath initial feature segment and its reference feature segment, and the more likely it is caused by abnormal water flow velocity values; and the more the number of monitoring anomalies between the ath initial feature segment and its reference feature segment at the pipe bend is, the greater the probability that the difference characteristics are caused by the pipe structure, and vice versa. The smaller the value of , the higher the possibility that the difference feature is caused by abnormal water flow monitoring value, that is, The larger the value of , the greater the possibility that the monitoring abnormality calculated by the abnormal water flow velocity value in the a-th initial characteristic segment is included.
[0080] Step S004, obtaining a neighborhood K value of the water flow velocity value according to the monitoring abnormality of the water flow velocity value and the probability of containing an abnormality in the initial feature segment to which the water flow velocity value belongs, and obtaining an abnormal water flow velocity value according to the neighborhood K value of the water flow velocity value using an anomaly detection algorithm.
[0081] First, according to the above steps, the monitoring abnormality of each water flow velocity value and the probability of containing abnormalities of each initial feature segment can be obtained respectively.
[0082] Secondly, the influence of each monitoring abnormality in each initial feature segment on the entire initial feature segment is further analyzed to evaluate the possibility that each monitoring abnormality is caused by an abnormal water flow velocity value. The neighborhood K value of each flow velocity value is comprehensively determined by combining the significance of the monitoring abnormality of each water flow velocity value compared with the monitoring abnormality of the water flow velocity values collected at all monitoring locations other than pipeline bends.
[0083] Specifically, from all monitoring anomalies, the monitoring anomalies of the water flow velocity values collected at the monitoring location with a label value of 1 are eliminated, and the remaining monitoring anomalies are used to form a screening set, and the information entropy of the monitoring anomalies in the screening set is used as the first threshold. In the screening set, the data level of the monitoring anomalies is counted, and the monitoring anomalies with equal values are all regarded as the data level of one anomaly.
[0084] Furthermore, for any data level of abnormality, the difference between the first threshold and the information entropy of the remaining monitored abnormalities in the screening set after deleting the data level of each abnormality is used as the distribution influence weight of the data level of each abnormality.
[0085] Here, the neighborhood K value of each water flow velocity value is calculated based on the distribution influence weight of the data level of each abnormality degree and the probability of each initial feature segment containing anomalies. The calculation formula of the neighborhood K value of the j-th water flow velocity value is:
[0086]
[0087]
[0088] In the formula, is the neighborhood distance of the jth water flow velocity value, is the rounding function, is the distribution influence weight of the data level to which the monitoring abnormality of the j-th water flow velocity value belongs, is the probability of abnormal inclusion of the initial characteristic segment to which the monitoring abnormality of the j-th water velocity value belongs, It is the maximum value of the probability of containing anomalies among all initial feature segments;
[0089] is the neighborhood K value of the j-th water velocity value, is the upper limit of the neighborhood K value when detecting abnormal water velocity data. The empirical value of size is 50. This setting is to avoid the possibility that the algorithm's sensitivity to outliers may be reduced due to a large K value. This is because the local anomaly factor is based on the comparison of local density. If the K value is too large, the local density estimate may be affected by more distant points, thereby weakening the ability to detect true outliers.
[0090] Furthermore, according to the above steps, the neighborhood K value of each water flow velocity value in the water flow velocity data is obtained respectively, and the abnormal water flow velocity value can be obtained by the LOF algorithm.
[0091] Specifically, all water flow velocity values and the neighborhood K values of the water flow velocity values are used as input, and the outlier factor detection LOF algorithm is used to obtain the local anomaly factor of each water flow velocity value, and a second threshold is preset. This embodiment is described with the second threshold of 0.85. If the local anomaly factor of the water flow velocity value is greater than the second threshold, the water flow velocity value is an abnormal water flow velocity value. Among them, the LOF algorithm is a commonly used technology for data anomaly detection neighborhood, and the specific process is not repeated; when an abnormal water flow velocity value appears, it means that the water flow velocity in the water supply and drainage pipes in the building is abnormal.
[0092] It should be noted that the above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
[0093] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
Claims
1. A method for monitoring abnormal flow rate of building water supply and drainage based on Internet of Things technology, characterized in that: The method comprises the following steps: Collect water flow velocity data in pipes in building water supply and drainage systems; The monitoring abnormality of the water flow velocity value is obtained according to the distribution of each water flow velocity value in the observation window and the clustering result of the differential elements between the water flow velocity values; Sorting the monitored abnormality of the water flow velocity values to obtain a characteristic value sequence of the water flow velocity values, dividing the characteristic value sequence into a plurality of initial characteristic segments, and calculating the probability of the initial characteristic segments containing abnormalities based on the element distribution characteristics and position information in the initial characteristic segments, wherein the position information is the coordinate information of the monitoring position of the water flow velocity value corresponding to each monitoring abnormality; According to the monitoring abnormality of the water flow velocity value and the probability of the water flow velocity value containing abnormality in the initial feature segment, the neighborhood K value of the water flow velocity value is obtained, and the abnormal water flow velocity value is obtained by using the abnormality detection algorithm according to the neighborhood K value of the water flow velocity value; The specific steps of obtaining the neighborhood K value of the water flow velocity value according to the monitoring abnormality of the water flow velocity value and the probability of containing abnormality of the initial feature segment to which the water flow velocity value belongs are as follows: Screening the monitoring abnormality based on the label value of the monitoring location of each water flow velocity value, and determining the distribution influence weight of the data level of each abnormality based on the screening result; Determine the neighborhood distance of each water flow velocity value based on the distribution influence weight of the data level to which each monitoring abnormality degree belongs and the probability of containing abnormalities of the initial feature segment to which each monitoring abnormality degree belongs; If the neighborhood distance of the water flow velocity value is less than the preset upper limit value, the neighborhood distance of the water flow velocity value is used as the neighborhood K value of the water flow velocity value; If the neighborhood distance of the water flow velocity value is greater than or equal to a preset upper limit value, the preset upper limit value is used as the neighborhood K value of the water flow velocity value.
2. According to claim 1, the method for monitoring abnormal flow rate of building water supply and drainage based on Internet of Things technology is characterized in that: The specific steps of obtaining the monitoring abnormality of the water flow velocity value according to the distribution of each water flow velocity value in the observation window and the clustering result of the differential elements between the water flow velocity values are as follows: All collected water flow velocity values are organized into a velocity sequence in chronological order, a differential sequence of the velocity sequence is obtained, and the elements in the differential sequence are divided into a plurality of clusters using a clustering algorithm without presetting the number of clusters; Set a sliding window of fixed size, and use the sliding window with each water flow velocity value as the window center point as the observation window for each water flow velocity value; The monitoring anomaly degree of each water flow velocity value is calculated based on the distribution of elements in the observation window of each water flow velocity value and the distribution characteristics of elements in the cluster.
3. According to claim 2, the method for monitoring abnormal flow rate of building water supply and drainage based on Internet of Things technology is characterized in that: The specific steps of calculating the monitoring abnormality of each water flow velocity value based on the distribution of elements in the observation window of each water flow velocity value and the distribution characteristics of elements in the cluster are as follows: Determine the number of clusters where the differential elements formed by all water flow velocity values in the observation window of each water flow velocity value are located, and calculate the product of the number of clusters and the distribution variance of all elements in the observation window of each water flow velocity value as the numerator; The reciprocal of the sum of the frequencies of the differential elements formed by all water flow velocity values in the observation window of each water flow velocity value in the differential sequence of the flow velocity sequence and the sum of the constant parameter is used as the first metric value; The product of the first metric value and the numerator is used as the monitoring abnormality degree of each water flow velocity value.
4. According to claim 1, the method for monitoring abnormal flow rate of building water supply and drainage based on Internet of Things technology is characterized in that: The specific steps of calculating the probability of the initial feature segment containing anomalies based on the element distribution characteristics and position information in the initial feature segment are as follows: For any initial feature segment, determine the coordinate information of the monitoring location corresponding to the water flow velocity value of each monitoring abnormality, and mark the label value of the monitoring location whose coordinate information is the turning point of the water supply and drainage pipeline in the building as 1; Calculate the product of the distribution variance of the monitoring abnormality in each initial feature segment and the mean of the monitoring abnormality in each initial feature segment, and use the ratio of the product to the number of monitoring abnormalities in each initial feature segment as the abnormality weight of each initial feature segment; The probability of each initial feature segment containing anomalies is determined based on the anomaly weight and the possibility that the trend difference of the monitored anomaly degree in each initial feature segment and the reference feature segment of each initial feature segment is caused by the abnormal water flow velocity value.
5. According to claim 4, the method for monitoring abnormal flow rate of building water supply and drainage based on Internet of Things technology is characterized in that: The probability of each initial feature segment containing anomalies is determined as follows: Calculate the Euclidean distance between the monitoring position coordinate information corresponding to any two monitoring anomaly degrees in the two initial feature segments, take the average of all Euclidean distances calculated between the two initial feature segments as the monitoring position distance between the two initial feature segments, and take the other initial feature segments corresponding to the minimum monitoring position distance between each initial feature segment as the reference feature segment of each initial feature segment; Determine the difference between the number of monitored abnormalities in each initial feature segment and the reference feature segment of each initial feature segment; The sum of the absolute value of the difference between the slopes of each initial feature segment and the monitoring abnormality within the reference feature segment of each initial feature segment obtained by linear fitting and the difference of the quantity is taken as the first difference value; The product of the first difference value and the abnormal weight of each initial feature segment is taken as the numerator, and the ratio of the numerator to the number of monitoring positions with a label value of 1 in the monitoring positions corresponding to the monitoring abnormality degree in the reference feature segment of each initial feature segment is taken as the probability of containing abnormalities for each initial feature segment.
6. According to claim 1, the method for monitoring abnormal flow rate of building water supply and drainage based on Internet of Things technology is characterized in that: The distribution influence weight of the data level of each abnormality degree is determined as follows: Eliminate the monitoring anomaly degrees whose label value of the corresponding monitoring position is 1 from all monitoring anomaly degrees, use the remaining monitoring anomaly degrees to form a screening set, and use the information entropy of the monitoring anomaly degrees in the screening set as the first threshold; In the screening set, the monitoring abnormality degrees with equal values are all regarded as the data level of one abnormality degree; For any data level of abnormality, the difference between the first threshold and the information entropy of the remaining monitored abnormalities in the screening set after deleting the data level of each abnormality is used as the distribution influence weight of the data level of each abnormality.
7. According to claim 1, the method for monitoring abnormal flow rate of building water supply and drainage based on Internet of Things technology is characterized in that: The specific steps of determining the neighborhood distance of each water flow velocity value are as follows: Calculate the ratio of the probability of inclusion of anomaly in the initial characteristic segment to which the monitoring anomaly degree of each water flow velocity value belongs to and the maximum value of the probability of inclusion of anomaly in all initial characteristic segments; The rounded result of the product of the ratio and the distribution influence weight of the data level to which the monitoring abnormality of each water flow velocity value belongs is taken as the neighborhood distance of each water flow velocity value.
8. According to claim 1, the method for monitoring abnormal flow rate of building water supply and drainage based on Internet of Things technology is characterized in that: The step of dividing the feature value sequence into a plurality of initial feature segments includes the following specific steps: The characteristic value sequence of water flow velocity values is taken as input, and the characteristic value sequence is divided into multiple subsequences using a sequence segmentation algorithm, and each subsequence is used as an initial characteristic segment.
9. The method for monitoring abnormal flow rate of building water supply and drainage based on Internet of Things technology according to claim 1 is characterized in that: The method of obtaining abnormal water flow velocity values by using an abnormality detection algorithm according to the neighborhood K value of the water flow velocity value includes the following specific steps: All water flow velocity values and the neighborhood K values of water flow velocity values are taken as input, and the outlier factor detection LOF algorithm is used to obtain the local anomaly factor of each water flow velocity value; A second threshold is preset, and if the local abnormal factor of the water flow velocity value is greater than the second threshold, the water flow velocity value is considered to be an abnormal water flow velocity value.
Citation Information
Patent Citations
River channel congestion condition judgment system and method based on deep learning, and storage medium
CN115909003A
Water conservancy project anomaly detection method
CN116429220A