Search

CN-115904244-B - Storage and recovery method for electric energy pulse mantissa

CN115904244BCN 115904244 BCN115904244 BCN 115904244BCN-115904244-B

Abstract

The invention discloses a storage and recovery method of an electric energy Pulse mantissa, which comprises the steps that an electric meter starts to be electrified, a metering chip starts to meter according to different load currents to generate Pulse signals with different frequencies, when the electric meter is electrified, a preset Pulse mantissa checking and repairing module is used for checking and repairing, and updating the successfully repaired Pulse mantissa to an electric quantity Pulse mantissa_int variable, when the electric quantity Pulse mantissa variable pulse_int is larger than a preset Pulse constant or other switching exists, electric quantity storage is immediately carried out, when the accumulated electric quantity Pulse after the electric meter is electrified meets storage conditions, a preset electric quantity mantissa Pulse storage module is called, and the storage address of the electric quantity mantissa in FLASH storage equipment is determined through the current electrified accumulated Pulse mantissa_total, so that the electric quantity mantissa Pulse storage is completed.

Inventors

  • ZHANG ZHENGXIN
  • CAO YANG
  • ZHANG BIN
  • FEI FEI
  • CHEN FEI
  • XU XIAOXING

Assignees

  • 国电南瑞三能电力仪表(南京)有限公司

Dates

Publication Date
20260505
Application Date
20221215

