A metadata and timestamp-based flash intelligent storage method and system for electric energy meter data

By introducing a dual-zone separation storage structure of metadata and timestamps and a multi-sector management strategy in the electricity meter, the problems of extensive structural design, imperfect indexing and low abnormal recovery capability of electricity meter data storage are solved, and efficient data management and long-life storage are achieved.

CN120523639BActive Publication Date: 2025-10-10JIANGSU TONGCHI POWER AUTOMATION
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511023560.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-24
Publication Date
2025-10-10
Estimated Expiration
2045-07-24

AI Technical Summary

Technical Problem

Existing electricity meter data storage methods have problems such as crude structural design, imperfect data indexing, low abnormality recovery capability, and short storage life. Especially in the resource-constrained electricity meter environment, they lack data reliability, index traceability, and storage balance.

Method used

It adopts a dual-area separation storage structure based on metadata and timestamps, combined with a data block differentiation structure. Through the separation design of the metadata area and the data block area, it realizes the synchronous update of data block positioning and sector status, uses the wear factor to control sector switching, and adopts a three-stage recovery mechanism for data anomaly monitoring and index reconstruction.

Benefits of technology

It improves the reliability and index traceability of electricity meter data storage, extends the life of storage devices, improves data recovery efficiency and system abnormal fault tolerance, and reduces system deployment and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120523639B_ABST
    Figure CN120523639B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on metadata and timestamp electric energy meter data FLASH intelligent storage method and system, it is related to electric power automation technical field, including the double separation type storage structure based on metadata and data block distinction structure is constructed, organization index mapping and data block structure encapsulation;Through current storage data index, data block positioning is carried out, drive sector state and time boundary synchronous update;Residual space is judged by preset wear factor, based on multi-sector data storage management strategy triggers sector switching, asynchronous erasing target area;Based on abnormal start scene, three-stage recovery mechanism is used to carry out data anomaly monitoring and index reconstruction;The method disclosed in the application realizes the efficient storage of electric energy meter data, adaptive scheduling and abnormal self-recovery by constructing double separation type storage structure, introducing index redundancy and three-level recovery mechanism, and improves system stability and FLASH life.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of electric power automation technology, and in particular to a FLASH intelligent storage method and system for electric energy meter data based on metadata and timestamps. Background Art

[0002] With the widespread adoption of smart grids, the reliability, efficiency, and long-term stability of data stored in energy meters, key devices used to measure user electricity consumption, are becoming increasingly important. Accurately recording and preserving data over time is crucial not only for power companies to accurately calculate electricity bills but also for providing users with accurate electricity usage information, supporting the refined management and operation of the power system.

[0003] Currently, electricity meters commonly use EEPROM to store energy and other important data, employing a dual backup mechanism and CRC checksums to ensure data integrity. However, EEPROM has a limited erase / write lifespan (typically 1 million cycles) and a relatively small storage capacity, making it inadequate for high-frequency data storage. Limited by the meter's hardware resources and platform, file systems cannot be used for data management. Some researchers have used Flash as a backup medium to increase storage capacity to alleviate the storage shortage, but this has not fundamentally addressed the issues of irrational storage structures and inefficient data management. Regarding data recovery, some solutions employ simple backup strategies that lack auxiliary information such as timestamps, resulting in weak data traceability and recovery capabilities. This significantly reduces the effectiveness and efficiency of backup data in the face of complex sector damage and data anomalies. Regarding reliability, while regular testing of storage devices is implemented, the lack of dynamic adjustment and intelligent optimization mechanisms makes it difficult to adapt to the complex operating environments of electricity meters during long-term operation.

[0004] The extensive design of the storage structure in the existing technology lacks detailed metadata identification and compact data recording format, which directly leads to the waste of storage space. For example, when searching for data within a specific time period, due to the lack of an effective timestamp index, it is necessary to traverse a large amount of data, which is time-consuming and labor-intensive. The imperfect data recovery and reliability assurance mechanisms make it impossible to locate and repair problems in a timely and accurate manner when faced with sector damage or data anomalies. Without a sound verification system, it is difficult to detect errors in the data transmission and storage process. Once a problem occurs, the risk of data loss increases significantly. The lack of write protection and wear leveling causes storage devices to be damaged prematurely due to frequent erasure of some sectors. Unbalanced erase and write operations are concentrated in a few sectors, which accelerates the aging of these sectors and shortens the overall life of the storage device. Summary of the Invention

[0005] In view of the above-mentioned problems, the present invention is proposed.

[0006] Therefore, the technical problem solved by the present invention is: the existing electricity meter data storage method has the problems of rough structural design, imperfect data index, low abnormal recovery capability, and short storage life, and how to construct a FLASH intelligent storage mechanism with data reliability, index traceability and storage balance in a resource-constrained electricity meter environment.

[0007] In order to solve the above technical problems, the present invention provides the following technical solutions: a FLASH intelligent storage method for electric energy meter data based on metadata and timestamp, including constructing a dual-area separation storage structure based on metadata and data block differentiation structure, organizing index mapping and data block structure encapsulation; locating data blocks through the current stored data index, driving the synchronous update of sector status and time boundary; judging the remaining space by preset wear factor, triggering sector switching based on multi-sector data storage management strategy, and asynchronously erasing the target area; based on the abnormal startup scenario, adopting a three-stage recovery mechanism to perform data abnormality monitoring and index reconstruction; the dual-area separation storage structure includes setting a metadata area containing the current sector status, the earliest recorded timestamp of the current sector, the last recorded timestamp of the current sector and the data check field in the FLASH sector, adopting compressed timestamp and unique The invention provides a data block structure with a CRC checksum field; the data block structure encapsulation includes using a 4-byte UNIX timestamp format to replace the traditional 6-byte year-month-day hour-minute-second time structure, and embedding the compressed timestamp into the data block as a time identification field; the multi-sector data storage management strategy includes executing activation, shutdown and erase operations of the sector based on the sector status identification rules including the initial state, activation state and historical state, combined with the sector status of the current storage data index and metadata area; the preset wear factor includes triggering sector switching according to the space remaining rate of the current sector based on the multi-sector data storage management strategy, setting different wear factor values ​​for data storage of different frequencies, and controlling data distribution and write scheduling among multiple sectors; the three-stage recovery mechanism includes storage data index check fallback, sector metadata traversal reconstruction and binary search based on timestamp increment.

[0008] As a preferred solution of the FLASH intelligent storage method of electric energy meter data based on metadata and timestamp described in the present invention, the dual-area separation storage structure includes a metadata area for recording sector status information and a data block area for storing actual data blocks.

[0009] As a preferred solution of the FLASH intelligent storage method of electric energy meter data based on metadata and timestamp described in the present invention, the data block structure includes a timestamp field and a data check field in a compressed format, and the data blocks are stored in sequence in FLASH, with a fixed length of each data block.

[0010] As a preferred solution of the FLASH intelligent storage method of electric energy meter data based on metadata and timestamp described in the present invention, the data block positioning includes positioning the position of the currently written data block through the current stored data index, deducing the actual stored sector and sector offset address, and performing redundant backup of the current stored data index and storing it in the RAM area.

[0011] As a preferred solution of the metadata and timestamp-based FLASH intelligent storage method for electric energy meter data described in the present invention, the synchronous update of the sector status and time boundary includes writing the earliest record timestamp of the current sector when writing the first data block; writing the last record timestamp of the current sector when writing the last data block; and updating the sector status and data check field of the metadata area after the sector is full.

[0012] As a preferred solution of the FLASH intelligent storage method of electricity meter data based on metadata and timestamps described in the present invention, the sector switching includes, based on a preset wear factor, when the remaining space rate of the current sector is lower than the preset wear factor, using an asynchronous mechanism to pre-erase the next sector in the background and activate it as a new sector.

[0013] As a preferred solution of the metadata and timestamp-based FLASH intelligent storage method for electric energy meter data described in the present invention, the three-stage recovery mechanism includes primary recovery, secondary recovery, and tertiary recovery; primary recovery includes reading the stored data index and performing a CRC check. If the check fails, it falls back to the stored data index backup for alternative use; secondary recovery includes traversing all sector metadata, extracting sector status, timestamps, and check fields, screening legal sectors, sorting all timestamps of the current sector one by one, and establishing a timeline map to attempt recovery; tertiary recovery includes locating the data block position corresponding to the maximum valid timestamp using a binary search method based on the continuity characteristics of the data timestamp.

[0014] Another object of the present invention is to provide a FLASH intelligent storage system for electric energy meter data based on metadata and timestamps, which can solve the problems of low data positioning efficiency, large storage structure redundancy, and lack of effective abnormal recovery mechanism in current electric energy meter data storage technology by constructing a dual-zone separated storage structure and combining a joint management solution of sector metadata and compressed timestamps.

[0015] As a preferred solution of the metadata and timestamp-based FLASH intelligent storage system for electric meter data described in the present invention, it includes: a storage structure module, an index control module, a sector management module, and an abnormality recovery module; the storage structure module is used to construct a dual-area separated storage structure including a metadata area and a data block area, and encapsulate data blocks including compressed timestamps and check fields; the index control module is used to locate data blocks through storage data indexes, calculate actual storage sectors and sector offset addresses, maintain storage data index backups, and synchronously update sector status and time boundaries; the sector management module is used to control sector switching based on preset wear factors and multi-sector data storage management strategies, perform erase and activation operations, and schedule data writing in multiple intervals; the abnormality recovery module is used to sequentially perform storage data index check rollback, sector metadata traversal reconstruction, and binary search based on timestamp incrementation in abnormal scenarios to recover storage data indexes and data.

[0016] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement a step of a FLASH intelligent storage method for electric energy meter data based on metadata and timestamps.

[0017] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a FLASH intelligent storage method for electric energy meter data based on metadata and timestamps.

[0018] Beneficial effects of the present invention: The metadata and timestamp-based FLASH intelligent storage method for electric energy meter data provided by the present invention supports the storage of important data in different storage media by introducing a dual-zone separation storage structure, realizes data hierarchical management and redundant accommodation, and improves the storage reliability of the electric energy meter for multiple types of data; by constructing a multi-sector data storage management strategy based on sector status and wear factor, combined with the large capacity characteristics of FLASH, dynamic allocation and space balance control of high-frequency data writing are realized, thereby extending the storage life of the entire system; through the wear factor, the distribution behavior of data at different frequencies is realized, and a unified scheduling logic compatible with high-frequency writing and low-frequency archiving is realized, thereby enhancing the system's adaptability to multiple types of operating conditions; by optimizing write control, index update and data encapsulation methods, the dependence on high-performance hardware resources is reduced, and the overall operating efficiency is improved by cooperating with software strategies, thereby reducing system deployment and maintenance costs; by setting a three-level abnormal recovery mechanism, multi-path recovery means are realized in data abnormality or power outage scenarios, thereby improving the system's abnormal fault tolerance and data continuity guarantee level. The present invention achieves better results in storage reliability management, write scheduling control and abnormal recovery mechanism construction. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0020] Figure 1 This is an overall flow chart of a method for intelligent FLASH storage of electric energy meter data based on metadata and timestamps provided in Example 1 of the present invention.

[0021] Figure 2 This is a flow chart of a multi-sector data storage management strategy for a FLASH intelligent storage method of electric energy meter data based on metadata and timestamps provided in Example 2 of the present invention.

[0022] Figure 3 A flowchart of a three-stage recovery mechanism for a FLASH intelligent storage method for electric energy meter data based on metadata and timestamps provided in Example 2 of the present invention. DETAILED DESCRIPTION

[0023] To make the above-mentioned objects, features, and advantages of the present invention more clearly understood, the following detailed description of the specific embodiments of the present invention is given in conjunction with the accompanying drawings. It is obvious that the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in this field without creative work should fall within the scope of protection of the present invention.

[0024] Example 1, with reference to Figure 1-Figure 3 , as one embodiment of the present invention, provides a FLASH intelligent storage method for electric energy meter data based on metadata and timestamps, comprising:

[0025] S1: Construct a dual-partition separation storage structure based on metadata and data block differentiation structure, organize index mapping and data block structure encapsulation.

[0026] Furthermore, the dual-area separation type storage structure includes a metadata area for recording sector status information and a data block area for storing actual data blocks.

[0027] Furthermore, the metadata area is set at the sector header. MetaData (sector metadata) is used to identify the status of the current sector. A 16-byte metadata area is reserved at the front of each sector, including Sector_Status (current sector status), 4 bytes, of which 0xA5A5FFFF indicates that the sector is in the active state, indicating that the sector is currently being operated; 0xA5A5A5A5 indicates that the sector is in the inactive state, indicating that the sector is a historical operation sector, and the data is historical data; 0xFFFFFFFF indicates the initial state (erased state), and there is no data stored in the sector.

[0028] It should be noted that Start_Timestamp (earliest record timestamp of the previous sector) uses UNIX timestamp, 4 bytes, and is updated when the first record is written to the sector; End_Timestamp (last record timestamp of the current sector) uses 4 bytes to update the value when the last record is written, and needs to be updated when there is a storage sector switch; CheckSum (data checksum field) represents CRC16 checksum, 2 bytes, the checksum of the first 12 bytes of metadata, and the checksum is updated after the last data block is stored in the sector (CRC-16-CCITT polynomial check Sector_Status, Start_Timestam data and End_Timestamp).

[0029] It should be noted that the data block structure includes a compressed timestamp field and a data check field. The data blocks are stored in sequence in the FLASH, and the length of each data block is fixed.

[0030] It should be noted that the data block structure is used to store a single piece of data, which includes three parts: time stamp, data, and check code. The length of a single data block is defined as BlockLen.

[0031] FLASH stands for flash memory, which has long erase / write life and large capacity.

[0032] It should also be noted that the metadata area and data block area quickly distinguish the current life cycle status of each sector, so that the subsequent sector switching and recovery mechanism has time boundaries and status basis, providing boundary judgment for data time sorting, continuity analysis and recovery operations.

[0033] S2: Locate the data block through the current stored data index, and drive the synchronous update of sector status and time boundary.

[0034] Furthermore, data block positioning includes locating the location of the currently written data block through the currently stored data index, deducing and recording the actually stored sector and sector offset address, and making a redundant backup of the currently stored data index and storing it in the RAM area;

[0035] The actual stored sector is represented as Sector, and the sector offset address is represented as Offset.

[0036] Furthermore, redundant backup of the current stored data index includes PageIdxBak (storage data index backup) as a backup storage of PageIdx (storage data index, recording the index value of the current FLASH storage location) in RAM (volatile storage space). When PageIdx is updated, PageIdxBak is updated synchronously. When PageIdxBak = PageIdx, the two are stored independently, both with CRC check (cyclic redundancy check, used to verify data integrity), and are updated synchronously during writing to facilitate power failure or abnormal recovery.

[0037] It should be noted that the synchronous update of sector status and time boundary includes writing the earliest record timestamp of the current sector when writing the first data block; writing the last record timestamp of the current sector when writing the last data block; and updating the sector status and data check field of the metadata area after the sector is full.

[0038] It should also be noted that the sector offset address calculation formula is expressed as:

[0039] ;

[0040] in, Indicates the physical write address of the current data block in FLASH. Indicates the starting address of the current sector, indicating the starting physical address of the sector in FLASH. Indicates the total capacity of a single sector (unit: bytes), including metadata area and data block area. Indicates the preset wear factor, which is defined by the user. Indicates the current storage data index, Indicates the length of a single data block. Indicates the total number of FLASH sectors configured in the system.

[0041] It should also be noted that the precise positioning of data blocks is achieved through the global index based on PageIdx, and the index values ​​are redundantly backed up and verified, which improves the data consistency and reliability during the writing process; the sector status identification and time boundary information are synchronously updated while writing data, realizing the linkage control of data writing and sector life cycle management, facilitating subsequent abnormal recovery and sector scheduling, thereby improving the system's self-management capabilities and operational stability.

