An electric energy metering device and an electric quantity data storage method

By combining RAM, FLASH and EEPROM storage, the problems of low-precision sparse storage, power loss and difficulty in fault tracing in power metering devices are solved. The system can accurately recover power data under multiple fault conditions, meeting the requirements of long life and high reliability of smart meters.

CN115562903BActive Publication Date: 2025-11-18JIANGYIN CHANGYI GRP CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211025408.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-25
Publication Date
2025-11-18
Estimated Expiration
2042-08-25

AI Technical Summary

Technical Problem

Existing electricity metering devices suffer from problems such as low-precision sparse storage, power loss, difficulty in fault tracing, and inability to recover power when multiple memory devices fail during power storage and recovery. These issues fail to meet the requirements of long lifespan and high reliability for electricity metering devices such as smart meters.

Method used

A combined storage scheme of RAM+FLASH+EEPROM is adopted. By rationally allocating storage areas and storage strategies, a real-time power storage area is set in RAM, a power recovery and failure scene storage area is set in EEPROM, and a power and failure scene storage area is set in FLASH. The redundancy and cyclic storage strategy of multiple storage areas ensures the accuracy and reliability of power data.

Benefits of technology

It enables accurate recovery of power data even in the event of a memory failure, ensuring the accuracy of user power metering and power grid statistics, and improving the reliability and lifespan of power metering devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115562903B_ABST
    Figure CN115562903B_ABST
Patent Text Reader

Abstract

The application discloses an electric energy metering device and an electric quantity data storage method. The electric energy metering device is designed by a RAM+FLASH+EEPROM combined storage configuration scheme. A real-time electric quantity storage area is arranged in the RAM to store real-time electric quantity data in a power-on state. First and second storage areas are arranged in the EEPROM. The first storage area includes n1*n2 two-dimensional electric quantity storage areas to store data for electric quantity recovery. The second storage area includes a failure site storage area. Third and fourth storage areas are opened in the FLASH. The third storage area includes an electric quantity storage area to store data for electric quantity recovery. The fourth storage area includes a failure site storage area. The method can better solve problems such as low storage life, low electric quantity recovery accuracy or electric quantity loss, difficult fault tracing, and low electric quantity recovery success rate of multiple storage failures.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power distribution and electricity metering technology, specifically to an electricity metering device and a method for storing electricity data. Background Technology

[0002] Electricity metering devices include smart meters, smart measurement switches, converged terminals or concentrators, and other terminal equipment with metering functions.

[0003] With the widespread adoption of smart meters and other energy metering devices, reliability has become paramount. The common practice for calculating, storing, and backing up energy consumption is to use RAM + EEPROM backup within the MCU. In the event of a power outage, the last stored energy value can be recovered from the EEPROM. For a 60A meter, based on an early design lifespan of 10 years, the energy consumption is calculated as (220*60 / 1000)*24*365*10 = 1156320 kWh. The nominal lifespan of an EEPROM is generally 1 million cycles, and current technological improvements can achieve 1.5 million cycles or even higher. Therefore, the design typically involves real-time accumulation of energy in RAM, with an EEPROM backup storage performed when 1 kWh is reached. Alternatively, some current transformer-connected or 100A three-phase meters use a ferroelectric memory + EEPROM for data storage; the ferroelectric memory has an unlimited lifespan.

[0004] Current smart meters and other energy metering devices are generally required to have a lifespan of 16 years. However, considering factors such as the probability of storage device failure and the influence of external interference, the above methods have the following problems:

[0005] 1. Low-precision sparse storage typically stores 1 kWh at a time. Using EEPROM, the nominal capacity is up to 1,000,000 kWh, with a maximum allowable capacity of 1,500,000 kWh. However, a typical 60A single-phase meter, calculated at full load, has a capacity of (220*60 / 1000)*24*365*16 = 1,850,112 kWh, while a 100A three-phase meter has a capacity of 9,250,560 kWh. Traditional designs cannot guarantee reliability. While ferroelectric memory can solve the reliability problem, its capacity is small and its cost is several times that of EEPROM. Compared to memory of the same capacity, FLASH memory offers nearly a thousand times the cost-effectiveness of ferroelectric memory. For essential household appliances, reducing costs and improving cost-effectiveness are crucial directions for the development of electricity metering devices.

