Electric energy meter frozen data storage method and device and intelligent electric energy meter
By adopting a dual-media storage collaborative architecture and a method of dynamically segmenting frozen storage files, the problem of low data storage efficiency in smart meters is solved, achieving efficient frozen data management and ensuring the normal operation of the system.
Patent Information
- Application Number
- CN202511234949.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-01
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2045-09-01
AI Technical Summary
In smart meters, the freezing of data storage causes prolonged system lag due to file overwrite operations, affecting normal operation. Existing technologies struggle to efficiently manage frozen data storage.
A dual-media storage collaborative architecture is adopted, utilizing EEPROM to store file feature description set record blocks and FLASH to store frozen data. Frozen storage files are constructed through dynamic segmentation and frozen types to achieve efficient storage of frozen data.
This improves the efficiency of frozen data storage, avoids the impact of freezing tasks on other program tasks, and ensures the normal operation of the electricity meter.
Smart Images

Figure CN120723724B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of smart meters, and particularly relates to a method and device for storing frozen data of an electric energy meter and a smart electric energy meter. BACKGROUND
[0002] With the continuous evolution of smart electric energy meter technology, a new generation of smart electric energy meter integrates a unified standardized operating system, and a standardized file system architecture is adopted in the internal FLASH storage area of the new generation of smart electric energy meter. Under this architecture, the frozen data collected by the electric energy meter is stored in the form of an independent file in the file system.
[0003] In the process of continuous operation of the electric energy meter and continuous generation of frozen data, if the number of data reaches or exceeds the maximum capacity limit of the storage system, the application program starts a cyclic overwrite file mechanism. However, in actual operation, if the overwrite operation occurs at the file header position, the system underlying layer needs to move or rewrite a large amount of original data every time new frozen data is written. This process is extremely time-consuming, and the electric energy meter often gets stuck in the frozen task execution phase for a long time, which cannot respond to other program tasks in time, and affects the normal operation of the overall function of the electric energy meter.
[0004] Therefore, there is an urgent need for an electric energy meter frozen data storage method, device and smart electric energy meter to solve the above problems. SUMMARY
[0005] In view of the problems in the prior art, the present application provides an electric energy meter frozen data storage method, device and smart electric energy meter.
[0006] The present application provides an electric energy meter frozen data storage method, comprising:
[0007] According to the frozen type of the target frozen data to be stored, a target file feature description set record block corresponding to the target frozen data is determined from a plurality of file feature description set record blocks, wherein the plurality of file feature description set record blocks are stored in a first storage medium;
[0008] According to the current frozen storage information of each frozen storage file recorded in the target file feature description set record block, a target frozen storage file corresponding to the target frozen data and storage location information of the target frozen data in the target frozen storage file are determined, wherein each frozen storage file is constructed based on the frozen type and is used to store frozen data generated by the electric energy meter; and the frozen storage file is stored in a second storage medium;
[0009] When it is determined that the frozen storage file marked as time-expired in the target file feature description set record block has been deleted or the time-expired frozen storage file does not exist in the target file feature description set record block, the target frozen data is written into the target frozen storage file according to the storage location information, and the target file feature description set record block is updated according to the storage result of the target frozen data.
[0010] According to the power meter frozen data storage method provided by the application, the method further comprises:
[0011] Based on the frozen data record byte length and the frozen storage depth corresponding to each frozen type, a plurality of frozen storage files corresponding to each frozen type are constructed in the second storage medium.
[0012] Based on the plurality of frozen storage files, a frozen file set of each frozen type is constructed.
[0013] The frozen data record byte length represents the maximum byte length occupied by a single frozen data; the frozen storage depth represents the maximum number of frozen data corresponding to the frozen type stored in the second storage medium; the maximum storage number of the frozen storage file is determined according to the total number of the frozen storage file and the frozen storage depth; and the frozen type at least includes a minute frozen type, an hour frozen type, a day frozen type and a month frozen type.
[0014] According to the power meter frozen data storage method provided by the application, the file feature description set record block is constructed by the following steps:
[0015] Based on the number of recorded frozen data in the frozen storage file, the frozen serial number of the first frozen data record, the frozen time of the first frozen data record, the frozen serial number of the last frozen data record and the frozen time of the last frozen data record, a frozen storage file feature description content is constructed.
[0016] acquire storage file flag information, storage file record frozen serial number, storage file record frozen time and frozen storage file total number in the frozen file set, wherein the storage file flag information represents a flag serial number corresponding to the frozen storage file currently used for storing frozen data in the frozen file set, and a plurality of the frozen storage files in the frozen file set are arranged in order of flag serial number; the storage file record frozen serial number represents a frozen serial number corresponding to the frozen data that has been recorded in the frozen storage file currently used for storing frozen data, and the frozen data that has been recorded in the frozen storage file is arranged in order of frozen serial number; and the storage file record frozen time represents a frozen time corresponding to the frozen data that has been recorded in the frozen storage file currently used for storing frozen data;
[0017] According to the storage file flag information, the storage file record frozen serial number, the storage file record frozen time, the frozen storage file total number, the file maximum storage number and the frozen storage file characteristic description content, a file characteristic description set record block corresponding to each frozen type is constructed.
[0018] According to the present application, a frozen data storage method of an electric energy meter is provided, and the frozen storage information at least includes the storage file flag information and the storage file record frozen serial number.
[0019] According to the current frozen storage information of each frozen storage file recorded in the target file characteristic description set record block, the storage location information of the target frozen data in the target frozen storage file is determined, including:
[0020] According to the storage file flag information, the target frozen storage file corresponding to the target frozen data is determined, and according to the storage file record frozen serial number, the storage location information of the target frozen data in the target frozen storage file is determined.
[0021] According to the present application, a frozen data storage method of an electric energy meter is provided, and when it is determined that the frozen storage file marked as time-expired in the target file characteristic description set record block has been deleted or the time-expired frozen storage file does not exist in the target file characteristic description set record block, the target frozen data is written into the target frozen storage file according to the storage location information, and the target file characteristic description set record block is updated according to the storage result of the target frozen data, including:
[0022] If the target frozen storage file is other frozen storage file except the last frozen storage file in the frozen file set, it is determined that the time-expired frozen storage file does not exist in the target file characteristic description set record block.
[0023] If the target frozen storage file is the last frozen storage file in the frozen file set, the first frozen storage file in the target file feature description set record block is deleted as the time-expired frozen storage file;
[0024] When it is determined that the time-expired frozen storage file in the target file feature description set record block has been deleted or the time-expired frozen storage file does not exist in the target file feature description set record block, the target frozen data is written into the target frozen storage file according to a next storage file record frozen serial number corresponding to the storage file record frozen serial number, and after it is determined that the writing is successful, the target file feature description set record block is updated according to the next storage file record frozen serial number.
[0025] According to the method, the target frozen data is written into the target frozen storage file according to the next storage file record frozen serial number corresponding to the storage file record frozen serial number.
[0026] When it is determined that the time-expired frozen storage file in the target file feature description set record block has been deleted or the time-expired frozen storage file does not exist in the target file feature description set record block, and the number of frozen data currently stored in the target frozen storage file has reached the maximum storage number of the file, the target frozen storage file is switched to a next frozen storage file according to the storage file flag information, and the target frozen data is written into the next frozen storage file, and after it is determined that the writing is successful, the target file feature description set record block is updated according to the flag serial number corresponding to the next frozen storage file.
[0027] According to the method, the target frozen data is written into the target frozen storage file according to the next storage file record frozen serial number corresponding to the storage file record frozen serial number.
[0028] The multi-dimensional navigation index information includes at least one or more of frozen type identification information, a frozen scheme number, a frozen time, a frozen serial number, the first N frozen serial numbers, and the first Nth frozen serial number.
[0029] According to the multi-dimensional navigation index information and the file feature description set record block, corresponding frozen data is acquired from the frozen storage file in the frozen file set.
[0030] The application further provides an electric energy meter frozen data storage device, which comprises:
[0031] a file feature description set record block obtaining module, configured to determine a target file feature description set record block corresponding to the target frozen data from a plurality of file feature description set record blocks according to a frozen type of the target frozen data to be stored, wherein the plurality of file feature description set record blocks are stored in a first storage medium;
[0032] a storage location positioning module, configured to determine a target frozen storage file corresponding to the target frozen data and storage location information of the target frozen data in the target frozen storage file according to current frozen storage information of each frozen storage file recorded in the target file feature description set record block, wherein each frozen storage file is constructed based on the frozen type and is used to store frozen data generated by an electric energy meter; and the frozen storage file is stored in a second storage medium;
[0033] a frozen data storage module, configured to write the target frozen data into the target frozen storage file according to the storage location information when it is determined that a frozen storage file marked as time-expired in the target file feature description set record block has been deleted or the time-expired frozen storage file does not exist in the target file feature description set record block, and update the target file feature description set record block according to a storage result of the target frozen data.
[0034] The application further provides an intelligent electric energy meter comprising the electric energy meter frozen data storage device.
[0035] The electric energy meter frozen data storage method, device and intelligent electric energy meter provided by the application determine a target record block corresponding to the target record block from a plurality of file feature description set record blocks in a first storage medium through the frozen type of the target frozen data to be stored, determine a target frozen storage file in a second storage medium based on frozen storage information in the target record block, write the target frozen data into the target frozen storage file and update the target record block if a frozen storage file marked as time-expired in the target record block has been deleted or does not exist, so that the storage efficiency of the frozen data is effectively improved through a dual-storage-medium architecture. BRIEF DESCRIPTION OF DRAWINGS
[0036] In order to more clearly illustrate the technical solutions of the application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are some embodiments of the application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.
[0037] Figure 1 a flowchart of the electric energy meter frozen data storage method provided by the application;
[0038] Figure 2 A flowchart of a freezing data storage initialization process provided by the present application is shown in Figure 1.
[0039] Figure 3 A flowchart of a freezing data storage process provided by the present application is shown in Figure 2.
[0040] Figure 4 A structural diagram of a freezing data storage device for an electric energy meter provided by the present application is shown in Figure 3.
[0041] Figure 5 A structural diagram of a smart electric energy meter provided by the present application is shown in Figure 4.
[0042] Figure 6 A structural diagram of an electronic device provided by the present application is shown in Figure 5. DETAILED DESCRIPTION
[0043] In order to make the objectives, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be described clearly and completely below with reference to the drawings in the present application. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0044] Traditional electric energy meters directly use FLASH storage, and need to consider problems such as erasing and writing and load balancing, and the storage implementation is relatively complex, and is not suitable for smart electric energy meters with operating systems and file systems.
[0045] With the continuous development of smart electric energy meters, a new generation of smart electric energy meters are equipped with a unified operating system, and the FLASH storage area therein also uses a unified file system, and the electric energy meter freezing data exists in the file system in the form of files.
[0046] When the number of freezing data gradually increases and exceeds the maximum storage depth, the usual practice is to cyclically overwrite the files. If the file is overwritten at the head, it will take a long time to write a freezing data, especially for the freezing type of minute freezing with 8 sets of storage scheme, plus other freezing types of hour freezing, day freezing and month freezing, when the electric energy meter performs freezing task at the end of the month, the freezing data will be stuck in the freezing task for a long time, affecting the normal operation of other tasks of the program.
[0047] In view of the problems in the prior art, the application adopts a dual-medium storage cooperative architecture and a clustered file storage algorithm to provide an electric energy meter frozen data storage method, which can improve the efficiency and accuracy of executing a frozen task to store frozen data when the number of electric energy meter frozen data is large and has reached the maximum storage depth, thereby not affecting the normal operation of other tasks of the program.
[0048] Figure 1 A flowchart of the electric energy meter frozen data storage method provided by the application is shown in FIG. 1. Figure 1 The application provides an electric energy meter frozen data storage method, which comprises the following steps:
[0049] In step 101, a target file feature description set record block corresponding to target frozen data is determined from a plurality of file feature description set record blocks according to the frozen type of the target frozen data to be stored, wherein the plurality of file feature description set record blocks are stored in a first storage medium.
[0050] In the application, the target frozen data is frozen data to be stored, which has different frozen types, such as data frozen by minute, data frozen by hour or data frozen by day.
[0051] The first storage medium is used to store a plurality of file feature description set record blocks. The application takes EEPROM as an example. EEPROM is a non-volatile memory that can keep stored data even after power failure. It can be erased and rewritten through electrical signals and has the advantages of high data reliability and multiple programming. It is often used to store some configuration parameters and a small amount of critical data. In addition to EEPROM, the first storage medium can also be a ferroelectric random access memory (FRAM), which combines the high-speed reading and writing of RAM and the non-volatile characteristics of ROM, has fast reading and writing speed and low power consumption, and can quickly respond to data storage requirements. It can also be a magnetoresistive random access memory (MRAM), which stores data based on the characteristics of magnetic materials and has the advantages of non-volatility, high speed and low power consumption, and is also suitable as a medium for storing file feature description set record blocks.
[0052] The application screens a target file feature description set record block corresponding to the frozen type of the target frozen data from a plurality of file feature description set record blocks in the first storage medium. The target file feature description set record block is stored in the first storage medium (such as EEPROM) and needs to be updated synchronously when the frozen data is stored. The main function is to record the basic information, features and current frozen storage state of each frozen data storage element, and to provide basic data for the subsequent storage process of the frozen data.
[0053] In step 102, according to the current frozen storage information of each frozen storage file recorded in the target file feature description set record block, the target frozen storage file corresponding to the target frozen data and the storage location information of the target frozen data in the target frozen storage file are determined, wherein each frozen storage file is constructed based on the frozen type and is used for storing frozen data generated by an electric energy meter; and the frozen storage file is stored in a second storage medium.
[0054] In the present application, when the target file feature description set record block is determined, the specific storage location is determined according to the information recorded in the target file feature description set record block.
[0055] The current frozen storage information of each frozen storage file is recorded in the target file feature description set record block, and the information includes but is not limited to the file remaining space size, the stored data amount and the frozen time.
[0056] In the present application, the frozen storage file is constructed based on the frozen type, and the frozen data of different frozen types is stored in different frozen storage files, for example, the minute frozen data is stored in a frozen storage file specially designed for minute freezing, and the hour frozen data is stored in a frozen storage file corresponding to the hour freezing. These frozen storage files are stored in a second storage medium. In the present application, FLASH is taken as an example, and FLASH has the characteristics of large capacity and low cost, and is suitable for storing a large amount of data.
[0057] In addition to FLASH, the second storage medium in the present application can also be a solid state disk (SSD). The SSD uses a flash memory chip as a storage medium, has high reading and writing speed and good shock resistance, and can quickly store and read a large amount of frozen data.
[0058] Further, according to the information in the target file feature description set record block, the target frozen storage file corresponding to the target frozen data and the specific storage location information in the target frozen storage file are determined, so as to quickly locate the required storage related information in the subsequent frozen data writing process.
[0059] In step 103, when it is determined that the frozen storage file marked as time expired in the target file feature description set record block has been deleted or the frozen storage file marked as time expired does not exist in the target file feature description set record block, the target frozen data is written into the target frozen storage file according to the storage location information, and the target file feature description set record block is updated according to the storage result of the target frozen data.
[0060] In the present application, a plurality of frozen storage files of the same frozen type constitute a frozen file set, the plurality of frozen storage files in the frozen file set are marked with a corresponding storage arrangement order (corresponding to a flag sequence number), and the stored frozen data in each frozen storage file is marked with a corresponding frozen sequence number.
[0061] In an embodiment, when storing a piece of daily frozen data into a frozen file set of a certain frozen type, after reading out the file feature description set record block from the EEPROM, it is determined that the frozen storage file (i.e. the target frozen storage file) currently used for storing data has never stored frozen data according to the fact that the current record frozen sequence number and the current record frozen time are both 0; and the frozen storage file currently used for storing data is not the last frozen storage file in the frozen file set (determined by the flag sequence number of the frozen storage file), that is, there is no expired frozen storage file in the target file feature description set record block, so there is no old data to be cleaned up at this time.
[0062] When the frozen data starts to be stored in the last frozen storage file, according to the information such as the maximum storage depth and the maximum number of files in the frozen file set, it is determined that the first frozen storage file A1 (i.e. the flag sequence number corresponding to the frozen storage file) in the frozen file set is an expired file, and it is determined that the deletion operation is to be performed on the frozen storage file A1.
[0063] Further, after the newly generated frozen data is successfully stored in the frozen storage file, the record frozen sequence number and time in the file feature description set record block can be updated according to the frozen sequence number and frozen time of the newly generated frozen data, and the frozen storage file feature description table can be updated, such as recording the related feature information of the file that has stored data, so as to accurately manage and query the frozen data in the file subsequently.
[0064] Further, after the data writing and record block updating are completed, it is determined whether the frozen data written into the target frozen storage file reaches the maximum storage number. If the maximum storage number is reached, the file storage flag is switched to the next file (for example, from the frozen storage file A1 to the frozen storage file A2). Finally, the updated file feature description set record block is stored in the EEPROM, ensuring the persistence of the data storage state, so that the relevant information can be accurately obtained when data is stored next time.
[0065] The application provides a frozen data storage method of an electric energy meter, which comprises the following steps: determining a target record block from a plurality of file characteristic description set record blocks in a first storage medium according to a frozen type of target frozen data to be stored; determining a target frozen storage file in a second storage medium based on frozen storage information in the target record block; and writing the target frozen data into the target frozen storage file and updating the target record block if a frozen storage file marked as time-expired in the target record block has been deleted or does not exist, so that the storage efficiency of the frozen data is effectively improved through a dual storage medium architecture.
[0066] On the basis of the above-mentioned embodiment, the method further comprises:
[0067] constructing a plurality of frozen storage files corresponding to each frozen type in the second storage medium based on the frozen data record byte length and the frozen storage depth corresponding to each frozen type;
[0068] constructing a frozen file set of each frozen type according to the plurality of frozen storage files;
[0069] The frozen data record byte length represents the maximum byte length occupied by a single piece of frozen data; the frozen storage depth represents the maximum number of frozen data corresponding to the frozen type stored in the second storage medium; the maximum storage number of the frozen storage file is determined according to the total number of the frozen storage file and the frozen storage depth; and the frozen type at least includes a minute frozen type, an hour frozen type, a day frozen type and a month frozen type.
[0070] In the application, the frozen data record byte length represents the maximum byte length occupied by a single piece of frozen data. For example, in an electric energy meter, a piece of minute frozen data may contain multiple parameters such as voltage, current and power, and the total byte length occupied by these parameters after encoding conversion is the frozen data record byte length. Assuming that the frozen data record byte length of a piece of minute frozen data is 100 bytes, it means that 100 bytes of space in the storage medium will be occupied for storing a piece of minute frozen data.
[0071] The frozen storage depth represents the maximum number of frozen data corresponding to a certain frozen type stored in the second storage medium (such as FLASH), and reflects the total amount of frozen data of the frozen type that can be accommodated by the storage medium. For example, the frozen storage depth of the minute frozen type is set to 10000, which means that the storage medium can store at most 10000 pieces of minute frozen data of the frozen type.
[0072] In the present application, the file splitting coefficient is determined according to the freezing type, freezing data record byte length, freezing storage depth, etc. to achieve dynamic splitting. Different freezing types of data have different generation frequencies and importance, so the storage space needs to be reasonably allocated. For example, minute freezing data has a high generation frequency and a relatively large data volume, which may require more storage files for distributed storage; while daily freezing data has a low generation frequency and a relatively small data volume, so the number of storage files can be less.
[0073] After dynamic splitting, the number of split files for each freezing type is different, for example, the number of minute freezing files is 5, the number of hour freezing files is 3, and the number of daily freezing files is 2, etc., so as to more efficiently utilize the storage space and facilitate data management and query.
[0074] Further, in the second storage medium, according to the dynamic splitting result, a plurality of freezing storage files corresponding to each freezing type are constructed, for example, for the minute freezing type, 5 freezing storage files are constructed for storing minute freezing data generated in different time periods.
[0075] In the present application, in order to facilitate management and distinguish different freezing storage files, each type of file after splitting needs to be identified. In a freezing file set, the file mark of the first freezing storage file is A1, the file mark of the second file is A2, and the file mark of the nth file is An, and so on. For example, the 5 files of the minute freezing type are marked as A1, A2, A3, A4 and A5 respectively.
[0076] Further, according to the plurality of freezing storage files, a freezing file set of each freezing type is constructed. For example, the 5 files of the minute freezing type are combined together to form a freezing file set of the minute freezing type; the 3 files of the hour freezing type are combined together to form a freezing file set of the hour freezing type, and each freezing type has a corresponding freezing file set.
[0077] In the present application, the maximum storage number of the freezing storage file is determined according to the total number of freezing storage files and the freezing storage depth. For a certain freezing type, the calculation formula of the maximum storage number of the file is: maximum storage number of the file = freezing storage depth / (total number of freezing storage files-1)+2. Assuming that the freezing storage depth of the minute freezing type is 10000 and the number of minute freezing files is 5, then the maximum storage number of the file of this freezing type = 10000 / (5-1)+2 = 2500+2 = 2502, which means that the freezing storage file of the minute freezing type can store up to 2502 freezing data. Through this calculation method, the storage space can be reasonably allocated to ensure that each file has sufficient capacity to store data, while avoiding the situation that the storage space of a certain file is insufficient while the storage space of other files is wasted.
[0078] In the present application, when the electric energy meter freezes parameter changes, data initialization or new table initialization, the file feature description set record block is restored to the initial value. At this time, the current storage file flag is A1, indicating that the data is stored from the first file; the current record freezing serial number and time are both 0, indicating that no frozen data has been stored; the maximum number of file storage is determined according to the above-mentioned calculation formula of the maximum number of file storage; the freezing storage file feature description table content is 0, which is used to record the feature information of each freezing storage file, such as the amount of stored data and the latest storage time, so as to ensure that the data storage system can start from zero and accurately record and manage the frozen data after initialization.
[0079] On the basis of the above-mentioned embodiment, the file feature description set record block is constructed by the following steps:
[0080] According to the number of frozen data records in the freezing storage file, the freezing serial number of the first frozen data record, the freezing time of the first frozen data record, the freezing serial number of the last frozen data record and the freezing time of the last frozen data record, the freezing storage file feature description content is constructed;
[0081] Obtain the storage file flag information, storage file record freezing serial number, storage file record freezing time and total number of freezing storage files in the freezing file set, wherein the storage file flag information represents the flag serial number corresponding to the freezing storage file currently used for storing frozen data in the freezing file set, and the freezing storage files in the freezing file set are arranged in order of flag serial number; the storage file record freezing serial number represents the freezing serial number corresponding to the recorded frozen data in the freezing storage file currently used for storing frozen data, and the recorded frozen data in the freezing storage file is arranged in order of freezing serial number; the storage file record freezing time represents the freezing time corresponding to the recorded frozen data in the freezing storage file currently used for storing frozen data;
[0082] According to the storage file flag information, the storage file record freezing serial number, the storage file record freezing time, the total number of freezing storage files, the maximum number of file storage and the freezing storage file feature description content, the file feature description set record block corresponding to each freezing type is constructed.
[0083] In the present application, the freezing storage file feature description content is an important part of the file feature description set record block, which records the key information of the frozen data in each freezing storage file in detail. The specific construction method is as follows:
[0084] Obtaining key data: the number of recorded frozen data, the frozen serial number of the first recorded frozen data, the frozen time of the first recorded frozen data, the frozen serial number of the last recorded frozen data, and the frozen time of the last recorded frozen data need to be obtained from each frozen storage file.
[0085] In the present application, the number of recorded frozen data reflects how many pieces of frozen data have been stored in the frozen storage file, which helps to understand the storage capacity usage of the frozen storage file. For example, a frozen storage file can store a maximum of 1000 pieces of data, and currently 500 pieces of data have been recorded, so the number of recorded pieces is 500.
[0086] The frozen serial number of the first recorded frozen data and the frozen time can determine the relevant information of the earliest stored frozen data in the frozen storage file. The frozen serial number is used to uniquely identify each piece of frozen data, and the frozen time records the time point when the data is generated. Through these two pieces of information, the starting time of file storage data can be traced back, which is of great significance for data analysis and troubleshooting.
[0087] The frozen serial number of the last recorded frozen data and the frozen time, similar to the first record, determine the relevant information of the latest stored frozen data in the frozen storage file, which can help understand the latest status of file storage data and the frequency of data updates.
[0088] Further, the key data obtained above is organized in a certain format to form the frozen storage file feature description content. For example, it can be recorded in the format of "number of recorded frozen data: X; frozen serial number of the first recorded frozen data: Y1; frozen time of the first recorded frozen data: T1; frozen serial number of the last recorded frozen data: Y2; frozen time of the last recorded frozen data: T2". Each frozen storage file feature description content corresponds to a frozen storage file, which can be specifically referred to Table 1:
[0089] Table 1 Frozen storage file feature description content
[0090]
[0091] In the present application, the frozen file set contains multiple frozen storage files corresponding to a certain frozen type. In order to construct the file feature description set record block, the relevant information of the frozen file set needs to be obtained, which is as follows:
[0092] Storage file flag information: a plurality of frozen storage files in the frozen file set are arranged in order of flag sequence number, and the storage file flag information indicates the flag sequence number corresponding to the frozen storage file currently used for storing frozen data. For example, the file flags are arranged in the order of A1, A2, A3, …, and if the file flag currently used for storing frozen data is A3, the storage file flag information is A3. Through this flag information, the currently used storage file can be quickly located.
[0093] Storage file record frozen sequence number: indicates the frozen sequence number corresponding to the frozen data recorded in the frozen storage file currently used for storing frozen data. Since the frozen data recorded in the frozen storage file is arranged in order of frozen sequence number, the storage file record frozen sequence number can reflect the continuity of data storage in the current file. For example, if the frozen sequence numbers recorded in the current file are from 100 to 150, the storage file record frozen sequence number can be 150 (indicating the latest recorded sequence number), which is helpful for determining the sequence number of new data when subsequent data is stored.
[0094] Storage file record frozen time: indicates the frozen time corresponding to the frozen data recorded in the frozen storage file currently used for storing frozen data. It corresponds to the storage file record frozen sequence number and records the time point at which the latest frozen data is generated. Through this time information, the timeliness of the data can be understood.
[0095] Total number of frozen storage files: that is, the total number of frozen storage files included in the frozen file set. For example, the frozen file set corresponding to the minute freezing type includes 5 files, so the total number of frozen storage files is 5. This information is helpful for understanding the size of the entire frozen file set and the file segmentation.
[0096] Further, after obtaining the frozen storage file feature description content and the frozen file set related information, the file feature description set record block corresponding to each frozen type can be constructed. Specifically, the storage file flag information, the storage file record frozen sequence number, the storage file record frozen time, the total number of frozen storage files, the maximum number of file storage, and the plurality of frozen storage file feature description contents are integrated, wherein the maximum number of file storage refers to the maximum number of data that each frozen storage file can store, which can be calculated according to the frozen storage depth and the number of files corresponding to each frozen type and other factors.
[0097] In the present application, the integrated information is organized into a file feature description set record block according to a preset format and structure. For details, refer to Table 2:
[0098] Table 2 File feature description set record block
[0099]
[0100] In the present application, a dual medium storage cooperative architecture is adopted, the dual medium being a file system (i.e. a second storage medium) and an EEPROM (i.e. a first storage medium), wherein the file system stores cold data (i.e. frozen data) in the form of files, and the EEPROM stores hot data (i.e. a file feature description set record block). The two kinds of medium work cooperatively to ensure the accuracy and efficiency of frozen data storage. In the present application, the file system and the EEPROM provide a basic direct read-write interface for the dual medium storage.
[0101] The file feature description set record block in the present application is hot data, stored in the EEPROM, and needs to be synchronously updated when frozen data is stored. The main function of the file feature description set record block is to record the basic information, features and current frozen storage state of each frozen storage file. Moreover, each frozen type corresponds to a file feature description set record block, such as the minute freezing, hour freezing, day freezing and month freezing in the electricity meter data freezing type. Before executing a freezing task to store frozen data, the file feature description set record block corresponding to the freezing type is read out from the EEPROM. According to the file feature description set record block, the specific position in which the current frozen data to be stored should be stored in the frozen storage file can be obtained, and the file feature description set record block is synchronously updated and stored in the EEPROM after the frozen data storage is completed.
[0102] Through the above steps, the file feature description set record block corresponding to each freezing type can be constructed, which provides basic data for the storage and management of frozen data, and ensures the accuracy and efficiency of frozen data storage.
[0103] On the basis of the above embodiment, the frozen storage information at least includes the storage file flag information and the storage file record freezing serial number;
[0104] The method for determining the target frozen storage file corresponding to the target frozen data and the storage position information of the target frozen data in the target frozen storage file according to the current frozen storage information of each frozen storage file recorded in the target file feature description set record block comprises:
[0105] According to the storage file flag information, the target frozen storage file corresponding to the target frozen data is determined, and according to the storage file record freezing serial number, the storage position information of the target frozen data in the target frozen storage file is determined.
[0106] In the present application, the storage file flag information is an identifier for uniquely identifying a frozen storage file, by which different frozen storage files can be clearly distinguished, so as to quickly locate the target frozen storage file.
[0107] The storage file record freezing serial number is used to record the order of each frozen data record in a certain frozen storage file. When multiple frozen data are stored in the same frozen storage file, each frozen data has a corresponding frozen serial number, which reflects the storage order of the frozen data in the frozen storage file. For example, the first frozen data record has a serial number of 1, the second has a serial number of 2, and so on. Through the frozen serial number, the relative position of the frozen data in the frozen storage file can be accurately known.
[0108] In the present application, the frozen storage information of each frozen storage file recorded in the target file feature description set record block is viewed. In these frozen storage information, the frozen storage file to which the target frozen data belongs is identified and matched through the storage file flag information.
[0109] After the target frozen storage file is determined, the specific position of the target frozen data in the frozen storage file is determined according to the storage file record freezing serial number recorded in the target frozen storage file. Since each frozen data is assigned a unique frozen serial number when stored, by looking up the frozen serial number corresponding to the target frozen data, its storage position in the target frozen storage file can be known.
[0110] The present application uses the storage file flag information and the storage file record freezing serial number in the frozen storage information to determine the frozen storage file to which the target frozen data belongs and the specific storage position in the frozen storage file, and can quickly and accurately determine the target frozen storage file and the storage position corresponding to the target frozen data.
[0111] On the basis of the above embodiment, when it is determined that the frozen storage file marked as time-expired in the target file feature description set record block has been deleted or that the time-expired frozen storage file does not exist in the target file feature description set record block, the target frozen data is written into the target frozen storage file according to the storage position information, and the target file feature description set record block is updated according to the storage result of the target frozen data, including:
[0112] If the target frozen storage file is other than the last frozen storage file in the frozen file set, it is determined that the time-expired frozen storage file does not exist in the target file feature description set record block;
[0113] If the target frozen storage file is the last frozen storage file in the frozen file set, the first frozen storage file in the target file feature description set record block is deleted as the time-expired frozen storage file;
[0114] When it is determined that the frozen storage file marked as time-expired in the target file feature description set record block has been deleted or the time-expired frozen storage file does not exist in the target file feature description set record block, the target frozen data is written into the target frozen storage file according to a next storage file record frozen serial number corresponding to the storage file record frozen serial number, and after determining that the writing is successful, the target file feature description set record block is updated according to the next storage file record frozen serial number.
[0115] In the present application, when the target frozen storage file is not the last file in the frozen file set, it is directly determined that the time-expired frozen storage file does not exist in the target file feature description set record block. In the present application, only when the data is stored to the last frozen storage file, it is determined whether the first frozen storage file is expired, at this time, the maximum storage depth is reached, and at each time of writing a new file subsequently, it is needed to determine whether the earliest file is expired. Therefore, for the frozen storage file that is not the last one, the expired file checking operation is not needed, and it can be considered that there is no expired file currently.
[0116] When the target frozen storage file is the last file in the frozen file set, according to the storage logic, it is checked whether the first frozen storage file is expired. Since the data is stored in a cycle, when the frozen data is stored to the last frozen storage file, the frozen data in the first frozen storage file has exceeded the maximum storage depth and becomes an expired data file. At this time, the first frozen storage file in the target file feature description set record block is marked as a time-expired frozen storage file, and a deletion processing is performed. For example, assuming that the frozen file set has three frozen storage files (A1, A2 and A3), when the frozen data is stored to A3, it is determined that the frozen data in A1 has expired, and the A1 file is deleted.
[0117] In the present application, after it is confirmed that there is no time-expired frozen storage file or the time-expired frozen storage file marked is deleted, the target frozen data is appended and written into the target frozen storage file according to a next storage file record frozen serial number corresponding to the current storage file record frozen serial number. For example, the current record frozen serial number is 5, then the next storage file record frozen serial number is 6, the target frozen data is written into the target frozen storage file, and the serial number of the frozen data is set to 6. After the writing is successful, the related information in the target file feature description set record block is updated according to the next storage file record frozen serial number, such as updating the current record frozen serial number, the frozen time and the like, so as to keep the consistency between the record block and the actual storage situation.
[0118] On the basis of the above embodiment, the method further comprises:
[0119] When it is determined that the frozen storage file marked as expired in the target file feature description set record block has been deleted or does not exist in the target file feature description set record block, and the number of currently stored frozen data in the target frozen storage file has reached the maximum storage number of the file, the target frozen storage file is switched to a next frozen storage file according to the storage file flag information, and the target frozen data is written into the next frozen storage file, and after successful writing, the target file feature description set record block is updated according to the flag serial number corresponding to the next frozen storage file.
[0120] In the present application, when it is determined that there is no expired frozen storage file or the expired file has been deleted, and the number of currently stored frozen data in the target frozen storage file has reached the maximum storage number of the file, the target frozen storage file is switched to a next frozen storage file according to the storage file flag information. For example, the current target storage file is A2 and is full, and the target storage file is switched to A3. Then, the target frozen data is written into the new target frozen storage file. After successful writing, the target file feature description set record block is updated according to the flag serial number corresponding to the next frozen storage file, and the update content includes the current storage file flag, the current record frozen serial number, the frozen time and other information, so as to ensure that the file feature description set record block can accurately reflect the current storage state.
[0121] Figure 2 The flowchart of the initialization process of the frozen data storage provided by the present application can refer to Figure 2 In the present application, when a reset initialization or data initialization command is received, the previously existing frozen storage file is cleared.
[0122] Then, the file is dynamically divided according to the frozen type, the storage depth and the like, and a new frozen storage file is created. In the present application, the storage space is dynamically divided according to the preset frozen type (for example, different types of data frozen conditions) and the storage depth (that is, the capacity or range of stored data) and the like, and a new frozen storage file is created, so as to ensure that the structure and size of the frozen storage file can adapt to the storage demand.
[0123] Further, the file feature description set record block is initialized. In the present application, when the new frozen storage file is created, the file feature description set record block is initialized. These file feature description set record blocks are used to store the feature information of the file, such as the size of the frozen storage file, the frozen time, the frozen type and the like, so as to accurately identify and manage the frozen storage file in subsequent operations.
[0124] Then, the file feature description set record block is stored into the EEPROM. In the present application, the initialized file feature description set record block is stored into the EEPROM. After all the above steps are completed, the initialization is finished. In the present application, when the electric energy meter occurs parameter freezing change, data initialization or new meter initialization, the file feature description set record block will be restored to the initial value, at this time, the file flag is A1, the current record freezing serial number and time are both 0, the maximum storage number of the file = freezing storage depth / (total number of freezing storage files-1)+2, and the freezing storage file feature description table content is cleared.
[0125] Figure 3 The flowchart of the freezing data storage process provided by the present application is shown in Figure 3 The present application provides a cluster file storage algorithm. When the freezing task is executed, the file feature description set record block is read from the EEPROM according to the freezing type and the scheme number (i.e. freezing scheme number, corresponding to the freezing type), and the freezing storage file A1 currently being written is located according to the current storage file flag in the file feature description set record block.
[0126] Then, it is judged whether the freezing storage file A1 is written for the first time. If yes, when the first freezing data is generated, the freezing data is recorded in the freezing storage file A1 according to the file feature description set record block, the starting position is 0, the freezing serial number is 0, and the freezing time is the current freezing time. If not, the freezing storage file is directly positioned to the position being written according to the current record freezing serial number and the record length in the file feature description set record block, and then the file writing operation is added.
[0127] Further, if it is written for the first time, it is checked whether there is an expired file (i.e. freezing storage file expired). If there is an expired file, the expired file is deleted and a new freezing storage file is created. Then, the freezing storage file feature description corresponding to the file in the file feature description set record block is updated. If there is no expired file, the freezing storage file is directly positioned to the position being written according to the current record freezing serial number and the record length in the file feature description set record block, and then the file writing operation is added.
[0128] Further, after the additional write file operation is completed, the record frozen serial number and time in the file feature description set record block and the frozen storage file feature description table are updated. Then, it is determined whether the current write data reaches the maximum storage number. In the present application, when a certain frozen storage file is not full, the last record frozen serial number and time in the frozen storage file feature description table being written and the current frozen time and serial number in the file feature description set record block are consistent. At this time, the updated file feature description set record block is stored in the EEPROM. When the frozen storage file A1 is full according to the maximum storage number, the current storage file flag is switched to the frozen storage file A2. Thereafter, the file is used in this way. When the number is full, the next frozen storage file is switched. At the same time, the current record frozen serial number, frozen time and frozen storage file feature description table also need to be updated. Finally, it is determined whether there is other frozen task to be executed. If there is other frozen task, the process returns to the starting point of the frozen task execution and continues to execute the new frozen task. If there is no other frozen task, the frozen task flow ends.
[0129] The cluster file storage algorithm provided by the present application determines that the data in the first file exceeds the maximum storage depth and belongs to an expired data file when the frozen data starts to be stored in the last file. At this time, only the file needs to be deleted and re-created. Thereafter, it is determined whether there is an expired file each time the first file is written. When the last frozen storage file is full according to the maximum storage number, the current storage file flag is switched to the next frozen storage file and the sequential storage is started. In the above process, the frozen data is always added to the tail of the frozen storage file in an additional manner. The time consumption of writing a single frozen data is very short. The time consumption of deleting a file by the electric energy meter unified file system is also very short. Therefore, the whole storage process can be implemented in a high efficient manner.
[0130] On the basis of the above embodiment, the method further comprises:
[0131] acquiring multi-dimensional navigation index information, wherein the multi-dimensional navigation index information comprises at least one or more of frozen type identification information, frozen scheme number, frozen time, frozen serial number, first N frozen serial numbers and the Nth frozen serial number;
[0132] According to the multi-dimensional navigation index information and the file feature description set record block, corresponding frozen data is acquired from the frozen storage file in the frozen file set.
[0133] In the present application, multi-dimensional navigation index management is adopted. The information required to be stored is quickly positioned through multiple dimensions. In this way, the time of searching for frozen data is reduced and the efficiency of searching and querying data is improved. When the multi-dimensional navigation index information is acquired, these information comprises but is not limited to at least one or more of the following dimensions:
[0134] Freezing type identification information: The freezing type identification is used to distinguish different kinds of frozen data. For example, in a power system, there can be different types of frozen data such as minute freezing, hour freezing, and day freezing, each type of frozen data has different characteristics and purposes, and the freezing type identification can accurately filter out frozen data of a specific type.
[0135] Freezing scheme number: The freezing scheme number corresponds to the freezing type, and through the freezing scheme number, the frozen data that meets the specific freezing type can be located.
[0136] Freezing time: The freezing time records the specific time when the data is frozen, and the freezing data at a specific time point can be queried as needed, such as querying the freezing data of a certain day, hour or minute, and the freezing time dimension can meet the needs of such time retrieval.
[0137] Freezing sequence number: The freezing sequence number is the sequential number of the frozen data in the frozen storage file. Each frozen data is assigned a unique sequence number when stored, and through the freezing sequence number, the specific data record in the frozen storage file can be located.
[0138] The first N freezing sequence numbers: used to obtain the sequence numbers of the first N consecutive frozen data before a certain frozen data.
[0139] The first N freezing sequence numbers: used to locate the sequence number of another frozen data at a specific position (interval N) from a certain frozen data. For example, to view the frozen data 5 intervals before a certain frozen data, the first N freezing sequence number can be used to achieve this.
[0140] In the present application, the file feature description set record block stores relevant feature information about the frozen file, such as the file segmentation, the current storage location, and the file flag, etc. According to the freezing type, the length of a frozen record, and the freezing storage depth, the file segmentation coefficient is determined to achieve dynamic segmentation. The number of files split for different freezing types is different, such as 5 for minute freezing, 3 for hour freezing, and 2 for day freezing, etc. Moreover, the segmented files are identified, for example, the file flag of the first frozen storage file is A1, the file flag of the second frozen storage file is A2, and the file flag of the nth frozen storage file is An.
[0141] In the present application, the freezing type identification and the freezing scheme number in the multi-dimensional navigation index information can index a certain type of frozen file after segmentation. For example, if you want to query the hour freezing data that meets a specific scheme, you can locate the corresponding hour freezing file set through these two dimensions.
[0142] Then, according to the file mark information recorded in the file feature description set record block, the specific target frozen storage file is determined. For example, it is determined whether the target file is A1, A2 or other marked file.
[0143] Finally, in combination with the frozen time, frozen serial number, first N frozen serial numbers or first N frozen serial number in the multi-dimensional navigation index information, the corresponding frozen data is accurately obtained from the determined target frozen storage file. For example, the data record at the corresponding time point in the file can be found through the frozen time; a certain data in the file can be directly located through the frozen serial number; the related adjacent data can be obtained through the first N frozen serial numbers or the first N frozen serial number.
[0144] According to the application, the multi-dimensional navigation index information is obtained, and in combination with the file feature description set record block, the required frozen data can be efficiently and accurately obtained from the frozen storage file in the frozen file set.
[0145] In an embodiment, the electric energy meter frozen data storage method provided by the application is described as a whole. First, the frozen data initialization process is performed, and the specific steps are as follows:
[0146] Step 11, the master station issues a data initialization command;
[0147] Step 12, all frozen data storage files are cleared;
[0148] Step 13, according to the frozen type, the length of a frozen record and the frozen storage depth, the file is dynamically segmented, and the corresponding number of frozen storage files is created;
[0149] Step 14, the file feature description set record block is initialized. According to the initialization requirement, the current frozen storage file is marked as A1, indicating that the next storage starts from the first frozen storage file; the current frozen serial number and time are both 0, indicating that no storage is performed; the number of frozen storage files is the number of files after dynamic segmentation; the maximum storage number of the file = frozen storage depth / (file number-1)+2, and all contents of the frozen storage file feature description table are cleared to 0;
[0150] Step 15, the file feature description set record block is stored in the EEPROM.
[0151] Then, taking the daily frozen data as an example, the specific steps of storing the first daily frozen data are as follows:
[0152] Step 21, the daily frozen task is performed, and the frozen time is XXXX year XX month XX day;
[0153] Step 22, the file feature description set record block is read out from the EEPROM;
[0154] Step 23, according to the current storage file flag A1, determine that the frozen data needs to be stored in the first frozen storage file;
[0155] Step 24, according to the current record freezing sequence number and the current record freezing time are both 0, determine that this frozen storage file has never stored frozen data, it is the first time to write this file, and there is no expired file, so the freezing sequence number of the newly generated frozen data is 0, the freezing time is XXXX year XX month XX day, and the storage file starts from position 0;
[0156] Step 25, store the newly generated frozen data in the frozen storage file;
[0157] Step 26, according to the freezing sequence number and freezing time of the newly generated frozen data, update the record freezing sequence number, freezing time and frozen storage file feature description table in the file feature description set record block;
[0158] Step 27, determine whether the current write data reaches the maximum storage number;
[0159] Step 28, if the maximum storage number is reached, switch the file storage flag to the next frozen storage file A2;
[0160] Step 29, store the updated file feature description set record block to EEPROM.
[0161] For the frozen data storage file, which is the last frozen storage file in the frozen file set, the specific steps are as follows:
[0162] Step 31, execute the daily freezing task, and the freezing time is XXXX year XX month XX day;
[0163] Step 32, read out the file feature description set record block from EEPROM, the file number is 5, and the current storage file flag is A5;
[0164] Step 33, according to the current storage file flag A5, determine that the frozen data is being stored in the last frozen storage file;
[0165] Step 34, according to the current record freezing sequence number and the current record freezing time are both 0, determine that this frozen storage file A5 has never stored frozen data, it is the first time to write this file;
[0166] Step 35, according to the maximum storage depth and file number, determine that the first frozen storage file A1 is an expired file;
[0167] Step 36, delete the frozen storage file A1 and recreate it, and update the frozen storage file feature description corresponding to the frozen storage file A1 in the file feature description set record block;
[0168] Step 37, the freeze serial number of the newly generated freeze data is 1 more than the current record freeze serial number in the file feature description set record block, the freeze time is XXXX year XX month XX day, and the storage file starts from position 0;
[0169] Step 38, store the newly generated freeze data in the freeze storage file;
[0170] Step 39, according to the freeze serial number and freeze time of the newly generated freeze data, update the record freeze serial number and time in the file feature description set record block and the freeze storage file feature description table, and store the updated file feature description set record block to the EEPROM.
[0171] The application stores the file feature description set record block with higher update frequency in the EEPROM by adopting the dual medium storage cooperative architecture and the clustered file storage algorithm, and stores the freeze data with lower update frequency in the file system in the form of file, and the two media work cooperatively depending on the clustered file storage algorithm. In addition, the clustered file storage algorithm in the application dynamically divides the freeze data to be stored into multiple files for storage, and the freeze data is always added at the file tail in the form of appending in the whole cyclic storage process, which has the technical effects of efficient operation, flexible storage, space saving, and no influence on the normal operation of other tasks of the program. At the same time, the clustered file storage algorithm creates multi-dimensional navigation index when dividing the file, and can quickly realize the storage and retrieval of freeze data by using the multi-dimensional navigation index management.
[0172] The following describes the electric energy meter freeze data storage device provided by the application, and the electric energy meter freeze data storage device described in the following description can be correspondingly referred to the electric energy meter freeze data storage method described in the above description.
[0173] Figure 4 The structural schematic diagram of the electric energy meter freeze data storage device provided by the application is shown in the following figure, Figure 4As shown, the application provides a frozen data storage device of an electric energy meter, comprising a file feature description set record block acquisition module 401, a storage location positioning module 402 and a frozen data storage module 403, wherein the file feature description set record block acquisition module 401 is used for determining a target file feature description set record block corresponding to target frozen data according to a frozen type of the target frozen data to be stored, from a plurality of file feature description set record blocks, wherein the plurality of file feature description set record blocks are stored in a first storage medium; the storage location positioning module 402 is used for determining a target frozen storage file corresponding to the target frozen data and storage location information of the target frozen data in the target frozen storage file according to current frozen storage information of each frozen storage file recorded in the target file feature description set record block, wherein each frozen storage file is constructed based on the frozen type and is used for storing frozen data generated by the electric energy meter; the frozen storage file is stored in a second storage medium; the frozen data storage module 403 is used for writing the target frozen data into the target frozen storage file according to the storage location information when it is determined that a frozen storage file marked as time-expired in the target file feature description set record block has been deleted or the time-expired frozen storage file does not exist in the target file feature description set record block, and updating the target file feature description set record block according to a storage result of the target frozen data.
[0174] In the application, a storage interface is provided in the frozen data storage device of the electric energy meter to provide services for an application layer, and the application layer stores frozen data through the storage interface. Related interface functions include:
[0175] A frozen data storage interface function: uint8_t db_write_rec(uint16_t frz_type, uint8_t plan_no, file_desc_t pfile_desc, uint32_t frz_sn, uint8_t pbuf, uint32_t len).
[0176] A frozen data reading interface function: uint32_t db_read_rec(uint16_t frz_type, uint8_t plan_no, sch_rule_t psch_rule, uint32_t rec_num, uint8_t pbuf).
[0177] Get file description set record block interface function: uint8_t get_file_desc (uint16_t frz_type, uint8_t plan_no, file_desc_t pfile_desc).
[0178] Update file description set record block interface function: uint8_t update_file_desc (uint16_t frz_type, uint8_t plan_no, uint32_t pos_tm, uint32_t pos_sn, uint8_t save_type, file_desc_t pfile_desc).
[0179] The specific content of the interface function can refer to Tables 3 to 6:
[0180] Table 3 Freezing data storage interface function
[0181]
[0182] Table 4 Freezing data reading interface function
[0183]
[0184] Table 5 Get file description set record block interface function
[0185]
[0186] Table 6 Update file description set record block interface function
[0187]
[0188] The power meter freezing data storage device provided by the application determines the corresponding target record block from a plurality of file description set record blocks in the first storage medium by the freezing type of the target freezing data to be stored; and determines the target freezing storage file in the second storage medium based on the freezing storage information in the target record block; if the freezing storage file marked as time-expired in the target record block has been deleted or does not exist, the target freezing data is written into the target freezing storage file, and the target record block is updated, so that the storage efficiency of the freezing data is effectively improved through the dual-storage medium architecture.
[0189] The device provided by the embodiments of the application is used for executing the above-mentioned method embodiments, and the specific process and detailed content can refer to the above-mentioned embodiments, which will not be described here again.
[0190] Figure 5The structural schematic diagram of the intelligent electric energy meter provided by the present application is shown in the figure, Figure 5 The present application provides an intelligent electric energy meter, which comprises the electric energy meter frozen data storage device 501 described in the above embodiments.
[0191] In the present application, the electric energy meter frozen data storage device is mainly used for storing and managing the data recorded by the electric energy meter at a specific time or under specific conditions (i.e. frozen data), which contains key information such as power consumption, voltage, current and power factor. The intelligent electric energy meter will continuously generate and collect various power consumption data during operation, and the electric energy meter frozen data storage device is responsible for effective storage and management of these data.
[0192] In the present application, the electric energy meter frozen data storage device provided in the intelligent electric energy meter can quickly locate the required information through multiple dimensions (such as frozen type identification, frozen scheme number, frozen time, frozen serial number, etc.), reduce the time for searching frozen data, and improve the efficiency of searching and querying data. Moreover, by using the cluster file storage algorithm, the file segmentation coefficient is determined according to the frozen type, the length of a frozen record and the frozen storage depth, so as to realize dynamic segmentation, thereby splitting the frozen storage files of different frozen types into multiple files. Through the multi-dimensional navigation index created, the frozen type identification and the frozen scheme number are indexed to the segmented frozen storage files, and the frozen storage files are sequentially identified, so that the frozen data can be accurately and efficiently stored, and the file switching and updating can be performed when the data storage reaches a certain condition (such as the file being full), while ensuring the integrity and accuracy of the data.
[0193] The intelligent electric energy meter provided by the present application determines the corresponding target record block from the multiple file feature description set record blocks in the first storage medium according to the frozen type of the target frozen data to be stored; then determines the target frozen storage file in the second storage medium based on the frozen storage information in the target record block; if the target record block marks that the expired frozen storage file has been deleted or does not exist, the target frozen data is written into the target frozen storage file, and the target record block is updated, so that the storage efficiency of the frozen data is effectively improved through the dual storage medium architecture.
[0194] Figure 6 The structural schematic diagram of the electronic device provided by the present application is shown in the figure, Figure 6As shown, the electronic device can include a processor 601, a communications interface 602, a memory 603, and a communications bus 604, wherein the processor 601, the communications interface 602, and the memory 603 complete mutual communication through the communications bus 604. The processor 601 can invoke a logic instruction in the memory 603 to execute the electric energy meter frozen data storage method, which includes: determining a target file feature description set record block corresponding to target frozen data according to a frozen type of the target frozen data to be stored currently from a plurality of file feature description set record blocks, wherein the plurality of file feature description set record blocks are stored in a first storage medium; determining a target frozen storage file corresponding to the target frozen data and storage location information of the target frozen data in the target frozen storage file according to current frozen storage information of each frozen storage file recorded in the target file feature description set record block, wherein each frozen storage file is constructed based on the frozen type and is used to store frozen data generated by an electric energy meter; the frozen storage file is stored in a second storage medium; when it is determined that a time limit expired frozen storage file marked in the target file feature description set record block has been deleted or the time limit expired frozen storage file does not exist in the target file feature description set record block, writing the target frozen data into the target frozen storage file according to the storage location information, and updating the target file feature description set record block according to a storage result of the target frozen data.
[0195] In addition, the logic instruction in the memory 603 described above can be implemented in the form of a software function unit and sold or used as an independent product, which can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0196] In another aspect, the present application also provides a computer program product, which comprises a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions that, when executed by a computer, enable the computer to perform the power meter frozen data storage method provided by any of the above methods, the method comprising: determining, according to a frozen type of target frozen data to be stored currently, a target file feature description set record block corresponding to the target frozen data from a plurality of file feature description set record blocks, wherein the plurality of file feature description set record blocks are stored in a first storage medium; determining, according to current frozen storage information of each frozen storage file recorded in the target file feature description set record block, a target frozen storage file corresponding to the target frozen data and storage location information of the target frozen data in the target frozen storage file, wherein each frozen storage file is constructed based on the frozen type and is used to store frozen data generated by a power meter; the frozen storage file is stored in a second storage medium; when it is determined that a frozen storage file marked as time-expired in the target file feature description set record block has been deleted or the time-expired frozen storage file does not exist in the target file feature description set record block, writing the target frozen data into the target frozen storage file according to the storage location information, and updating the target file feature description set record block according to a storage result of the target frozen data.
[0197] In yet another aspect, the present application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the power meter frozen data storage method provided by any of the above embodiments, the method comprising: determining, according to a frozen type of target frozen data to be stored currently, a target file feature description set record block corresponding to the target frozen data from a plurality of file feature description set record blocks, wherein the plurality of file feature description set record blocks are stored in a first storage medium; determining, according to current frozen storage information of each frozen storage file recorded in the target file feature description set record block, a target frozen storage file corresponding to the target frozen data and storage location information of the target frozen data in the target frozen storage file, wherein each frozen storage file is constructed based on the frozen type and is used to store frozen data generated by a power meter; the frozen storage file is stored in a second storage medium; when it is determined that a frozen storage file marked as time-expired in the target file feature description set record block has been deleted or the time-expired frozen storage file does not exist in the target file feature description set record block, writing the target frozen data into the target frozen storage file according to the storage location information, and updating the target file feature description set record block according to a storage result of the target frozen data.
[0198] The apparatus embodiments described above are merely illustrative, wherein the units described as separated components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed to multiple network units. Part or all of the modules can be selected to achieve the purpose of the embodiment scheme according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0199] Through the description of the above embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software and the necessary universal hardware platform, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of software products, and the computer software products can be stored in a computer readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and include a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.
[0200] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. An electric energy meter frozen data storage method, characterized by, The method comprises the following steps: determining a target file feature description set record block corresponding to target frozen data from a plurality of file feature description set record blocks according to a frozen type of the target frozen data to be stored at present, wherein the plurality of file feature description set record blocks are stored in a first storage medium; determining a target frozen storage file corresponding to the target frozen data and storage location information of the target frozen data in the target frozen storage file according to current frozen storage information of each frozen storage file recorded in the target file feature description set record block, wherein each frozen storage file is constructed based on the frozen type and is used for storing frozen data generated by an electric energy meter; and the frozen storage file is stored in a second storage medium; when it is determined that a frozen storage file marked as time-expired in the target file feature description set record block has been deleted or the time-expired frozen storage file does not exist in the target file feature description set record block, writing the target frozen data into the target frozen storage file according to the storage location information, and updating the target file feature description set record block according to a storage result of the target frozen data, specifically comprising the following steps: if the target frozen storage file is a frozen storage file other than the last frozen storage file in a frozen file set, it is determined that the time-expired frozen storage file does not exist in the target file feature description set record block; wherein a frozen file set of each frozen type is constructed according to a plurality of frozen storage files; if the target frozen storage file is the last frozen storage file in the frozen file set, a first frozen storage file in the target file feature description set record block is deleted as the time-expired frozen storage file; when it is determined that the frozen storage file marked as time-expired in the target file feature description set record block has been deleted or the time-expired frozen storage file does not exist in the target file feature description set record block, writing the target frozen data into the target frozen storage file according to a next storage file record frozen serial number corresponding to a storage file record frozen serial number, and updating the target file feature description set record block according to the next storage file record frozen serial number after it is determined that the writing is successful, wherein the storage file record frozen serial number represents a frozen serial number corresponding to frozen data that has been recorded in the frozen storage file currently used for storing the frozen data.
2. The electric energy meter frozen data storage method according to claim 1, characterized in that, The method further comprises the following steps: constructing a plurality of frozen storage files corresponding to each frozen type in the second storage medium based on a frozen data record byte length and a frozen storage depth corresponding to each frozen type; constructing a frozen file set of each frozen type according to a plurality of frozen storage files. The frozen data record byte length represents the maximum byte length occupied by a single piece of frozen data; the frozen storage depth represents the maximum number of frozen data corresponding to the frozen type stored in the second storage medium; the file maximum storage number of the frozen storage file is determined according to the total number of the frozen storage file and the frozen storage depth; and the frozen type at least includes a minute frozen type, an hour frozen type, a day frozen type and a month frozen type.
3. The electric energy meter frozen data storage method according to claim 2, characterized in that, The file feature description set record block is constructed by the following steps: According to the number of recorded frozen data in the frozen storage file, the first frozen data record frozen serial number, the first frozen data record frozen time, the last frozen data record frozen serial number and the last frozen data record frozen time, the frozen storage file feature description content is constructed; The storage file flag information, the storage file record frozen serial number, the storage file record frozen time and the total number of the frozen storage file in the frozen file set are acquired, wherein the storage file flag information represents the flag serial number corresponding to the frozen storage file currently used for storing frozen data in the frozen file set, and the plurality of frozen storage files in the frozen file set are arranged in the order of the flag serial number; the storage file record frozen serial number represents the frozen serial number corresponding to the recorded frozen data in the frozen storage file currently used for storing frozen data, and the recorded frozen data in the frozen storage file is arranged in the order of the frozen serial number; and the storage file record frozen time represents the frozen time corresponding to the recorded frozen data in the frozen storage file currently used for storing frozen data. According to the storage file flag information, the storage file record frozen serial number, the storage file record frozen time, the total number of the frozen storage file, the file maximum storage number and the frozen storage file feature description content, the file feature description set record block corresponding to each frozen type is constructed.
4. The electric energy meter frozen data storage method according to claim 3, characterized in that, The frozen storage information at least includes the storage file flag information and the storage file record frozen serial number; According to the current frozen storage information of each frozen storage file recorded in the target file feature description set record block, the target frozen storage file corresponding to the target frozen data and the storage location information of the target frozen data in the target frozen storage file are determined, and the method comprises the following steps: According to the storage file flag information, the target frozen storage file corresponding to the target frozen data is determined, and according to the storage file record frozen serial number, the storage location information of the target frozen data in the target frozen storage file is determined.
5. The electric energy meter frozen data storage method according to claim 4, characterized in that, The method further comprises: When it is determined that the frozen storage file marked as expired in the target file feature description set record block has been deleted or the expired frozen storage file does not exist in the target file feature description set record block, and the number of currently stored frozen data of the target frozen storage file has reached the maximum storage number of the file, the target frozen storage file is switched to a next frozen storage file according to the storage file flag information, and the target frozen data is written into the next frozen storage file. After determining that the writing is successful, the target file feature description set record block is updated according to the flag serial number corresponding to the next frozen storage file.
6. The electric energy meter frozen data storage method according to any one of claims 2 to 5, characterized in that, The method further comprises: obtaining multi-dimensional navigation index information, wherein the multi-dimensional navigation index information comprises at least one of frozen type identification information, a frozen scheme number, a frozen time, a frozen serial number, the first N frozen serial numbers, and the first Nth frozen serial number; obtaining corresponding frozen data from the frozen storage file in the frozen file set according to the multi-dimensional navigation index information and the file feature description set record block.
7. An electric energy meter frozen data storage device, characterized by, Comprise: a file feature description set record block acquisition module, configured to determine a target file feature description set record block corresponding to target frozen data according to a frozen type of the target frozen data to be stored currently, from a plurality of file feature description set record blocks, wherein the plurality of file feature description set record blocks are stored in a first storage medium; a storage location positioning module, configured to determine a target frozen storage file corresponding to the target frozen data and storage location information of the target frozen data in the target frozen storage file according to current frozen storage information of each frozen storage file recorded in the target file feature description set record block, wherein each frozen storage file is constructed based on the frozen type and is used to store frozen data generated by an electric energy meter; and the frozen storage file is stored in a second storage medium; a frozen data storage module, configured to, when it is determined that a frozen storage file marked as expired in the target file feature description set record block has been deleted or the expired frozen storage file does not exist in the target file feature description set record block, write the target frozen data into the target frozen storage file according to the storage location information, and update the target file feature description set record block according to a storage result of the target frozen data; the frozen data storage module is specifically configured to: if the target frozen storage file is a frozen storage file other than the last frozen storage file in a frozen file set, it is determined that the expired frozen storage file does not exist in the target file feature description set record block; wherein each frozen file set of the frozen type is constructed according to a plurality of frozen storage files; if the target frozen storage file is the last frozen storage file in the frozen file set, the first frozen storage file in the target file feature description set record block is deleted as the expired frozen storage file. When it is determined that the frozen storage file marked as expired in the target file feature description set record block has been deleted or the expired frozen storage file does not exist in the target file feature description set record block, the target frozen data is written into the target frozen storage file according to a next storage file record frozen serial number corresponding to a storage file record frozen serial number, and after determining that the writing is successful, the target file feature description set record block is updated according to the next storage file record frozen serial number, wherein the storage file record frozen serial number represents a frozen serial number corresponding to frozen data that has been recorded in the frozen storage file currently used for storing the frozen data.
8. A smart meter, characterized by The electric energy meter frozen data storage device of claim 7 is included. The electric energy meter frozen data storage device of claim 7 is included.
Citation Information
Patent Citations
Intelligent electric meter segmented freezing data storage method and device and intelligent electric meter segmented freezing data query method and device
CN109614447A
Operation data management and maintenance method of energy storage equipment, equipment and medium
CN119248774A