[0042] S3: The remaining space is determined based on the preset wear factor, sector switching is triggered based on the multi-sector data storage management strategy, and the target area is asynchronously erased.

[0043] Furthermore, the sector switching includes, based on a preset wear factor, using an asynchronous mechanism to pre-erase the next sector in the background and activate it as a new sector when the remaining space ratio of the current sector is lower than the preset wear factor.

[0044] It should be noted that the asynchronous mechanism includes completing it through background asynchronous tasks without blocking the foreground write operation. Each time a write is required, the actual storage address of the current data in the sector is calculated according to PageIdx and the sector offset address. After the data is successfully stored, PageIdx needs to be updated, which is expressed as:

[0045] ;

[0046] ;

[0047] in, Indicates the updated storage data index, Indicates the current storage data index, Indicates the total number of FLASH sectors configured in the system. Indicates the number of data blocks that can be accommodated in each FLASH sector. Indicates the total capacity of a single sector (unit: bytes), including metadata area and data block area. Indicates the size of the metadata area in the sector used to record status and timestamps, usually 16 bytes. Indicates the length of a single data block. After the next sector is erased, it is automatically set to the "active state" and the Start_Timestamp field is initialized, ready to accept data writing. The current sector is marked as "inactive".

[0048] It should also be noted that the multi-sector data storage management strategy includes, after receiving new data, dynamic judgment is made in combination with the current PageIdx index and metadata area status, first locating the target sector through the storage data index, and if it is in the initial state, it is activated as the current write area. After it is full, it is updated to the historical state and the time boundary and check field are written; the remaining space of the sector is determined by setting the wear factor, and when it is lower than the threshold, it is asynchronously erased and the next sector is activated to ensure that data is continuously written, dynamically switched and evenly distributed among multiple sectors, effectively improving the write efficiency and life management capabilities of FLASH.

[0049] It should also be noted that by dynamically determining the remaining space in the sector through a preset wear factor, and combining multi-sector status scheduling with an asynchronous erase mechanism, automatic sector switching and background space recovery are achieved during the writing process, thereby improving writing efficiency and FLASH service life, and solving the problems of concentrated sector wear and write blocking in traditional solutions. It has strong scheduling flexibility and innovation.

[0050] S4: Based on the abnormal startup scenario, a three-stage recovery mechanism is used to monitor data anomalies and rebuild indexes.

[0051] Furthermore, the three-stage recovery mechanism includes primary recovery, secondary recovery, and tertiary recovery; primary recovery includes reading the stored data index and performing a CRC check. If the check fails, it will fall back to the stored data index backup for alternative use; secondary recovery includes traversing all sector metadata, extracting sector status, timestamps, and check fields, screening legal sectors, and sorting all timestamps of the current sector one by one to establish a timeline map for recovery attempts; tertiary recovery includes, based on the continuity characteristics of data timestamps, using a binary search method to locate the data block position corresponding to the maximum valid timestamp.

[0052] It should be noted that when entering the three-stage recovery mechanism, when PageIdx falls back to PageIdxBak after the first-level recovery, if PageIdxBak passes the verification, the index recovery is completed and the system operates normally, otherwise it enters the second-level recovery process; after entering the second-level recovery, a timeline graph is constructed, and the PageIdx and PageIdxBak indexes are rebuilt. If the recovery fails, the third-level recovery process is entered; when entering the third-level recovery, the current time of the meter is used as the maximum end point of the binary search, the data block position corresponding to the maximum valid timestamp is located, and the PageIdx and PageIdxBak indexes are rebuilt, and the system can return to normal.

[0053] It should also be noted that the entire recovery process is regularly executed by the electricity meter abnormality recovery module, which is used to automatically repair abnormal situations at system startup or during operation, realizing hierarchical adaptive repair of the system in scenarios with different degrees of data damage, improving the index reconstruction capability and data continuity guarantee level of the electricity meter in abnormal situations such as power outages and index loss, and effectively enhancing the stability and operational reliability of the system.

[0054] Example 2 is an embodiment of the present invention, which provides an electric energy meter data FLASH intelligent storage system based on metadata and timestamp, including a storage structure module, an index control module, a sector management module, and an abnormality recovery module.