[0006] 2. For the traditional method of storing 1kWh at a time, if the power metering device loses power or is interfered with, the MCU will be reset, the RAM will be lost, or the direct RAM storage area will be interfered with. Even if it can be recovered from the EEPROM, 1kWh of power may be lost. If the method is to connect a three-phase meter with a current transformer, the current transformer ratio may be up to 8000, and the power loss may reach 8000kWh.

[0007] 3. When an EEPROM or FLASH storage failure occurs, the cause cannot be traced. It's unknown when the failure occurred or after which battery level, and the lost battery level cannot be estimated. Preserving the failure scene information is urgently needed. EEPROM or FLASH storage failures include EEPROM inability to read or write (manifested as index verification failure), errors in partial storage areas or bytes (manifested as data verification failure in that storage area), and FLASH inability to read or write, or errors in partial storage areas.

[0008] 4. When a dual fault occurs, such as the simultaneous failure of RAM and EEPROM, or RAM and FLASH. In fact, when subjected to strong external electromagnetic interference, the probability of partial EEPROM storage areas and RAM failing simultaneously, or partial FLASH storage areas and RAM failing simultaneously, or even all three failing simultaneously, is relatively high (the probability of all storage areas of non-volatile memories such as EEPROM and FLASH failing simultaneously is very low). Existing solutions are unlikely to effectively restore a reasonable power level.

[0009] To address the above issues, the invention patent CN113267673A, entitled "An Effective Method for Solving the Problem of Power Loss in Electronic Energy Meters," proposes setting up a corresponding number of power data block storage areas in an erasable programmable read-only memory (EEPROM) and using a rotating storage method, which can solve the above problem 1. Although there is a solution that uses power-loss protection measures to temporarily store the last digits of the RAM power data when power is lost, which can partially solve the above problem 2, it is still impossible to obtain effectively accurate recovery data for problems such as RAM abnormalities or external interference.

[0010] The announcement number CN108122594A, entitled "An efficient data storage method for smart energy meters and its smart energy meter", proposes to open a data area in RAM that is not cleared upon power-on to prevent current power data from being lost. Its essential function is similar to FLASH, which partially solves problem 1. The invention also proposes a scheme to set a power-off data area in EEPROM, which can temporarily store the power value when power is lost, which only partially solves the fault tracing problem in problem 3.

[0011] Other existing technologies generally only solve some of the problems in 1 to 3 above, and lack solutions to problem 4, let alone solutions that can solve problems 1 to 4 at the same time. Summary of the Invention

[0012] In view of this, the present invention proposes an energy metering device and energy data storage method based on the conventional combination storage scheme of RAM+FLASH+EEPROM, through reasonable allocation of storage areas and reasonable storage strategy, which can effectively solve the above-mentioned problems of the prior art.

[0013] This invention discloses a power data storage method, characterized by a RAM+FLASH+EEPROM combined storage configuration. A real-time power storage area is set up in the RAM to store real-time power data under power-on conditions, consistent with existing technologies. First and second storage areas are set up in the EEPROM. The first storage area includes a two-dimensional power storage area of ​​n1×n2, storing data for power recovery. The second storage area includes a failure scene storage area. Third and fourth storage areas are allocated in the FLASH memory. The third storage area includes a power storage area, storing data for power recovery. The fourth storage area includes a failure scene storage area. Wherein, n1 ≥ expected EEPROM write cycles ÷ actual EEPROM product write cycles, rounded to the nearest integer; n2 ≥ traditional power storage accuracy ÷ expected power storage accuracy, rounded to the nearest integer. The expected power storage accuracy is the power recovery accuracy. Generally, the power storage accuracy is 1 kWh or lower, which this invention calls a low-precision sparse storage strategy. Power storage accuracy better than 1 kWh, such as 0.1 kWh, 0.01 kWh, or 0.001 kWh, is called a high-precision storage strategy. Generally, large-capacity EEPROM and FLASH are used. For the current MCU of smart energy meters, it already contains RAM and FLASH that meet the requirements; the failure site storage area stores failure site information.

