A water meter communication process control method and system
By dividing homomorphic clusters in the water meter system and controlling the data upload period, the problems of low data transmission efficiency and battery exhaustion of the water meter system are solved, and more reliable water meter communication and extended battery life are achieved.
Patent Information
- Application Number
- CN202411065661.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-05
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2044-08-05
AI Technical Summary
Due to network power consumption limitations, the data transmission efficiency of existing water meter systems is not high, especially when the network environment is poor, the data packet transmission failure rate is high, resulting in rapid depletion of water meter batteries or untimely water consumption statistics.
By obtaining the water consumption of each water meter, setting the statistical cycle and uploading period, dividing the water meter into homomorphic clusters, judging and sending upload instructions, ensuring that the data is uploaded within the appropriate time period, avoiding long-term retransmission, and marking the faulty water meter to Save electricity.
On the premise of saving water meter communication and electricity, the reliability of water meter communication is improved, the battery life of water meter is extended, and communication failures are discovered and repaired in a timely manner.
Smart Images

Figure CN118590847B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of water meter data synchronization, and in particular relates to a water meter communication process control method and system. Background Art
[0002] As an important tool for measuring water consumption, the accuracy and management efficiency of water meters directly affect the rational allocation and billing of water resources. With the development of technology, electronic water meters are gradually being used. This type of water meter can record water flow through electronic components and realize remote data transmission through wireless communication technology.
[0003] However, due to the network power consumption limit of the water meter, the data transmission efficiency of the existing system is not high, especially in poor network environment, the data packet transmission failure rate is high. If the water meter continues to send data, the water meter battery will be exhausted quickly, but if it does not send data continuously, the water consumption may not be counted in time. Summary of the invention
[0004] The object of the present invention is to provide a water meter communication process control method and system, which improves the reliability of water meter communication under the premise of saving water meter communication power consumption.
[0005] In order to solve the above technical problems, the present invention is achieved through the following technical solutions:
[0006] The present invention provides a water meter communication process control method, comprising:
[0007] Obtain the meter-side water consumption uploaded by each water meter within the communication control range at each collection time;
[0008] Set the duration of the statistical cycle;
[0009] Setting an upload communication period at the end of the period of the statistical cycle;
[0010] In each round of the statistical cycle, the water meters within the communication control range are divided into corresponding homomorphic clusters according to the meter-end water consumption of each water meter at each collection moment in the previous statistical cycle, wherein users of water meters in the same homomorphic cluster have the same water consumption status;
[0011] Continuously receiving the water consumption uploaded by each water meter during the upload communication period of this statistical cycle;
[0012] In each of the homomorphic clusters, it is continuously determined whether a water meter that has not uploaded its meter-side water consumption is abnormal according to the upload time of each water meter uploading its meter-side water consumption during the upload communication period of the current statistical cycle;
[0013] If yes, an upload instruction is sent to the water meter that has not uploaded the water consumption at the meter end, wherein the upload instruction requires the water meter that receives and executes the instruction to upload the water consumption at the meter end at each collection moment that has not been uploaded;
[0014] If not, continue to judge.
[0015] The present invention also discloses a water meter communication process control method, comprising:
[0016] Get the minimum metering capacity;
[0017] Continuously obtain and record the water consumption at the meter end at each collection moment;
[0018] Determining whether the total water consumption of the water meter reaches an integer multiple of the minimum metering capacity according to the water consumption at the meter end at each collection moment;
[0019] If yes, then upload the meter-side water consumption at each collection moment that has not been uploaded to the data synchronization controller;
[0020] If not, no uploading will be performed;
[0021] Receive upload instructions;
[0022] Upload the meter water consumption at each collection moment that has not been uploaded.
[0023] The present invention also discloses a water meter communication process control method, comprising:
[0024] Obtain the meter-side water consumption uploaded by each water meter within the communication control range at each collection time;
[0025] Set the duration of the statistical cycle;
[0026] Setting an upload communication period at the end of the period of the statistical cycle;
[0027] In each round of the statistical cycle, the water meters within the communication control range are divided into corresponding homomorphic clusters according to the meter-end water consumption of each water meter at each collection moment in the previous statistical cycle, wherein users of water meters in the same homomorphic cluster have the same water consumption status;
[0028] Continuously receiving the water consumption uploaded by each water meter during the upload communication period of this statistical cycle;
[0029] In each of the homomorphic clusters, it is continuously determined whether a water meter that has not uploaded its meter-side water consumption is abnormal according to the upload time of each water meter uploading its meter-side water consumption during the upload communication period of the current statistical cycle;
[0030] If yes, an upload instruction is sent to the water meter that has not uploaded the water consumption at the meter end, wherein the upload instruction requires the water meter that receives and executes the instruction to upload the water consumption at the meter end at each collection moment that has not been uploaded;
[0031] If not, continue to judge;
[0032] At the end of the upload communication period of this statistical cycle, it is determined whether there is a water meter that has not uploaded the water consumption at the meter end;
[0033] If yes, it is marked as a faulty water meter;
[0034] If not, no action is taken.
[0035] The present invention also discloses a water meter communication process control system, comprising:
[0036] A data synchronization controller is used to obtain the meter-end water consumption uploaded by each water meter within the communication control range at each collection moment;
[0037] Set the duration of the statistical cycle;
[0038] Setting an upload communication period at the end of the period of the statistical cycle;
[0039] In each round of the statistical cycle, the water meters within the communication control range are divided into corresponding homomorphic clusters according to the meter-end water consumption of each water meter at each collection moment in the previous statistical cycle, wherein users of water meters in the same homomorphic cluster have the same water consumption status;
[0040] Continuously receiving the water consumption uploaded by each water meter during the upload communication period of this statistical cycle;
[0041] In each of the homomorphic clusters, it is continuously determined whether a water meter that has not uploaded its meter-side water consumption is abnormal according to the upload time of each water meter uploading its meter-side water consumption during the upload communication period of the current statistical cycle;
[0042] If yes, an upload instruction is sent to the water meter that has not uploaded the water consumption at the meter end, wherein the upload instruction requires the water meter that receives and executes the instruction to upload the water consumption at the meter end at each collection moment that has not been uploaded;
[0043] If not, continue to judge;
[0044] Water meter, used to obtain the minimum metering capacity;
[0045] Continuously obtain and record the water consumption at the meter end at each collection moment;
[0046] Determining whether the total water consumption of the water meter reaches an integer multiple of the minimum metering capacity according to the water consumption at the meter end at each collection moment;
[0047] If yes, then upload the meter-side water consumption at each collection moment that has not been uploaded to the data synchronization controller;
[0048] If not, no uploading will be performed;
[0049] Receive upload instructions;
[0050] Upload the meter water consumption at each collection moment that has not been uploaded;
[0051] The maintenance control unit is used to determine whether there is a water meter that has not uploaded the water consumption at the meter end at the end of the upload communication period of the current statistical cycle;
[0052] If yes, it is marked as a faulty water meter;
[0053] If not, no action is taken.
[0054] By analyzing the data uploaded by each water meter and the time of uploading, the present invention can remotely re-upload data for water meters with abnormal communication, thereby avoiding excessive power loss caused by long-term continuous retransmission of water meters. In this process, the technical effect of improving the reliability of water meter communication can be achieved while saving the power consumption of water meter communication.
[0055] Of course, any product implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for describing the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0057] Figure 1 A schematic diagram of functional modules and information flow of a water meter communication process control system according to an embodiment of the present invention;
[0058] Figure 2 A schematic diagram of a step flow of a data synchronization controller according to an embodiment of the present invention;
[0059] Figure 3 A schematic diagram of a process flow of a water meter according to an embodiment of the present invention;
[0060] Figure 4 A schematic diagram of a process flow of a maintenance control unit according to an embodiment of the present invention;
[0061] Figure 5 This is a schematic diagram of the step flow of step S4 in one embodiment of the present invention;
[0062] Figure 6 This is a schematic diagram of a step flow chart of step S43 in an embodiment of the present invention;
[0063] Figure 7 A schematic diagram of a step flow chart of step S44 in an embodiment of the present invention;
[0064] Figure 8 A schematic diagram of a step flow chart of step S444 of an embodiment of the present invention;
[0065] Fig. 9 This is a schematic diagram of the step flow of step S6 in one embodiment of the present invention;
[0066] Fig.10 A schematic diagram of a step flow chart of step S54 in an embodiment of the present invention;
[0067] In the accompanying drawings, the components represented by the reference numerals are listed as follows:
[0068] 1-Data synchronization controller, 2-Water meter, 3-Maintenance control unit. DETAILED DESCRIPTION
[0069] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0070] It should be noted that the terms "first", "second", etc. in this application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0071] See also Figures 1 to 4 As shown, the present invention provides a water meter communication process control system, which includes a data synchronization controller 1, a water meter 2, and a maintenance control unit 3 in terms of functional units. The data synchronization controller 1 can be a cloud server, which is used to control the network action of the water meter 2 and collect and process water service data. The maintenance control unit 3 is a virtual functional unit, which can be a device or APP to guide maintenance personnel.
[0072] The water meter 2 in this system can be a common Internet of Things water meter. The water meter 2 does not continuously send water usage status data during operation, because this will quickly deplete the battery. At the same time, since the water fee is calculated according to integer tonnage, too fragmented data does not have billing statistical value, so step S021 is usually executed first to obtain the minimum metering capacity, usually one ton. Next, step S022 can be executed to continuously obtain and record the meter-end water consumption at each collection moment. Next, step S023 can be executed to determine whether the total water consumption of the water meter reaches an integer multiple of the minimum metering capacity, that is, whether it is a full integer tonnage, based on the meter-end water consumption at each collection moment.
[0073] If the billing state is reached, then step S024 can be executed to upload the meter-side water consumption at each collection time that has not been uploaded to the data synchronization controller. If otherwise, data does not need to be updated, so step S025 can be executed next without uploading.
[0074] When there is a network failure or a hardware failure of the water meter 2 itself, the data synchronization controller 1 may not receive the data uploaded by the water meter 2. But it may also be that the user's water consumption of the water meter is too small, and the data update has not been triggered. In order to determine whether this is the case during the operation of the system, the data synchronization controller 1 first executes step S1 to obtain the meter-end water consumption uploaded by each water meter within the communication control range at each collection time. Next, step S2 can be executed to set the duration of the statistical period, which is usually one month. Next, step S3 can be executed to set the upload communication period at the end of the statistical period, which is usually the last day of the month.
[0075] In the process of receiving data uploaded by the water meter, first, step S4 can be executed. In each statistical cycle, the water meters within the communication control range are divided into corresponding homomorphic clusters according to the meter-side water consumption of each water meter at each collection moment in the previous statistical cycle, wherein the users of the water meters in the same homomorphic cluster have the same water use status. Next, step S5 can be executed to continuously receive the meter-side water consumption uploaded by each water meter during the upload communication period of this statistical cycle. Next, step S6 can be executed to continuously judge whether the water meter that has not yet uploaded the meter-side water consumption is abnormal in each homomorphic cluster according to the upload time of each water meter uploading the meter-side water consumption during the upload communication period of this statistical cycle. If so, then step S7 can be executed to send an upload instruction to the water meter that has not yet uploaded the meter-side water consumption. The upload instruction requires the water meter that receives and executes it to upload the meter-side water consumption at each collection moment that has not been uploaded; if not, return to step S6 to continue the judgment.
[0076] When the water meter 2 and the communication network are operating normally, the water meter can then execute step S026 to receive the upload instruction, and then execute step S027 to upload the meter-side water consumption at each collection time that has not been uploaded.
[0077] If the water meter 2 or the network fails, the maintenance control unit 3 may then execute step S031 to determine whether there is a water meter that has not yet uploaded the water consumption at the meter end at the end of the upload communication period of the current statistical cycle. If so, then step S032 may be executed to mark it as a faulty water meter. If not, then step S033 may be executed to take no action.
[0078] During this process, the water meter 2 itself does not need to perform complex analysis and network operations, so its battery life can be greatly improved. At the same time, once a failure occurs in the water meter 2 or the network, it can be discovered and repaired in time.
[0079] See also Figure 5 As shown, in order to determine whether the water meter is faulty or has not met the upload triggering conditions, it is necessary to analyze the previously uploaded data. If all water meters 2 with the same water usage habits have uploaded data, but some water meters 2 have not uploaded data within a certain period of time, it is likely that they have a fault and need to be repaired.
[0080] According to this principle, it is necessary to divide the water meters within the communication control range into corresponding homomorphic clusters, and at the same time make the water meters 2 in the homomorphic cluster have the same or similar water use status. Specifically, for each water meter 2, those with the same water use habits must first have the same or similar total water consumption. Therefore, step S41 can be first executed to obtain the total water consumption of each water meter in the last statistical cycle based on the meter-end water consumption of each water meter at each collection moment in the last statistical cycle. Next, step S42 can be executed to classify water meters with the same total water consumption in the last statistical cycle into the same pre-classified cluster, which can reduce the amount of calculation for subsequent comparisons one by one and speed up the classification speed of homomorphic clusters.
[0081] Then, step S43 can be executed to extract the water consumption status characteristics of each water meter in each pre-classified cluster according to the meter-end water consumption of each water meter at each collection time in the previous statistical cycle, so that the water consumption status of water meter 2 can be expressed in a more comparable way. Finally, step S44 can be executed to compare the water consumption status of each water meter one by one, and the water meters with the same water consumption status characteristics can be classified into the same homomorphic cluster.
[0082] See also Figure 6As shown, in order to further reduce the difficulty of comparison, the water usage status characteristics of the water meter can be classified into water usage period comparison and time-sharing water usage comparison for easy comparison. Specifically, step S431 can be first executed to obtain several continuous water usage periods and continuous water-free periods of the water meter in the previous statistical cycle according to the meter-end water usage of the water meter at each collection moment in the previous statistical cycle as the water usage period status characteristics of the water meter. Next, step S432 can be executed to extract the meter-end water usage at multiple collection moments at the same interval in the previous statistical cycle of the water meter. Next, step S433 can be executed to arrange the meter-end water usage at multiple collection moments in chronological order to obtain the water usage time-sharing status characteristics of the water meter. Finally, step S434 can be executed to use both the water usage period status characteristics and the water usage time-sharing status characteristics of the water meter as the water usage status characteristics of the water meter.
[0083] In the specific comparison process, the water meter's water consumption period state characteristics and water consumption time state characteristics can be compared first to reduce the comparison complexity. Figure 7 As shown, specifically, first, step S441 can be executed to compare one by one to determine whether the water usage time state characteristics of any two water meters overlap. If so, step S442 can be executed next to classify them into the same temporary cluster. If not, step S443 can be executed next to classify them into different temporary clusters. In this step, water meters 2 with large differences are directly classified, and it is not necessary to compare the water usage status of each pair of water meters 2 using the water usage time state characteristics, which reduces the complexity of the comparison.
[0084] See also Figure 8As shown, in the process of executing step S444, in each temporary cluster, calculating the difference of the water consumption time-limited state characteristics of each water meter one by one in the table-end water consumption at each extracted collection time, and classifying the water meters into the homomorphic cluster according to the difference, firstly, step S4441 can be executed to randomly select the water consumption time-limited state characteristics of several water meters as reference water consumption time-limited state characteristics. Next, step S4442 can be executed to calculate and obtain the difference cumulative value of the table-end water consumption of each reference water consumption time-limited state characteristic and other water consumption time-limited state characteristics at each extracted collection time. Next, step S4443 can be executed to classify the reference water consumption time-limited state characteristic with the smallest difference cumulative value between each other water consumption time-limited state characteristic and the table-end water consumption at each extracted collection time into the same feature cluster. Next, step S4444 can be executed to calculate and obtain the mean of the table-end water consumption of all water consumption time-limited state characteristics in each feature cluster at each extracted collection time as the water consumption time-limited state average characteristic. Next, step S4445 can be executed to take the minimum difference between the meter end water consumption in each feature cluster and the water consumption time state mean feature at each extracted collection time as the updated reference water consumption time state feature. Next, step S4446 can be executed to determine whether the updated reference water consumption time state feature has changed.
[0085] If yes, it means that the classification discrimination of the feature cluster is not enough, so next, we can return to step S4442 to continue iteratively updating the feature cluster and the reference water consumption time state feature. If no, it means that there is enough discrimination between the feature clusters and there is no room for improvement, so next, we can execute step S4447 to classify the water meters corresponding to the water consumption time state feature in each feature cluster into the same homomorphic cluster.
[0086] In order to supplement the implementation process of the above steps S4441 to S4447, the source code of some functional modules is provided, and the explanation is made in the comment section. In order to avoid the leakage of data involving commercial secrets, some data that does not affect the implementation of the solution are desensitized, the same below.
[0087] #include <iostream>
[0088] #include <vector>
[0089] #include <cstdlib>
[0090] #include <ctime>
[0091] #include <numeric>
[0092] #include <limits>
[0093] struct WaterMeter {
[0094] std::string id;
[0095] std::vector <double>timeBasedFeatures; / / State features when using water
[0096] };
[0097] / / Function: Calculate the difference between two eigenvectors
[0098] double calculateDifference(const std::vector <double>& features1,const std::vector <double>& features2) {
[0099] double diff = 0.0;
[0100] for (size_t i = 0; i < features1.size(); ++i) {
[0101] diff += abs(features1[i] - features2[i]);
[0102] }
[0103] return diff;
[0104] }
[0105] / / Function: Form homomorphic clusters
[0106] void formHomogeneousClusters(std::vector <watermeter>& meters, intnumClusters) {
[0107] std::vector<std::vector <double>> centroids;
[0108] std::srand(std::time(nullptr));
[0109] / / Randomly select the initial center point
[0110] for (int i = 0; i < numClusters; ++i) {
[0111] centroids.push_back(meters[std::rand() % meters.size()].timeBasedFeatures);
[0112] }
[0113] bool changed;
[0114] std::vector <int>assignments(meters.size());
[0115] do {
[0116] changed = false;
[0117] / / Assign to the nearest center point
[0118] for (size_t i = 0; i < meters.size(); ++i) {
[0119] double minDiff = std::numeric_limits <double>::max();
[0120] int bestCluster = 0;
[0121] for (int j = 0; j < numClusters; ++j) {
[0122] double diff = calculateDifference(meters[i].timeBasedFeatures, centroids[j]);
[0123] if (diff < minDiff) {
[0124] minDiff = diff;
[0125] bestCluster = j;
[0126] }
[0127] }
[0128] if (assignments[i] != bestCluster) {
[0129] assignments[i] = bestCluster;
[0130] changed = true;
[0131] }
[0132] }
[0133] / / Update the centroids
[0134] std::vector<std::vector <double>> newCentroids(numClusters,std::vector <double>(centroids[0].size(), 0.0));
[0135] std::vector <int>counts(numClusters, 0);
[0136] for (size_t i = 0; i < meters.size(); ++i) {
[0137] int cluster = assignments[i];
[0138] for (size_t j = 0; j < meters[i].timeBasedFeatures.size();++j) {
[0139] newCentroids[cluster][j] += meters[i].timeBasedFeatures[j];
[0140] }
[0141] counts[cluster]++;
[0142] }
[0143] for (int j = 0; j < numClusters; ++j) {
[0144] for (size_t k = 0; k < centroids[j].size(); ++k) {
[0145] if (counts[j] > 0) {
[0146] centroids[j][k] = newCentroids[j][k] / counts[j];
[0147] }
[0148] }
[0149] }
[0150] } while (changed);
[0151] / / Output the final classification
[0152] for (int i = 0; i < numClusters; ++i) {
[0153] std::cout << "Cluster " << i << ": ";
[0154] for (size_t j = 0; j < meters.size(); ++j) {
[0155] if (assignments[j] == i) {
[0156] std::cout << meters[j].id << " ";
[0157] }
[0158] }
[0159] std::cout << std::endl;
[0160] }
[0161] }
[0162] int main() {
[0163] std::vector <watermeter>meters = {
[0164] {"001", {150.0, 160.0, 120.0}},
[0165] {"002", {152.0, 162.0, 122.0}},
[0166] {"003", {200.0, 210.0, 190.0}}
[0167] };
[0168] formHomogeneousClusters(meters, 2); / / Form two homogeneous clusters
[0169] return 0;
[0170] }
[0171] This code classifies water meters into different homomorphic clusters based on their water usage time-of-day characteristics. The code first randomly selects reference features as classification centers, and then assigns water meters to the most similar centers by calculating the differences between the features. These centers are iteratively updated until they are stable, eventually forming several homomorphic clusters with similar water usage patterns. This approach can help water management systems more accurately monitor and analyze users' water usage behaviors, thereby improving the efficiency and accuracy of water resource management.
[0172] See also Fig. 9 As shown, in the process of judging whether the water meter that has not uploaded information is normal, considering that the water meter 2 in the same homomorphic cluster has the same or similar water use status, it can be quantified by judging whether the upload interval time has timed out. Specifically, in each homomorphic cluster, step S61 can be first executed to determine whether the proportion of water meters that have uploaded the meter-side water consumption in the homomorphic cluster has reached the set trigger value. If not, then step S62 can be executed next without taking any action, because the data is not sufficient to support a correct judgment. If so, then step S63 can be executed next to continuously calculate the interval length since the last upload of the meter-side water consumption as the upload window length. Next, step S64 can be executed to calculate the critical interval length of the loss of connection based on the upload time of the meter-side water consumption that has been uploaded. Next, step S65 can be executed to continuously judge whether the upload window length is greater than the critical interval length of the loss of connection.
[0173] If yes, then step S66 can be executed to determine if the water meter that has not uploaded the water consumption at the meter end is abnormal. If no, then step S67 can be executed to determine if the water meter that has not uploaded the water consumption at the meter end is not abnormal, and then step S63 can be returned to continue the determination.
[0174] See also Fig.10 As shown, since the water meter 2 in the homomorphic cluster is only divided according to the water use habits of the previous cycle, there may be some discrepancies in this round. In order to avoid misjudgment, the critical interval of loss of connection needs to be set more leniently, but in order to avoid waiting for too long, the critical interval of loss of connection also needs to be strictly controlled. In view of this, in the specific implementation process of the above-mentioned step S64, firstly, step S641 can be executed to calculate the upload interval of all adjacent upload times in chronological order according to the upload time of the water consumption of the meter end that has been uploaded. Next, step S642 can be executed to calculate the ratio of the difference between the maximum and minimum values of all upload intervals to the number of all upload intervals as the tolerance, and finally step S643 can be executed to add the maximum value of all upload intervals to the tolerance as the critical interval of loss of connection.
[0175] In order to provide additional explanation for the implementation process of the above-mentioned steps S641 to S643, source codes of some functional modules are provided, and comparative explanations are provided in the comments.
[0176] #include <iostream>
[0177] #include <vector>
[0178] #include <algorithm>
[0179] / / Define the water meter structure, including ID and last upload time
[0180] struct WaterMeter {
[0181] std::string id;
[0182] time_t lastUploadTime;
[0183] bool hasUploaded;
[0184] };
[0185] / / Function: Calculate the critical interval of loss of connection
[0186] time_t calculateCriticalInterval(const std::vector <watermeter>&meters) {
[0187] std::vector<time_t> uploadTimes;
[0188] / / Collect all uploaded water meter times
[0189] for (const auto& meter : meters) {
[0190] if (meter.hasUploaded) {
[0191] uploadTimes.push_back(meter.lastUploadTime);
[0192] }
[0193] }
[0194] / / Sort by time
[0195] std::sort(uploadTimes.begin(), uploadTimes.end());
[0196] / / Calculate the interval between adjacent upload times
[0197] std::vector<time_t> intervals;
[0198] for (size_t i = 1; i < uploadTimes.size(); i++) {
[0199] intervals.push_back(uploadTimes[i] - uploadTimes[i - 1]);
[0200] }
[0201] if (intervals.empty()) {
[0202] return 0; / / Not enough data to calculate the interval
[0203] }
[0204] / / Calculate the maximum and minimum values of the interval
[0205] time_t maxInterval = *max_element(intervals.begin(), intervals.end());
[0206] time_t minInterval = *min_element(intervals.begin(), intervals.end());
[0207] / / Calculate tolerance
[0208] double tolerance = (maxInterval - minInterval) / (double)intervals.size();
[0209] / / Calculate the critical interval time of loss of connection
[0210] time_t criticalInterval = maxInterval + static_cast<time_t> (tolerance);
[0211] return criticalInterval;
[0212] }
[0213] / / Main function
[0214] int main() {
[0215] / / Sample data
[0216] std::vector <watermeter>meters = {
[0217] {"001", 1622505600, true}, / / Sample timestamp
[0218] {"002", 1622509200, true},
[0219] {"003", 1622512800, true}
[0220] };
[0221] time_t criticalInterval = calculateCriticalInterval(meters);
[0222] std::cout << "Calculated critical interval: " << criticalInterval<< " seconds." << std::endl;
[0223] return 0;
[0224] }
[0225] This code effectively calculates the critical interval duration of disconnection, which is based on the uploaded time data of the water meter. By calculating the interval between adjacent upload times and considering the range of interval changes, we can get a reasonable critical value to determine whether the water meter may be abnormal or disconnected. This calculation method takes into account the uncertainty of the upload interval and provides a more flexible judgment standard by introducing tolerance, so as to better adapt to different operating environments and conditions.
[0226] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the device, system, method and computer program product according to multiple embodiments of the present application. In this regard, each square frame in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some alternative implementations, the functions marked in the square frame can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square frames can actually be executed substantially in parallel, and they can also be executed in reverse order sometimes, depending on the functions involved.
[0227] It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented by hardware that performs the corresponding function or action, such as a circuit or ASIC (Application Specific Integrated Circuit), or can be implemented by a combination of hardware and software, such as firmware.
[0228] Although the present invention is described herein in conjunction with various embodiments, in the process of implementing the claimed invention, those skilled in the art may understand and implement other variations of the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.
[0229] The embodiments of the present application have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes are obvious to those of ordinary skill in the art without departing from the scope of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.< / watermeter> < / watermeter> < / algorithm> < / vector> < / iostream> < / watermeter> < / int> < / double> < / double> < / double> < / int> < / double> < / watermeter> < / double> < / double> < / double> < / limits> < / numeric> < / ctime> < / cstdlib> < / vector> < / iostream>
Claims
1. A water meter communication process control method, characterized in that: include, Obtain the meter-side water consumption uploaded by each water meter within the communication control range at each collection time; Set the duration of the statistical cycle; Setting an upload communication period at the end of the period of the statistical cycle; In each round of the statistical cycle, the water meters within the communication control range are divided into corresponding homomorphic clusters according to the meter-end water consumption of each water meter at each collection moment in the previous statistical cycle, wherein users of water meters in the same homomorphic cluster have the same water consumption status; Continuously receiving the water consumption uploaded by each water meter during the upload communication period of this statistical cycle; In each of the homomorphic clusters, it is continuously determined whether a water meter that has not uploaded its meter-side water consumption is abnormal according to the upload time of each water meter uploading its meter-side water consumption during the upload communication period of the current statistical cycle; If yes, an upload instruction is sent to the water meter that has not uploaded the water consumption at the meter end, wherein the upload instruction requires the water meter that receives and executes the instruction to upload the water consumption at the meter end at each collection moment that has not been uploaded; If not, continue to judge.
2. The method according to claim 1, characterized in that The step of dividing the water meters within the communication control range into corresponding homomorphic clusters according to the meter-end water consumption of each water meter at each collection moment in the previous statistical cycle in each statistical cycle in each round of the statistical cycle includes: Obtaining the total water consumption of each water meter in the previous statistical period according to the meter-end water consumption of each water meter at each collection moment in the previous statistical period; Classify water meters with the same total water consumption in the previous statistical period into the same pre-classification cluster; In each of the pre-classified clusters, the water consumption status characteristics of each water meter are extracted based on the meter-end water consumption of each water meter at each collection moment in the previous statistical period; The water usage status of each water meter is compared one by one, and water meters with the same water usage status characteristics are classified into the same homomorphic cluster.
3. The method according to claim 2, characterized in that The step of extracting the water consumption status characteristics of each water meter based on the meter-end water consumption of each water meter at each collection moment in the previous statistical period includes: For each water meter, According to the meter-end water consumption of the water meter at each collection moment in the previous statistical period, several continuous water use periods and continuous water non-use periods of the water meter in the previous statistical period are obtained as the water use period state characteristics of the water meter. The water consumption at the water meter end is collected at multiple sampling times at the same interval within the previous statistical cycle of the water meter. Arrange the water consumption at the meter end at multiple sampling moments in chronological order to obtain the water consumption time-sharing state characteristics of the water meter. The water usage time period state characteristics and the water usage time-sharing state characteristics of the water meter are both used as the water usage state characteristics of the water meter.
4. The method according to claim 3, characterized in that The step of comparing the water usage status of each water meter one by one and classifying the water meters with the same water usage status characteristics into the same homomorphic cluster includes: Compare one by one to determine whether the water use time period status characteristics of any two water meters overlap; If so, they are classified into the same temporary cluster; If not, they are classified into different temporary clusters; In each of the temporary clusters, the water consumption time-sharing state characteristics of each water meter are calculated one by one to find the difference in water consumption at the meter end at each extracted collection moment, and the water meters are classified into the homomorphic clusters according to the differences.
5. The method according to claim 4, characterized in that The step of calculating the difference in water consumption at each sampling moment between the water consumption time-sharing state characteristics of each water meter in each temporary cluster, and classifying the water meters into the homomorphic cluster according to the difference, include, The water usage time state characteristics of several water meters are randomly selected as reference water usage time state characteristics, Calculate and obtain the cumulative difference between the water consumption at the meter end of each reference water consumption time state characteristic and other water consumption time state characteristics at each extracted collection time. The reference water consumption time state feature with the smallest cumulative difference between each other water consumption time state feature and the water consumption at the meter end at each extracted collection moment is classified into the same feature cluster. Calculate and obtain the mean water consumption of the meter end at each extracted collection time of all water consumption time state characteristics in each feature cluster as the water consumption time state mean characteristic; The smallest cumulative difference between the water consumption at the meter end in each feature cluster and the water consumption time state mean feature at each extracted collection moment is used as the updated reference water consumption time state feature; Determine whether the state characteristics of the updated reference water usage have changed; If yes, continue to iteratively update the feature cluster and the reference water usage time state feature; If not, the water meters corresponding to the water usage time status feature in each feature cluster are classified into the same homomorphic cluster.
6. The method according to claim 1, characterized in that The step of continuously judging whether a water meter that has not uploaded its meter-side water consumption is abnormal in each of the homomorphic clusters according to the upload time of each water meter uploading its meter-side water consumption during the upload communication period of the current statistical cycle, include, In each of the homomorphic clusters, Determine whether the proportion of water meters in the homomorphic cluster that have uploaded water consumption at the meter end has reached a set trigger value, If not, no action is taken. If so, the time interval between the last upload of the meter water consumption is calculated and used as the upload window time. The critical interval duration of disconnection is calculated based on the upload time of the water consumption at the meter end. Continue to determine whether the upload window duration is greater than the disconnection critical interval duration, If so, it is determined that the water meter that has not yet uploaded the water consumption at the meter end is abnormal. If not, it is determined that the water meter that has not yet uploaded the water consumption at the meter end is normal.
7. The method according to claim 6, characterized in that The step of calculating the critical interval duration of disconnection according to the upload time of the water consumption at the meter end that has been uploaded includes: According to the upload time of the water consumption at the meter end that has been uploaded, the upload interval duration of all adjacent upload times is calculated in chronological order; Calculate and obtain the ratio of the difference between the maximum value and the minimum value of all the upload interval durations to the number of all the upload interval durations as the tolerance; The maximum value of all the upload interval durations plus the tolerance is used as the critical interval duration for loss of connection.
8. A water meter communication process control method, characterized in that: include, Get the minimum metering capacity; Continuously obtain and record the water consumption at the meter end at each collection moment; Determining whether the total water consumption of the water meter reaches an integer multiple of the minimum metering capacity according to the water consumption at the meter end at each collection moment; If yes, then upload the meter-side water consumption at each collection moment that has not been uploaded to the data synchronization controller; If not, no uploading will be performed; Receiving an upload instruction in a water meter communication process control method according to any one of claims 1 to 7; Upload the meter water consumption at each collection moment that has not been uploaded.
9. A water meter communication process control method, characterized in that: include, Obtain the meter-side water consumption uploaded by each water meter within the communication control range at each collection time; Set the duration of the statistical cycle; Setting an upload communication period at the end of the period of the statistical cycle; In each round of the statistical cycle, the water meters within the communication control range are divided into corresponding homomorphic clusters according to the meter-end water consumption of each water meter at each collection moment in the previous statistical cycle, wherein users of water meters in the same homomorphic cluster have the same water consumption status; Continuously receiving the water consumption uploaded by each water meter during the upload communication period of this statistical cycle; In each of the homomorphic clusters, it is continuously determined whether a water meter that has not uploaded its meter-side water consumption is abnormal according to the upload time of each water meter uploading its meter-side water consumption during the upload communication period of the current statistical cycle; If yes, an upload instruction is sent to the water meter that has not uploaded the water consumption at the meter end, wherein the upload instruction requires the water meter that receives and executes the instruction to upload the water consumption at the meter end at each collection moment that has not been uploaded; If not, continue to judge; At the end of the upload communication period of this statistical cycle, it is determined whether there is a water meter that has not uploaded the water consumption at the meter end; If yes, it is marked as a faulty water meter; If not, no action is taken.
10. A water meter communication process control system, characterized in that: include, A data synchronization controller is used to obtain the meter-end water consumption uploaded by each water meter within the communication control range at each collection moment; Set the duration of the statistical cycle; Setting an upload communication period at the end of the period of the statistical cycle; In each round of the statistical cycle, the water meters within the communication control range are divided into corresponding homomorphic clusters according to the meter-end water consumption of each water meter at each collection moment in the previous statistical cycle, wherein users of water meters in the same homomorphic cluster have the same water consumption status; Continuously receiving the water consumption uploaded by each water meter during the upload communication period of this statistical cycle; In each of the homomorphic clusters, it is continuously determined whether a water meter that has not uploaded its meter-side water consumption is abnormal according to the upload time of each water meter uploading its meter-side water consumption during the upload communication period of the current statistical cycle; If yes, an upload instruction is sent to the water meter that has not uploaded the water consumption at the meter end, wherein the upload instruction requires the water meter that receives and executes the instruction to upload the water consumption at the meter end at each collection moment that has not been uploaded; If not, continue to judge; Water meter, used to obtain the minimum metering capacity; Continuously obtain and record the water consumption at the meter end at each collection moment; Determining whether the total water consumption of the water meter reaches an integer multiple of the minimum metering capacity according to the water consumption at the meter end at each collection moment; If yes, then upload the meter-side water consumption at each collection moment that has not been uploaded to the data synchronization controller; If not, no uploading will be performed; Receive upload instructions; Upload the meter water consumption at each collection moment that has not been uploaded; The maintenance control unit is used to determine whether there is a water meter that has not uploaded the water consumption at the meter end at the end of the upload communication period of the current statistical cycle; If yes, it is marked as a faulty water meter; If not, no action is taken.