Claims (8)

  1. 1. A method for storing and recovering a mantissa of an electrical energy pulse, comprising: the ammeter starts to be electrified, and the metering chip starts to meter according to different load currents to generate pulse signals with different frequencies; when the ammeter is powered on, checking and repairing are carried out through a preset Pulse mantissa checking and repairing module, and the successfully repaired Pulse mantissa is updated to an electric quantity pulse_int variable; After the ammeter is electrified, an initialization operation is executed, and two variables, namely zero-clearing electrification accumulated Pulse number pulse_total and electrification accumulated Pulse number backup pulse_ TotalBak, are cleared; when the metering chip generates a Pulse, the ammeter reads an energy register of the metering chip and accumulates the Pulse, and the read Pulse numbers are respectively accumulated into a Pulse mantissa variable pulse_int and a power-on accumulated Pulse number pulse_total variable; when the electric quantity Pulse mantissa variable pulse_int is larger than a preset Pulse constant or other switching exists, immediately storing the electric quantity once; When the difference between the Total number of power-on accumulated pulses pulse_total and the Total number of last accumulated pulses pulse_ TotalBak reaches a preset Pulse mantissa resolution, a preset electric quantity mantissa Pulse storage module is called, and a storage address of an electric quantity mantissa in FLASH storage equipment is determined through the current power-on accumulated Pulse number pulse_total, so that electric quantity mantissa Pulse storage is completed, and the method comprises the following steps: Determining a memory sector address FLASHADDR by calculating parity of (pulse_total/C/100); obtaining an integer part of the current electric energy through calculation (pulse_total/C% 100), and determining an Offset address Offset where the integer part of the Pulse is located through calculation (pulse_total/C% 100) x 25; Determining the number of mantissa pulses which are not full of 1 degree electricity by calculation (pulse_total% C), and determining a specific Byte Offset address Offset_Byte stored by the mantissa by calculation (pulse_total% C/0.04C) because 0.04C pulses are stored in 1 Byte; determining an Offset of the power mantissa in the offset_byte Byte by calculation (pulse_total% C/0.005C); The offset_bit Bit of the offset_byte Byte is cleared, and the data corresponding to 0xFF < < offset_bit is directly written into FLASHADDR +offset+offset_byte addresses.
  2. 2. The method for storing and recovering the mantissa of electric energy according to claim 1, wherein the power-on accumulated Pulse number pulse_total is used for recording the accumulated Pulse of the electric meter from the power-on and storing the electric quantity mantissa Pulse, and the power-on accumulated Pulse number backup pulse_ TotalBak is used for recording the value of the last time the electric quantity mantissa Pulse is stored in the electric meter.
  3. 3. The method for storing and recovering a Pulse mantissa of electric energy according to claim 1, wherein the immediately performing the electric energy storage once when the pulse_int of the electric energy Pulse mantissa variable is greater than a preset Pulse constant or there is a rest of switching comprises: when the pulse_int variable of the electric quantity is larger than the Pulse constant C or the conditions of rate switching, day time period table switching, time zone switching and power direction switching exist, a preset electric quantity storage module is called to store the electric quantity once, and the pulse_int variable is cleared and recounting is carried out after the electric quantity is stored.
  4. 4. The method of claim 1, wherein each time a power mantissa Pulse is stored, the value of pulse_ TotalBak is updated and pulse_total is copied to pulse_ TotalBak.
  5. 5. The method of claim 1, wherein determining that Offset is equal to 0 and both offset_byte and offset_bit are equal to 0 indicates that there is a sector switch, and wherein the last sector is erased.
  6. 6. The method for storing and recovering electric energy pulse mantissa according to claim 1, wherein when the storing of the electric energy mantissa pulse is completed, the electric energy mantissa pulse backup data is updated, and the CRC check code is synchronously refreshed, and the normal pulse accumulation flow is returned to wait for the next meeting of the electric energy pulse mantissa storing condition.
  7. 7. The method for storing and recovering pulse mantissas of electric energy according to claim 1, wherein the checking by a preset pulse mantissa checking and recovering module comprises: After power-on, firstly reading the pulse_int value of the dual-backup electric quantity Pulse in the RAM area and calculating whether the CRC check code is correct, if one of the two parts is correct, indicating that the pulse_int value is reliable, jumping to a stop repair step, not executing subsequent check and repair operations, enabling the electric meter to enter a normal working state, and enabling the electric meter to enter an electric quantity mantissa repair logic only when the CRC check code of the two parts of data is incorrect; the ammeter enters an electric quantity restoration process, reads the current forward total electric energy and the current reverse total electric energy, and calculates the sum of the current forward total electric energy and the current reverse total electric energy to be the current total electric energy pulse_Cur; reading the data content of the Last two power-down records to obtain forward total electric energy and reverse total electric energy data at the power-down recovery time of the Last secondary ammeter, wherein the sum of the forward total electric energy and the reverse total electric energy data is the total electric energy pulse_last at the Last power-up time; Calculating the Total integer Pulse taken in the Last working period as pulse_total=pulse_Cur-pulse_last, and calculating the range of the mantissa Pulse storage address according to the value; stopping the repairing step, wherein the mantissa Pulse checking is available through pulse_int, and the mantissa Pulse recovery is not performed any more; the ammeter enters the electric quantity module to store electric quantity.
  8. 8. The method for storing and recovering a pulse mantissa of electrical energy according to claim 1, wherein the repairing by a preset pulse mantissa checking and repairing module comprises: Calculating FLASH sector address FLASHADDR and Offset address Offset in the sector according to a formula through integer parts of pulse mantissas; the 25 bytes after the Offset are pulse mantissas which are less than one degree of electricity, and the specific bytes and specific bits in which the pulse mantissas are stored are determined through analysis; Analyzing 25 bytes after Offset, finding out the position Byte of the first 0xFF, searching the last Bit of 0 for the last Byte, and determining the Pulse mantissa pulse_flash= (Byte-1) 0.04C+bit 0.005C; Reading the electric quantity mantissa pulse_Eeprom of the EEPROM, verifying whether the CRC is correct, if not, directly recovering by using the value of the pulse_flash, if the CRC is correct, comparing the difference, if the difference is within 0.005C Pulse, considering that the electric quantity mantissa Pulse stored in the EEPROM is credible, directly recovering by using the value of the pulse_Eeprom, otherwise, considering that the value of the pulse_Eeprom is not credible, and recovering by using the value of the pulse_flash; the ammeter enters the electric quantity module to store electric quantity.