[0014] Furthermore, the third storage area includes a one-dimensional storage area of ​​length n4, a two-dimensional storage area of ​​length n1×n2, or a three-dimensional storage area of ​​length n1×n2×n3; the failure scene information includes at least the power level and failure time information at the time of failure, and each type of information is stored only once. Therefore, the length of the second and fourth storage areas is mainly determined by the type and quantity of information to be stored; where n3 ≥ the actual write cycle life of the EEPROM product ÷ the actual write cycle life of the FLASH product, rounded to the nearest integer; n4 ≥ the lower limit of n1 × the lower limit of n3; the failure scene storage area generally also needs to store information such as voltage, current, and power at the time of failure. When FLASH space is insufficient, a one-dimensional storage area of ​​length n4 can be set up to implement a low-precision sparse storage strategy, using the traditional 1kWh storage once scheme. When FLASH space is sufficient, a three-dimensional storage area of ​​n1×n2×n3 can be set up, using the same power storage precision as EEPROM, such as 0.1kWh, 0.01kWh, or 0.001kWh storage once scheme. When the third storage area is set up as a two-dimensional storage area of ​​n1×n2, it is generally only used to start high-precision power value FLASH storage before starting the failure site storage when an abnormal power supply voltage is detected. The specific storage scheme can be the same as the first storage area.

[0015] Furthermore, a fifth storage area is allocated in the EEPROM, and a sixth storage area is allocated in the FLASH. The fifth storage area is the same as the second storage area, and the sixth storage area is the same as the fourth storage area. This design is mainly for failure sites that, in addition to storing power information, generally also need to store information such as time, voltage, current, and power. The basic configuration is to set up a region in both the EEPROM and FLASH to store the above information. However, since there are many types of information in this data block, and each type of information occupies several bytes, if even one byte is damaged by external interference, the verification of that type of information may fail, resulting in missing data in that area. Therefore, setting up a fifth and sixth storage area can further improve the probability of effective recovery of failure site information. Given that the current EEPROM and FLASH storage space is sufficient and the cost is relatively low, it is meaningful to carry out this design for local storage area or storage byte failures, and the power information at the failure site can also serve as one of the bases for power recovery.

[0016] Furthermore, the aforementioned method for storing electrical data includes the following steps:

[0017] S1: Power-on startup, initialization;

[0018] S2: Power restored;

[0019] Read the last stored result from the first storage area of ​​the EEPROM, and after verification, store it as the initial value of the accumulated power in the real-time power storage area of ​​RAM.

[0020] If the verification fails, read the last stored result from the third storage area of ​​FLASH. If the verification passes, store it as the initial value of the accumulated power in the real-time power storage area of ​​RAM.

[0021] If the verification still fails, read all power values ​​from the first storage area of ​​the EEPROM, extract the maximum value from the verified data as the initial value for power accumulation, and store it in the real-time power storage area of ​​RAM.

[0022] All power values ​​in the first storage area of ​​EEPROM fail the verification. Read all power values ​​in the third storage area of ​​FLASH, extract the maximum value of the verified data as the initial value of power accumulation and store it in the real-time power storage area of ​​RAM.

[0023] When all power values ​​in the first EEPROM storage area fail verification or all power values ​​in the third FLASH storage area fail verification, the maximum power and time available at the time of the error are reported to the master station, and an emergency handling prompt is given. If this situation occurs during initialization, after the fault is reported to the master station, the RAM power data is incremented from 0, and step S3 is entered. If this situation occurs during the loop, the system can simultaneously attempt to recover the power information of the most recent failure scene from the failure scene storage area, and then enter step S3. If the failure scene cannot be obtained, the RAM power data is incremented from 0, and step S3 is entered.

[0024] The above are the steps for step-by-step initialization. Normally, the initial power value can be obtained by reading the EEPROM on the first read, or all valid power data in the first storage area of ​​the EEPROM and the third storage area of ​​the FLASH can be read at once, and the maximum value is taken as the initial value of power accumulation and stored in the RAM real-time power storage area. If the power value cannot be recovered from the first and third storage areas, the power data of the failure site can be obtained from the second, fourth, fifth and sixth storage areas in sequence. Once one area can be recovered, this step is completed.

[0025] S3: Read the power pulse count and accumulate RAM power data;

[0026] First, determine whether the RAM power data before accumulation can pass the verification. If the verification passes, directly accumulate the power and store it together with the calculated new verification value in the RAM real-time power storage area. If the verification fails, it indicates that there may be an anomaly in the corresponding RAM storage area. Execute step S2, and after the power is restored, perform real-time accumulation and store it together with the calculated new verification value in the RAM real-time power storage area. The RAM real-time power storage area can be dynamically allocated. That is, when a RAM stored power verification fails, the system should generally actively isolate the relevant storage area and open a new storage area.

[0027] S4: According to the quantitative storage strategy, the real-time power value is stored in the first storage area of ​​EEPROM and the third storage area of ​​FLASH respectively. The storage method includes sequential, continuous and cyclic storage. The stored power value is the power value with the expected recovery accuracy. If there is no storage abnormality and the task has not ended, proceed to step S3 for normal loop. If there is an abnormality, proceed to step S5.

[0028] S5: If the EEPROM write or FLASH write fails in step S4, the MCU actively acquires the failure scene information and writes it into the failure scene storage areas of the EEPROM and FLASH, including the second, fourth, fifth, and sixth storage areas respectively; it reports the power consumption and time at the time of the error to the master station and prompts for emergency handling, while continuing to cycle through step S3; even if the failure scene write fails, it can continue to report and cycle, thus ensuring that in the event of abnormality of some components of the meter, as much fault information and final power consumption information as possible can be recorded accurately.

[0029] S6: The loop ends when the power is off or the task is manually terminated.

[0030] Furthermore, the storage operation on the third FLASH storage area in step S4 includes:

[0031] When the third storage area is a one-dimensional storage area of ​​length n4, a low-precision sparse storage strategy is executed, such as a scheme that stores 1kWh once.

[0032] When the third storage area is a two-dimensional storage area of ​​size n1×n2, a high-precision storage strategy is executed in case of an anomaly. Since the nominal lifespan of FLASH is generally much shorter than that of EEPROM, when the storage area size is the same, it is not possible to save every high-precision value like EEPROM. In this case, the storage function of this area is generally enabled only when an anomaly occurs during the verification process, such as enabling the FLASH storage of high-precision power values ​​before starting the storage of the failure scene.

[0033] When the third storage area is a three-dimensional storage area of ​​size n1×n2×n3, a high-precision storage strategy is implemented, that is, the same power storage precision as EEPROM, such as a scheme that stores power once at 0.01kWh or 0.001kWh.

[0034] An electricity metering device is characterized by comprising a memory combination of at least RAM, FLASH, and EEPROM. The memory combination is connected to a main control unit (MCU) via a bus, and the MCU executes a program based on the electricity data storage method described above. The EEPROM includes first and second storage areas. The first storage area includes a two-dimensional electricity storage area of ​​n1×n2, storing data for electricity recovery. The second storage area includes a failure scene storage area. The FLASH memory includes third and fourth storage areas. The third storage area includes an electricity storage area, storing data for electricity recovery. The fourth storage area includes a failure scene storage area. Other implementation technologies of the electricity metering device are existing technologies.

[0035] The advantages and beneficial effects of this invention are as follows: It makes full use of the phenomenon that when RAM, FLASH and EEPROM and other memories are interfered with or malfunctioned, some storage areas or storage bytes are corrupted, while other areas and bytes are still usable. When such problems occur in smart energy meters and other energy metering devices, through reasonable storage and recovery strategies, the accumulated power data can be recovered as accurately as possible, thereby ensuring the accuracy of user power metering and the accuracy of various statistical information of the power grid, and guiding the power grid to make reasonable adjustments. Attached Figure Description

[0036] Figure 1 This is a block diagram of a method for storing electrical energy data. Detailed Implementation

[0037] The specific embodiments of the present invention will be further described below with reference to the accompanying drawings and examples. The following examples are only used to more clearly illustrate the technical solutions of the present invention and should not be construed as limiting the scope of protection of the present invention.

[0038] Example 1: A method for storing electrical energy data

[0039] like Figure 1As shown, a power data storage method is based on a RAM+FLASH+EEPROM combined storage configuration. A real-time power storage area is set up in RAM to store real-time power data under power-on conditions, consistent with existing technologies. First and second storage areas are set up in the EEPROM. The first storage area includes a two-dimensional power storage area of ​​n1×n2, storing data for power recovery. The second storage area includes a failure scene storage area. Third and fourth storage areas are allocated in the FLASH memory. The third storage area includes a power storage area, storing data for power recovery. The fourth storage area includes a failure scene storage area. Wherein, n1 ≥ the expected EEPROM write cycle life ÷ the actual EEPROM product write cycle life, and is an integer. For example, traditionally, storing 1 kWh of electricity requires 9,250,560 storage operations over a 16-year lifespan for a 100A three-phase meter. However, the nominal lifespan of an EEPROM is typically 1 million operations. Therefore, in this embodiment, n1 = 10; n2 ≥ traditional electricity storage accuracy ÷ desired electricity storage accuracy, rounded to the nearest integer. The desired electricity storage accuracy is the electricity recovery accuracy. Generally, the electricity storage accuracy is 1 kWh or lower, which this invention calls a low-precision sparse storage strategy. Electricity storage accuracy better than 1 kWh, such as 0.1 kWh, 0.01 kWh, or 0.001 kWh, is called a high-precision storage strategy. In this embodiment, the desired electricity storage accuracy is 0.01 kWh. For the traditional 1 kWh electricity storage accuracy, n2 = 100. Generally, large-capacity EEPROMs and FLASH are used. Current smart meter MCUs already include sufficient RAM and FLASH. The failure site storage area stores failure site information.

[0040] Preferably, the third storage area includes a one-dimensional storage area of ​​length n4, a two-dimensional storage area of ​​length n1×n2, or a three-dimensional storage area of ​​length n1×n2×n3; the failure scene information includes at least the power level and failure time information at the time of failure, and each type of information is stored only once. Therefore, the length of the second and fourth storage areas is mainly determined by the type and quantity of information to be stored; wherein, n3 ≥ the actual write cycle lifespan of the EEPROM product ÷ the actual write cycle lifespan of the FLASH product, rounded to the nearest integer. In this embodiment, for an EEPROM nominal lifespan of 1 million times and a FLASH nominal lifespan of 100,000 times, n3 = 10; n4 ≥ the lower limit of n1 × the lower limit of n3. In this embodiment, n4 = 100; the failure scene storage area generally also needs to store information such as voltage, current, and power at the time of failure. When FLASH space is insufficient, a one-dimensional storage region of length n4 can be set up to implement a low-precision sparse storage strategy, using the traditional 1kWh storage once scheme. When FLASH space is sufficient, a three-dimensional storage region of n1×n2×n3 can be set up, using the same power storage precision as EEPROM, such as a 0.1kWh, 0.01kWh, or 0.001kWh storage once scheme. This embodiment uses the 0.01kWh storage scheme. When the third storage region is set up as a two-dimensional storage region of n1×n2, it is generally only used for monitoring power supply voltage. In case of an anomaly, before saving the failure scene, first start saving the high-precision power value in FLASH. The specific saving scheme can be the same as the first storage area. Regarding the values ​​of n1, n2, n3, and n4, this invention only provides the principle for their selection. In fact, it is not impossible to be slightly smaller than the calculated value, because the actual lifespan of the storage product is only a statistical result. For example, a single EEPROM may have a lifespan of 2 million cycles. As long as the total storage space can be guaranteed, it is feasible. However, it is relatively risky compared to the theoretical design. In actual engineering, very small values ​​are generally not taken, otherwise the meaning of solving the lifespan problem would be lost.

[0041] Preferably, a fifth storage area is allocated in the EEPROM, and a sixth storage area is allocated in the FLASH. The fifth storage area is the same as the second storage area, and the sixth storage area is the same as the fourth storage area. This design is mainly for failure sites that, in addition to storing power information, generally also need to store information such as time, voltage, current, and power. The basic configuration is to set up a region in both the EEPROM and FLASH to store the above information. However, since there are many types of information in this data block, and each type of information occupies several bytes, if even one byte is damaged by external interference, the verification of that type of information may fail, resulting in missing data in that area. Therefore, setting up a fifth and sixth storage area can further improve the probability of effective recovery of failure site information. Given that the current EEPROM and FLASH storage space is sufficient and the cost is relatively low, it is meaningful to carry out this design for local storage area or storage byte failures, and the power information at the failure site can also serve as one of the bases for power recovery.

[0042] Preferably, the method for storing electrical data includes, for example, Figure 1 As shown, it includes the following steps:

[0043] S1: Power-on startup, initialization;

[0044] S2: Power restored;

