CN113791931B - Method for rapidly storing power failure data of electric meter - Google Patents

Method for rapidly storing power failure data of electric meter Download PDF

Info

Publication number
CN113791931B
CN113791931B CN202111106235.5A CN202111106235A CN113791931B CN 113791931 B CN113791931 B CN 113791931B CN 202111106235 A CN202111106235 A CN 202111106235A CN 113791931 B CN113791931 B CN 113791931B
Authority
CN
China
Prior art keywords
data
data block
stored
event
pointer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111106235.5A
Other languages
Chinese (zh)
Other versions
CN113791931A (en
Inventor
蒋卫平
金波
章恩友
钟祖安
马益平
姚晓峰
金宇
周斌
刘灿
毛伟
胡益波
李家佳
盛旭朝
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ningbo Jianan Electronics Co ltd
Original Assignee
Ningbo Jianan Electronics Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ningbo Jianan Electronics Co ltd filed Critical Ningbo Jianan Electronics Co ltd
Priority to CN202111106235.5A priority Critical patent/CN113791931B/en
Publication of CN113791931A publication Critical patent/CN113791931A/en
Application granted granted Critical
Publication of CN113791931B publication Critical patent/CN113791931B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1004Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's to protect a block of data words, e.g. CRC or checksum
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1441Resetting or repowering
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention sets two continuous data blocks A and B in RAM, the pointer PB points to the initial address of the data block B, and a memory area C is set in the nonvolatile memory for storing the contents stored in the data blocks A and B when power failure occurs. Through the improvement of the data storage structure and the method, the invention realizes that only a small amount of voltage and current real-time data is needed to be stored during power failure, the data accuracy is not influenced, and the data can be quickly acquired during power on.

Description

Method for rapidly storing power failure data of electric meter
Technical Field
The invention relates to a method for rapidly storing event record data before an electric energy meter enters dormancy after power failure.
Background
According to the promulgation of national grid companies: the Q/GDW 10354-2020 intelligent electric energy meter has the requirement of function specification, and when the electric energy meter stops working, the event record related to the storage voltage and the storage current is finished. The recording content includes: undervoltage, decompression, overvoltage, overcurrent, current loss, phase loss, reverse phase sequence and other forty-last events.
According to a general processing mode, after the electric energy meter judges that the power failure occurs, the electric energy meter needs to store the occurred related event records, and then the MCU enters a dormant state to achieve the purpose of reducing the power consumption. However, this approach presents a significant operational risk under certain operating conditions.
The working mode of the electric energy meter design is that when the external power supply is lost, the residual charge of the rectification electrolytic capacitor is used for supplying power for all operations before the dormancy of stored data and the like, and the battery is used for supplying power after the low power consumption. However, when the power meter is powered down, and multiple events exist simultaneously, all events need to be finished and written into the storage area, and a large amount of data needs to be written into the storage area for multiple times. At this time, the electrolytic capacitor cannot meet the requirements, and the design working time of the battery can be greatly shortened due to the early intervention of the battery. Writing data is incorrect when the battery is exhausted, causing a failure in which the operating data is erroneous.
Disclosure of Invention
In order to overcome the defects in the prior art, the invention provides the method for quickly storing the electric meter data, which can realize quick data writing.
The invention is realized by the following technical scheme:
a method for rapidly storing power failure data of an electric meter,
setting two continuous data blocks A and B in an RAM, wherein a pointer PB points to the initial address of the data block B, and setting a storage area C in a nonvolatile memory for storing the contents stored in the data blocks A and B in the case of power failure, wherein the length of the data block A is fixed, and A1, A2 and A3 are sequentially arranged in the data block A;
when the electric energy meter judges that the power is down, the steps are as follows:
(1) acquiring the current time as the power-down time plus the CRC check code and storing the power-down time plus the CRC check code at A1;
(2) judging related events such as voltage, current and the like one by one according to a preset sequence, if the related events need to be recorded, setting a corresponding status byte to TRUE, otherwise, setting the status byte to FALSE, and then storing the event status bytes in A2;
(3) according to the sequence and the actual state of the event status bytes stored in A2, sequentially acquiring data to be stored, if the status bytes are TRUE, storing real-time data to be stored corresponding to the event into a position pointed by a pointer PB in a data block B, accumulating the data length L, setting a new address pointed by the pointer PB as a starting position plus the position of the pointer L, if the status bytes are FALSE, not storing corresponding event data, and not increasing the data length until all events are processed;
(4) storing the total length L of the data block B into A3, and adding the CRC check code of the whole data block A at the tail part of the data block A;
(5) the data block A and the data block B are gathered together and added with CRC, and the CRC is stored in a storage area C of a nonvolatile memory;
when the power is turned on again, the electric energy meter MCU wakes up from the sleep mode, and the data is recovered from the nonvolatile memory to the data block A and the data block B, and the recovery process is as follows:
(1) reading the data block A in the storage area C, respectively verifying the CRC of the whole data block A and the CRC of the power failure time in the A1, and reading the data stored in the data block B from the storage area C according to the length L of the data block B stored at the A3 if the two checks are correct;
(2) checking the CRC of the acquired data block B for the last time, and if the check is correct, performing the next step;
(3) sequentially recording events according to the sequence and the actual state of event state bytes stored in A2, if the state byte is TRUE, acquiring stored real-time data from the position pointed by the pointer PB in the data block B, accumulating the data length L, wherein the new address pointed by the pointer PB is the initial position plus the position of the L, and if the state byte is FALSE, acquiring corresponding event data is not needed, and the data length is not increased until all the events are acquired;
(4) and after the judgment of all events is completed, the storage supplementing processing of the event records during power-on is finished, and the MCU enters a normal working state.
The invention stores the real-time data whether the relevant events need to be written in the data block A or not when the power is down, saves the data which needs to be written in the data block B in real time, and acquires the data recorded by the relevant events when the power is up.
The core method of the invention is realized by compressing the data volume under the premise of not changing the writing rate. After analyzing the data stored in a complete event record, the vast majority of the data is various types of electric energy and the maximum demand. The power and demand are stored in the nonvolatile memory in a separate space, and can be stored in real time once changed, and the data can not be changed during the power failure. Therefore, only a small amount of voltage and current real-time data needs to be written into the nonvolatile memory before the MUC is dormant.
The complete event record has a fixed format and is longer, only some data which can be lost are stored in the event of power failure, other data can be used for reading the electric quantity and the maximum demand which are stored in real time to replace a data source which is not stored in the event of power failure when the event record is supplemented, and the data source is stored after the supplement is completed according to the format in the event of power failure. On the premise of not influencing the data accuracy, the storage time of the event records related to the voltage and the current is transferred from the power-off time to the power-on time.
And acquiring a data block A and a data block B written before the electric energy meter is dormant from the nonvolatile memory during electrification, and sequentially judging whether the events need to be recorded according to the sequence of the event states stored at A2. If recording is needed, the event recording is completed by using the power-off event and the real-time data in the data block B, otherwise, the event is skipped until all events are processed.
The invention has the beneficial effects that: through the improvement of the data storage structure and the method, the invention realizes that only a small amount of voltage and current real-time data is needed to be stored during power failure, the data accuracy is not influenced, and the data can be quickly acquired during power on.
Drawings
FIG. 1 is a schematic diagram of an inventive data storage architecture.
Detailed Description
The invention is described in further detail below with reference to the figures and the detailed description.
A method for rapidly storing power-down data of an electric meter is disclosed, as shown in figure 1, two continuous data blocks A and B are arranged in an RAM of an electric energy meter MCU, a pointer PB points to a start address of the data block B, a storage area C is arranged in a nonvolatile memory and used for storing contents stored in the data blocks A and B during power-down, the length of the data block A is fixed, and the length of the data block B is not fixed. A1, A2 and A3 are sequentially arranged in the data block A;
when the electric energy meter judges that the power is down, the steps are as follows:
(1) the current time is obtained as the power down time plus the CRC check code and stored at a 1.
(2) Forty events need to be recorded when power is down, the events have a preset sequence, the electric energy meter program judges the related events such as voltage, current and the like one by one according to the sequence, if the events need to be recorded, the corresponding status byte is set to TRUE, otherwise, the status byte is set to FALSE, and then the event status bytes are stored in A2.
(3) And sequentially acquiring data to be stored according to the sequence and the actual state of the event state bytes stored in the A2, if the state bytes are TRUE, storing the real-time data to be stored corresponding to the event into the position pointed by the pointer PB in the data block B, accumulating the data length L, setting the new address pointed by the pointer PB as the initial position plus the L position, and if the state bytes are FALSE, not storing the corresponding event data and not increasing the data length until all the events are processed.
For example, there are N events in total, and when power is down, there are event 1, event 2, event 4 and event N that need to be recorded, and the rest of events do not need to be recorded. The N event status bytes at a2 are FALSE except that the 1 st, 2 nd, 4 th, and N th bytes are TRUE. Initially, the pointer PB points to the start address of the data block B, the total length L of the data block B is 0, and then the contents of the data block B are collected in the order of the event status bytes.
Event 1 is TRUE, and stores L1 bytes of real-time data to be stored into the address pointed to by the pointer PB, the total length L is increased by L1 bytes (L =0+ L1), PB points to a new address: data block B start address + L;
event 2 is TRUE, and stores L2 bytes of data to be stored into the address pointed to by the pointer PB, the total length L is increased by L2 bytes (L = L1+ L2), PB points to a new address: data block B start address + L;
event 3 is FALSE, data is not required to be stored into data block B, the total length L is increased by 0 bytes (L = L1+ L2+ 0), PB points to the new address: data block B start address + L (unchanged);
event 4 is TRUE, and stores L4 bytes of data to be stored into the address pointed to by the pointer PB, the total length L is increased by L4 bytes (L = L1+ L2+ L4), PB points to the new address: data block B start address + L;
……
event N is TRUE, storing Ln bytes to be stored into the address pointed to by pointer PB, increasing total length L by Ln bytes (L = L1+ L2+ L4+ Ln), PB points to the new address: data block B start address + L.
Therefore, the real-time data to be stored corresponding to the event are all stored in the data block B, and the length of the data block B is L.
(4) The total length L of data block B is stored at a3 and the CRC check code for the entire data block a is added to the end of data block a.
(5) The data blocks A and B are gathered together and CRC is added to the data blocks, and the data blocks are stored in a storage area C of the nonvolatile memory.
Therefore, the data storage work during power failure is completed.
When the power is turned on again, the electric energy meter MCU wakes up from the sleep mode, and the data is recovered from the nonvolatile memory to the data block A and the data block B, and the recovery process is as follows:
(1) reading the data block A in the storage area C, respectively verifying the CRC of the whole data block A and the CRC of the power failure time in the A1, and reading the data stored in the data block B from the storage area C according to the length L of the data block B stored at the A3 if the two verifications are correct. Otherwise, the data is considered to be illegal, and the event record is not made.
(2) And checking the CRC of the acquired data block B for the last time, and if the check is correct, performing the next step.
(3) Event records are made in turn according to the order and actual state of the event status bytes saved in A2. After power-up, the pointer PB re-points to the start address of the data block B, and event records are made in turn according to the order and actual state of the event status bytes saved in a 2. If the status byte is TRUE, the program acquires the stored real-time data from the position pointed by the pointer PB in the data block B, and accumulates the data length L, the new address pointed by the pointer PB is the initial position plus L, if the status byte is FALSE, the corresponding event data does not need to be acquired, and the data length is not increased until all the events are acquired. Namely, the program acquires the voltage and current real-time data stored in the data block B during power failure, and completes corresponding event recording by combining the electric energy and demand data stored from other places.
(4) And after the judgment of all events is completed, the storage supplementing processing of the event records during power-on is finished, and the MCU enters a normal working state.
And analyzing data stored in a complete event record to find out that most of the contents of the data are various types of electric energy and maximum demand. The electric energy and the demand are stored in the nonvolatile memory in an independent space and can be stored in real time once being changed. And the data can not change during the power failure, so that the power quantity and the maximum demand quantity which are stored in real time can be read to replace the data source which is not stored during the power failure when the power-on supplement event is recorded.
The invention stores the real-time data whether the relevant events need to be written in the data block A or not when the power is down, saves the data which needs to be written in the data block B in real time, and acquires the data recorded by the relevant events when the power is up.
The core method of the invention is realized by compressing the data volume under the premise of not changing the writing rate. The analysis of the data related to the event records shows that the majority of the data is various types of electric energy and maximum demand, and the data is stored in real time and cannot be changed during the power failure. Therefore, only a small amount of voltage and current real-time data needs to be written into the nonvolatile memory before the MUC is dormant.
The invention also aims to transfer the storage time of the event records related to the voltage and the current from the power-off time to the power-on time on the premise of not influencing the data accuracy. The complete event record has a fixed format and is longer, only some data which can be lost are stored in the event of power failure, and when the event record is supplemented by power on, the electric quantity and the maximum demand which are stored in real time are read to replace the data source which is not stored in the event of power failure, and the data source is stored after the completion of the supplement according to the format. And acquiring a data block A and a data block B written before the electric energy meter is dormant from the nonvolatile memory during electrification, and sequentially judging whether the events need to be recorded according to the sequence of the event states stored at A2. If recording is needed, the event recording is completed by using the power-off event and the real-time data in the data block B, otherwise, the event is skipped until all events are processed.
Through the improvement of the data storage structure and the method, the invention realizes that only a small amount of voltage and current real-time data is needed to be stored during power failure, the data accuracy is not influenced, and the data can be quickly acquired during power on.

Claims (1)

1. A method for rapidly storing power failure data of an electric meter is characterized by comprising the following steps:
setting two continuous data blocks A and B in an RAM, wherein a pointer PB points to the initial address of the data block B, and setting a storage area C in a nonvolatile memory for storing the contents stored in the data blocks A and B in the case of power failure, wherein the length of the data block A is fixed, and A1, A2 and A3 are sequentially arranged in the data block A;
when the electric energy meter judges that the power is down, the steps are as follows:
(1) acquiring the current time as the power-down time plus a CRC check code and storing the current time at A1;
(2) judging the voltage and current events one by one according to a preset sequence, if the events need to be recorded, setting the corresponding status byte to TRUE, otherwise, setting the status byte to FALSE, and then storing the event status bytes at A2;
(3) according to the sequence and the actual state of the event status bytes stored in A2, sequentially acquiring data to be stored, if the status bytes are TRUE, storing real-time data to be stored corresponding to the event into a position pointed by a pointer PB in a data block B, accumulating the data length L, setting a new address pointed by the pointer PB as a starting position plus the position of the pointer L, if the status bytes are FALSE, not storing corresponding event data, and not increasing the data length until all events are processed;
(4) storing the total length L of the data block B into A3, and adding the CRC check code of the whole data block A at the tail part of the data block A;
(5) the data block A and the data block B are gathered together and added with CRC, and the CRC is stored in a storage area C of a nonvolatile memory;
when the power is turned on again, the electric energy meter MCU wakes up from the sleep mode, and the data is recovered from the nonvolatile memory to the data block A and the data block B, and the recovery process is as follows:
(1) reading the data block A in the storage area C, respectively verifying the CRC of the whole data block A and the CRC of the power failure time in the A1, and reading the data stored in the data block B from the storage area C according to the length L of the data block B stored at the A3 if the two verifications are correct;
(2) checking the CRC of the acquired data block B for the last time, and if the check is correct, performing the next step;
(3) sequentially recording events according to the sequence and the actual state of event state bytes stored in A2, if the state byte is TRUE, acquiring stored real-time data from the position pointed by the pointer PB in the data block B, accumulating the data length L, wherein the new address pointed by the pointer PB is the initial position plus the position of the L, and if the state byte is FALSE, acquiring corresponding event data is not needed, and the data length is not increased until all the events are acquired;
(4) and after the judgment of all events is completed, the storage supplementing processing of the event records during power-on is finished, and the MCU enters a normal working state.
CN202111106235.5A 2021-09-22 2021-09-22 Method for rapidly storing power failure data of electric meter Active CN113791931B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111106235.5A CN113791931B (en) 2021-09-22 2021-09-22 Method for rapidly storing power failure data of electric meter

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111106235.5A CN113791931B (en) 2021-09-22 2021-09-22 Method for rapidly storing power failure data of electric meter

Publications (2)

Publication Number Publication Date
CN113791931A CN113791931A (en) 2021-12-14
CN113791931B true CN113791931B (en) 2022-05-17

Family

ID=78879011

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111106235.5A Active CN113791931B (en) 2021-09-22 2021-09-22 Method for rapidly storing power failure data of electric meter

Country Status (1)

Country Link
CN (1) CN113791931B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007172650A (en) * 1991-11-28 2007-07-05 Hitachi Ltd Information device employing flash memory
CN103729299A (en) * 2012-10-12 2014-04-16 苏州工业园区新宏博通讯科技有限公司 Data safety management method for event data storage of multi-path electricity meter
CN105512056A (en) * 2014-09-24 2016-04-20 中兴通讯股份有限公司 Method and device for data storage, and terminal
CN106648982A (en) * 2016-12-15 2017-05-10 宁波迦南智能电气股份有限公司 Electric energy meter power down protection data storing method
CN108122594A (en) * 2017-12-19 2018-06-05 宁波三星医疗电气股份有限公司 A kind of efficient intelligent electric energy meter date storage method and its intelligent electric energy meter
CN108226590A (en) * 2017-12-27 2018-06-29 深圳市科陆电子科技股份有限公司 A kind of method and system for settling accounts electric energy meter power failure data

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007172650A (en) * 1991-11-28 2007-07-05 Hitachi Ltd Information device employing flash memory
CN103729299A (en) * 2012-10-12 2014-04-16 苏州工业园区新宏博通讯科技有限公司 Data safety management method for event data storage of multi-path electricity meter
CN105512056A (en) * 2014-09-24 2016-04-20 中兴通讯股份有限公司 Method and device for data storage, and terminal
CN106648982A (en) * 2016-12-15 2017-05-10 宁波迦南智能电气股份有限公司 Electric energy meter power down protection data storing method
CN108122594A (en) * 2017-12-19 2018-06-05 宁波三星医疗电气股份有限公司 A kind of efficient intelligent electric energy meter date storage method and its intelligent electric energy meter
CN108226590A (en) * 2017-12-27 2018-06-29 深圳市科陆电子科技股份有限公司 A kind of method and system for settling accounts electric energy meter power failure data

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Optimal privacy-preserving energy management for smart meters;Lei Yang等;《IEEE Conference on Computer Communication》;20140708;第513-521页 *
基于嵌入式MCU数据Flash的数据存储及管理方法研究与实现;刘源杨等;《电子产品世界》;20131031(第10期);第57-60页 *

Also Published As

Publication number Publication date
CN113791931A (en) 2021-12-14

Similar Documents

Publication Publication Date Title
CN106227680B (en) A kind of data processing and power fail preventing data guard method
CN101477482B (en) Method for recovering flash memory data at power-off of built-in Linux system
CN106648982B (en) Power-down protection data storage method for electric energy meter
CN102033826B (en) Power failure data protection device and method for internal memory
US8838918B2 (en) Information processing apparatus and data backup method
CN102567146B (en) Log backup method and device and smart card
CN106877442B (en) Battery management method
CN108122594A (en) A kind of efficient intelligent electric energy meter date storage method and its intelligent electric energy meter
CN105512056A (en) Method and device for data storage, and terminal
CN103677869A (en) Wireless sensor network node remote code updating system and method
CN109470918B (en) Electric quantity data processing method of IR46 electric energy meter and IR46 electric energy meter
CN108318851A (en) A kind of twin-core clock of power meter method for managing security
CN109669889B (en) Light Nor Flash control method and device
CN104317671A (en) Power-down data storage and recovery algorithm prolonging service life of non-volatile memory
CN111143239B (en) Frozen electric quantity data compression storage method and decompression method for intelligent electric meter
CN113791931B (en) Method for rapidly storing power failure data of electric meter
CN103093157A (en) Method of permanent protection of cache data of serial attached scsi (SAS) redundant array of independent disks (RAID) card
CN116360695A (en) Data storage method and device based on hybrid energy storage power supply
CN2852489Y (en) Power-off protection circuit of tax-controlled cash register
CN115167761A (en) Intelligent water affair terminal data protection method and system
CN112748271B (en) Electric energy meter and electric quantity metering method thereof
CN112231178B (en) Power-on time timing system suitable for airborne high-safety computer
CN109558080B (en) NandFlash data management method of power acquisition equipment
CN106448017A (en) System for recording power-off and restoration time of fire alarm controller and implementation methods thereof
CN111900498B (en) Storage and retrieval method for fault information of battery management system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant