CN103729143A - Data safety method for electric energy data storage of multi-path electricity meter - Google Patents
Data safety method for electric energy data storage of multi-path electricity meter Download PDFInfo
- Publication number
- CN103729143A CN103729143A CN201210385829.9A CN201210385829A CN103729143A CN 103729143 A CN103729143 A CN 103729143A CN 201210385829 A CN201210385829 A CN 201210385829A CN 103729143 A CN103729143 A CN 103729143A
- Authority
- CN
- China
- Prior art keywords
- data
- flash memory
- storage
- sector
- security method
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 23
- 238000013500 data storage Methods 0.000 title claims abstract description 11
- 230000005611 electricity Effects 0.000 title abstract 4
- 230000003068 static effect Effects 0.000 claims description 11
- 230000006870 function Effects 0.000 claims description 7
- 238000013507 mapping Methods 0.000 claims description 6
- 239000012141 concentrate Substances 0.000 claims description 2
- 238000013524 data verification Methods 0.000 abstract 1
- 238000012795 verification Methods 0.000 abstract 1
- 230000008014 freezing Effects 0.000 description 6
- 238000007710 freezing Methods 0.000 description 6
- 241001269238 Data Species 0.000 description 2
- 230000015572 biosynthetic process Effects 0.000 description 1
- 238000005538 encapsulation Methods 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
Images
Landscapes
- Techniques For Improving Reliability Of Storages (AREA)
- Read Only Memory (AREA)
- Storage Device Security (AREA)
Abstract
The invention discloses a data safety method for electric energy data storage of a multi-path electricity meter. The multi-path electricity meter comprises a single chip microcomputer with a serial port and a flash which is connected with the single chip microcomputer through the serial port and can store electric energy data. The data safety method for electric energy data storage of the multi-path electricity meter is characterized by comprising the following steps that (1) the flash is rewritten; (2) whether a starting address is written into a sector is judged, if the judgment result is yes, the section is erased, and the step (3) is executed, and if the judgment result is no, the step (3) is executed; (3) data are written; (4) after verification of the written data is read backwards, whether data verification is correct is judged, if the judgment result is yes, operation is quit, and if the judgment result is no, data blocks are redistributed, a directory area is rewritten, and the step (3) is repeated.
Description
Technical field
The present invention relates to data security method, relate in particular to the data security method of multichannel ammeter energy data storage.
Background technology
In the design of multiloop multifunction electric meter, need to possess jumbo storage space, for the storage of electric energy quafric curve data.The size of data of such data is more unified, and kind is less, and single type data volume is large.
Ammeter can keep at most the data of 96 single-phase, three-phases or DC loop.For each piece ammeter, need respectively again to preserve a day freezing data, timing freezing data, instantaneous freezing data, the accumulative total energy data of agreement freezing data, integral point freezing data and front 12 name days.Particular capacity demand is as following table:
Data name | Unit byte number | Quantity | Total bytes |
Integral point freezes | ? | 26 | ? |
Day freezes | 269 | 30 | ? |
Timing is freezed | 269 | 12 | ? |
Instantaneous freezing | 269 | 3 | ? |
Agreement is freezed | 269 | 2 | ? |
Energy data | 269 | 12 | ? |
For mass data like this, in system, must need to expand mass storage, must guarantee data above security in 10 years simultaneously.Due to the restriction of monolithic prow encapsulation, there is no external parallel bus, this has just limited its external mass storage.
Summary of the invention
The object of the present invention is to provide the data security method of multichannel ammeter energy data storage, can preserve the serviceable life of a large amount of energy datas and prolongation flash memory.
For realizing above goal of the invention, the present invention adopts following technical scheme: the data security method of a kind of multichannel ammeter energy data storage, described multichannel ammeter comprises having the single-chip microcomputer of serial ports and by serial ports, be connected with described single-chip microcomputer and flash memory that can storage of electrical energy data, and described method comprises the steps:
S1 flash memory is rewritten;
S2 judges whether to write the first address of sector:
Judged result is yes,, wipes behind this sector, enters step S3,
Judged result is no,, enters step S3,
S3 data writing;
After the check of S4 retaking of a year or grade data writing, judge that whether data check is correct:
Judged result is yes, exits,
Judged result is no, redistributes data block and rewrites behind directory area, enters step S3.
As a further improvement on the present invention, described multichannel ammeter comprises the static RAM of the mapping table of storing flash memory, also comprises and read flash memory mapping table in static RAM between described step S1 and S2.
As a further improvement on the present invention, described data are first saved in static RAM, and data are after correctly having confirmed, disposable data are write in flash memory.
As a further improvement on the present invention, the data unification that synchronization is rewritten is unit take sector, concentrates the processing of wiping of carrying out sector.
As a further improvement on the present invention, during described rewriting, first data block of each sector is carried out erase operation, and remaining can write direct.
As a further improvement on the present invention, the storage space of described flash memory is greater than the memory space of data, if bad piece appears in flash memory, data write after flash memory, reads checking and finds that bad piece shields the read-write of this piece, and Mobile data is to idle sector.
As a further improvement on the present invention, described flash memory is supported 256 byte page mode programmings and continuous programming mode.
As a further improvement on the present invention, described flash memory can read and write data from arbitrary address, can sector erasing or piece is wiped or full sheet is wiped.
As a further improvement on the present invention, described flash memory has block protection function and hardware protection function.
As a further improvement on the present invention, described flash memory is provided with power-down mode, enters power-down mode to reduce power consumption after power down.
Compared to prior art, thereby the data security method of multichannel ammeter energy data of the present invention storage is equipped with flash memory can preserve a large amount of energy datas, thereby the erasable frequency of minimizing flash memory can extend the serviceable life of flash memory.
Accompanying drawing explanation
Fig. 1 is the control flow chart of the data security method of multichannel ammeter energy data of the present invention storage.
Embodiment
Multichannel ammeter of the present invention comprises having the single-chip microcomputer of serial ports and by serial ports, be connected with described single-chip microcomputer and flash memory (Flash) that can storage of electrical energy data.MX25L6445E or MX25L12845E that described flash memory can select Macronix International to produce.Described model is that the flash memory of MX25L6445E is the serial NOR Flash of a 64Mb, and the flash memory that described model is MX25L12845E is the serial NOR Flash of a 128Mb.Described model is that the flash memory inside of MX25L6445E has 2048 sectors (a sector 4KB), 128 pieces (a piece 64KB), and the flash memory inside that described model is MX25L12845E has 4096 sectors, 256 pieces.Operating voltage is all at 2.7 ~ 3.6V.Use serial line interface (SPI, Serial Peripheral Interface) to carry out access data, also can use 2I/O reading mode.Support page mode programming and the continuous programming mode of 256 bytes, can be from arbitrary address read data, can sector erasing or piece is wiped or full sheet wipe.There is optional block protection function and hardware protection function.Can enter power-down mode to reduce the power consumption of chip.The safe OTP(one-time-program of the 4Kbit that user or manufacturer use is provided) region is used as the sequence number of device.
FLASH chip has certain limitation, and in its serviceable life especially, its secure access life-span is 100,000 times, and when normal use, the formation of bad piece is also more common fault.Conventionally for NAND FLASH, take equalization algorithm, but algorithm is very complicated, also very large for the demand of software and hardware.
On Software for Design, be first the bottom layer driving that will realize for this chip, complete normally and the function such as read, programme, wipe.But it is inadequate only realizing these, how to guarantee correctness, the security of data storage, need to consider from data structure, storage algorithm, control flow.
First from the structure of data storage, reduce the frequency of FLASH chip-stored, reduce the access times of FLASH chip within the product life cycle, thereby reduce, chip is out of order may go.According to the characteristic of FLASH chip, need to first wipe and just can re-write afterwards, and wipe must be take sector, piece or full sheet be unit, that is to say the space that at least needs to wipe 4K byte.Conventionally for the rewriting of data in FLASH chip, the data in this operation sector need to be read in buffer memory, then wipe this piece, rewrite after the data in buffer memory, again write in sector.Certainly will shine into like this, independent while rewriting in same sector data, may repeatedly wipe this sector.The present invention is the characteristic for demand data according to ammeter, and by the data unified management of all 96 single-phase meter unit, according to the rewriting time, for distinguishing foundation, the data unification that synchronization is rewritten is unit take sector, is concentrated into the processing of wiping of carrying out sector.For example, for energy data piece, size is 236 bytes, arranges 16 energy data pieces take 256 bytes in each sector, unit, adds up to 256*16=4096, i.e. 4K byte.During concrete rewriting, first data block of each sector, carries out erase operation, and all the other 15 data blocks can be write direct.On the one hand, during operation, do not need the support of buffer memory, on the other hand, greatly reduced the processing of sector erasing.Needed in the past to wipe for 16 times, only need now once just passable.
Improve the utilization factor of FLASH chip, the at utmost safe operating life of delay product.The memory space altogether needing in the present invention is 5.6M byte, and FLASH chip 8M byte altogether.After long-play, easily there is bad piece in FLASH, now data will be lost.By simple bad piece judgement, shielding mechanism, make full use of unnecessary storage space, at utmost the safe operating life of delay product.Data are write after FLASH storer at every turn, read immediately checking, if find bad piece, i.e. the read-write of this piece of maskable.Mobile data is to idle sector.Take full advantage of whole storage space.
On the control flow of storage, reduce the storing frequencies of FLASH chip, in the time of ammeter hardware using FLASH chip, also configured static RAM (Static Random Access Memory, SRAM), while carrying out data manipulation, first data are saved in static RAM, after confirming that data are correct, complete, disposable data are write in FLASH.Reduced the frequency that FLASH rewrites.
The data security method concrete steps of described multichannel ammeter energy data storage are:
S1 flash memory is rewritten;
S2 judges whether to write the first address of sector:
Judged result is yes,, wipes behind this sector, enters step S3,
Judged result is no,, enters step S3,
S3 data writing;
After the check of S4 retaking of a year or grade data writing, judge that whether data check is correct:
Judged result is yes, exits,
Judged result is no, redistributes data block and rewrites behind directory area, enters step S3.
Described multichannel ammeter comprises the static RAM of the mapping table of storing flash memory, also comprises and read flash memory mapping table in static RAM between described step S1 and S2.
In sum, these are only preferred embodiment of the present invention, should not limit the scope of the invention with this, i.e. every simple equivalence of doing according to the claims in the present invention book and description of the invention content changes and modifies, and all should still remain within the scope of the patent.
Claims (10)
1. a data security method for multichannel ammeter energy data storage, described multichannel ammeter comprises having the single-chip microcomputer of serial ports and by serial ports, be connected with described single-chip microcomputer and flash memory that can storage of electrical energy data, it is characterized in that, described method comprises the steps:
S1 flash memory is rewritten;
S2 judges whether to write the first address of sector:
Judged result is yes,, wipes behind this sector, enters step S3,
Judged result is no,, enters step S3,
S3 data writing;
After the check of S4 retaking of a year or grade data writing, judge that whether data check is correct:
Judged result is yes, exits,
Judged result is no, redistributes data block and rewrites behind directory area, enters step S3.
2. the data security method of multichannel ammeter energy data as claimed in claim 1 storage, it is characterized in that: described multichannel ammeter comprises the static RAM of the mapping table of storing flash memory, between described step S1 and S2, also comprise and read flash memory mapping table in static RAM.
3. the data security method of multichannel ammeter energy data as claimed in claim 2 storage, is characterized in that: described data are first saved in static RAM, and data are after correctly having confirmed, disposable data is write in flash memory.
4. the data security method of multichannel ammeter energy data as claimed in claim 1 storage, is characterized in that: the data unification that synchronization is rewritten is unit take sector, concentrates the processing of wiping of carrying out sector.
5. the data security method of multichannel ammeter energy data as claimed in claim 4 storage, is characterized in that: during described rewriting, first data block of each sector is carried out erase operation, and remaining can write direct.
6. the data security method of multichannel ammeter energy data as claimed in claim 1 storage, it is characterized in that: the storage space of described flash memory is greater than the memory space of data, if there is bad piece in flash memory, data write after flash memory, read checking and find that bad piece shields the read-write of this piece, Mobile data is to idle sector.
7. the data security method of multichannel ammeter energy data as claimed in claim 1 storage, is characterized in that: described flash memory is supported 256 byte page mode programmings and continuous programming mode.
8. the data security method of multichannel ammeter energy data as claimed in claim 1 storage, is characterized in that: described flash memory can read and write data from arbitrary address, can sector erasing or piece is wiped or full sheet is wiped.
9. the data security method of multichannel ammeter energy data as claimed in claim 1 storage, is characterized in that: described flash memory has block protection function and hardware protection function.
10. the data security method of multichannel ammeter energy data as claimed in claim 1 storage, is characterized in that: described flash memory is provided with power-down mode, enters power-down mode to reduce power consumption after power down.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210385829.9A CN103729143A (en) | 2012-10-12 | 2012-10-12 | Data safety method for electric energy data storage of multi-path electricity meter |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210385829.9A CN103729143A (en) | 2012-10-12 | 2012-10-12 | Data safety method for electric energy data storage of multi-path electricity meter |
Publications (1)
Publication Number | Publication Date |
---|---|
CN103729143A true CN103729143A (en) | 2014-04-16 |
Family
ID=50453234
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210385829.9A Pending CN103729143A (en) | 2012-10-12 | 2012-10-12 | Data safety method for electric energy data storage of multi-path electricity meter |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103729143A (en) |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104898989A (en) * | 2015-06-04 | 2015-09-09 | 宁波市江东精诚自动化设备有限公司 | Large-volume data storage equipment, large-volume data storage method and large-volume data storage device |
CN105606856A (en) * | 2015-12-21 | 2016-05-25 | 南昌市科陆智能电网科技有限公司 | Method for raising power meter system real-time response speed, system and power meter |
CN106408790A (en) * | 2016-08-26 | 2017-02-15 | 恒银金融科技股份有限公司 | Method for writing and reading log information of circulating machine core of financial equipment |
CN107132996A (en) * | 2017-04-12 | 2017-09-05 | 杭州宏杉科技股份有限公司 | Storage method, module and the system configured based on Intelligent simple |
CN108367154A (en) * | 2015-12-14 | 2018-08-03 | 美敦力公司 | Implantable medical device with the scheme for managing data storage |
CN110164394A (en) * | 2019-06-04 | 2019-08-23 | 深圳市华星光电技术有限公司 | Sequence controller and timing control panel |
CN114356792A (en) * | 2021-11-18 | 2022-04-15 | 国电南瑞三能电力仪表(南京)有限公司 | Electric energy meter frozen data storage method based on FLASH pre-erasing technology and electric energy meter |
CN115129257A (en) * | 2022-07-08 | 2022-09-30 | 深圳市正浩创新科技股份有限公司 | Data reading and writing method, electronic equipment and computer readable storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS6042637A (en) * | 1983-08-19 | 1985-03-06 | Shimadzu Corp | Load-elongation curve recording device |
CN102148535A (en) * | 2010-11-15 | 2011-08-10 | 中国计量学院 | Intelligent instrument for managing household power utilization |
CN102306125A (en) * | 2011-08-17 | 2012-01-04 | 深圳市共进电子股份有限公司 | Method for erasing and writing data of FLASH memory |
-
2012
- 2012-10-12 CN CN201210385829.9A patent/CN103729143A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS6042637A (en) * | 1983-08-19 | 1985-03-06 | Shimadzu Corp | Load-elongation curve recording device |
CN102148535A (en) * | 2010-11-15 | 2011-08-10 | 中国计量学院 | Intelligent instrument for managing household power utilization |
CN102306125A (en) * | 2011-08-17 | 2012-01-04 | 深圳市共进电子股份有限公司 | Method for erasing and writing data of FLASH memory |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104898989B (en) * | 2015-06-04 | 2018-10-19 | 宁波市江东精诚自动化设备有限公司 | A kind of Mass Data Storage Facility, method and device |
CN104898989A (en) * | 2015-06-04 | 2015-09-09 | 宁波市江东精诚自动化设备有限公司 | Large-volume data storage equipment, large-volume data storage method and large-volume data storage device |
CN108367154B (en) * | 2015-12-14 | 2021-10-29 | 美敦力公司 | Implantable medical device with scheme for managing data storage |
CN108367154A (en) * | 2015-12-14 | 2018-08-03 | 美敦力公司 | Implantable medical device with the scheme for managing data storage |
CN105606856A (en) * | 2015-12-21 | 2016-05-25 | 南昌市科陆智能电网科技有限公司 | Method for raising power meter system real-time response speed, system and power meter |
CN106408790A (en) * | 2016-08-26 | 2017-02-15 | 恒银金融科技股份有限公司 | Method for writing and reading log information of circulating machine core of financial equipment |
CN106408790B (en) * | 2016-08-26 | 2024-03-19 | 恒银金融科技股份有限公司 | Log information writing method and reading method for circulation movement of financial equipment |
CN107132996A (en) * | 2017-04-12 | 2017-09-05 | 杭州宏杉科技股份有限公司 | Storage method, module and the system configured based on Intelligent simple |
CN110164394A (en) * | 2019-06-04 | 2019-08-23 | 深圳市华星光电技术有限公司 | Sequence controller and timing control panel |
CN110164394B (en) * | 2019-06-04 | 2021-08-06 | Tcl华星光电技术有限公司 | Time sequence controller and time sequence control board |
CN114356792A (en) * | 2021-11-18 | 2022-04-15 | 国电南瑞三能电力仪表(南京)有限公司 | Electric energy meter frozen data storage method based on FLASH pre-erasing technology and electric energy meter |
CN114356792B (en) * | 2021-11-18 | 2023-03-10 | 国电南瑞三能电力仪表(南京)有限公司 | Electric energy meter frozen data storage method based on FLASH pre-erasing technology and electric energy meter |
CN115129257A (en) * | 2022-07-08 | 2022-09-30 | 深圳市正浩创新科技股份有限公司 | Data reading and writing method, electronic equipment and computer readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103729143A (en) | Data safety method for electric energy data storage of multi-path electricity meter | |
CN107168647B (en) | FLASH data read-write method and system | |
CN102841851B (en) | Flash memory management method and flash memory device | |
CN103164345B (en) | Data storage method after solid-state storage device encounters power failure | |
CN101446921B (en) | Dynamic storage method of Flash memory | |
CN103150125B (en) | Method for prolonging service life of power-down protection date buffer memory and smart card | |
CN104699413B (en) | Data management method, memory storage device and memory control circuit unit | |
CN201387448Y (en) | Multi-functional electric energy meter with high-reliability data storage function | |
CN101419841B (en) | A kind of FLASH memory erasing and writing method | |
CN104268095A (en) | Memory and data reading/ writing operation method based on memory | |
CN104820641A (en) | Method for reducing FLASH erasure frequency | |
CN102339254A (en) | Flash data storage method for intelligent electric energy meter | |
CN114356792B (en) | Electric energy meter frozen data storage method based on FLASH pre-erasing technology and electric energy meter | |
CN104317671A (en) | Power-down data storage and recovery algorithm prolonging service life of non-volatile memory | |
CN106940625A (en) | The date storage method of intelligent electric meter | |
CN102214143A (en) | Method and device for managing multilayer unit flash memory, and storage equipment | |
CN103294607A (en) | A storage management method | |
CN109521944A (en) | data storage device and data storage method | |
CN108365283A (en) | Device battery and unmanned plane | |
CN101625661B (en) | Data management method, storage system and controller for flash memory | |
CN103399520A (en) | Method and device for accessing power-failure data of PLC (Programmable Logic Controller) system | |
CN103544118B (en) | Memory storage device, its memory controller and data writing method | |
CN106155914A (en) | Method for maintaining entity storage comparison table and device using same | |
CN102147771B (en) | Method for finding storage position of firmware program of flash memory device | |
CN107544912A (en) | A kind of log recording method, loading method and its device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C02 | Deemed withdrawal of patent application after publication (patent law 2001) | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20140416 |