Description

Storage and recovery method for electric energy pulse mantissa Technical Field The invention relates to a storage and recovery method of an electric energy pulse mantissa, and belongs to the technical field of intelligent electric meters. Background The popularization and application of the intelligent electric meter play a positive role in promoting the development of the intelligent electric network and the transformation of the power consumption management mode, but a plurality of problems are also exposed in the application process, and the problem of loss of mantissa electric quantity occurs in a plurality of electric meters on site under the condition that external energy storage components become invalid along with the lengthening of the operation time of the electric meter. The EEPROM is an electrified erasable programmable read-only memory, the erasing life of the EEPROM is 100 ten thousand times at most, the EEPROM cannot be subjected to data writing operation at higher frequency, the electric quantity is often stored in the EEPROM by taking the whole electric quantity as a period, and the data at higher frequency of electric quantity mantissa pulses are stored in a RAM area and are stored in the EEPROM only when the power is lost. When the ammeter is abnormally reset or external energy storage equipment of the ammeter is damaged (such as under-voltage battery, faraday capacitor leakage and the like), the electric quantity tail number pulses can be lost due to the fact that the electric quantity tail number pulses are not stored, so that loss is caused, and the metering accuracy is affected. Disclosure of Invention The invention aims to overcome the defects in the prior art, provides a storage and recovery method for the pulse mantissa of electric energy, can quickly position the mantissa pulse at the FLASH position and realize the self-recovery of the pulse mantissa, and improves the reliability. In order to achieve the above purpose, the invention is realized by adopting the following technical scheme: in a first aspect, the present invention provides a method for storing and recovering a mantissa of an electrical energy pulse, including: the ammeter starts to be electrified, and the metering chip starts to meter according to different load currents to generate pulse signals with different frequencies; when the ammeter is powered on, checking and repairing are carried out through a preset Pulse mantissa checking and repairing module, and the successfully repaired Pulse mantissa is updated to an electric quantity pulse_int variable; After the ammeter is electrified, an initialization operation is executed, and two variables, namely zero-clearing electrification accumulated Pulse number pulse_total and electrification accumulated Pulse number backup pulse_ TotalBak, are cleared; when the metering chip generates a Pulse, the ammeter reads an energy register of the metering chip and accumulates the Pulse, and the read Pulse numbers are respectively accumulated into a Pulse mantissa variable pulse_int and a power-on accumulated Pulse number pulse_total variable; when the electric quantity Pulse mantissa variable pulse_int is larger than a preset Pulse constant or other switching exists, immediately storing the electric quantity once; When the difference between the Total number of the power-on accumulated pulses pulse_total and the Total number of the last accumulated pulses pulse_ TotalBak reaches the preset Pulse mantissa resolution, a preset electric quantity mantissa Pulse storage module is called, and the storage address of the electric quantity mantissa in the FLASH storage device is determined through the current power-on accumulated Pulse number pulse_total, so that electric quantity mantissa Pulse storage is completed. Further, the power-on accumulated Pulse number pulse_total is used for recording the accumulated Pulse of the ammeter from the power-on and storing the electric quantity mantissa Pulse, and the power-on accumulated Pulse number backup pulse_ TotalBak is used for recording the numerical value of the ammeter when the electric quantity mantissa Pulse is stored last time. Further, when the power Pulse mantissa variable pulse_int is greater than a preset Pulse constant or there are other switches, immediately performing power storage once, including: when the pulse_int variable of the electric quantity is larger than the Pulse constant C or the conditions of rate switching, day time period table switching, time zone switching and power direction switching exist, a preset electric quantity storage module is called to store the electric quantity once, and the pulse_int variable is cleared and recounting is carried out after the electric quantity is stored. Further, each time a power mantissa Pulse is stored, the value of pulse_ TotalBak needs to be updated after the storage is completed, and pulse_total is copied to pulse_ TotalBak. Further, the determining, by the current power-on a