Efficient algorithm for extracting effective reading of instrument
Through an efficient algorithm for extracting effective instrument readings, the accuracy and reliability of energy data acquisition in the prior art are solved, accurate energy consumption calculation and analysis are realized, and more accurate energy monitoring is supported.
Patent Information
- Application Number
- CN202510213629.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-26
- Publication Date
- 2025-06-06
AI Technical Summary
In the prior art, energy consumption data collection relies on manual meter reading, which leads to time-consuming and labor-intensive, high error rate, and cannot meet the requirements of data timeliness and accuracy. Real-time communication technology faces problems such as communication interruption, data loss and data delay, which affects the calculation of energy performance indicators.
An efficient algorithm is proposed for extracting effective readings of the instrument. By defining three pointers to traverse the time series, we judge whether the readings meet the incremental trend, and conduct reasonable amplitude judgment and return to the table, extract all valid readings to calculate the total energy consumption data.
It improves the accuracy and reliability of data acquisition, can accurately calculate the energy consumption in each time period, and provides energy consumption data in multiple time intervals, supporting more accurate energy monitoring and analysis.
Smart Images

Figure CN120107017A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of computer technology, and in particular to an efficient algorithm for extracting effective readings of a meter. Background Art
[0002] The manufacturing process of wires and cables is complex, covering multiple key processes, including the production of insulated single wires, single wire twisting, cabling, sheathing, and coil stacking. These processes are not only cumbersome and complex, but also usually involve a large amount of electricity consumption. In order to effectively manage and control the energy medium consumption of the group's subsidiaries and ensure the achievement of established energy goals and indicators, it is urgent to establish a comprehensive energy indicator system. The system should construct energy performance indicators from multiple dimensions such as energy management links, energy medium systems, professional management, and management levels.
[0003] At present, most companies still rely on manual meter reading to collect energy consumption data. This collection method is time-consuming and labor-intensive, with a high error rate, and cannot meet the requirements of data timeliness and accuracy. Therefore, companies plan to access data through industrial control collection points and use real-time communication technology for data collection. However, this method also faces challenges such as communication interruption, data loss and data delay. While the accuracy of data collection is limited, the instrument may return to the table, change the table and reverse during use, resulting in some cumulative energy consumption data not showing a reasonable increasing trend, which in turn affects the calculation of energy performance indicators. The above problems have brought great difficulties to energy consumption analysis, and companies need to constantly check data problems, communication problems or equipment problems. However, sometimes the root cause of the problem is difficult to identify, resulting in deviations in statistical calculation results.
[0004] Therefore, there is an urgent need to explore a systematic solution to improve the accuracy and reliability of data collection, thereby supporting more accurate energy consumption analysis and decision-making. Summary of the invention
[0005] The purpose of the present invention is to solve the shortcomings in the prior art and to propose an efficient algorithm for extracting effective readings of an instrument.
[0006] To achieve the above object, the present invention adopts the following technical solutions: An efficient algorithm for extracting valid meter readings includes the following steps: S1: define three pointers; Save the meter readings into a time series in advance; The three pointers are pointer p1, pointer p2, and pointer p3; The pointer p1 is used to traverse the time series data in the time series sequence; The pointer p2 is used to follow up and compare with p1, pointing to the valid data to be confirmed; The pointer p3 is used to follow up with p2 to confirm the validity and point to the confirmed valid data; S2: Determine whether the readings conform to the increasing trend; By default, the first reading in the time series is the valid reading; Specifically, the isValidReadings function is used to traverse the time series and determine for each reading whether it conforms to the increasing trend; If the reading pointed to by p1 is less than the reading pointed to by p2, it does not conform to the increasing trend. At this time, the readings pointed to by p1 and p2, that is, the two time series data, are considered invalid data; the pointer p2 is rolled back to the time series data pointed to by the pointer p3, so that p2 starts to re-judge from the confirmed valid time series data; If the reading pointed to by p1 is greater than or equal to the reading pointed to by p2, it meets the increasing trend, and the process goes to step S3; S3: Make a reasonable increase judgment; Obtain the maximum range of the instrument and set a reasonable increment according to the maximum range of the instrument; Calculate the reading pointed to by p1 minus the reading pointed to by p2. If the difference is within the set reasonable increase range, it is considered that the growth is normal and is considered to be valid data. If the difference is outside the reasonable increase range of the set interval, it is considered to be abnormal growth and is judged as invalid data; Furthermore, if the reading pointed to by p1 is close to the maximum range of the instrument, it is necessary to determine whether to return to the meter. The specific determination method is as follows: If the maximum value of the instrument range - the reading pointed to by p2 ≤ the reasonable increase of the interval and the reading pointed to by p1 ≤ the reasonable increase of the interval, then the increase is reasonable, and the reading pointed to by p1 is considered to be the return data, that is, the reading pointed to by p1 is a valid reading, and the reading of p2 moves forward in the time series; On the contrary, if the maximum value of the instrument range - the reading pointed by p2 > the reasonable increase of the interval or the reading pointed by p1 > the reasonable increase of the interval, the increase is unreasonable, and it is determined that the reading pointed by p1 is not the returned data, that is, the reading pointed by p1 is an invalid reading, and the reading of p2 remains unchanged; S4: extract all valid readings to obtain total energy consumption data; When the p1 pointer has traversed all the data, all the data points pointed to by p3 in the time series are valid readings. All valid readings are extracted and added to the valid reading set. Calculate the total energy consumption data. The specific calculation method is as follows: Set a specific time interval, and divide the time series data in the valid reading set into multiple time intervals according to the time interval; The getIntervalTimestamp function is used to obtain the start time of each time interval. The calcConsumption function is used to calculate the difference between the last valid reading and the current valid reading in each time interval. These differences are accumulated to obtain the total energy consumption data for the time interval. The start time, end time, and total energy consumption data of each time interval are returned.
[0007] Furthermore, a conditional function is set in the algorithm. When a meter replacement record is detected during the time series data judgment process, the reading of the new meter is directly used as valid data, and the difference calculation process is skipped; Furthermore, in the process of timing data judgment, when power outages, communication interruptions, data anomalies, etc. cause the continuous data judgment to be invalid, a time limit is defined. If the anomaly continues beyond the time limit, the reading currently pointed to by pointer p1 is used as the benchmark to recalculate and ensure the continuity of the judgment of valid readings.
[0008] Compared with the prior art, the present invention has the following beneficial effects: The efficient algorithm for extracting effective meter readings proposed in the present invention improves the accuracy and reliability of data collection through a number of measures such as detailed effective reading screening, increase judgment, table return processing, and exception processing; through the division of time intervals and energy consumption calculation methods, the algorithm can accurately calculate the energy consumption in each time period, and provide energy consumption data for multiple time intervals according to actual conditions; it is very useful for energy monitoring and analysis, especially for application scenarios that require accurate tracking of energy consumption changes. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 The present invention is a flowchart of the steps of an efficient algorithm for extracting effective meter readings. DETAILED DESCRIPTION
[0010] In order to provide a further understanding of the purpose, structure, features, and functions of the present invention, the following detailed description is given in conjunction with the embodiments.
[0011] like Figure 1 As shown, an efficient algorithm for extracting effective meter readings includes the following steps: S1: define three pointers; Save the meter readings into a time series in advance; The three pointers are pointer p1, pointer p2, and pointer p3; The pointer p1 is used to traverse the time series data in the time series sequence; The pointer p2 is used to follow up and compare with p1, pointing to the valid data to be confirmed; The pointer p3 is used to follow up with p2 to confirm the validity and point to the confirmed valid data; S2: Determine whether the readings conform to the increasing trend; By default, the first reading in the time series is the valid reading; Specifically, the isValidReadings function is used to traverse the time series and determine for each reading whether it conforms to the increasing trend; If the reading pointed to by p1 is less than the reading pointed to by p2, it does not conform to the increasing trend. At this time, the readings pointed to by p1 and p2, that is, the two time series data, are considered invalid data; the pointer p2 is rolled back to the time series data pointed to by the pointer p3, so that p2 starts to re-judge from the confirmed valid time series data; If the reading pointed to by p1 is greater than or equal to the reading pointed to by p2, it meets the increasing trend, and the process goes to step S3; S3: Make a reasonable increase judgment; Obtain the maximum range of the instrument and set a reasonable increment according to the maximum range of the instrument; Calculate the reading pointed to by p1 minus the reading pointed to by p2. If the difference is within the set reasonable increase range, it is considered that the growth is normal and is considered to be valid data. If the difference is outside the reasonable increase range of the set interval, it is considered to be abnormal growth and is judged as invalid data; Furthermore, if the reading pointed to by p1 is close to the maximum range of the instrument, it is necessary to determine whether to return to the meter. The specific determination method is as follows: If the maximum value of the instrument range - the reading pointed to by p2 ≤ the reasonable increase of the interval and the reading pointed to by p1 ≤ the reasonable increase of the interval, then the increase is reasonable, and the reading pointed to by p1 is considered to be the return data, that is, the reading pointed to by p1 is a valid reading, and the reading of p2 moves forward in the time series; On the contrary, if the maximum value of the instrument range - the reading pointed to by p2 > the reasonable increase of the interval or the reading pointed to by p1 > the reasonable increase of the interval, the increase is unreasonable, and it is determined that the reading pointed to by p1 is not the returned data, that is, the reading pointed to by p1 is an invalid reading, and the reading of p2 remains unchanged.
[0012] By judging whether the time series data conforms to the increasing trend, readings that do not conform to the trend are excluded, effectively avoiding erroneous readings due to sudden glitch values or data jitter; in the increase judgment of step S3, by setting a reasonable increase range, those readings that change too quickly or are unreasonable can be further filtered, and readings whose increase is not within a reasonable range will be judged as invalid, avoiding interference from instantaneous fluctuations or abnormal values; effectively monitor the sharp fluctuations of data, detect data anomalies in time, and provide a basis for subsequent processing.
[0013] S4: extract all valid readings to obtain total energy consumption data; When the p1 pointer has traversed all the data, all the data points pointed to by p3 in the time series are valid readings. All valid readings are extracted and added to the valid reading set. Calculate the total energy consumption data. The specific calculation method is as follows: Set a specific time interval, and divide the time series data in the valid reading set into multiple time intervals according to the time interval; The getIntervalTimestamp function is used to obtain the start time of each time interval. The calcConsumption function is used to calculate the difference between the last valid reading and the current valid reading in each time interval. These differences are accumulated to obtain the total energy consumption data for the time interval. The start time, end time, and total energy consumption data of each time interval are returned.
[0014] Furthermore, a conditional function is set in the algorithm. When a meter replacement record is detected during the time series data judgment process, the reading of the new meter is directly used as valid data, and the difference calculation process is skipped; Furthermore, in the process of judging the time series data, when a power outage, communication interruption, data anomaly, etc. causes the continuous data judgment to be invalid, a time limit is defined. If the anomaly continues to exceed the time limit, an automatic reminder is triggered, and the reading currently pointed to by pointer p1 is used as a benchmark to recalculate and ensure the continuity of the judgment of valid readings.
[0015] By taking into account abnormal situations such as power outages and communication interruptions, in this case, when the time series data continues to be invalid, the algorithm sets a time limit. When the abnormal state of the data continues to exceed this limit, an alarm will be issued to prompt relevant personnel to handle it. The introduction of this time limit helps to ensure that the system can respond quickly to situations such as power outages or communication interruptions, avoiding the risk of missing important data due to the abnormality lasting too long.
[0016] The present invention has been described by the above-mentioned relevant embodiments, however, the above-mentioned embodiments are only examples for implementing the present invention. It must be pointed out that the disclosed embodiments do not limit the scope of the present invention. On the contrary, changes and modifications made without departing from the spirit and scope of the present invention are all within the scope of patent protection of the present invention.
Claims
1. An efficient algorithm for extracting effective meter readings, characterized in that: The following steps are involved: S1: define three pointers; Save the meter readings into a time series in advance; The three pointers are pointer p1, pointer p2, and pointer p3; The pointer p1 is used to traverse the time series data in the time series sequence; The pointer p2 is used to follow up and compare with p1, pointing to the valid data to be confirmed; The pointer p3 is used to follow up with p2 to confirm the validity and point to the confirmed valid data; S2: Determine whether the readings conform to the increasing trend; The isValidReadings function is used to traverse the time series and determine whether each reading conforms to the increasing trend. S3: Make a reasonable increase judgment; Obtain the maximum range of the instrument and set a reasonable increment according to the maximum range of the instrument; Calculate the reading pointed to by p1 minus the reading pointed to by p2. If the difference is within the set reasonable increase range, it is considered that the growth is normal and is considered to be valid data. If the difference is outside the reasonable increase range of the set interval, it is considered to be abnormal growth and is judged as invalid data; S4: extract all valid readings to obtain total energy consumption data; When the p1 pointer traverses all the data, all the data points pointed to by p3 in the time series are valid readings. All valid readings are extracted and added to the valid reading set to calculate the total energy consumption data.
2. The efficient algorithm for extracting effective meter readings as claimed in claim 1, characterized in that: The specific content of step S2 is as follows: By default, the first reading in the time series is the valid reading; Specifically, the isValidReadings function is used to traverse the time series and determine for each reading whether it conforms to the increasing trend; If the reading pointed to by p1 is less than the reading pointed to by p2, it does not conform to the increasing trend. At this time, the readings pointed to by p1 and p2, that is, the two time series data, are considered invalid data; the pointer p2 is rolled back to the time series data pointed to by the pointer p3, so that p2 starts to re-judge from the confirmed valid time series data; If the reading pointed to by p1 is greater than or equal to the reading pointed to by p2, it conforms to the increasing trend and the process goes to step S3.
3. The efficient algorithm for extracting effective meter readings as claimed in claim 1, characterized in that: In step S3, if the reading pointed to by p1 is close to the maximum range of the instrument, it is necessary to determine whether to return to the meter. The specific determination method is as follows: If the maximum value of the instrument range - the reading pointed to by p2 ≤ the reasonable increase of the interval and the reading pointed to by p1 ≤ the reasonable increase of the interval, then the increase is reasonable, and the reading pointed to by p1 is considered to be the return data, that is, the reading pointed to by p1 is a valid reading, and the reading of p2 moves forward in the time series; On the contrary, if the maximum value of the instrument range - the reading pointed to by p2 > the reasonable increase of the interval or the reading pointed to by p1 > the reasonable increase of the interval, the increase is unreasonable, and it is determined that the reading pointed to by p1 is not the returned data, that is, the reading pointed to by p1 is an invalid reading, and the reading of p2 remains unchanged.
4. The efficient algorithm for extracting effective meter readings as claimed in claim 1, characterized in that: The specific calculation method in step S4 is as follows: Set a specific time interval, and divide the time series data in the valid reading set into multiple time intervals according to the time interval; The getIntervalTimestamp function is used to obtain the start time of each time interval. The calcConsumption function is used to calculate the difference between the last valid reading and the current valid reading in each time interval. These differences are accumulated to obtain the total energy consumption data for the time interval. The start time, end time, and total energy consumption data of each time interval are returned.
5. The efficient algorithm for extracting effective meter readings as claimed in claim 1, characterized in that: A conditional function is set in the algorithm. When a meter replacement record is detected during the time series data judgment process, the reading of the new meter is directly used as the valid data and the difference calculation process is skipped.
6. The efficient algorithm for extracting effective meter readings as claimed in claim 1, characterized in that: In the process of timing data judgment, when a power outage, communication interruption, or data anomaly causes the data to be continuously judged invalid, a time limit is defined. If the anomaly continues beyond the time limit, the reading currently pointed to by pointer p1 is used as the benchmark to recalculate and ensure the continuity of the judgment of valid readings.
Citation Information
Patent Citations
Meter reading system data validity analysis method and device
CN111666273A
Power consumption data management method and system, terminal and storage medium
CN115456478A
Industrial field data fault-tolerant processing method and fault-tolerant processing intelligent optimization energy-saving system
CN115685926A
Metering data processing method and device, metering instrument and readable storage medium
CN115795257A
Vehicle mileage fuel consumption integral compensation longitude and latitude compensation method
CN119416049A