[0045] Read the last stored result from the first storage area of ​​the EEPROM, and after verification, store it as the initial value of the accumulated power in the real-time power storage area of ​​RAM.

[0046] If the verification fails, read the last stored result from the third storage area of ​​FLASH. If the verification passes, store it as the initial value of the accumulated power in the real-time power storage area of ​​RAM.

[0047] If the verification still fails, read all power values ​​from the first storage area of ​​the EEPROM, extract the maximum value from the verified data as the initial value for power accumulation, and store it in the real-time power storage area of ​​RAM.

[0048] All power values ​​in the first storage area of ​​EEPROM fail the verification. Read all power values ​​in the third storage area of ​​FLASH, extract the maximum value of the verified data as the initial value of power accumulation and store it in the real-time power storage area of ​​RAM.

[0049] When all power values ​​in the first EEPROM storage area fail verification or all power values ​​in the third FLASH storage area fail verification, the maximum power and time available at the time of the error are reported to the master station, and an emergency handling prompt is given. If this situation occurs during initialization, after the fault is reported to the master station, the RAM power data is incremented from 0, and step S3 is entered. If this situation occurs during the loop, the system can simultaneously attempt to recover the power information of the most recent failure scene from the failure scene storage area, and then enter step S3. If the failure scene cannot be obtained, the RAM power data is incremented from 0, and step S3 is entered.

[0050] The above are the steps for step-by-step initialization. Normally, the initial power value can be obtained by reading the EEPROM on the first read, or all valid power data in the first storage area of ​​the EEPROM and the third storage area of ​​the FLASH can be read at once, and the maximum value is taken as the initial value of power accumulation and stored in the RAM real-time power storage area. If the power value cannot be recovered from the first and third storage areas, the power data of the failure site can be obtained from the second, fourth, fifth and sixth storage areas in sequence. Once one area can be recovered, this step is completed.

[0051] The initial RAM value of newly installed smart energy meters and other energy metering devices can be set to 0 or the initial value during testing and calibration.

[0052] S3: Read the power pulse count and accumulate RAM power data;

[0053] First, determine whether the RAM power data before accumulation can pass the verification. If the verification passes, directly accumulate the power and store it together with the calculated new verification value in the RAM real-time power storage area. If the verification fails, it indicates that there may be an anomaly in the corresponding RAM storage area. Execute step S2, and after the power is restored, perform real-time accumulation and store it together with the calculated new verification value in the RAM real-time power storage area. The RAM real-time power storage area can be dynamically allocated. That is, when a RAM stored power verification fails, the system should generally actively isolate the relevant storage area and open a new storage area.

[0054] S4: According to the quantitative storage strategy, the real-time power value is stored in the first storage area of ​​EEPROM and the third storage area of ​​FLASH respectively. The storage method includes sequential, continuous and cyclic storage. The stored power value is the power value with the expected recovery accuracy. For example, in this embodiment, a storage operation is performed every 0.01kWh. The sequential and continuous storage means that the data storage pointer in the storage area should be incremented or decremented one by one. The cyclic storage means that when the data block storage data pointer is the end pointer, the next storage should start from the first pointer. If there is no storage abnormality and the task has not ended, proceed to step S3 for normal loop. If there is an abnormality, proceed to step S5.

[0055] S5: If the EEPROM write or FLASH write fails in step S4, the MCU actively acquires the failure scene information and writes it into the failure scene storage areas of the EEPROM and FLASH, including the second, fourth, fifth, and sixth storage areas respectively; it reports the power consumption and time at the time of the error to the master station and prompts for emergency handling, while continuing to cycle through step S3; even if the failure scene write fails, it can continue to report and cycle, thus ensuring that in the event of abnormality of some components of the meter, as much fault information and final power consumption information as possible can be recorded accurately.

[0056] S6: The loop ends when the power is off or the task is manually terminated.

[0057] Preferably, the storage operation on the third FLASH storage area in step S4 includes:

[0058] When the third storage area is a one-dimensional storage area of ​​length n4, a low-precision sparse storage strategy is executed, such as a scheme that stores 1kWh once.

