High-precision deduction method and components for electric energy meters based on FRAM
By using FRAM in the power meter for data backup and MD5 effect verification, the problem of deduction data loss of the power meter when power is on and off is solved, and high-precision and high-reliability deduction operations are achieved, reducing economic losses and line losses.
Patent Information
- Application Number
- CN202111583202.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-22
- Publication Date
- 2025-01-17
- Estimated Expiration
- 2041-12-22
AI Technical Summary
When the existing power meter is powered up or down or reset abnormally, it leads to the loss of synchronization of deducted data, resulting in economic disputes and line losses. The number of read and writes of EEPROM and ESAM cards is limited, so high-speed synchronization cannot be supported.
Ferroelectric memory (FRAM) is used for data backup and verification, and combined with MD5 effect verification algorithm, multiple backups and fast positioning of data are realized, ensuring that data can be accurately restored when powered on and deducted operations.
It effectively solves the problem of data synchronization loss, improves the accuracy and reliability of deductions, reduces economic losses, and reduces line losses, achieving efficient and accurate data recovery.
Smart Images

Figure CN114487588B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a high-precision deduction method and component for an electric energy meter based on FRAM, and belongs to the technical field of electric energy meter deduction methods. Specifically, it relates to an electric energy meter deduction method, which can solve the problem that the electric energy meter of the Southern Power Grid cannot successfully deduct fees from an internal ESAM card wallet file and deducts fees repeatedly. Background Art
[0002] The current domestic electricity meter local deduction process is mainly divided into two steps:
[0003] 1. After the electric energy is accumulated, the internal RAM of the microcontroller performs calculations and deductions, and temporarily stores the RAM;
[0004] 2.15-minute timing, power on / off, and card insertion will synchronize the deduction data in RAM to the ESAM card and EEPROM.
[0005] In the above execution steps, the hardware devices that need to be relied on are RAM, EEPROM, ESAM card, and electrolytic capacitor.
[0006] Each of these devices has its own advantages and disadvantages:
[0007] The disadvantage of RAM is that data is easily lost after power failure.
[0008] The disadvantages of EEPROM and ESAM cards are that they are slow, have limited read and write times, and cannot be read and written at unlimited high speeds;
[0009] Electrolytic capacitors have attenuation characteristics and device consistency, and in the worst state only 60% of the capacitance remains.
[0010] Based on the above solutions and device characteristics, this type of deduction solution will cause abnormal deduction when the power is turned on or off, or the electric energy meter is abnormally reset, and data synchronization is lost (within 15 minutes).
[0011] Example 1: During the operation of the energy meter, the energy meter is abnormally reset due to external factors. At this time, the power consumption and deduction data in the RAM may be lost. If it is restored from the data saved in the last EEPROM, the data generated during this period will be irreversibly lost.
[0012] Example 2: When the power meter loses power, the data in the RAM is saved to the EEPROM and ESAM card. However, the electrolytic capacitor may have degraded severely at this time, and thus cannot support the power supply when saving data, which ultimately leads to the failure of data saving and deduction. From the frozen data, it can even be seen that the power deduction is reversed.
[0013] Once this kind of phenomenon occurs, it will cause economic disputes, causing considerable economic losses to users and power companies, and also increase line losses.
[0014] Therefore, designing an electricity meter deduction method to solve the electricity meter deduction problem has great social value and application prospects. Summary of the invention
[0015] The technical problem to be solved by the present invention is generally to provide a high-precision deduction method for electric energy meters based on FRAM. The purpose of the present invention is to overcome the shortcomings of the prior art and seek to design an electric energy meter deduction method that uses reliable device equipment, data verification methods, and a power-on error correction protection mechanism to perform multi-type and multi-backup processing on electric energy data.
[0016] In order to achieve the above-mentioned purpose, the electricity meter deduction scheme involved in the present invention needs to add a storage device "Ferroelectric RAM (FRAM)", which provides an unlimited read and write performance consistent with RAM, but has the same non-volatility as ROM.
[0017] To solve the above problems, the technical solution adopted by the present invention is:
[0018] A high-precision fee deduction method for an electric energy meter based on FRAM, comprising the following steps;
[0019] S1, execute the program to determine whether it is powered on, if not, go into sleep mode, otherwise, power on;
[0020] S2, performs the task of electric energy metering;
[0021] S3, execute the wallet file ESAM card fee deduction task;
[0022] S4, execute the data saving task.
[0023] As a further improvement of the above technical solution:
[0024] In S3, when the electric energy meter is powered on, the FRAM performs data backup regularly.
[0025] S3 also includes S3.1, the timed wallet file ESAM card refresh process. First, the electric energy is accumulated; then, after the accumulation reaches the set threshold condition, the internal RAM of the microcontroller performs calculations to deduct money, and the deduction data is temporarily stored in the RAM; secondly, the deduction data is synchronized to the FRAM and backed up; thirdly, it is judged whether it exceeds the set time period, whether the power is turned on and off, and / or whether the card is inserted. When the condition is yes, the deduction data in the RAM is synchronized to the ESAM and EEPROM. When the condition is no, the electric energy is accumulated again.
[0026] S3 also includes S3.2, the wallet file storage backup processing flow. First, the internal RAM of the microcontroller performs calculations for deductions, and the deduction data is temporarily stored in the RAM; then, the deduction data is synchronized to the FRAM for several groups of backups, each backup contains wallet file data and MD5 verification data, and a storage pointer is stored in each backup area to locate the current storage location of the backup; secondly, the FRAM storage pointer +1 is used for polling storage, and the storage frequency varies with the deduction rate, which is the workload, and one pulse is deducted once; thirdly, it is executed to determine whether the FRAM storage pointer is greater than or equal to the number of backup data. If so, the FRAM storage pointer repeatedly traverses the backup data corresponding to the storage pointer = 1, otherwise, the FRAM storage pointer repeatedly traverses the backup data corresponding to the storage pointer +1.
[0027] S3 also includes S3.3, the wallet file deduction process, which first locates and reads the current wallet file according to the storage pointer of FRAM; then, performs MD5 data verification after reading. If correct, continue to run according to the wallet file data and deduct the wallet file ESAM card; if wrong, obtain all wallet file data in FRAM, verify them one by one, find a backup with the smallest remaining amount and correct verification, and deduct the backup.
[0028] With the help of FRAM-based high-precision deduction circuit components for electricity meters.
[0029] A high-precision fee deduction circuit component for an electric energy meter based on FRAM, comprising:
[0030] The FRAM circuit includes a chip US20 as an MCU, pins 1-4 and 7 of the chip US20 are grounded, pin 8 is connected to the system power supply MVDD and the other is grounded through an isolation capacitor CS20, pin 6 is connected to the clock signal FRAM_SCL MCU, and pin 5 is connected to the data signal FRAM_SDA through a resistor RS22;
[0031] The system power supply MVDD is connected to the output terminal of resistor RS22 and pin 6 through resistor RS20 and resistor RS23 respectively;
[0032] FRAM circuit for reading backup data;
[0033] ESAM card, which holds and has wallet file storage;
[0034] The FRAM circuit is electrically connected to a power-off detection circuit;
[0035] The above-mentioned high-precision deduction circuit component of the electric energy meter based on FRAM, ESAM card, performs data synchronization update regularly during deduction, recharge, card insertion and setting minute periods. The wallet file in FRAM includes several backups, each backup contains wallet file data and MD5 verification data, and a storage pointer is stored in each backup area for locating the current storage location of the backup; the several backup areas are polled for storage, and the storage frequency depends on the deduction rate, which is the workload, and one pulse is deducted once;
[0036] The storage time of one data line of FRAM is << the interval time between two pulses, that is, the interval time between two pulses is several times the storage time of one data line of FRAM.
[0037] As a further improvement of the above technical solution:
[0038] In the power-off detection circuit, including resistors RT30-32; diode DT30, capacitor CT30; the system power MVDD outputs three paths through the series resistors RT30 and 31, one path is connected to the ground through the resistor RT32, one path is connected to DVDD through the diode DT30, and one path is connected to the comparator input pin of the MCU through PUDTest_1_ADC;
[0039] When the system power supply MVDD has no voltage, this pin will trigger the MCU's comparator signal to flip, thereby detecting the power-off flag.
[0040] The power supply system of the electric energy meter includes resistors RP11, RP2, RP21, diodes DP1, DP3-8, capacitors EP1-3, CP3, and transformer TRP1;
[0041] Connect resistor RP11 between external input UN and UL. External input UN is divided into two paths after passing through resistor RP2. One path is connected to external input UL through RP21, and the other path is connected to pin 1 of transformer TRP1. Pin 4 is connected to HVDDM through diode DP1, and pin 5 is connected to HVDDM and external input UL through capacitor EP1.
[0042] For the secondary coil of the mutual inductor TRP1, the pin 10 of the same secondary coil as the pin 9 is connected to MGND, and the pin 9 passes through the diode DP4, and then one way is connected to MGND through the capacitor EP3, and the other way is respectively connected to TP3 and CHVDD; pins 6 and 7 are in the same secondary coil, wherein the secondary rectifier filter module composed of the rectifier bridge composed of diodes DP5-8 and the filter capacitor CP1 is connected in parallel at both ends of pins 6 and 7, one output of the secondary rectifier filter module is connected to the TP2 end and grounded, and the other way is respectively connected to the MHVDD end and grounded through the capacitor EP2 after passing through the diode DP3;
[0043] When the external UN and UL lose voltage, the HVDD at the back end loses power, the MCU detects the power-off signal, and starts to save data. The electrolytic capacitor EP2 provides power.
[0044] The ESAM card is electrically connected with RAM and EEPROM, and the energy meter has an electrolytic capacitor.
[0045] The invention has reasonable design, low cost, durability, safety and reliability, simple operation, time and labor saving, money saving, compact structure and convenient use. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 It is a circuit diagram of the FRAM chip of the present invention.
[0047] Figure 2 It is a control flow diagram of the present invention.
[0048] Figure 3 It is a schematic diagram of a power-off detection circuit of the present invention.
[0049] Figure 4 It is a schematic diagram of a power supply system of an electric energy meter of the present invention.
[0050] Figure 5 It is a flowchart of wallet file refreshing of the present invention.
[0051] Figure 6 It is a flowchart of the wallet file storage backup process of the present invention.
[0052] Figure 7 It is a flowchart of the wallet file deduction process of the present invention.
[0053] Figure 8 It is the parent diagram of the flow chart of the present invention. DETAILED DESCRIPTION
[0054] like Figure 1-8 , the present invention adopts the MD5 verification algorithm, Figure 1 The circuit of the FRAM chip includes a chip US20 as an MCU, pins 1-4 and 7 of the chip US20 are grounded, pin 8 is connected to the system power supply MVDD and the other is grounded through an isolation capacitor CS20, pin 6 is connected to the clock signal FRAM_SCL MCU, and pin 5 is connected to the data signal FRAM_SDA through a resistor RS22;
[0055] The system power supply MVDD is connected to the output terminal of resistor RS22 and pin 6 through resistor RS20 and resistor RS23 respectively;
[0056] The present invention verifies the data in the wallet file, abandons the traditional CRC16 verification, and greatly improves the data security.
[0057] The electric energy meter deduction method of the present invention performs multiple backups of data, wherein the ESAM card maintains and has the original wallet file storage, and performs data synchronization and updating at regular intervals of 15 minutes during deduction, recharge, card insertion, and 10 backups of the wallet file in the FRAM, each backup contains wallet file data and MD5 verification data, and in addition, the 10 backup areas store storage pointers, which can quickly and accurately locate the current storage location. The 10 backup areas perform polling storage, and the storage frequency depends on the deduction rate (load size), and the deduction granularity can reach the maximum accuracy level (one pulse deduction once).
[0058] Example of multiple backup procedures:
[0059] void EngryBackUp()
[0060] {
[0061] unsigned int ofst = 0;
[0062] ofst=Clock.Sec&0x0F; / / Get the low digit of the second (0~9)
[0063] FRAM_Write(BackupArea+ofst*40,(unsigned char*)&Money_Block.buf,40); / / Store the data in memory into FRAM
[0064] }
[0065] The electric energy meter deduction method of the present invention has the characteristics of high efficiency and accuracy when restoring data. When the electric energy meter is powered on, the program quickly locates and reads the current wallet file according to the storage pointer of FRAM, and performs MD5 data verification after reading. If it is correct, it continues to operate normally according to the wallet file data and deducts the fee from the ESAM card; if it is wrong, it continues to operate normally after obtaining the latest accurate data from the other 9 backups and deducts the fee from the ESAM card.
[0066] Compared with the prior art, the present invention fully considers the attenuation characteristics of the electrolytic capacitor. After repeated actual tests, it is found that within the specified temperature range, when the MCU detects that the electric energy meter has entered a power-off state, the corresponding hardware can still maintain operation. According to the FRAM operation rate of 5MHZ and the amount of each data of 20 bytes, it only takes 32us to store a piece of data; and taking a single-phase meter as an example, when the maximum current is 72A and the voltage is 220V, the pulse constant is 1200imp / kWh, and the interval time between two pulses is 189ms. The storage time of 32us is much shorter than 189ms. Therefore, even if the electrolytic capacitor decays to an invalid state, the error in the deduction of the wallet file is only 1 pulse.
[0067] In the power-off detection circuit, including resistors RT30-32; diode DT30, capacitor CT30; the system power MVDD outputs three paths through the series resistors RT30 and 31, one path is connected to the ground through the resistor RT32, one path is connected to DVDD through the diode DT30, and one path is connected to the comparator input pin of the MCU through PUDTest_1_ADC;
[0068] When the system power supply MVDD has no voltage, this pin will trigger the MCU's comparator signal to flip, thereby detecting power-off signals and power-on signals.
[0069] Compared with the prior art, the present invention solves the serious inequality of wallet file data between RAM, EEPROM and ESAM card. RAM is easily lost when power is off, and the number of read and write times of EEPROM and ESAM card is limited, and can only be synchronized once every 15 minutes, and the storage process is long, and has a high dependence on power supply stability. Therefore, data synchronization between EEPROM and ESAM card is prone to errors, resulting in data distortion. The FRAM and multi-backup storage mechanism adopted in the present invention effectively solve the 15-minute synchronization problem and the strong dependence on power supply.
[0070] As a further step, the chip US20 acts as an MCU, which provides power through the power supply system of the energy meter, including resistors RP11, RP2, RP21, diodes DP1, DP3-8, capacitors EP1-3, CP3, and transformer TRP1;
[0071] Connect resistor RP11 between external input UN and UL. External input UN is divided into two paths after passing through resistor RP2. One path is connected to external input UL through RP21, and the other path is connected to pin 1 of transformer TRP1. Pin 4 is connected to HVDDM through diode DP1, and pin 5 is connected to HVDDM and external input UL through capacitor EP1.
[0072] For the secondary coil of the mutual inductor TRP1, the pin 10 of the same secondary coil as the pin 9 is connected to MGND, and the pin 9 passes through the diode DP4, and then one way is connected to MGND through the capacitor EP3, and the other way is respectively connected to TP3 and CHVDD; pins 6 and 7 are in the same secondary coil, wherein the secondary rectifier filter module composed of the rectifier bridge composed of diodes DP5-8 and the filter capacitor CP1 is connected in parallel at both ends of pins 6 and 7, one output of the secondary rectifier filter module is connected to the TP2 end and grounded, and the other way is respectively connected to the MHVDD end and grounded through the capacitor EP2 after passing through the diode DP3;
[0073] When the external UN and UL lose voltage, the HVDD at the back end will be powered off immediately, and the MCU will detect the power-off signal, and then start to save data. At this time, the data saving is fully supported by the electrolytic capacitor EP2 in the frame. Through the present invention, the data has been fully backed up during the power-on period, and there is no need to worry about the dependence on the power supply at the moment of power off and after power off, realizing double insurance, thereby ensuring the accuracy of the data as much as possible and achieving unexpected results.
[0074] The electric energy meter deduction method of the present invention has the characteristics of high efficiency and accuracy when restoring data. When the electric energy meter is powered on, the program quickly locates and reads the current wallet file according to the storage pointer of FRAM, and performs MD5 data verification after reading. If it is correct, it continues to operate normally according to the wallet file data and deducts the fee from the ESAM card; if it is wrong, it continues to operate normally after obtaining the latest accurate data from the other 9 backups and deducts the fee from the ESAM card.
[0075] Embodiment 1:
[0076] When testing the electricity meter deduction method involved in the present embodiment, first, 500 yuan of electricity charges were charged to the electricity meter, wherein the steps were set to two values of 50kWh and 200kWh, and the step electricity prices were set to 0.3 yuan / kWh, 0.4 yuan / kWh and 0.5 yuan / kWh respectively. Then, after one month of simulation operation, during which irregular power on and off, frequent power outages and power on, and power consumption of equipment were interspersed, the total accumulated electricity consumption of the electricity meter was 300kWh. Finally, according to the step electricity price calculation, the electricity charge generated should be 50×0.3+150×0.4+100×0.5=125 yuan, and the actual deduction was 125 yuan. The actual electricity charge remaining on the electricity meter was 375 yuan, which fully met the design specifications, without repeated deductions or under-deductions.
[0077] Among them, the MD5 algorithm program
[0078]
[0079]
[0080]
[0081]
[0082]
[0083]
[0084]
[0085]
[0086] The present invention is fully described for a clearer disclosure, and the prior art is not listed one by one.
[0087] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some of the technical features therein with equivalents; it is obvious for those skilled in the art to combine multiple technical solutions of the present invention. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention. The technical contents not described in detail in the present invention are all known technologies.
Claims
1. A high-precision fee deduction method for electric energy meters based on FRAM, characterized in that: The steps include: S1, execute the program to determine whether it is powered on, if not, go into sleep mode, otherwise, power on; S2, performs the task of electric energy metering; S3, execute the wallet file ESAM card fee deduction task; S4, execute data saving task; In S3, including S3.1, the timed wallet file ESAM card refresh process, first, the electric energy is accumulated; then, after the accumulation reaches the set threshold condition, the internal RAM of the microcontroller performs calculation deduction, and the deduction data is temporarily stored in the RAM; secondly, the deduction data is synchronized to the FRAM and backed up; Again, it is judged whether the set time period has been exceeded, whether the power is turned on or off, and / or whether the card is inserted. If the condition is yes, the deduction data in the RAM is synchronized to the ESAM and the EEPROM. If the condition is no, the electric energy is accumulated again. S3.2, wallet file storage backup process, first, the internal RAM of the microcontroller performs calculation deduction, and the deduction data is temporarily stored in the RAM; Then, the deduction data is synchronized to FRAM for several groups of backups. Each backup contains wallet file data and MD5 verification data, and a storage pointer is stored in each backup area to locate the current storage location of the backup. Secondly, the FRAM storage pointer +1 is used for polling storage. The storage frequency depends on the deduction rate. The deduction rate is the workload, and deduction is made once per pulse. Again, it is determined whether the FRAM storage pointer is greater than or equal to the number of backup data. If so, the FRAM storage pointer repeatedly traverses the backup data corresponding to the storage pointer = 1. Otherwise, the FRAM storage pointer repeatedly traverses the backup data corresponding to the storage pointer + 1. S3.3, wallet file deduction process, first locate and read the current wallet file according to the storage pointer of FRAM; then, perform MD5 data verification after reading, if correct, continue to run according to the wallet file data, and deduct the wallet file ESAM card; if wrong, obtain all wallet file data in FRAM, verify them one by one, find the backup with the smallest remaining amount and correct verification, and deduct the backup.
2. According to claim 1, the high-precision fee deduction method for electric energy meters based on FRAM is characterized in that: In S3, when the electric energy meter is powered on, the FRAM performs data backup regularly.
3. The high-precision fee deduction method for electric energy meters based on FRAM according to claim 1 is characterized in that: With the help of FRAM-based high-precision deduction circuit components for electricity meters.
4. A high-precision fee deduction circuit component for an electric energy meter based on FRAM, characterized in that: include The FRAM circuit includes a chip US20 as an MCU, wherein pins 1-4 and 7 of the chip US20 are grounded, pin 8 is connected to the system power supply MVDD and the other is grounded through an isolation capacitor CS20, pin 6 is connected to the clock signal FRAM_SCL MCU, and pin 5 is connected to the data signal FRAM_SDA through a resistor RS22; The system power supply MVDD is connected to the output terminal of resistor RS22 and pin 6 through resistor RS20 and resistor RS23 respectively; FRAM circuit for reading backup data; ESAM card, which holds and has wallet file storage; The FRAM circuit is electrically connected to a power-off detection circuit; ESAM card, during deduction, recharge, card insertion and set minute period, the wallet file in FRAM includes several backups, each backup contains wallet file data and MD5 verification data, and each backup area has a storage pointer for locating the current storage location of the backup; the several backup areas are polled for storage, and the storage frequency depends on the deduction rate, which is the workload, and one pulse is deducted once; The storage time of one data line of FRAM is less than the interval time between two pulses, that is, the interval time between two pulses is several times the storage time of one data line of FRAM; in the power-off detection circuit, it includes resistors RT30-32; diode DT30, capacitor CT30; the system power MVDD outputs three paths through the series resistors RT30 and 31, one path is connected to the ground through the resistor RT32, one path is connected to DVDD through the diode DT30, and one path is connected to the comparator input pin of the MCU through PUDTest_1_ADC; When the system power supply MVDD has no voltage, this pin will trigger the MCU's comparator signal to flip, thereby detecting power-off signals and power-on signals.
Citation Information
Patent Citations
High-precision billing components for electricity meters based on FRAM
CN218825582U