Processing method and device based on synchronization of frozen data of electric energy meter and computer equipment
By employing a backup data source and asynchronous management of record queues in the electricity meter, the issues of real-time performance and low blocking in the electricity meter freezing process were resolved, achieving synchronization and consistency of frozen data and improving the system's processing efficiency and reliability.
Patent Information
- Application Number
- CN202511380158.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-25
- Publication Date
- 2025-10-31
AI Technical Summary
The existing electricity meter freezing process cannot meet users' real-time and low-blocking requirements, especially in the case of multiple freezing processes, which can easily lead to data inconsistency and system crashes.
By adopting an asynchronous management approach for backup data sources and record queues, multiple frozen tasks are processed asynchronously through the task queue management module. This ensures that the data source is not preempted by other tasks during the freezing process and performs data backup and recovery when necessary, thereby achieving synchronization and consistency of frozen data.
It improves the atomicity of freeze processing, reduces the blocking nature of freeze processing, enhances the real-time performance and data consistency of the system, and avoids prolonged freeze processing time and waste of resources.
Smart Images

Figure CN120880992A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electricity meter technology, and in particular to a processing method, apparatus, and computer equipment based on the synchronization of frozen data from electricity meters. Background Technology
[0002] The "freeze" function of an electricity meter refers to the process by which the meter automatically records and saves current electricity consumption data (such as energy value, time, and tariff) at a specific time or when triggered by a specific event. This function is similar to a data "snapshot" and is mainly used in scenarios such as electricity billing, electricity usage analysis, and fault diagnosis to ensure the timeliness and traceability of data. At the same time, the electricity meter's freeze function requires that the data for the same data item frozen at the same time and under different types be consistent.
[0003] In existing technologies, electricity meters typically employ three modules for freezing: a detection module, a data collection module, and a storage device. The freezing process involves the detection module detecting the need for freezing, the data collection module gathering various data points related to the freezing requirement, and then sending these data to the storage device for storage. However, this is only one type of freezing process. If N freezing operations are required simultaneously, these N processes must be executed sequentially, or all N freezing operations must be processed concurrently (i.e., synchronous freezing).
[0004] In addition, since it is necessary to ensure the consistency of the frozen data required by the electricity meter function, it is necessary to ensure that the data collected in these N sets of processes cannot be changed. Therefore, to ensure that the processing of these N sets of processes cannot be preempted by other processes that may change the data, the most direct method is to add data locks (i.e., real-time operating system) or centralized function processing (i.e., front-end and back-end system) during the processing of these N sets of processes, thereby achieving blocking freeze.
[0005] However, since the data source is dynamically changing—meaning the frozen data is configurable based on actual conditions—pre-locking of potentially used data sources is necessary. This is an undesirable processing mode in a real-time operating system, resulting in low maintainability and reliability, and limiting real-time performance. Furthermore, the lack of a preemptive mechanism in the front-end and back-end systems means that freezing is tightly packed into the same function. With a large number of freezing processes, blocking becomes severe, preventing communication and other processing, leading to stalls and freezes. Even if additional functional processes are added to N consecutive freezing processes, it must be ensured that the added processes do not unexpectedly modify the data source. However, these added processes generate extra code and idle processing, extending the freezing time ineffectively and wasting MCU resources. Therefore, the existing freezing process for electricity meters cannot adequately meet users' requirements for real-time performance and low blocking. Summary of the Invention
[0006] The purpose of this invention is to provide a processing method, apparatus, and computer device for synchronizing frozen data from electricity meters, thereby solving the technical problem that existing electricity meter freezing processing cannot adequately meet users' real-time and low-blocking requirements. The various technical effects of the preferred solutions among the many technical solutions provided by this invention are detailed below.
[0007] To achieve the above objectives, the present invention provides the following technical solution: This invention provides a processing method for synchronizing frozen data from electricity meters, comprising: Multiple tasks are monitored in real time. The detected tasks that need to be frozen are pushed into a recording queue for recording. The data source is synchronized to one of the tasks to obtain the recorded tasks. Once all the tasks to be frozen are pushed into the record queue, the record tasks in the record queue are periodically or conditionally popped into the task queue for detection and execution according to the order of their push-in time. At the same time, the task queue management function module performs its function periodically until all the record tasks in the record queue have been executed.
[0008] Optionally, the step of real-time detection of multiple tasks, pushing detected tasks requiring freezing into a recording queue for recording, and synchronizing the data source to one of the tasks to obtain the recorded tasks includes: Real-time detection of whether the task is one of the tasks that needs to be frozen; If so, the task to be frozen is pushed into the record queue, and the corresponding inherent information is recorded during the process of pushing it into the record queue to obtain the recorded task; If not, continue to monitor in real time whether the task is one that needs to be frozen.
[0009] Optionally, the step of real-time detection of multiple tasks, pushing the detected tasks that need to be frozen into a recording queue for recording, and synchronizing the data source to one of the tasks to obtain the recorded tasks further includes: Data from the same data source is synchronized into one task to complete the backup of the data source; Before pushing the frozen tasks of each task into the record queue, first push the task function to disable data source synchronization into the record queue, and after pushing the frozen tasks of each task into the record queue, push the task function to restore data source synchronization into the record queue.
[0010] Optionally, the inherent information includes the freeze time and freeze type.
[0011] Optionally, after all the tasks to be frozen are pushed into the recording queue, the recording tasks in the recording queue are periodically or conditionally popped into the task queue for detection and execution according to the order of their push-in time. Simultaneously, the task queue management module performs a periodic execution function until all the recording tasks in the recording queue have been executed, including: Once all the tasks that need to be frozen have been pushed into the record queue, the record task that was pushed into the record queue earliest will be popped into the task queue periodically or by conditional triggering. The task queue management module pops up and executes the detected recorded tasks according to the periodic execution function; After the recording task in the task queue is completed, the recording task that was pushed into the task queue earliest is popped back into the task queue for detection and execution. This process is repeated until all the recording tasks in the task queue are completed.
[0012] Optionally, popping and executing the detected recording task includes: Collect the frozen data of the recording task and store the collected frozen data.
[0013] A processing device based on the synchronization of frozen data from an electricity meter, the device comprising: The management module is used to perform real-time detection of multiple tasks, push the detected tasks that need to be frozen into a recording queue for recording, and synchronize the data source to one of the tasks to obtain the recorded tasks. After all the tasks that need to be frozen are pushed into the recording queue, the recorded tasks in the recording queue are periodically or conditionally triggered to be popped into the task queue for detection and execution in the order of their push-in time. At the same time, the task queue management function module performs its function according to the cycle until all the recorded tasks in the recording queue have been executed.
[0014] Optionally, the management module includes a freeze detection module, a cost control function module, and a communication processing module. The freeze detection module is used to detect multiple tasks in real time and push the detected tasks that need to be frozen into a record queue for recording. The cost control function module is used to perform cost control processing functions, and the communication processing module is used to perform communication processing functions.
[0015] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program stored in the memory to cause the processor to perform the steps of the processing method for synchronizing frozen data based on electricity meters as described above.
[0016] A computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described processing method for synchronizing frozen data from an electricity meter.
[0017] Implementing one of the above-described technical solutions of the present invention has the following advantages or beneficial effects: This invention utilizes a backup data source and a record queue asynchronous management module to solve the freeze synchronization problem under different systems. While ensuring the consistency of data requirements for the same data items frozen at the same time and of different types, it improves the atomicity of the freeze processing unit, reduces the blocking of freeze processing, and improves the real-time performance of the system. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings: Figure 1 This is a flowchart of Embodiment 1 of the present invention; Figure 2 This is a schematic diagram of the data source synchronization to the task in Embodiment 1 of the present invention; Figure 3 This is a schematic diagram of the modules in Embodiment 2 of the present invention. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the present invention clearer, various exemplary embodiments described below will be referenced to the accompanying drawings, which form part of the exemplary embodiments, illustrating various exemplary embodiments that may be used to implement the present invention. Unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. It should be understood that they are merely examples of processes, methods, and apparatuses consistent with some aspects of the present invention disclosed as detailed in the appended claims, and other embodiments may be used, or structural and functional modifications may be made to the embodiments listed herein without departing from the scope and spirit of the present invention.
[0020] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," etc., indicate the orientation or positional relationship based on the accompanying drawings, and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the referred element must have a specific orientation, or be constructed and operated in a specific orientation. The terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. The term "multiple" means two or more. The terms "connected" and "linked" should be interpreted broadly, for example, they can be fixed connections, detachable connections, integral connections, mechanical connections, electrical connections, communication connections, direct connections, indirect connections through an intermediate medium, and can be the internal connection of two elements or the interaction relationship between two elements. The term "and / or" includes any and all combinations of one or more of the related listed items. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0021] To illustrate the technical solution described in this invention, specific embodiments are described below, showing only the parts related to the embodiments of this invention.
[0022] Example 1: like Figure 1 As shown, the present invention provides a processing method for synchronizing frozen data from an electricity meter, comprising: S10. Perform real-time detection on multiple tasks, push the detected tasks that need to be frozen into the recording queue for recording, and synchronize the data source to a task to obtain the recorded tasks. S20. After all the tasks that need to be frozen are pushed into the recording queue, the recording tasks in the recording queue are popped into the task queue in order of their push time through periodic or conditional triggering for detection and execution. At the same time, the task queue management function module performs its function according to the cycle until all the recording tasks in the recording queue are executed.
[0023] The processing method of this embodiment is applied to a data synchronization freezing system, particularly to an electricity meter within the system. In the absence of a real-time operating system (i.e., a data lock), a task queue is used for asynchronous management of functional modules. The main loop of the task queue continuously checks for recording tasks. When a recording task is detected, it is popped from the queue and executed, thus enabling the computer to perform the data freezing function.
[0024] The processing method in this embodiment uses the backup data source and the asynchronous management function module of the record queue to solve the freeze synchronization problem under different systems. While ensuring that the data requirements of the same data items frozen at the same time and of different types are consistent, it improves the atomicity of the freeze processing unit, reduces the blocking of freeze processing, and improves the real-time performance of the system.
[0025] As an optional implementation, multiple tasks are monitored in real time, and the detected tasks that need to be frozen are pushed into a recording queue for recording. The data source is synchronized to a task to obtain the recorded tasks, including: Real-time detection of whether a task needs to be frozen; If so, the task to be frozen is pushed into the record queue, and the corresponding inherent information is recorded during the process of pushing it into the record queue, thus obtaining the recorded task; If not, the system continues to monitor whether tasks require freezing in real time. Specifically, the management module monitors tasks in real time through the freeze detection module. When a task requiring freezing is detected, it is pushed into a record queue, along with its inherent information. The record queue manages the pushed tasks through a structure unit queue. Each unit records one task requiring freezing and its corresponding inherent information, thus creating a recorded task. The inherent information identifies the task requiring freezing. More specifically, the inherent information includes the freeze time and freeze type. If no task requiring freezing is detected during real-time task monitoring, the system continues to monitor whether tasks require freezing until all tasks requiring freezing are detected, and then the detected tasks are pushed into the record queue.
[0026] As an optional implementation, multiple tasks are monitored in real time, and the detected tasks that need to be frozen are pushed into a recording queue for recording. The data source is synchronized to a task to obtain the recorded task. This also includes: Synchronize data from the same data source into a single task to complete the backup of the data source; Before pushing each task requiring freezing into the recording queue, first push the task function to disable data source synchronization into the recording queue. After pushing all the tasks requiring freezing into the recording queue, push the task function to restore data source synchronization into the recording queue. Specifically, to ensure that the data source is not preemptively executed and modified by tasks from other modules during the recording task execution, the data source is sliced, i.e., the data source is backed up to ensure data consistency during the execution of the recording task. During the process of pushing detected tasks requiring freezing into the recording queue for recording, when a new task requiring freezing needs to be pushed in (that is, a task whose task requiring freezing is not from the same data source as the previously pushed task requiring freezing), first push the task function to disable data source synchronization into the recording queue. After pushing the last task requiring freezing of the new task into the recording queue, then push the task function to restore data source synchronization into the recording queue. Figure 2 As shown, it can be ensured that the data source of the recording task is consistent between disabling data source synchronization and resuming data source synchronization. For example, the data source of recording task 1 and recording task 2 is consistent, while the data source of recording task 3 is not necessarily consistent with the data source of recording task 1 and recording task 2. This depends on the implementation specifying the consistency of the frozen data source, rather than blindly freezing the consistency of all types of data sources.
[0027] As an optional implementation, after all tasks requiring freezing are pushed into the recording queue, the recording tasks in the recording queue are periodically or conditionally popped into the task queue for detection and execution according to their pushing time. Simultaneously, the task queue management module performs periodic execution functions until all recording tasks in the recording queue have been executed, including: Once all tasks requiring freezing are pushed into the recording queue, the earliest recorded task pushed into the recording queue is popped into the task queue periodically or by conditional triggering. The task queue management module pops and executes detected recorded tasks according to the periodic execution function; After all recorded tasks in the task queue are completed, the earliest recorded task pushed into the queue is popped back into the task queue for detection and execution. This process is repeated until all recorded tasks in the queue are completed. Specifically, once all tasks requiring freezing are pushed into the task queue, the earliest recorded task pushed into the queue (i.e., the task at the bottom of the queue) is popped back into the task queue periodically or under certain conditions to await execution. The task queue is managed asynchronously by functional modules (such as the freeze detection module, cost control module, and communication processing module). During the periodic execution of functions by each module, if a recorded task is detected in the task queue, it is popped and executed. After a recorded task in the task queue is completed, the next recorded task in the queue (i.e., the earliest recorded task currently pushed into the queue) is popped back into the task queue for detection and execution. This process is repeated until all recorded tasks in the queue are completed. By periodically or conditionally triggering multiple recording tasks from the recording queue to the task queue one by one for detection and execution, the blocking effect of freezing processes can be reduced when handling a large number of freezing processes simultaneously. The periodicity and condition for triggering the earliest recorded task pushed into the recording queue to the task queue can be set according to actual needs.
[0028] As an optional implementation, the detected recording tasks are popped up and executed, including: collecting frozen data from the recording tasks and storing the collected frozen data. Specifically, each recording task, when executed, points to a processing function that includes data collection and storage. In this embodiment, multiple freezing processes in a task are split into individual recording tasks in a recording queue, ensuring the uniqueness of each recording unit in the recording queue by the inherent information identifier. When collecting frozen data from the recording tasks, the collected frozen data originates from a backup data source, ensuring that the acquired frozen data is unmodified, thereby guaranteeing data consistency. The collected frozen data is stored, thereby enabling the energy meter to synchronously freeze the data.
[0029] Example 2: like Figure 3 As shown, a processing device based on the synchronization of frozen data from an electricity meter is disclosed. The device includes: a management module for real-time detection of multiple tasks, pushing detected tasks requiring freezing into a recording queue for recording, and synchronizing the data source to a task to obtain a recording task. After all tasks requiring freezing are pushed into the recording queue, the recording tasks in the recording queue are periodically or conditionally triggered to be popped into the task queue for detection and execution according to the order of their pushing time. At the same time, the task queue management function module performs its functions according to the cycle until all recording tasks in the recording queue are executed.
[0030] This invention utilizes an asynchronous task queue management module with periodic execution to record tasks that need to be frozen in the queue. These tasks are then sequentially popped into the task queue for execution. During the periodic execution of the task queue module, popped tasks are detected and executed. After execution, the next task is popped from the queue and executed. This process repeats until all tasks in the queue are completed, reducing the blocking nature of the freeze process. Furthermore, by backing up the data source, it ensures that data is not preemptively executed and modified by tasks from other modules during the execution of a single task.
[0031] As an optional implementation, the management module includes a freeze detection module, a cost control function module, and a communication processing module. The freeze detection module performs real-time detection on multiple tasks and pushes detected tasks requiring freezing into a recording queue for recording. The cost control function module executes cost control processing functions, and the communication processing module executes communication processing functions. Specifically, the freeze detection module, cost control function module, and communication processing module in the management module are managed asynchronously through a task queue. Corresponding functions are executed periodically in the task queue, allowing the freeze detection module to pop and execute detected recording tasks, thus synchronizing freeze data and function execution.
[0032] Example 3: Based on the same inventive concept, the third embodiment of the present invention also provides a computer device, including a memory and a processor. The memory is used to store a computer program, and the processor executes the computer program stored in the memory to cause the processor to perform the steps of the processing method based on the above-described data synchronization of frozen electricity meters.
[0033] Example 4: Based on the same inventive concept, the fourth embodiment of the present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described processing method for synchronizing frozen data of an electricity meter.
[0034] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0035] The aforementioned storage media capable of storing program code include: static disks, solid-state drives, random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), optical storage devices, magnetic storage devices, flash memory, magnetic disks or optical disks, and / or combinations of the above devices, that is, they can be implemented by any type of volatile or non-volatile storage devices or combinations thereof.
[0036] The above description is merely a preferred embodiment of the present invention. Those skilled in the art will understand that various changes or equivalent substitutions can be made to these features and embodiments without departing from the spirit and scope of the present invention. Furthermore, under the teachings of the present invention, these features and embodiments can be modified to adapt to specific situations and materials without departing from the spirit and scope of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application are within the protection scope of the present invention.
Claims
1. A processing method based on the synchronization of frozen data from an electricity meter, characterized in that, include: Multiple tasks are monitored in real time. The detected tasks that need to be frozen are pushed into a recording queue for recording. The data source is synchronized to one of the tasks to obtain the recorded tasks. Once all the tasks to be frozen are pushed into the record queue, the record tasks in the record queue are periodically or conditionally popped into the task queue for detection and execution according to the order of their push-in time. At the same time, the task queue management function module performs its function periodically until all the record tasks in the record queue have been executed.
2. The processing method based on the synchronization of frozen data from electricity meters according to claim 1, characterized in that, The process involves real-time detection of multiple tasks, pushing detected tasks requiring freezing into a recording queue for recording, and synchronizing the data source to one of the tasks to obtain the recorded tasks, including: Real-time detection of whether the task is one of the tasks that needs to be frozen; If so, the task to be frozen is pushed into the record queue, and the corresponding inherent information is recorded during the process of pushing it into the record queue to obtain the recorded task; If not, continue to monitor in real time whether the task is one that needs to be frozen.
3. The processing method based on the synchronization of frozen data from electricity meters according to claim 2, characterized in that, The process of real-time detection of multiple tasks, pushing detected tasks requiring freezing into a recording queue for recording, and synchronizing the data source to one of the tasks to obtain the recorded tasks, further includes: Data from the same data source is synchronized into one task to complete the backup of the data source; Before pushing the frozen tasks of each task into the record queue, first push the task function to disable data source synchronization into the record queue, and after pushing the frozen tasks of each task into the record queue, push the task function to restore data source synchronization into the record queue.
4. The processing method based on the synchronization of frozen data from an electricity meter according to claim 3, characterized in that, The inherent information includes the freeze time and freeze type.
5. The processing method based on the synchronization of frozen data from an electricity meter according to claim 1, characterized in that, Once all the tasks requiring freezing are pushed into the recording queue, the recording tasks in the recording queue are periodically or conditionally popped into the task queue for detection and execution according to their pushing time. Simultaneously, the task queue management module performs a periodic execution function until all the recording tasks in the recording queue have been executed, including: Once all the tasks that need to be frozen have been pushed into the record queue, the record task that was pushed into the record queue earliest will be popped into the task queue periodically or by conditional triggering. The task queue management module pops up and executes the detected recorded tasks according to the periodic execution function; After the recording task in the task queue is completed, the recording task that was pushed into the task queue earliest is popped back into the task queue for detection and execution. This process is repeated until all the recording tasks in the task queue are completed.
6. The processing method based on the synchronization of frozen data from an electricity meter according to claim 5, characterized in that, The step of popping up and executing the detected recording task includes: Collect the frozen data of the recording task and store the collected frozen data.
7. A processing device based on the synchronization of frozen data from an electricity meter, characterized in that, The device includes: The management module is used to perform real-time detection of multiple tasks, push the detected tasks that need to be frozen into a recording queue for recording, and synchronize the data source to one of the tasks to obtain the recorded tasks. After all the tasks that need to be frozen are pushed into the recording queue, the recorded tasks in the recording queue are periodically or conditionally triggered to be popped into the task queue for detection and execution in the order of their push-in time. At the same time, the task queue management function module performs its function according to the cycle until all the recorded tasks in the recording queue have been executed.
8. The processing device for synchronizing frozen data from an electricity meter according to claim 7, characterized in that, The management module includes a freeze detection module, a cost control function module, and a communication processing module. The freeze detection module is used to detect multiple tasks in real time and push the detected tasks that need to be frozen into a record queue for recording. The cost control function module is used to perform cost control processing functions, and the communication processing module is used to perform communication processing functions.
9. A computer device, characterized in that, The device includes a memory and a processor, the memory being used to store a computer program, and the processor executing the computer program stored in the memory to cause the processor to perform the steps of the processing method based on the synchronization of frozen electricity meter data as described in any one of claims 1-6.
10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the steps of the processing method based on the synchronization of frozen electricity meter data as described in any one of claims 1-6.
Citation Information
Patent Citations
Intelligent electric meter segmented freezing data storage method and device and intelligent electric meter segmented freezing data query method and device
CN109614447A
Electric energy meter data storage method and device based on message queue
CN115543648A
Database backup method, system and device, computer equipment and storage medium
CN117555730A
Method and system for implementing current, consistent, and complete backups by rolling a change log backwards
US10922186B1