[0059] When the third storage area is a two-dimensional storage area of ​​size n1×n2, a high-precision storage strategy is executed in case of an anomaly. Since the nominal lifespan of FLASH is generally much shorter than that of EEPROM, when the storage area size is the same, it is not possible to save every high-precision value like EEPROM. In this case, the storage function of this area is generally enabled only when an anomaly occurs during the verification process, such as enabling the FLASH storage of high-precision power values ​​before starting the storage of the failure scene.

[0060] When the third storage area is a three-dimensional storage area of ​​size n1×n2×n3, a high-precision storage strategy is implemented, that is, the same power storage precision as EEPROM, such as a scheme that stores power once at 0.01kWh or 0.001kWh.

[0061] This embodiment adopts a two-dimensional storage area scheme with a third storage area of ​​size n1×n2. The power storage accuracy is the same as that of the first storage area of ​​EEPROM, but it is only performed when an anomaly occurs.

[0062] All storage is circular overwrite storage, provided the operation is feasible; new storage values ​​will overwrite previously stored results.

[0063] Example 2: An electricity metering device

[0064] An electricity metering device includes at least a memory combination of RAM, FLASH, and EEPROM. The memory combination is connected to a main control unit (MCU) via a bus. The main control unit executes a program implemented by the electricity data storage method described in Embodiment 1. The EEPROM has first and second storage areas. The first storage area includes a two-dimensional electricity storage area of ​​n1×n2, storing data for electricity recovery. The second storage area includes a failure scene storage area. The FLASH memory has third and fourth storage areas. The third storage area includes an electricity storage area, storing data for electricity recovery. The fourth storage area includes a failure scene storage area. Other implementation technologies of electricity metering devices such as smart meters are existing technologies.

[0065] In this embodiment, a fifth storage area is set in the EEPROM, and a sixth storage area is set in the FLASH. The RAM and FLASH memory directly adopt the memory of the MCU of the main control unit of the power metering device. The EEPROM is an external 256kB electrically erasable and rewritable memory. The first and third storage areas are both set as 10×100 two-dimensional power storage areas, and each single quantity occupies 4B (byte) storage unit; the second, fourth, fifth and sixth storage areas are all set as 100B storage areas.

[0066] The basic principle of this invention is as follows: Utilizing a regional circular storage strategy avoids the problem of frequent read / write operations on fixed EEPROM storage units, leading to exceeding their lifespan; setting up a two-dimensional storage area enables high-precision power storage over a period of time, thus ensuring both power recovery accuracy and improving recovery probability (even if the recovered value is not the maximum, some power will still be lost; compared to existing technologies where power cannot be recovered after a storage unit failure, this solution is a more optimized one); setting up multiple failure scene storage areas further improves the ability to acquire fault information; and setting up a backup storage area in the FLASH memory enhances the ability to cope with EEPROM failures. This invention trades storage space for increased lifespan, storage accuracy, and reliability.

[0067] In summary, this invention simultaneously addresses the problems of traditional 1kWh storage of single-use electricity, the inadequacy of existing EEPROM nominal lifespan (write cycles) to meet the 16-year lifespan requirement of smart meters and other energy metering devices, the low accuracy and easy loss of recovered electricity data in traditional 1kWh storage, the inability to trace the source of EEPROM or FLASH storage failures, and the inability to recover electricity data when RAM, EEPROM, and FLASH memory experience dual or even triple failures. The method proposed in this invention, and the energy metering device implemented using this method, significantly improves the fault shielding capability of the storage unit and its ability to operate continuously under fault conditions. Even in the event of multiple memory failures, it still possesses a certain degree of electricity recovery capability, enabling the most accurate recovery of accumulated electricity data. This ensures the accuracy of user electricity metering and various statistical information of the power grid, guiding the power grid in rational regulation.

[0068] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, including further configuration of storage space, etc., and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for storing electrical energy data, characterized in that, Based on the RAM+FLASH+EEPROM combined storage configuration scheme, a real-time power storage area is set in RAM to store real-time power data under power-on conditions; First and second storage areas are set in the EEPROM. The first storage area includes a two-dimensional power storage area of ​​n1×n2, which stores data for power recovery. The second storage area includes a failure scene storage area. A third and a fourth storage area are created in the FLASH memory. The third storage area includes a power storage area, which stores data for power recovery. The fourth storage area includes a failure scene storage area. Wherein, n1≥expected EEPROM write cycle life ÷ actual EEPROM product write cycle life, rounded to the nearest integer; n2≥traditional power storage accuracy ÷expected power storage accuracy, rounded to the nearest integer; the failure site storage area stores failure site information; The third storage area includes a one-dimensional storage area of ​​length n4, a two-dimensional storage area of ​​length n1×n2, or a three-dimensional storage area of ​​length n1×n2×n3; wherein, n3 ≥ the write lifespan of the actual EEPROM product ÷ the write lifespan of the actual FLASH product, rounded to the nearest integer; n4 ≥ the lower limit of n1 × the lower limit of n3.

