Electricity meter metering management method and device, electricity meter and storage medium
By setting multiple external storage locations in the electricity meter and implementing a data verification and recovery mechanism, the problem of unreliable meter reading caused by external storage read errors is solved, and normal meter reading and data recovery are achieved when the storage device fails.
Patent Information
- Application Number
- CN202411333280.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2024-11-01
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing electricity meters cannot function properly when there is a read error in the external memory, resulting in reduced metering reliability.
Multiple external storage locations are set up in the electricity meter. Through verification and data recovery mechanisms, it is ensured that the power data of at least one storage location can be verified correctly and can work normally. Data recovery is performed for other erroneous locations, thereby improving reliability.
When a read error occurs in the external storage, the backup and recovery mechanism of multiple storage locations ensures that the electricity meter can measure normally, thus improving the meter's measurement reliability.
Smart Images

Figure CN118885328A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of storage technology, and in particular to an electric meter measurement management method, device, electric meter and storage medium. Background Art
[0002] The electric meter records the electric energy data periodically, for example, once every hour, day or month. These records include total power consumption, forward active energy, reverse active energy, reactive energy, etc. Existing electric meters usually store the electric energy data in an external memory.
[0003] However, in the existing storage method, when a read error occurs in the external memory, the electric meter will not work normally until the external memory is read normally, which reduces the reliability of the electric meter measurement. Summary of the invention
[0004] In view of the deficiencies in the prior art, the present invention provides an electric meter measurement management method, device, electric meter and storage medium.
[0005] In a first aspect, in one embodiment, the present invention provides an electric meter measurement management method, the electric meter measurement management method comprising: Entering the power-on startup phase of the electric meter, reading electric energy data from multiple external storage locations in the external memory, and verifying the electric energy data read from the multiple external storage locations; If the electric energy data read from multiple external storage locations are all verified to be wrong, the electric energy data read from the real-time data block in the memory of the electric meter is cleared, and the storage error flag of the real-time data block is set to an abnormal state; If one of the electric energy data read from multiple external storage locations is verified to be correct, the electric energy data is stored in the real-time data block, and data is restored from other external storage locations with verification errors based on the electric energy data, and the storage error flag of the real-time data block is set to a normal state.
[0006] In one embodiment, reading power data from a plurality of external storage locations in an external memory and verifying the power data read from the plurality of external storage locations includes: Read the electric energy data in the first external storage location to the real-time data block, verify the electric energy data read from the first external storage location, if the verification is correct, read the electric energy data in the second external storage location to the power-on temporary data block in the memory, if the verification is wrong, read the electric energy data in the second external storage location to the real-time data block; The electric energy data in the power-on temporary data block read from the second external storage location is verified, or the electric energy data in the real-time data block read from the second external storage location is verified.
[0007] In one embodiment, if one of the electric energy data read from multiple external storage locations is verified to be correct, the electric energy data is stored in the real-time data block, and data recovery is performed on other external storage locations with verification errors based on the electric energy data, including: If the electric energy data read from the second external storage location in the power-on temporary data block is verified to be wrong, the electric energy data read from the real-time data block is written to the second external storage location; If the electric energy data read from the second external storage location in the real-time data block is verified to be correct, the electric energy data read from the real-time data block is written into the first external storage location.
[0008] In one embodiment, the electric meter measurement management method further includes: If the electric energy data read from multiple external storage locations are all verified to be errors and the storage error flag of the real-time data block is set to a normal state, the electric energy data in the real-time data block is written to the backup location of the flash memory for backup.
[0009] In one embodiment, after the step of setting the storage error flag of the real-time data block to an abnormal state or after the step of setting the storage error flag of the real-time data block to a normal state, the electric meter measurement management method further includes: Entering the meter operation storage phase, reading electric energy data from multiple external storage locations, and verifying the electric energy data read from the multiple external storage locations; If the electric energy data read from the multiple external storage locations are all verified to be errors, the electric energy data in the backup location is read to the running temporary data block in the memory; If one of the electric energy data read from the multiple external storage locations is verified to be correct, the electric energy data is stored in the running temporary data block, and data recovery is performed on other external storage locations with verification errors based on the electric energy data.
[0010] In one embodiment, after the step of reading the electric energy data in the backup location into the temporary data block in the memory, the electric meter measurement management method further includes: Writing the electric energy data in the running temporary data block to multiple external storage locations respectively; Reading electric energy data from a plurality of external storage locations, and verifying the electric energy data read from the plurality of external storage locations; If the electric energy data read from multiple external storage locations are all verified to be errors, the electric energy data in the backup location will not be erased; If one of the electric energy data read from the multiple external storage locations is verified to be correct, the electric energy data in the backup location is erased.
[0011] In one embodiment, after the step of recovering data from other external storage locations with verification errors according to the electric energy data, after the step of not erasing the electric energy data in the backup location, or after the step of erasing the electric energy data in the backup location, the electric meter measurement management method further includes: Detect storage error flags of real-time data blocks; If the storage error flag of the real-time data block is in an abnormal state, the power data of the real-time data block is updated according to the sum of the power data in the real-time data block and the power data in the running temporary data block; Set the storage error flag of the real-time data block to normal state.
[0012] In a second aspect, in one embodiment, the present invention provides an electric meter measurement management device, the electric meter measurement management device comprising: A reading and verification module is used to enter the power-on startup phase of the electric meter, read electric energy data from multiple external storage locations in the external memory, and verify the electric energy data read from the multiple external storage locations; A first post-verification processing module, for clearing the electric energy data read from the real-time data block in the memory of the electric meter and setting the storage error flag of the real-time data block to an abnormal state if all the electric energy data read from the multiple external storage locations are verified to be errors; The second post-verification processing module is used to store the electric energy data in the real-time data block if one of the electric energy data read from multiple external storage locations is verified to be correct, and to recover data from other external storage locations with verification errors based on the electric energy data, and to set the storage error flag of the real-time data block to a normal state.
[0013] In a third aspect, in one embodiment, the present invention provides an electric meter, comprising a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute the steps in the electric meter measurement management method in any of the above embodiments.
[0014] In a fourth aspect, in one embodiment, the present invention provides a storage medium storing a computer program, and the computer program is loaded by a processor to execute the steps in the electric meter measurement management method in any of the above embodiments.
[0015] Through the above-mentioned electricity meter measurement management method, device, electricity meter and storage medium, multiple external storage locations are opened in the external memory, and mutual backup is achieved between the multiple external storage locations. When the electricity meter is powered on, if there is one electric energy data that is correctly verified among the multiple external storage locations read, normal metering work can be achieved based on the electric energy data, and data recovery of other external storage locations with verification errors can also be achieved based on the electric energy data, thereby improving the reliability of electricity meter measurement. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the 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 work.
[0017] Figure 1 A schematic diagram of the structure of an electric meter in one embodiment of the present invention; Figure 2 A schematic diagram of a flow chart of an electric meter measurement management method in one embodiment of the present invention; Figure 3 A schematic diagram of a specific flow of integer data in a power-on phase in one embodiment of the present invention; Figure 4 A schematic diagram of a specific flow of pulse data in a power-on phase in one embodiment of the present invention; Figure 5 A schematic diagram of a specific flow chart of electric energy calculation in one embodiment of the present invention; Figure 6 A schematic diagram of a specific process of data verification in an embodiment of the present invention; Figure 7 A schematic diagram of a specific process of reading electric energy data in a metering module in one embodiment of the present invention; Figures 8 to 10 A schematic diagram of a specific flow of integer data in the running stage in one embodiment of the present invention; Figures 11 to 13 A schematic diagram of a specific flow of pulse data in the operation phase in one embodiment of the present invention; Fig.14 It is a schematic diagram of the structure of an electric meter measurement management device in one embodiment of the present invention. DETAILED DESCRIPTION
[0018] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0019] In the description of the present invention, it should be understood that the terms "first" and "second" are used only for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined. In the present application, the word "exemplary" is used to mean "used as an example, illustration or description". Any embodiment described as "exemplary" in the present application is not necessarily interpreted as being more preferred or more advantageous than other embodiments. In order to enable any person skilled in the art to implement and use the present invention, the following description is given. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the present invention can be implemented without using these specific details. In other examples, well-known structures and processes will not be elaborated in detail to avoid unnecessary details that make the description of the present invention obscure. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the widest range of principles and features disclosed in the present application.
[0020] The electric meter measurement management method in the embodiment of the present invention is applied to an electric meter measurement management device, and the electric meter measurement management device is arranged in a computer device; the computer device can be a terminal, such as a mobile phone or a tablet computer, and the computer device can also be a server, or a service cluster composed of multiple servers.
[0021] In a first aspect, in one embodiment, the present invention provides an electric meter measurement management method, which is applied to an electric meter, such as Figure 1 As shown, the electric meter includes an MCU, an external memory, a metering module, a display module and a communication module. The MCU includes a CPU processing unit and a memory. The external memory includes a first external storage location, a second external storage location and a third external storage location. The memory includes a real-time data block.
[0022] The MCU and the external memory communicate via a bus. When interference signals appear on the bus, such as fast pulse group interference, external radiation interference or conducted interference, the data of the external memory read by the MCU through the bus may be incorrect.
[0023] Among them, the metering module collects voltage and current signals in the power grid and counts the power data. After the MCU reads the power data from the metering module, it stores the data. The power data of the metering chip is configured as read-after-clear mode: when the MCU correctly reads the data from the metering module, the metering module starts to accumulate power data again. The unit of power data read from the metering chip is the power represented by the unit pulse.
[0024] The electric meter measurement management method in this embodiment can be executed by a CPU processing unit.
[0025] like Figure 2 As shown, the electricity meter measurement management method includes: Step 101, entering the power-on startup phase of the electric meter, reading electric energy data from multiple external storage locations in the external memory, and verifying the electric energy data read from the multiple external storage locations.
[0026] Among them, the electric energy data stored in the memory of the electric meter is lost after each power-off, so after each power-on, it is necessary to read from the external memory, so as to complete the accumulation of subsequent electric energy data based on the reading.
[0027] The external memory may be disturbed in the actual process, resulting in errors in the electric energy data stored therein. Therefore, when the external memory has multiple external storage locations, it is necessary to verify the electric energy data in the multiple external storage locations.
[0028] Step 102: If the electric energy data read from the multiple external storage locations are all verified to be errors, the electric energy data read from the real-time data block in the memory of the electric meter is cleared, and the storage error flag of the real-time data block is set to an abnormal state.
[0029] Among them, the verification errors of the electric energy data in multiple external storage locations are more extreme situations, which usually do not occur. When this situation occurs, the electric energy data currently read from the external storage area by the real-time data block needs to be cleared to ensure that the real-time data block can continue to accumulate new electric energy data in the future.
[0030] Among them, when the above extreme situation occurs, in order to be able to try to solve it later, the storage error flag of the current real-time data block needs to be set to an abnormal state. Specifically, taking the binary method as an example, it can be set to 1.
[0031] Step 103, if there is one electric energy data that is correctly verified among the electric energy data read from multiple external storage locations, the electric energy data is stored in the real-time data block, and data is restored from other external storage locations with verification errors based on the electric energy data, and the storage error flag of the real-time data block is set to a normal state.
[0032] It is a common situation that some verification errors exist in the power data of multiple external storage locations. In this case, there is at least one power data that is verified correctly, so that not only can the normal accumulation of power data be achieved based on the correctly verified power data, but also data recovery can be performed on other external storage locations with verification errors. This avoids the situation in which, in the subsequent process, if a verification error occurs in the currently verified correctly external storage location, the external storage location with the verification error can be verified correctly by then, thus ensuring the reliability and sustainability of mutual backup between multiple external storage locations.
[0033] In order to avoid subsequent erroneous steps, the storage error flag of the current real-time data block needs to be set to a normal state. Specifically, taking a binary method as an example, it can be set to 0.
[0034] Through the above-mentioned electricity meter measurement management method, multiple external storage locations are opened in the external memory, and mutual backup is achieved between the multiple external storage locations. When the electricity meter is powered on, if there is one electric energy data that is correctly verified among the multiple external storage locations read, normal metering work can be achieved based on the electric energy data, and data recovery of other external storage locations with verification errors can also be achieved based on the electric energy data, thereby improving the reliability of electricity meter measurement.
[0035] In one embodiment, reading power data from a plurality of external storage locations in an external memory and verifying the power data read from the plurality of external storage locations includes: Read the electric energy data in the first external storage location to the real-time data block, verify the electric energy data read from the first external storage location, if the verification is correct, read the electric energy data in the second external storage location to the power-on temporary data block in the memory, if the verification is wrong, read the electric energy data in the second external storage location to the real-time data block; The electric energy data in the power-on temporary data block read from the second external storage location is verified, or the electric energy data in the real-time data block read from the second external storage location is verified.
[0036] Among them, it has been mentioned in the above embodiment that it is necessary to verify the electric energy data read from multiple external storage locations. Specifically in this embodiment, a sequential verification method can be adopted. That is, the electric energy data in the first external storage location is first read to the real-time data block for verification. If the verification is wrong, the electric energy data in the second external storage location is read to the real-time data block. In the real-time data block, the electric energy data in the second external storage location will overwrite the electric energy data previously read from the first external storage location. If the electric energy data in the first external storage location is verified correctly in the real-time data block, the electric energy data in the second external storage location is read to the power-on temporary data block (the power-on temporary data block can be understood as a data block for temporarily processing electric energy data in the power-on startup phase) for verification. By analogy, the verification of the electric energy data in the third external storage location, the electric energy data in the fourth external storage location, or the electric energy data in more external storage locations can also be realized.
[0037] In one embodiment, if one of the electric energy data read from multiple external storage locations is verified to be correct, the electric energy data is stored in the real-time data block, and data recovery is performed on other external storage locations with verification errors based on the electric energy data, including: If the electric energy data read from the second external storage location in the power-on temporary data block is verified to be incorrect, the electric energy data read from the real-time data block is written into the second external storage location.
[0038] Among them, on the basis that the electric energy data read from the first external storage location in the real-time data block is verified correctly, if the electric energy data read from the second external storage location in the power-on temporary data block is verified incorrectly, the data of the second external storage location can be restored based on the electric energy data read from the first external storage location that has been verified correctly in the real-time data block. Specifically, the electric energy data in the real-time data block is directly written to the second external storage location, so that the correctly verified electric energy data overwrites the incorrectly verified electric energy data.
[0039] If the electric energy data read from the second external storage location in the real-time data block is verified to be correct, the electric energy data read from the real-time data block is written into the first external storage location.
[0040] Among them, based on the verification error of the electric energy data read from the first external storage location in the real-time data block, if the verification of the electric energy data read from the second external storage location in the power-on temporary data block is correct, the data of the first external storage location can be restored based on the electric energy data read from the second external storage location that has been verified correctly in the power-on temporary data block. Specifically, the electric energy data in the power-on temporary data block is directly written to the first external storage location, so that the electric energy data with correct verification can cover the electric energy data with incorrect verification.
[0041] Usually, electric energy data includes two parts: integer data and pulse data. After obtaining the quotient of the pulse data and the pulse constant, it is summed with the integer data, and the final data obtained is the real electric energy data.
[0042] In order to make the above embodiment clearer, in this embodiment, the reading process of integer data and pulse data from the external memory in the power-on phase and the recovery process of the external memory are specifically described respectively.
[0043] like Figure 1 As shown, the real-time data block includes an integer real-time data block and a pulse real-time data block, the power-on temporary data block includes an integer power-on temporary data block and a pulse power-on temporary data block, the external memory includes a first external storage position, a second external storage position and a third external storage position, the first external storage position includes an integer storage position 1 and a pulse storage position 1, the second external storage position includes an integer storage position 2 and a pulse storage position 2, and the third external storage position includes an integer storage position 3 and a pulse storage position 3.
[0044] The memory also has a global integer backup data block. For easy understanding, the integer real-time data block is set to I_A, the integer power-on temporary data block is set to I_C, and the global integer backup data block is set to I_B. The specific process of integer data in the power-on stage can be referred to Figure 3 , and contains the following steps.
[0045] Step 1: Read the energy data from integer storage location 1 of the external memory into integer real-time data block I_A.
[0046] Step 2: Check whether the power data in the integer real-time data block I_A is correct. If the check is correct, read the power data in the integer storage location 2 to the integer power-on temporary data block I_C, and jump to step 3. If the power data in the integer real-time data block I_A is incorrect, read the power data from the integer storage location 2 of the external memory to the integer real-time data block I_A, and jump to step 5.
[0047] Step 3: Check the power data in the integer power-on temporary data block I_C. If the power data in the integer power-on temporary data block I_C is checked incorrectly, write the power data in the integer real-time data block I_A to the integer storage location 2. Then read the power data in the integer storage location 3 of the external memory to the integer power-on temporary data block I_C.
[0048] Step 4: Verify the power data in the integer power-on temporary data block I_C. If the power data in the integer power-on temporary data block I_C is verified incorrectly, write the power data in the integer real-time data block I_A to integer storage location 3 and jump to step 9.
[0049] Step 5: Read the energy data from integer storage location 2 of the external memory into integer real-time data block I_A.
[0050] Step 6: Check whether the power data in the integer real-time data block I_A is correct. If correct, the integer real-time data block I_A is written to the integer storage location 1, and the power data in the integer storage location 3 is read to the integer power-on temporary data block I_C, and jump to step 7. If it is wrong, the power data is read from the integer storage location 3 of the external memory to the integer real-time data block I_A, and jump to step 8.
[0051] Step 7: Verify the power data in the integer power-on temporary data block I_C. If the power data in the integer power-on temporary data block I_C is verified incorrectly, write the power data in the integer real-time data block I_A to integer storage location 3 and jump to step 9.
[0052] Step 8: Check whether the power data in the integer real-time data block I_A is correct. If correct, write the power data in the integer real-time data block I_A to integer storage position 1 and integer storage position 3 respectively, and jump to step 9. If wrong, 1. Set the integer storage error flag to 1; 2. Back up the integer real-time data block I_A (check failed) to the global integer backup data block I_B; 3. Clear the integer real-time data block I_A. End the process.
[0053] Step 9: Set the integer storage error flag to 0. End the process.
[0054] The memory also has a global pulse backup data block and a global fractional data block (used by the MCU to read the power data from the metering module and accumulate it in the global fractional data block). For easy understanding, the pulse real-time data block is set to P_A, the pulse power-on temporary data block is set to P_C, the global pulse backup data block is set to P_B, and the global fractional data block is set to C_A. The specific process of pulse data in the power-on stage can be referred to Figure 4 , and contains the following steps.
[0055] Step 1: Read the energy data from pulse storage location 1 of the external memory to the pulse real-time data block P_A.
[0056] Step 2: Check whether the power data in the pulse real-time data block P_A is correct. If it is correct, read the power data in the pulse storage position 2 to the pulse power-on temporary data block set to P_C, and jump to step 3. If it is wrong, read the power data from the pulse storage position 2 of the external memory to the pulse real-time data block P_A, and jump to step 5.
[0057] Step 3: Verify the electric energy data in the pulse power-on temporary data block set to P_C. If the electric energy data verification in the pulse power-on temporary data block set to P_C is wrong, write the electric energy data in the pulse real-time data block P_A to the pulse storage position 2, and then read the electric energy data in the pulse storage position 3 of the external memory to the pulse power-on temporary data block set to P_C.
[0058] Step 4: Verify the electric energy data in the pulse power-on temporary data block set to P_C. If the electric energy data verification in the pulse power-on temporary data block set to P_C is wrong, write the electric energy data in the pulse real-time data block P_A to the pulse storage position 3 and jump to step 9.
[0059] Step 5: Read the power data from pulse storage location 2 of the external memory to the pulse real-time data block P_A.
[0060] Step 6: Check whether the power data in the pulse real-time data block P_A is correct. If correct, write the power data in the pulse real-time data block P_A to the pulse storage position 1, read the power data in the pulse storage position 3 to the pulse power-on temporary data block set to P_C, and jump to step 7. If wrong, read the power data from the pulse storage position 3 of the external memory to the pulse real-time data block P_A, and jump to step 8.
[0061] Step 7: Verify the electric energy data in the pulse power-on temporary data block set to P_C. If the electric energy data verification in the pulse power-on temporary data block set to P_C is wrong, write the electric energy data in the pulse real-time data block P_A to the pulse storage position 3 and jump to step 9.
[0062] Step 8: Check whether the electric energy data in the pulse real-time data block P_A is correct. If correct, write the electric energy data in the pulse real-time data block P_A into pulse storage position 1 and pulse storage position 2, and jump to step 9. If wrong, 1. Set the pulse storage error flag to 1; 2. Back up the pulse real-time data block P_A (check failed) to the global pulse backup data block I_B; 3. Clear the pulse real-time data block P_A. Jump to step 10.
[0063] Step 9: Set the pulse storage error flag to 0.
[0064] Step 10: Back up the pulse real-time data block P_A to the global score data block C_A.
[0065] The memory also includes temporary integer data block JI_A, temporary pulse data block JP_A and global power data block J_A (used for communication and displaying scenes that require real power data). The calculation process of power can be referred to Figure 5 , and includes the following steps.
[0066] Step 1: Determine whether the integer storage error flag is set to 1. If so, copy the global integer backup data block I_B + integer real-time data block I_A to the temporary integer data block JI_A. If the integer storage error flag is 0, copy the integer real-time data block I_A to the temporary integer data block JI_A.
[0067] Step 2: Determine whether the pulse storage error flag is set to 1. If so, copy the global pulse backup data block P_B + pulse real-time data block P_A to the temporary pulse data block JP_A. If the pulse storage error flag is 0, copy the pulse real-time data block P_A to the temporary pulse data block JP_A.
[0068] Step 3: After calculating the temporary integer data block JI_A + temporary pulse data block JP_A / pulse constant, go to the global power data block J_A.
[0069] The verification process of integer data and pulse data in memory can be referred to Figure 6 , and includes the following steps.
[0070] The integer real-time data block I_A in the memory is checked. If the check is wrong, the integer storage error flag is set to 1 and the integer real-time data block I_A is cleared.
[0071] The pulse real-time data block P_A in the memory is checked. If the check is wrong, the pulse storage error flag is set to 1 and the pulse real-time data block P_A is cleared.
[0072] The reading process of electric energy data in the metering module can refer to Figure 7 , and includes the following steps.
[0073] Step 1: The MCU reads the current accumulated power data from the metering module (cleared after reading) and adds it to the global fractional data block C_A.
[0074] Step 2: Determine whether the data in the global fractional data block C_A is greater than the pulse constant. If it is, add 1 to the integer data corresponding to the integer real-time data block I_A, and subtract the pulse constant from the data corresponding to the global fractional data block C_A.
[0075] Step 3: Copy the data of the global fractional data block C_A to the pulse real-time data block P_A.
[0076] Step 4: Determine whether the integer real-time data block I_A data has changed. If changed, call the integer storage function FunctionA to store the integer data into the external memory.
[0077] Step 5: Determine whether the pulse real-time data block P_A data has changed. If it has changed, call the pulse storage function FunctionB to store the pulse data in the external memory. End.
[0078] like Figure 1 As shown, the MCU also includes a flash memory, and a backup location is provided in the flash memory. In one embodiment, the meter measurement management method also includes: If the electric energy data read from multiple external storage locations are all verified to be errors and the storage error flag of the real-time data block is set to a normal state, the electric energy data in the real-time data block is written to the backup location of the flash memory for backup.
[0079] Among them, when the electric energy data read from multiple external storage locations are all verified incorrectly, it means that the current external memory cannot continue to store normally. Therefore, in order to ensure that the subsequent electric energy can be accumulated normally, the electric energy data that has been verified correctly in the current real-time data block must be backed up to the backup location of the flash memory.
[0080] In one embodiment, after the step of setting the storage error flag of the real-time data block to an abnormal state or after the step of setting the storage error flag of the real-time data block to a normal state, the electric meter measurement management method further includes: Entering the electric meter operation storage phase, reading electric energy data from multiple external storage locations, and verifying the electric energy data read from the multiple external storage locations.
[0081] After the power-on startup phase is completed, the operation storage phase can be entered. In the operation storage phase, as in the power-on startup phase, it is also necessary to read the electric energy data in multiple external storage locations and perform verification.
[0082] If the electric energy data read from the multiple external storage locations are all verified to be errors, the electric energy data in the backup location is read to the running temporary data block in the memory.
[0083] Among them, different from the power-on startup stage, when the electric energy data read from multiple external storage locations are all verified as errors, they will not be directly backed up and cleared, but the electric energy data in the backup position in the flash memory will be read to the operation temporary data block. The operation temporary data block and the power-on temporary data block in the above embodiment can be the names of the same data block in different stages, so as to achieve multiplexing. Of course, in other embodiments, the operation temporary data block and the power-on temporary data block can also be directly two independent data blocks.
[0084] It should be noted that the above embodiment has mentioned that when the electric energy data read from multiple external storage locations are all verified errors and the storage error flag in the real-time data block is in a normal state, the electric energy data in the real-time data block will be backed up to the backup location in the flash memory. In the above power-on startup phase, when the electric energy data read from multiple external storage locations are all verified errors, the storage error flag of the real-time data block will be set to an abnormal state. Therefore, in this embodiment, the electric energy data in the backup location is backed up in the last storage phase.
[0085] If one of the electric energy data read from the multiple external storage locations is verified to be correct, the electric energy data is stored in the running temporary data block, and data recovery is performed on other external storage locations with verification errors based on the electric energy data.
[0086] Among them, as in the power-on startup stage, as long as there is power data in an external storage location that is verified correctly, power accumulation during operation can be achieved based on the power data and data recovery can be performed on other external storage locations with verification errors.
[0087] In one embodiment, after the step of reading the electric energy data in the backup location into the real-time data block, the electric meter measurement management method further includes: Writing the electric energy data in the real-time data block to multiple external storage locations respectively; Reading electric energy data from a plurality of external storage locations, and verifying the electric energy data read from the plurality of external storage locations; If the electric energy data read from multiple external storage locations are all verified to be errors, the electric energy data in the backup location will not be erased; If one of the electric energy data read from the multiple external storage locations is verified to be correct, the electric energy data in the backup location is erased.
[0088] Among them, when data is restored through the power data in the backup location, the power data is first written to multiple external storage locations in sequence, and then the power data in the multiple external storage locations are read for verification to confirm whether the external storage locations can be read and written normally. When there is an external storage location that can be read and written normally, the power data in the backup location can be erased to ensure the service life of the flash memory.
[0089] In one embodiment, after the step of recovering data from other external storage locations with verification errors according to the electric energy data, after the step of not erasing the electric energy data in the backup location, or after the step of erasing the electric energy data in the backup location, the electric meter measurement management method further includes: Detect storage error flags of real-time data blocks; If the storage error flag of the real-time data block is in an abnormal state, the power data of the real-time data block is updated according to the sum of the power data in the real-time data block and the power data in the running temporary data block; Among them, when the storage error flag of the real-time data block is in an abnormal state, the electric energy data on it is cleared at that moment, and the real-time data block accumulates the newly added electric energy data from zero. For example, when reading the external memory at a certain time, multiple external storage locations are all verified errors, then the real-time data block backs up its corresponding electric energy data to the backup location in the flash memory; after powering on again, the storage error flag of the real-time data block is set to an abnormal state because multiple external storage locations are all verified errors, and the real-time data block accumulates from zero; when entering the operation storage stage, the cleared part can be restored through the electric energy data at the backup location in the flash memory, so the current real electric energy data is the electric energy data at the backup location and the newly added electric energy data in the real-time data block, thereby ensuring that the electric energy data to be measured will not be lost after an abnormality occurs; or after entering the operation storage stage, the storage in the external memory has been restored, so the cleared part can be restored through the external memory.
[0090] Set the storage error flag of the real-time data block to normal state.
[0091] After the electric energy data in the real-time data block is restored to the real electric energy data, the corresponding storage error flag may be set to a normal state.
[0092] In order to make the above embodiment clearer, in this embodiment, the reading process of integer data and pulse data from the external memory and the recovery process of the external memory in the running stage are specifically described respectively.
[0093] like Figure 1 As shown, the running temporary data block includes an integer running temporary data block and a pulse running temporary data block, and the backup position includes an integer backup position and a pulse backup position.
[0094] The integer operation temporary data block includes the integer operation temporary data block IT_A and the integer operation temporary data block IT_C. The specific process of the integer data in the operation phase can be referred to Figure 8 , Fig. 9 and Fig.10 , and contains the following steps.
[0095] Step 1: Read the energy data from integer storage location 1 of the external memory into integer operation temporary data block IT_A.
[0096] Step 2: Check whether the power data in the integer operation temporary data block IT_A is correct. If correct, read the integer storage location 2 data to the integer operation temporary data block IT_C and jump to step 3. If wrong, read the power data from the integer storage location 2 of the external memory to the integer operation temporary data block IT_A and jump to step 5.
[0097] Step 3: Verify the integer operation temporary data block IT_C. If the integer operation temporary data block IT_C is verified incorrectly, write the integer operation temporary data block IT_A to the integer storage location 2. Then read the integer storage location 3 of the external memory to the integer operation temporary data block IT_C.
[0098] Step 4: Check the power data in the integer operation temporary data block IT_C. If it is wrong, write the power data in the integer operation temporary data block IT_A to the integer storage location 3 and jump to step 15.
[0099] Step 5: Read the energy data from integer storage location 2 of the external memory into integer operation temporary data block IT_A.
[0100] Step 6: Check whether the power data in the integer operation temporary data block IT_A is correct. If correct, write the integer operation temporary data block IT_A to the integer storage position 1, read the power data in the integer storage position 3 to the integer operation temporary data block IT_C, and jump to step 7. If wrong, read the power data from the integer storage position 3 of the external memory to the integer operation temporary data block IT_A, and jump to step 8.
[0101] Step 7: Check the integer operation temporary data block IT_C. If it is wrong, write the power data in the integer operation temporary data block IT_A to the integer storage location 3 and jump to step 15.
[0102] Step 8: Check whether the integer operation temporary data block IT_A is correct. If correct, write the power data in the integer operation temporary data block IT_A into integer storage location 1 and integer storage location 2, and jump to step 15. If wrong, read the power data from the integer backup location of the MCU internal Flash to the integer operation temporary data block IT_A.
[0103] Step 9: Check the integer operation temporary data block IT_A. If it is wrong, the process ends. If it is correct: 1. Write the power data in the integer operation temporary data block IT_A to the integer storage position 1 of the external memory; 2. Write the power data in the integer operation temporary data block IT_A to the integer storage position 2 of the external memory; 3. Write the power data in the integer operation temporary data block IT_A to the integer storage position 3 of the external memory.
[0104] Step 10: Integer storage location 1 is read into the integer run temporary data block IT_C.
[0105] Step 11: Check the integer operation temporary data block IT_C. If it is correct, jump to step 14. If it is not correct, the integer storage location 2 reads the integer operation temporary data block IT_C.
[0106] Step 12: Check the integer operation temporary data block IT_C. If it is correct, jump to step 14. If it is not correct, the integer storage location 3 reads the integer operation temporary data block IT_C.
[0107] Step 13: Verify the integer using temporary data block IT_C. If correct, jump to step 14. If incorrect, jump to step 15.
[0108] Step 14: Erase the integer backup location data in the MCU internal Flash. At this point, at least one of the three integer storage locations in the external memory is normal.
[0109] Step 15: Determine whether the integer storage error flag is 1. If it is 1, process the integer real-time data block I_A = integer running temporary data block IT_A + integer real-time data block I_A, and clear the integer storage error flag.
[0110] Step 16: Set the error flag 1 of integer storage location 1 to 0, write the power data in the integer real-time data block I_A to integer storage location 1, and then read the data in integer storage location 1 to the integer running temporary data block IT_C.
[0111] Step 17: Check whether the integer running temporary data block IT_C is correct. If it is wrong, write the data in the integer real-time data block I_A to the integer storage position 1; read the data in the integer storage position 1 to the integer running temporary data block IT_C. If it is correct, jump to step 20.
[0112] Step 18: Check whether the integer running temporary data block IT_C is correct. If it is wrong, write the integer real-time data block I_A data to the integer storage position 1; read the data in the integer storage position 1 to the integer running temporary data block IT_C. If it is correct, jump to step 20.
[0113] Step 19: Check whether the integer running temporary data block IT_C is correct. If it is wrong, it means that the area has been written three times incorrectly. Set the integer error flag 1 to 1. If it is correct, jump to step 20.
[0114] Step 20: Set integer storage location 2 error flag 2 to 0, write the data in integer real-time data block I_A to external memory integer storage location 2, and then read the data in integer storage location 2 to integer running temporary data block IT_C.
[0115] Step 21: Check whether the integer running temporary data block IT_C is correct. If it is wrong, write the data in the integer real-time data block I_A to the integer storage position 2 of the external memory; read the data in the integer storage position 2 to the integer running temporary data block IT_C. If it is correct, jump to step 24.
[0116] Step 22: Check whether the integer running temporary data block IT_C is correct. If it is wrong, write the data in the integer real-time data block I_A to the integer storage position 2 of the external memory; read the data in the integer storage position 2 to the integer running temporary data block IT_C. If it is correct, jump to step 24.
[0117] Step 23: Check whether the integer running temporary data block IT_C is correct. If it is wrong, it means that the area has been written three times incorrectly. Set the integer error flag 2 to 1. If it is correct, jump to step 24.
[0118] Step 24: Set integer storage location 3 error flag 3 to 0, write the data in integer real-time data block I_A to external memory integer storage location 3, and then read the data in integer storage location 3 to integer running temporary data block IT_C.
[0119] Step 25: Check whether the integer running temporary data block IT_C is correct. If it is wrong, write the data in the integer real-time data block I_A to the integer storage position 3 of the external memory; read the data in the integer storage position 3 to the integer running temporary data block IT_C. If it is correct, jump to step 28.
[0120] Step 26: Check whether the integer running temporary data block IT_C is correct. If it is wrong, write the data in the integer real-time data block I_A to the integer storage position 3 of the external memory; read the data in the integer storage position 3 to the integer running temporary data block IT_C. If it is correct, jump to step 28.
[0121] Step 27: Check whether the integer running temporary data block IT_C is correct. If it is wrong, it means that the area has been written three times incorrectly. Set the integer error flag 3 to 1. If it is correct, jump to step 28.
[0122] Step 28: Determine whether integer error flag 1 is 1, integer error flag 2 is 1, and integer error flag 3 is 1. If so, consider that three write operations are wrong, and write the data in integer real-time data block I_A to the integer backup area in the internal Flash of MCU. If the requirements are not met, end the process.
[0123] The pulse operation temporary data block includes the pulse operation temporary data block PT_A and the pulse operation temporary data block PT_C. The specific process of pulse data in the operation stage can be referred to Fig.11 , Fig.12 and Fig.13 , and contains the following steps.
[0124] Step 1: Read the energy data from pulse storage location 1 of the external memory to the pulse operation temporary data block PT_A.
[0125] Step 2: Check whether the pulse operation temporary data block PT_A is correct. If it is correct, read the data in pulse storage location 2 to the pulse operation temporary data block PT_C. Jump to step 3. If it is wrong, read the data from the pulse storage location 2 of the external memory to the pulse operation temporary data block PT_A. Jump to step 5.
[0126] Step 3: Check the pulse operation temporary data block PT_C. If it is wrong, write the electric energy data in the pulse operation temporary data block PT_A to the pulse storage position 2. Then read the pulse storage position 3 of the external memory to the pulse operation temporary data block PT_C.
[0127] Step 4: Verify the pulse operation temporary data block PT_C. If the verification is wrong, write the pulse operation temporary data block PT_A to the pulse storage location 3. Jump to step 15.
[0128] Step 5: Read data from pulse storage location 2 of the external memory to the pulse operation temporary data block PT_A.
[0129] Step 6: Check whether the pulse operation temporary data block PT_A is correct. If correct, write the electric energy data in the pulse operation temporary data block PT_A to the pulse storage position 1, read the data in the pulse storage position 3 to the pulse operation temporary data block PT_C, and jump to step 7. If wrong, read the data from the pulse storage position 3 of the external memory to the pulse operation temporary data block PT_A, and jump to step 8.
[0130] Step 7: Check the pulse operation temporary data block PT_C. If it is wrong, write the pulse operation temporary data block PT_A to the pulse storage position 3 and jump to step 15.
[0131] Step 8: Check whether the pulse operation temporary data block PT_A is correct. If correct, write the data in the pulse operation temporary data block PT_A to pulse storage position 1 and pulse storage position 2, and jump to step 15. If wrong, read the pulse operation temporary data block PT_A from the MCU internal Flash pulse backup position.
[0132] Step 9: Check the pulse operation temporary data block PT_A. If it is wrong, the process ends. If it is correct: 1. Write the power data in the pulse operation temporary data block PT_A to the pulse storage position 1 of the external memory; 2. Write the power data in the pulse operation temporary data block PT_A to the pulse storage position 2 of the external memory; 3. Write the power data in the pulse operation temporary data block PT_A to the pulse storage position 3 of the external memory.
[0133] Step 10: Pulse storage location 1 reads the pulse operation temporary data block PT_C.
[0134] Step 11: Check the pulse operation temporary data block PT_C. If correct, jump to step 14. If incorrect, read the pulse operation temporary data block PT_C at pulse storage location 2.
[0135] Step 12: Check the pulse operation temporary data block PT_C. If correct, jump to step 14. If incorrect, read the pulse operation temporary data block PT_C at pulse storage location 3.
[0136] Step 13: Check the pulse operation temporary data block PT_C. If it is correct, jump to step 14. If it is incorrect, jump to step 15.
[0137] Step 14: Erase the pulse backup location data in the MCU internal Flash. At this point, at least one of the three pulse storage areas in the external memory is normal.
[0138] Step 15: Determine whether the pulse storage error flag is 1. If it is 1, process the pulse real-time data block P_A = pulse operation temporary data block PT_A + pulse real-time data block P_A, copy the calculated pulse real-time data block P_A to the global fractional data block C_A, and clear the pulse storage error flag.
[0139] Step 16: Set the pulse storage location 1 error flag 1 to 0, write the pulse real-time data block P_A data to the external memory pulse storage location 1, and then read the data in the pulse storage location 1 to the pulse operation temporary data block PT_C.
[0140] Step 17: Check whether the pulse operation temporary data block PT_C is correct. If it is wrong, write the data in the pulse real-time data block P_A to the pulse storage position 1 of the external memory; read the data in the pulse storage position 1 to the pulse operation temporary data block PT_C. If it is correct, jump to step 20.
[0141] Step 18: Check whether the pulse operation temporary data block PT_C is correct. If it is wrong, write the pulse real-time data block P_A data to the pulse storage position 1 of the external memory; read the data in the pulse storage position 1 to the pulse operation temporary data block PT_C. If it is correct, jump to step 20.
[0142] Step 19: Check whether the pulse operation temporary data block PT_C is correct. If it is wrong, it means that the area has been written three times incorrectly. Set the pulse error flag 1 to 1. If it is correct, jump to step 20.
[0143] Step 20: Set the pulse storage location 2 error flag 2 to 0, write the data in the pulse real-time data block P_A to the external memory pulse storage location 2, and then read the data in the pulse storage location 2 to the pulse operation temporary data block PT_C.
[0144] Step 21: Check whether the pulse operation temporary data block PT_C is correct. If it is wrong, write the data in the pulse real-time data block P_A to the pulse storage position 2 of the external memory; read the data in the pulse storage position 2 to the pulse operation temporary data block PT_C. If it is correct, jump to step 24.
[0145] Step 22: Check whether the pulse operation temporary data block PT_C is correct. If it is wrong, write the data in the pulse real-time data block P_A to the pulse storage position 2 of the external memory; read the data in the pulse storage position 2 to the pulse operation temporary data block PT_C. If it is correct, jump to step 24.
[0146] Step 23: Check whether the pulse operation temporary data block PT_C is correct. If it is wrong, it means that the area has been written incorrectly for 3 times. Set the pulse error flag 2 to 1. If it is correct, jump to step 24.
[0147] Step 24: Set the pulse storage location 3 error flag 3 to 0, write the data in the pulse real-time data block P_A to the external memory pulse storage location 3, and then read the data in the pulse storage location 3 to the pulse operation temporary data block PT_C.
[0148] Step 25: Check whether the pulse operation temporary data block PT_C is correct. If it is wrong, write the data in the pulse real-time data block P_A to the pulse storage position 3 of the external memory; read the data in the pulse storage position 3 to the pulse operation temporary data block PT_C. If it is correct, jump to step 28.
[0149] Step 26: Check whether the pulse operation temporary data block PT_C is correct. If it is wrong, write the data in the pulse real-time data block P_A to the pulse storage position 3 of the external memory; read the data in the pulse storage position 3 to the pulse operation temporary data block PT_C. If it is correct, jump to step 28.
[0150] Step 27: Check whether the pulse operation temporary data block PT_C is correct. If it is wrong, it means that the area has been written three times incorrectly. Set the pulse error flag 3 to 1. If it is correct, jump to step 28.
[0151] Step 28: Determine whether pulse error flag 1 is 1, pulse error flag 2 is 1, and pulse error flag 3 is 1. If so: it is considered that 3 write operations are wrong, and the data in the pulse real-time data block P_A is written to the pulse backup area in the internal Flash of the MCU. If the requirements are not met, the process ends.
[0152] The electric energy data in the integer backup position, the electric energy data in the pulse backup position, the electric energy data in the integer storage position 1, the electric energy data in the integer storage position 2, the electric energy data in the integer storage position 3, the electric energy data in the pulse storage position 1, the electric energy data in the pulse storage position 2, and the electric energy data in the pulse storage position 3 are all checked using CRC16.
[0153] Among them, CRC16 check is a commonly used error detection algorithm used to ensure the integrity of data during transmission or storage. It is based on a 16-bit cyclic redundancy check code (CRC16 value) that is appended to the transmitted or stored data.
[0154] Through the above example analysis, we can know that when interference occurs during power-on errors, running memory errors, and writing process errors, as long as the external memory is not invalid, the electric energy data can be restored, and during the error process, the metering data can be recorded, and this part of the data will not be lost after recovery.
[0155] Second, as Fig.14 As shown, in one embodiment, the present invention provides an electric meter measurement management device, the electric meter measurement management device comprising: The reading and verification module 201 is used to enter the power-on startup phase of the electric meter, read electric energy data from multiple external storage locations in the external memory, and verify the electric energy data read from the multiple external storage locations; A first post-verification processing module 202, for clearing the electric energy data read from the real-time data block in the memory of the electric meter and setting the storage error flag of the real-time data block to an abnormal state if all the electric energy data read from the multiple external storage locations are verified to be errors; The second post-verification processing module 203 is used to store the electric energy data in the real-time data block if one of the electric energy data read from multiple external storage locations is verified to be correct, and to perform data recovery on other external storage locations with verification errors based on the electric energy data, and to set the storage error flag of the real-time data block to a normal state.
[0156] Through the above-mentioned electricity meter measurement management device, multiple external storage locations are opened in the external memory, and mutual backup is achieved between the multiple external storage locations. When the electricity meter is powered on, if there is one electric energy data that is correctly verified among the multiple external storage locations read, normal metering work can be achieved based on the electric energy data, and data recovery of other external storage locations with verification errors can also be achieved based on the electric energy data, thereby improving the reliability of electricity meter measurement.
[0157] In a third aspect, the present invention provides an electric meter, in which a processor (such as a CPU processing unit) in the electric meter loads executable files corresponding to processes of one or more computer programs into a memory according to the following instructions, and the processor runs the computer program stored in the memory to perform the following steps: Entering the power-on startup phase of the electric meter, reading electric energy data from multiple external storage locations in the external memory, and verifying the electric energy data read from the multiple external storage locations; If the electric energy data read from multiple external storage locations are all verified to be wrong, the electric energy data read from the real-time data block in the memory of the electric meter is cleared, and the storage error flag of the real-time data block is set to an abnormal state; If one of the electric energy data read from multiple external storage locations is verified to be correct, the electric energy data is stored in the real-time data block, and data is restored from other external storage locations with verification errors based on the electric energy data, and the storage error flag of the real-time data block is set to a normal state.
[0158] Through the above-mentioned electric meter, multiple external storage locations are opened in the external memory, and mutual backup is achieved between the multiple external storage locations. When the electric meter is powered on, if there is one electric energy data that is correctly verified among the multiple external storage locations read, normal metering work can be achieved based on the electric energy data, and data recovery of other external storage locations with verification errors can also be achieved based on the electric energy data, thereby improving the reliability of the electric meter measurement.
[0159] A person of ordinary skill in the art will appreciate that all or part of the steps in any of the methods of the above embodiments may be completed by a computer program, or by controlling related hardware through a computer program. The computer program may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0160] In a fourth aspect, in one embodiment, the present invention provides a storage medium storing a plurality of computer programs, wherein the computer programs can be loaded by a processor to perform the following steps: Entering the power-on startup phase of the electric meter, reading electric energy data from multiple external storage locations in the external memory, and verifying the electric energy data read from the multiple external storage locations; If the electric energy data read from multiple external storage locations are all verified to be wrong, the electric energy data read from the real-time data block in the memory of the electric meter is cleared, and the storage error flag of the real-time data block is set to an abnormal state; If one of the electric energy data read from multiple external storage locations is verified to be correct, the electric energy data is stored in the real-time data block, and data is restored from other external storage locations with verification errors based on the electric energy data, and the storage error flag of the real-time data block is set to a normal state.
[0161] Through the above-mentioned storage medium, multiple external storage locations are opened in the external memory, and mutual backup is achieved between the multiple external storage locations. When the electric meter is powered on, if there is one electric energy data that is correctly verified among the multiple external storage locations read, normal metering work can be achieved based on the electric energy data, and data recovery of other external storage locations with verification errors can also be achieved based on the electric energy data, thereby improving the reliability of the electric meter measurement.
[0162] Since the computer program stored in the storage medium can execute the steps in the electric meter measurement management method in any embodiment provided by the present invention, the beneficial effects that can be achieved by the electric meter measurement management method in any embodiment provided by the present invention can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0163] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0164] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the detailed description of other embodiments above, and will not be repeated here.
[0165] The above is a detailed introduction to an electric meter measurement management method, device, electric meter and storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
[0166] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
Claims
1. A method for managing electric meter measurement, characterized in that: The electric meter measurement management method comprises: Entering the power-on startup phase of the electric meter, reading electric energy data from multiple external storage locations in the external memory, and verifying the electric energy data read from the multiple external storage locations; If the electric energy data read from the plurality of external storage locations are all verified to be errors, the electric energy data read from the real-time data block in the memory of the electric meter is cleared, and the storage error flag of the real-time data block is set to an abnormal state; If there is one electric energy data that is correctly verified among the electric energy data read from multiple external storage locations, then the electric energy data is stored in the real-time data block, and data is restored from other external storage locations with verification errors based on the electric energy data, and the storage error flag of the real-time data block is set to a normal state.
2. The electric meter measurement management method according to claim 1, characterized in that: The step of reading the electric energy data from a plurality of external storage locations in the external memory and verifying the electric energy data read from the plurality of external storage locations comprises: Read the electric energy data in the first external storage location to the real-time data block, verify the electric energy data read from the first external storage location, if the verification is correct, read the electric energy data in the second external storage location to the power-on temporary data block in the memory, if the verification is wrong, read the electric energy data in the second external storage location to the real-time data block; The electric energy data in the power-on temporary data block read from the second external storage location is verified, or the electric energy data in the real-time data block read from the second external storage location is verified.
3. The electric meter measurement management method according to claim 2, characterized in that: If one of the electric energy data read from the plurality of external storage locations is correctly verified, the electric energy data is stored in the real-time data block, and data is recovered from other external storage locations with verification errors according to the electric energy data, including: If the electric energy data read from the second external storage location in the power-on temporary data block is verified to be wrong, writing the electric energy data read from the real-time data block to the second external storage location; If the electric energy data read from the second external storage location in the real-time data block is verified to be correct, the electric energy data read from the real-time data block is written into the first external storage location.
4. The electric meter measurement management method according to any one of claims 1 to 3, characterized in that: The electric meter measurement management method further includes: If the electric energy data read from the plurality of external storage locations are all verified to be errors and the storage error flag of the real-time data block is set to a normal state, the electric energy data in the real-time data block is written to a backup location of the flash memory for backup.
5. The electric meter measurement management method according to claim 4, characterized in that: After the step of setting the storage error flag of the real-time data block to an abnormal state or after the step of setting the storage error flag of the real-time data block to a normal state, the electric meter measurement management method further includes: Entering the electric meter operation storage phase, reading electric energy data from the plurality of external storage locations, and verifying the electric energy data read from the plurality of external storage locations; If the electric energy data read from the plurality of external storage locations are all verified as errors, then the electric energy data in the backup location is read into the running temporary data block in the memory; If there is one electric energy data which is verified to be correct among the electric energy data read from the multiple external storage locations, the electric energy data is stored in the running temporary data block, and data recovery is performed on other external storage locations which are verified to be incorrect according to the electric energy data.
6. The electric meter measurement management method according to claim 5, characterized in that: After the step of reading the electric energy data in the backup location into the running temporary data block in the memory, the electric meter measurement management method further includes: Writing the electric energy data in the operation temporary data block into the plurality of external storage locations respectively; Reading electric energy data from the plurality of external storage locations, and verifying the electric energy data read from the plurality of external storage locations; If the electric energy data read from the plurality of external storage locations are all verified as errors, the electric energy data in the backup location is not erased; If one of the electric energy data read from the plurality of external storage locations is verified to be correct, the electric energy data in the backup location is erased.
7. The electric meter measurement management method according to claim 6, characterized in that: After the step of restoring data from other external storage locations with verification errors according to the electric energy data, after the step of not erasing the electric energy data in the backup location, or after the step of erasing the electric energy data in the backup location, the electric meter measurement management method further includes: Detecting a storage error flag of the real-time data block; If the storage error flag of the real-time data block is in an abnormal state, the electric energy data of the real-time data block is updated according to the sum of the electric energy data in the real-time data block and the electric energy data in the running temporary data block; The storage error flag of the real-time data block is set to a normal state.
8. An electric meter measurement management device, characterized in that: The electric meter measurement management device comprises: A reading and verification module, used for entering the power-on startup phase of the electric meter, reading electric energy data from a plurality of external storage locations in the external memory, and verifying the electric energy data read from the plurality of external storage locations; A first post-verification processing module, for clearing the electric energy data read from the real-time data block in the memory of the electric meter and setting the storage error flag of the real-time data block to an abnormal state if all the electric energy data read from the plurality of external storage locations are verified as errors; The second post-verification processing module is used to store the electric energy data in the real-time data block if one of the electric energy data read from the multiple external storage locations is verified to be correct, and to perform data recovery on other external storage locations with verification errors based on the electric energy data, and set the storage error flag of the real-time data block to a normal state.
9. An electric meter, characterized in that: It comprises a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute the steps in the electric meter measurement management method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium stores a computer program, and the computer program is loaded by a processor to execute the steps in the electric meter measurement management method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method for managing high reliability of electric energy measurement data
CN101923112A
Efficient data storage method for intelligent ammeter and intelligent ammeter
CN108122594A
Intelligent electric meter power-on loading correction method
CN110596636A
Method for processing abnormal reset of MCU and electric energy meter for realizing method
CN114488915A
Electric energy data processing method and system based on metering system
CN115271999A
Cited By
Storage architecture of electric energy meter events
CN120803343A
A storage architecture for electricity meter events
CN120803343B
