CN-121994292-A - Sensor rollover compensation method, system, equipment and medium based on range prediction
Abstract
The invention discloses a sensor rollover compensation method, a system, equipment and a storage medium based on range prediction, wherein the method comprises the steps of configuring a range upper limit and an upper/lower limit threshold according to a sensor model; the method comprises the steps of receiving a data message comprising an accumulated value, a message ID and a time stamp, repeatedly judging the message ID and the time stamp by comparing, carrying out trend analysis by combining sliding window statistics after smoothing filtering on the accumulated value if the message is not repeated, judging turnover when a transition mode from a continuous high level to a continuous low level is detected, updating a turnover number counter of a sensor, calculating a compensated real accumulated value according to the turnover number, an upper range limit and the current accumulated value, and finally updating a cache state. The invention realizes automatic and accurate detection and real-time compensation of the data overturn of the accumulation type instrument, and effectively improves the automation level, accuracy and reliability of data processing.
Inventors
- WU FEIYI
- ZHOU CHENYU
- HE YAN
- ZHANG ZHEN
- WANG AIHUA
Assignees
- 江苏安科瑞微电网研究院有限公司
- 江苏安科瑞电器制造有限公司
- 安科瑞电气股份有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20260227
Claims (9)
- 1. A sensor roll-over compensation method based on range prediction, the method comprising: S1, parameter configuration, namely acquiring corresponding upper limit, upper limit threshold and lower limit threshold of the measuring range of the instrument according to the model identification of the target sensor; S2, data acquisition and state caching, namely receiving a current data message and a historical data message reported by the target sensor, and storing the historical data message in a storage module, wherein the data message comprises an accumulated value, a message ID and a time stamp; S3, repeating message judgment, namely extracting a previous data message record of the target sensor stored in a cache module, and comparing a message ID and a time stamp of a current data message with the message ID and the time stamp in the previous data message record; S4, detecting a turnover condition, namely if the current message is not a repeated message, performing data smoothing on the accumulated value in the previous data message to obtain a smoothed value, inputting the smoothed value into a sliding window with a preset length, and calculating statistics of the window; trend analysis is carried out based on statistic sequences of a plurality of continuous sliding windows, and if an analysis result meets a preset turning mode, a turning event is judged to occur once, wherein the turning mode is that the statistic of M continuous windows is higher than the upper limit threshold value, and then the statistic of N continuous windows is lower than the lower limit threshold value, wherein M and N are preset positive integers; S5, data compensation and state updating, namely if a turnover event is detected, updating a turnover number counter corresponding to the sensor, and calculating a compensated real accumulated value based on the turnover number and the upper limit of the measuring range of the instrument; And S6, buffer updating, namely if the current data message is judged to be a non-repeated message in the step S3, storing the non-repeated message into the storage module for updating the buffered historical data record.
- 2. The roll-over compensation method of claim 1, wherein in step S4, the data smoothing process uses an exponentially weighted moving average algorithm, and the statistics of the sliding window are median or arithmetic averages of the data within the window.
- 3. The roll-over compensation method of claim 1, further comprising the step of zero-value filtering the current running total before the trend analysis in step S4, wherein if the current running total is zero, it is directly determined that the data is invalid or communication is abnormal, and no roll-over detection is performed.
- 4. The roll-over compensation method according to claim 1, wherein in step S5, the compensated true cumulative value is calculated by the following compensation formula: C t =(R c *R)+C v ; Wherein, C t is the true accumulated value, R c is the turnover number recorded by the turnover number counter, R is the upper limit of the measuring range of the instrument, and C v is the current accumulated value.
- 5. The roll-over compensation method according to claim 1, further comprising a post-verification step of calculating an instantaneous change between the real accumulated value and a historical real accumulated value outputted from the previous compensation process after calculating the real accumulated value in step S5, and if the instantaneous change exceeds a maximum possible change threshold calculated according to a maximum physical measurement rate and a data reporting interval of the target sensor, generating verification alarm information and marking the roll-over event as a state to be rechecked.
- 6. The roll-over compensation method of claim 1, wherein the upper threshold is set to between 90% and 99% of the upper range limit and the lower threshold is set to between 1% and 10% of the upper range limit.
- 7. A range prediction-based sensor roll-over compensation system, comprising: The parameter configuration module is used for acquiring and configuring corresponding upper limit, upper limit threshold and lower limit threshold of the instrument range according to the model identification of the target sensor; The data acquisition and caching module is used for receiving a current data message reported by the target sensor and storing or reading a historical data message of the sensor, wherein the data message comprises an accumulated value, a message ID and a time stamp; The repeated message judging module compares the message ID and the time stamp of the current data message with the last message ID and the time stamp recorded in the historical data message; The turnover event detection module is used for carrying out change trend analysis on the accumulated value corresponding to the non-repeated message and identifying whether a turnover event occurs or not based on a preset turnover mode characteristic, wherein the turnover mode characteristic is that the accumulated value is changed from a state continuously higher than the upper limit threshold value to a change trend continuously lower than the lower limit threshold value; the data compensation and updating module is used for updating the turnover number counter associated with the target sensor at the event point of the turnover event and calculating the real accumulated value after compensation; And the state refreshing module is used for updating and storing the data message which is judged to be non-repeated by the repeated message judging module into the data acquisition and caching module.
- 8. An electronic device comprising a processor and a memory, wherein the memory has stored therein a computer program, which when executed by the processor, implements the method of any of claims 1-7.
- 9. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-7.
Description
Sensor rollover compensation method, system, equipment and medium based on range prediction Technical Field The invention relates to the technical field of industrial Internet of things and intelligent sensor data processing, in particular to a sensor rollover compensation method, a system, equipment and a medium based on range prediction. Background In industrial automation and internet of things monitoring systems, accumulation sensors are widely used. Such sensors typically have an upper range limit within them. When the accumulated value of the physical quantity reaches the upper limit, the sensor reading is reset to zero and accumulation is restarted, a phenomenon known as "data rollover" or "overflow". The traditional processing mode is highly dependent on manual intervention, when the monitoring system receives suspected overturned data, an alarm is generated, an operation and maintenance person is required to manually confirm whether the overturned data is overturned, and a real accumulated value is calculated. The mode is complex in process, low in efficiency and easy to make mistakes, and cannot meet the requirements of a large-scale and high-real-time Internet of things platform. Some existing automation schemes are not robust enough. For example, a simple threshold comparison method, if the current value is far smaller than the previous value, the value is judged to be turned over, and the method is extremely easy to be interfered by data transmission packet loss, instantaneous faults of a sensor or random noise, so that erroneous judgment is caused. In addition, in a distributed and multithreaded data processing architecture, if there is no effective mechanism, the same data packet may be processed multiple times concurrently, resulting in repeated compensation for a single rollover event, seriously damaging data consistency. Therefore, an intelligent solution capable of automatically, accurately and reliably identifying a rollover event and performing real-time and disposable compensation while being suitable for a complex data environment and a high concurrent processing scene is needed. Disclosure of Invention The invention aims to overcome the defects of the prior art and provide an automatic high-robustness sensor accumulated data overturning compensation method and system with concurrency control capability. In order to achieve the above object, the first aspect of the present invention adopts the following technical scheme: A method for span prediction based sensor cumulative data roll-over compensation, the method comprising the steps of: S1, parameter configuration, namely acquiring corresponding upper limit, upper limit threshold and lower limit threshold of the measuring range of the instrument according to the model identification of the target sensor; The upper threshold is used for predicting a turnover occurrence trend, and the lower threshold is used for confirming whether a turnover event occurs or not; S2, data acquisition and state caching, namely receiving a current data message and a historical data message reported by the target sensor, and storing the historical data message in a storage module, wherein the data message comprises an accumulated value, a message ID and a time stamp, the accumulated value is a counting result of the sensor under the corresponding time stamp, the message ID is used for uniquely identifying the message, the time stamp is used for recording the reporting time of the message, and the historical data message is used for subsequent comparison and trend analysis; S3, repeating message judgment, namely extracting a previous data message record of the target sensor stored in a cache module, comparing a message ID and a time stamp of a current data message with the message ID and the time stamp in the previous data message record, judging that the current data message is a repeated message if the current data message record and the time stamp are identical, terminating the processing flow of the current data message, entering a sampling judgment flow of a next group of data messages, thereby fundamentally avoiding repeated compensation, ensuring idempotency of data operation, and entering a subsequent turnover detection flow if the current data message and the time stamp are inconsistent; S4, detecting a turnover condition, namely if the current message is not a repeated message, carrying out data smoothing on the accumulated value in the previous data message to obtain a smoothed value, filtering noise and instantaneous mutation in original data, inputting the smoothed value into a sliding window with a preset length, and calculating statistics of the window; trend analysis is carried out based on statistic sequences of a plurality of continuous sliding windows, and if an analysis result meets a preset turning mode, a turning event is judged to occur once, wherein the turning mode is that the statistic of M continuous windows is higher than the uppe