2. The method for storing electrical data according to claim 1, characterized in that, The failure site information includes at least the battery level at the time of failure and the failure time.

3. The method for storing electrical energy according to claim 2, characterized in that, A fifth storage area is allocated in the EEPROM, and a sixth storage area is allocated in the FLASH. The fifth storage area stores the same information as the second storage area, and the sixth storage area stores the same information as the fourth storage area.

4. A method for storing electrical energy according to any one of claims 1 to 3, characterized in that, Includes the following steps: S1: Power-on startup, initialization; S2: Power restored; Read the last stored result from the first storage area of ​​the EEPROM, and after verification, store it as the initial value of the accumulated power in the real-time power storage area of ​​RAM. If the verification fails, read the last stored result from the third storage area of ​​FLASH. If the verification passes, store it as the initial value of the accumulated power in the real-time power storage area of ​​RAM. If the verification still fails, read all power values ​​from the first storage area of ​​the EEPROM, extract the maximum value from the verified data as the initial value for power accumulation, and store it in the real-time power storage area of ​​RAM. All power values ​​in the first storage area of ​​EEPROM fail the verification. Read all power values ​​in the third storage area of ​​FLASH, extract the maximum value of the verified data as the initial value of power accumulation and store it in the real-time power storage area of ​​RAM. When all power values ​​in the first EEPROM storage area fail verification or all power values ​​in the third FLASH storage area fail verification, the maximum power and time available at the time of the error are reported to the master station, and an emergency handling prompt is given. If this situation occurs during initialization, after the fault is reported to the master station, the RAM power data is incremented from 0, and step S3 is entered. If this situation occurs during the loop, the system can simultaneously attempt to recover the power information of the most recent failure scene from the failure scene storage area, and then enter step S3. If the failure scene cannot be obtained, the RAM power data is incremented from 0, and step S3 is entered. S3: Read the power pulse count and accumulate RAM power data; First, determine whether the RAM power data before accumulation can pass the verification. If the verification passes, directly accumulate the power and store it together with the newly calculated verification value in the RAM real-time power storage area. If the verification fails, execute step S2. After the power is restored, perform real-time accumulation and store it together with the newly calculated verification value in the RAM real-time power storage area. S4: According to the quantitative storage strategy, the real-time power value is stored in the first storage area of ​​EEPROM and the third storage area of ​​FLASH respectively. The storage methods include sequential, continuous and cyclic storage; if there is no storage abnormality and the task has not ended, proceed to step S3 for normal loop; if there is an abnormality, proceed to step S5. S5: If the EEPROM write fails or the FLASH write fails in step S4, the MCU actively obtains the failure scene information and writes it into the EEPROM and FLASH failure scene storage areas respectively; it reports the power consumption and time at the time of the error to the master station and prompts for emergency handling, while continuing to repeat step S3. S6: The loop ends when the power is off or the task is manually terminated.

5. A method for storing electrical data according to claim 4, characterized in that, The storage operation on the third FLASH storage area in step S4 includes: When the third storage area is a one-dimensional storage area of ​​length n4, a low-precision sparse storage strategy is executed. When the third storage area is a two-dimensional storage area of ​​size n1×n2, a high-precision storage strategy is executed in case of an exception. When the third storage area is a three-dimensional storage area of ​​size n1×n2×n3, a high-precision storage strategy is executed.

6. An electricity metering device, characterized in that, The device includes at least a memory combination of RAM, FLASH and EEPROM, which is connected to a main control unit (MCU) via a bus. The main control unit executes a program based on a power data storage method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Efficient data storage method for intelligent ammeter and intelligent ammeter

    CN108122594A

  • Effective method for solving electric quantity loss of electronic electric energy meter

    CN113267673A

  • Electric energy meter and electric quantity metering method thereof

    CN112748271A