[0055] The storage structure module includes a metadata processing submodule, a data block structure submodule, and a structure separation mapping submodule.

[0056] It should be noted that the metadata processing submodule is used to record the status information of each FLASH sector, including the current sector status, the earliest recorded timestamp of the current sector, the last recorded timestamp of the current sector and the data check field; the data block structure submodule is used to encapsulate each collected data, including the timestamp field and data check field in compressed format; the structure separation mapping submodule is used to partition the metadata and data blocks to ensure that the metadata is stored independently in the sector header for quick access and status judgment.

[0057] It should also be noted that through standardized structural formats and compressed field design, the metadata and data blocks are separated and encapsulated, which improves data access efficiency and optimizes FLASH storage space utilization, forming the key basis for distinguishing the present invention from the existing EEPROM storage structure (electrically erasable programmable read-only memory, used for storing data).

[0058] The index control module includes a main index submodule, a backup index submodule, and a CRC check submodule.

[0059] It should be noted that the main index submodule is used to: record the storage data index of the currently written data block, and calculate its corresponding sector storage data index and sector offset address; the backup index submodule is used as a real-time redundant copy of the main index, which is independently stored in RAM and comes with a CRC check value to ensure that the system can still restore the index under abnormal circumstances; the CRC check submodule is used to perform cyclic redundancy check on the index data, and trigger the recovery process when the check fails.

[0060] It should also be noted that both the main index submodule and the backup index submodule are stored in RAM and updated in real time. The design of separation of primary and backup and mutual redundancy improves the reliability of the index and constitutes the entry point of the abnormal recovery mechanism. The index control module is linked with the storage structure module to ensure the accuracy of the data write address and form a closed loop with the abnormal recovery module. When index damage is detected, it can quickly roll back or guide reconstruction.

[0061] The sector management module includes a sector status switching submodule, a wear factor control submodule, and an asynchronous erase control submodule.

[0062] It should be noted that the sector status switching submodule is used to maintain the status switching of each sector, including switching between the initial state, activation state, and historical state; the wear factor control submodule dynamically evaluates the remaining space after each sector is written based on the wear factor set by the user, and triggers the sector status switching submodule when the remaining rate is lower than the threshold; the asynchronous erase control submodule is used to pre-erase the next sector in the background and activate the new sector to achieve dynamic switching without interruption of writing.

[0063] It should also be noted that the sector management module performs sector management based on both time and space dimensions, dynamically switches between the active state and the erased state, and cooperates with the wear factor strategy to achieve balanced data distribution and improve the FLASH life.

[0064] The abnormal recovery module includes an index rollback submodule, a metadata guidance submodule, and a binary search submodule.

[0065] It should be noted that the index fallback submodule is used to read PageIdx. If the CRC check fails, it falls back to PageIdxBak as the main index; the data guidance submodule is used to traverse the metadata of all sectors, screen legal sectors, and build a timeline map to try to restore the index; the binary search submodule is used to use the timestamp continuity feature and use the binary search method to locate the data block position corresponding to the maximum valid timestamp, and rebuild the index mapping table.

[0066] It should also be noted that the abnormality recovery module performs graded recovery based on the degree of error, gradually increasing the complexity to form a complete mechanism of self-checking, self-guiding, and self-recovery, which can effectively deal with storage abnormalities, power failures, or index damage and other failure situations.

Claims

1. A method for intelligent FLASH storage of electric energy meter data based on metadata and timestamp, characterized in that: include: Construct a dual-area separation storage structure based on metadata and data block differentiation structure, organize index mapping and data block structure encapsulation; The data block is located through the current stored data index, and the sector status and time boundary are synchronously updated; The preset wear factor is used to determine the remaining space, trigger sector switching based on the multi-sector data storage management strategy, and asynchronously erase the target area; Based on abnormal startup scenarios, a three-stage recovery mechanism is used to monitor data anomalies and rebuild indexes; The dual-area separation storage structure includes setting a metadata area containing the current sector status, the earliest recorded timestamp of the current sector, the latest recorded timestamp of the current sector and a data check field in the FLASH sector, and adopting a data block structure with a compressed timestamp and an independent CRC check field; The data block structure encapsulation includes using a 4-byte UNIX timestamp format to replace the traditional 6-byte year-month-day hour-minute-second time structure, and embedding the compressed timestamp into the data block as a time identification field; Multi-sector data storage management strategies include sector activation, deactivation, and erasure operations based on sector status identification rules, including initial, activated, and historical states, combined with the current stored data index and the sector status of the metadata area; The preset wear factor includes, based on the multi-sector data storage management strategy, triggering sector switching according to the space remaining ratio of the current sector, setting different wear factor values ​​for data storage of different frequencies, and controlling data distribution and write scheduling among multiple sectors; The three-stage recovery mechanism includes storing data index verification and fallback, traversing all sector metadata, extracting sector status, timestamps and verification fields, screening legal sectors, sorting all timestamps of the current sector one by one to establish a timeline map for recovery attempts, and based on the continuity characteristics of data timestamps, using binary search to locate the data block position corresponding to the maximum valid timestamp.

2. The method for intelligent FLASH storage of electric energy meter data based on metadata and timestamps according to claim 1, characterized in that: The dual-area separation type storage structure includes: The metadata area is used to record sector status information and the data block area is used to store actual data blocks.

3. The method for intelligent FLASH storage of electric energy meter data based on metadata and timestamps according to claim 2, characterized in that: The data block structure includes: The compressed timestamp field and data check field are stored in sequence in FLASH, and the length of each data block is fixed.

4. The method for intelligent FLASH storage of electric energy meter data based on metadata and timestamps according to claim 3, characterized in that: The data block positioning includes: The current stored data index is completed to locate the position of the currently written data block, and the actual stored sector and sector offset address are recorded. The current stored data index is redundantly backed up and stored in the RAM area.

5. The method for intelligent FLASH storage of electric energy meter data based on metadata and timestamps according to claim 4, characterized in that: The sector status and time boundary synchronization update includes: When writing the first data block, write the earliest record timestamp of the current sector; When writing the last data block, write the last recorded timestamp of the current sector; After the sector is fully written, the sector status and data check field in the metadata area are updated.

6. The method for intelligent FLASH storage of electric energy meter data based on metadata and timestamps according to claim 5, characterized in that: The sector switching includes: Based on the preset wear factor, when the remaining space ratio of the current sector is lower than the preset wear factor, an asynchronous mechanism is used to pre-erase the next sector in the background and activate it as a new sector.

7. The method for intelligent FLASH storage of electric energy meter data based on metadata and timestamps according to claim 6, characterized in that: The three-stage recovery mechanism includes: First level recovery, second level recovery, third level recovery; Level 1 recovery includes reading the stored data index and performing a CRC check. If the check fails, it will fall back to the stored data index backup for alternative use.

8. A FLASH intelligent storage system for electric energy meter data based on metadata and timestamps, adopting the FLASH intelligent storage method for electric energy meter data based on metadata and timestamps according to any one of claims 1 to 7, characterized in that: Including storage structure module, index control module, sector management module, abnormal recovery module; The storage structure module is used to construct a dual-area separation storage structure including a metadata area and a data block area, and encapsulate data blocks including a compressed timestamp and a checksum field; The index control module is used to locate data blocks through storage data indexes, calculate actual storage sectors and sector offset addresses, maintain storage data index backups, and synchronously update sector status and time boundaries; The sector management module is used to control sector switching based on a preset wear factor and a multi-sector data storage management policy, perform erase and activate operations, and schedule data writing between multiple sectors; The abnormality recovery module is used to sequentially perform storage data index check rollback, sector metadata traversal reconstruction, and binary search based on timestamp incrementation in abnormal scenarios to recover storage data index and data.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the FLASH intelligent storage method of electric energy meter data based on metadata and timestamps according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the FLASH intelligent storage method of electric energy meter data based on metadata and timestamps according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Storage space management method of Flash memory and data read-write system

    CN117194279A

  • Accessing compressed computer memory

    US20220012184A1