Electric Energy Meter Data Management Method, Device and Computer Readable Storage Medium

By assigning logical identifiers to the power meter data and querying the preset logic file attribute table, the unified management and processing of the power meter data is realized, solving the problem of code development difficulties caused by developers in the face of various reading and writing situations, and improving the development efficiency and reliability of data management.

CN114691943BActive Publication Date: 2025-07-01WASION GROUP HLDG
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210170077.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-23
Publication Date
2025-07-01
Estimated Expiration
2042-02-23

AI Technical Summary

Technical Problem

When writing functions to complete the reading and writing of electricity meter data, developers need to face a variety of reading and writing situations, which leads to increased difficulty in code development.

Method used

By assigning logical identifiers to the data to be written, querying the preset logical file attribute table according to the identification, performing classified storage, verification and backup, and processing the data writing process in a unified manner; when reading, querying the preset logical file attribute table according to the logical identifier, performing reading, checking and repairing, and processing the data reading process in a unified manner.

Benefits of technology

The power meter data management process is simplified, reducing the complexity of developers in handling data reading and writing, shortening development time and reducing error rates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114691943B_ABST
    Figure CN114691943B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device and computer-readable storage medium for managing electric energy meter data. The method for managing electric energy meter data includes: when the electric energy meter generates data to be written, allocating a first logical identifier for the data to be written according to the service type of the electric energy meter generating the data to be written; completing the writing of the data to be written according to the first logical identifier and a preset logical file attribute table; when the electric energy meter has a target data reading request, obtaining a second logical identifier of the target data carried in the reading request; and completing the reading of the target data according to the second logical identifier and the preset logical file attribute table. All storage media and all storage requirements in the electric energy meter are converted into a unified function for unified process processing, so that the program developers of the electric energy meter do not need to pay attention to the data reading and writing process, shortening the development time and reducing errors.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data management, and particularly to a method, device, and computer-readable storage medium for managing electric energy meter data. Background Art

[0002] On an electric energy meter, there are various types of data, such as parameter data, power consumption data, frozen data, etc. Among them, the security of parameter type data is particularly important. Generally, CRC is used to verify and backup the integrity of the data. Each time data is read, CRC verification is required. The power consumption data has a small data volume but a high update frequency, while the frozen data has a large data volume but a low update frequency. When developers write functions to complete data reading and writing, they need to spend a lot of time designing write functions with or without CRC, write functions with or without backup, functions for writing to flash or functions for writing to EEPROM, etc., which greatly increases the difficulty of code development.

[0003] The above content is only used to assist in understanding the technical solution of the present invention, and does not represent an admission that the above content is prior art. Summary of the Invention

[0004] The main purpose of the present invention is to provide a method for managing electric energy meter data, aiming to solve the technical problem that current developers need to face various reading and writing situations when writing functions to complete data reading and writing, resulting in an increase in the difficulty of code development.

[0005] To achieve the above purpose, the present invention provides a method for managing electric energy meter data, which includes the following steps:

[0006] When the electric energy meter generates data to be written, according to the service type of the electric energy meter that generates the data to be written, a first logical identifier is assigned to the data to be written;

[0007] The writing of the data to be written is completed according to the first logical identifier and a preset logical file attribute table;

[0008] When there is a target data reading request on the electric energy meter, the second logical identifier of the target data carried in the reading request is obtained;

[0009] The reading of the target data is completed according to the second logical identifier and the preset logical file attribute table.

[0010] Further, the first logical identifier includes a data Id, a storage address, a backup address, and a data attribute. The data attribute includes a first data attribute, a second data attribute, and a third data attribute. The step of completing the writing of the data to be written according to the first logical identifier and the preset logical file attribute table includes:

[0011] Query the preset logical file attribute table according to the third data attribute, and determine whether there is a cache configuration for the data to be written;

[0012] If there is a cache configuration for the data to be written, query the data in the buffer area to determine the hit status of the data in the buffer area hitting the data to be written;

[0013] If the hit status is not hit, query the preset logical file attribute table according to the first data attribute, and determine whether there is a verification configuration for the data to be written;

[0014] If there is no verification configuration for the data to be written, query the preset logical file attribute table according to the data Id to obtain the storage type;

[0015] According to the storage type and the storage address, complete the writing of the data to be written, and update the data to be written to the buffer area;

[0016] Query the preset logical file attribute table according to the second data attribute, and determine whether there is a backup configuration for the data to be written;

[0017] If there is a backup configuration for the data to be written, complete the backup of the data to be written according to the storage type and the backup address.

[0018] Further, after the step of determining whether there is a cache configuration for the data to be written, it includes:

[0019] If there is no cache configuration for the data to be written, execute the step of querying the preset logical file attribute table according to the first data attribute and determining whether there is a verification configuration for the data to be written.

[0020] Further, after the step of if there is a cache configuration for the data to be written, query the data in the buffer area to judge the hit status of the data in the buffer area hitting the data to be written, it includes:

[0021] If the hit status is all hits, update the data to be written to the buffer area, and execute the step of querying the preset logical file attribute table according to the first data attribute and determining whether there is a verification configuration for the data to be written;

[0022] If the hit status is partial hits, determine that the data hit in the buffer area is invalid, and execute the step of querying the preset logical file attribute table according to the first data attribute and determining whether there is a verification configuration for the data to be written.

[0023] Further, after the step of determining whether the data to be written has a check configuration, the following steps are included:

[0024] If the data to be written has a check configuration, perform an integrity check on the data to be written, generate a check code for the data to be written correspondingly, and add the check code to the data to be written.

[0025] Further, the step of reading the target data according to the second logical identifier and the preset logical file attribute table includes:

[0026] Query the preset logical file attribute table according to the second logical identifier, determine whether the target data has a check configuration, and if there is a check configuration, perform an integrity self-check on the target data;

[0027] If the self-check of the target data fails, perform a data rollback check on the target data;

[0028] If the self-check of the target data is qualified, query the preset logical file attribute table according to the second logical identifier, and after determining that the target data has a cache configuration, query the data in the cache area to determine the hit status of the data in the cache area hitting the target data;

[0029] If the hit status is a full hit, read the target data from the cache area;

[0030] If the hit status is a partial hit or a miss, read the target data from the main file area and update the target data to the cache area.

[0031] Further, the step of performing a data rollback check on the target data includes:

[0032] Query the preset logical file attribute table according to the second logical identifier, and after determining that the target data has a cache configuration, query the data in the cache area to determine the hit status of the data in the cache area hitting the target data. If the hit status is a full hit, perform an integrity check on the target data read from the cache area;

[0033] If the integrity check of the target data read from the cache area is qualified, the reading of the target data is completed;

[0034] If the integrity check of the target data read from the cache area is unqualified, read the target data from the main file area and perform an integrity check;

[0035] If the integrity check of the target data read from the main file area passes, the cache area is repaired based on the target data read from the main file area, and the reading of the target data is completed;

[0036] If the integrity check of the target data read from the main file area fails, the target data is read from the backup area and its integrity is checked;

[0037] If the integrity check of the target data read from the backup area passes, the main file and the cache area are repaired based on the target data read from the backup area, and the reading of the target data is completed.

[0038] Further, after the step of querying the data in the cache area to determine the hit status of the data in the cache area hitting the target data, it includes:

[0039] If the hit status is partial hit or miss, the step of reading the target data from the main file area and performing integrity check is executed.

[0040] In addition, to achieve the above object, the present invention also provides an electric energy meter data management device, which includes a memory and a processor. An electric energy meter data management program is stored on the memory, and when the electric energy meter data management program is run by the processor, the steps of the above-mentioned electric energy meter data management method are implemented.

[0041] In addition, to achieve the above object, the present invention also provides a computer-readable storage medium, on which an electric energy meter data management program is stored, and when the electric energy meter data management program is run by a processor, the steps of the above-mentioned electric energy meter data management method are implemented.

[0042] An electric energy meter data management method proposed by an embodiment of the present invention. When data is written, the electric energy meter assigns corresponding logical identifiers to different data generated according to different services, and classifies, stores, checks, and backs up the generated data according to the assigned logical identifiers by querying a preset logical file attribute table, completing the data writing process. At the same time, when data is read, the target data is read, checked, and repaired by querying the preset logical file attribute table according to the logical identifier carried in the read request, completing the data reading process. That is, all storage media and all storage requirements in the electric energy meter are converted into a unified function for unified process processing, so that the program developers of the electric energy meter do not need to pay attention to the data reading and writing process, shortening the development time and reducing errors. Description of the Drawings

[0043] Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the solution of the embodiment of the present invention;

[0044] Figure 2 This is a schematic flowchart of the first embodiment of the data management method for the electric energy meter of the present invention.

[0045] The realization, functional features, and advantages of the object of the present invention will be further described with reference to the embodiments and the accompanying drawings. Specific Embodiments

[0046] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0047] The main solution of the embodiment of the present invention is: when data is written, the electric energy meter assigns corresponding logical identifiers to different data generated by different services, and classifies, stores, checks, and backs up the generated data according to the assigned logical identifiers by querying the preset logical file attribute table, thereby completing the data writing process. At the same time, when data is read, the target data is read, verified, and repaired by querying the preset logical file attribute table according to the logical identifier carried in the read request, thereby completing the data reading process.

[0048] Since in the prior art, developers need to spend a lot of time designing write functions with or without CRC, write functions with or without backup, functions for writing to flash or functions for writing to eeprom, etc. when writing functions to complete data reading and writing, which greatly increases the difficulty of code development.

[0049] The present invention provides a solution to convert all storage media and all storage requirements in the electric energy meter into unified functions for unified process processing, so that the program developers of the electric energy meter do not need to pay attention to the data reading and writing process, shortening the development time and reducing errors.

[0050] As Figure 1 shown, Figure 1 This is a schematic diagram of the terminal structure of the hardware operating environment involved in the embodiment solution of the present invention.

[0051] The terminal in the embodiment of the present invention can be an electric energy meter, or a movable terminal device such as a PC, a smart phone, a tablet computer, or a portable computer that has functions of data writing, data reading, and data processing.

[0052] As Figure 1As shown in the figure, the device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard). Optionally, the user interface 1003 may further include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0053] Optionally, the device may further include a camera, an RF (Radio Frequency) circuit, sensors, an audio circuit, a WiFi module, and so on. Among them, the sensors include, for example, a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. Among them, the ambient light sensor can adjust the brightness of the display screen according to the brightness of the ambient light, and the proximity sensor can turn off the display screen and / or the backlight when the mobile terminal moves to the ear. As a kind of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in all directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that identify the posture of the mobile terminal (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as a pedometer, tapping), etc.; of course, the mobile terminal can also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be elaborated here.

[0054] Those skilled in the art can understand that Figure 1 the device structure shown in the figure does not constitute a limitation on the device. It may include more or fewer components than shown in the figure, or combine some components, or have a different component layout.

[0055] Such as Figure 1 As shown in the figure, the memory 1005, as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an electric energy meter data management program.

[0056] In Figure 1 the terminal shown in the figure, the network interface 1004 is mainly used to connect to the background server and communicate with the background server for data; the user interface 1003 is mainly used to connect to the client (user side) and communicate with the client for data; and the processor 1001 can be used to call the electric energy meter data management program stored in the memory 1005 and perform the following operations:

[0057] When the electricity meter generates data to be written, a first logical identifier is assigned to the data to be written according to the service type of the electricity meter that generates the data to be written;

[0058] The writing of the data to be written is completed according to the first logical identifier and a preset logical file attribute table;

[0059] When there is a target data reading request in the electricity meter, a second logical identifier of the target data carried by the reading request is obtained;

[0060] The reading of the target data is completed according to the second logical identifier and the preset logical file attribute table.

[0061] Further, the processor 1001 may call the electricity meter data management program stored in the memory 1005 and further perform the following operations:

[0062] The first logical identifier includes a data Id, a storage address, a backup address, and data attributes. The data attributes include a first data attribute, a second data attribute, and a third data attribute. The step of completing the writing of the data to be written according to the first logical identifier and the preset logical file attribute table includes:

[0063] Query the preset logical file attribute table according to the third data attribute to determine whether there is a cache configuration for the data to be written;

[0064] If there is a cache configuration for the data to be written, query the data in the buffer area to determine the hit status of the data in the buffer area hitting the data to be written;

[0065] If the hit status is a miss, query the preset logical file attribute table according to the first data attribute to determine whether there is a verification configuration for the data to be written;

[0066] If there is no verification configuration for the data to be written, query the preset logical file attribute table according to the data Id to obtain the storage type;

[0067] According to the storage type and the storage address, complete the writing of the data to be written and update the data to be written to the buffer area;

[0068] Query the preset logical file attribute table according to the second data attribute to determine whether there is a backup configuration for the data to be written;

[0069] If there is a backup configuration for the data to be written, complete the backup of the data to be written according to the storage type and the backup address.

[0070] Further, the processor 1001 may call the electricity meter data management program stored in the memory 1005 and further perform the following operations:

[0071] After the step of determining whether the data to be written has a cache configuration, it includes:

[0072] If the data to be written does not have a cache configuration, then perform the step of querying the preset logical file attribute table according to the first data attribute and determining whether the data to be written has a verification configuration.

[0073] Further, the processor 1001 may call the electricity meter data management program stored in the memory 1005 and further perform the following operations:

[0074] After the step of, if the data to be written has a cache configuration, querying the data in the cache area to determine the hit status of the data in the cache area hitting the data to be written, it includes:

[0075] If the hit status is all hits, then update the data to be written to the cache area and perform the step of querying the preset logical file attribute table according to the first data attribute and determining whether the data to be written has a verification configuration;

[0076] If the hit status is partial hits, then determine that the data hit in the cache area is invalid and perform the step of querying the preset logical file attribute table according to the first data attribute and determining whether the data to be written has a verification configuration.

[0077] Further, the processor 1001 may call the electricity meter data management program stored in the memory 1005 and further perform the following operations:

[0078] After the step of determining whether the data to be written has a verification configuration, it includes:

[0079] If the data to be written has a verification configuration, then perform an integrity check on the data to be written, correspondingly generate a verification code for the data to be written, and add the verification code to the data to be written.

[0080] Further, the processor 1001 may call the electricity meter data management program stored in the memory 1005 and further perform the following operations:

[0081] The step of completing the reading of the target data according to the second logical identifier and the preset logical file attribute table includes:

[0082] Query the preset logic file attribute table according to the second logic identifier, and determine whether there is a verification configuration for the target data. If there is a verification configuration, perform an integrity self-check verification on the target data;

[0083] If the self-check verification of the target data fails, perform a data rollback verification on the target data;

[0084] If the self-check verification of the target data is qualified, query the preset logic file attribute table according to the second logic identifier, and after determining that there is a cache configuration for the target data, query the data in the cache area to determine the hit status of the data in the cache area hitting the target data;

[0085] If the hit status is a full hit, read the target data from the cache area;

[0086] If the hit status is a partial hit or a miss, read the target data from the main file area and update the target data to the cache area.

[0087] Further, the processor 1001 can call the electric energy meter data management program stored in the memory 1005 and perform the following operations:

[0088] The step of performing a data rollback verification on the target data includes:

[0089] Query the preset logic file attribute table according to the second logic identifier, and after determining that there is a cache configuration for the target data, query the data in the cache area to determine the hit status of the data in the cache area hitting the target data. If the hit status is a full hit, perform an integrity verification on the target data read from the cache area;

[0090] If the integrity verification of the target data read from the cache area is qualified, the reading of the target data is completed;

[0091] If the integrity verification of the target data read from the cache area is unqualified, read the target data from the main file area and perform an integrity verification;

[0092] If the integrity verification of the target data read from the main file area is qualified, perform data repair on the cache area based on the target data read from the main file area, and the reading of the target data is completed;

[0093] If the integrity verification of the target data read from the main file area is unqualified, read the target data from the backup area and perform an integrity verification;

[0094] If the integrity check of the target data read from the backup area is qualified, data repair is performed on the main file and the cache area based on the target data read from the backup area, and the reading of the target data is completed.

[0095] Further, the processor 1001 may call the electric energy meter data management program stored in the memory 1005 and further perform the following operations:

[0096] After the step of querying the data in the cache area to determine the hit status of the target data in the cache area, it includes:

[0097] If the hit status is partial hit or miss, the step of reading the target data from the main file area and performing integrity check is executed.

[0098] Refer to Figure 2 , in the first embodiment of the electric energy meter data management method of the present invention, the electric energy meter data management method includes:

[0099] Step S10, when the electric energy meter generates data to be written, according to the service type of the data generated by the electric energy meter, a first logical identifier is assigned to the data to be written;

[0100] Currently, the electric energy meter generates different types of data according to different service types, such as parameter data, power consumption data, and frozen data, etc. When the data is generated, the electric energy meter assigns a logical identifier (i.e., the first logical identifier) to the data to be written according to the preset assignment method and the data type of the generated data. Different data types have different logical identifiers. The above preset assignment method is the correspondence between the data type and the logical identifier. For example, the parameter data corresponds to the first logical identifier A, and the power consumption data corresponds to the first logical identifier B.

[0101] Step S20, complete the writing of the data to be written according to the first logical identifier and the preset logical file attribute table;

[0102] Further, the above first logical identifier includes a data Id, a storage address, a backup address, and data attributes. The corresponding data attributes include a first data attribute, a second data attribute, and a third data attribute. In addition, the first logical identifier may further include a file size. It can be understood that the first logical identifier contains multiple field descriptions. For example, the data Id is the field description corresponding to the data Id segment in the first logical identifier, as shown in the preset logical file attribute table in Table 1. The size of the data Id is 4, that is, it occupies four bytes. When the data Id is greater than or equal to 0 and less than 100, it indicates that the memory type where the data to be written corresponding to the first logical identifier is written is eeprom (Electrically Erasable Programmable Read-Only Memory); when the data Id is greater than or equal to 100 and less than 200, it indicates that the memory type where the data to be written corresponding to the first logical identifier is written is flash (Flash Memory); when the data Id is greater than or equal to 200 and less than 300, it indicates that the memory type where the data to be written corresponding to the first logical identifier is written is determined according to the file system logic of the system. Other contents in the first logical identifier can be referred to Table 1, which will not be elaborated here. It can be understood that there are actually variables in the configuration information included in Table 1. After the content of Table 1 above is modified by the const (qualifier, which converts an object into a constant) method, the variables can be removed, so that the configuration information of Table 1 can be stored in a flash-type memory to save the space of a ram (random access memory) type of memory, that is, to save the space of the buffer area.

[0103] Each content of the first logical identifier can be set by technicians according to the characteristics of the data type. After the data to be written is assigned the first logical identifier, the electric energy meter completes the writing of the data to be written according to the content of the first logical identifier with reference to the preset logical file attribute table.

[0104] Table 1

[0105]

[0106] Further, query the preset logical file attribute table according to the third data attribute to determine whether there is a cache configuration for the data to be written; if there is a cache configuration, query the cache area to determine whether the data in the cache area hits the hit status of the data to be written; if the hit status is a miss, query the preset logical file attribute table according to the first data attribute to determine whether there is a verification configuration for the data to be written; if there is no verification configuration for the data to be written, query the preset logical file attribute table according to the data Id to obtain the storage type; according to the storage type and the storage address, complete the writing of the data to be written, and update the data to be written to the cache area; query the preset logical file attribute table according to the second data attribute to determine whether there is a backup configuration for the data to be written; if there is a backup configuration, complete the backup of the data to be written according to the storage type and the backup address.

[0107] Specifically, the electricity meter reads the third data attribute in the first logical identifier. The third data attribute is the description of the third data attribute field in the data attribute field of the first logical identifier description field. It can be understood that the size of the data attribute is 1 byte, and there are eight bits (bit) in one byte. The third data attribute occupies two of them. As shown in Table 1, the third data attribute occupies Bit4-bit5. Usually, the data stored in each bit is 0 or 1. Further, according to the different storage positions of 0 or 1, there are four kinds of information that Bit4-bit5 can actually reflect: Bit4 = 0-bit5 = 0, Bit4 = 0-bit5 = 1, Bit4 = 1-bit5 = 0, Bit4 = 1-bit5 = 1. Therefore, it can correspond to four states, such as Bit4-bit5: 0 means that the data to be written does not have a cache configuration (no cache); Bit4-bit5: 1 means that the data to be written does not exist in the buffer (cache no data); Bit4-bit5: 2 means that the data to be written exists in the buffer (cache data ditry), but the data to be written has been damaged; Bit4-bit5: 3 means that the data to be written exists in the buffer (cache data good), and the data to be written is intact. Among them, when Bit4-bit5 is 1, 2, or 3, it means that the data to be written has a cache configuration at this time. It can be understood that when the data to be written is written for the first time, it actually only has a cache configuration and no cache configuration. If the data to be written is written repeatedly, the third attribute of the data to be written can be 1, 2, or 3, and the third attribute is actually the manifestation based on the query result in the buffer. For example, when the electricity meter reads that the third data attribute is any one of 1, 2, or 3, it is determined that the data to be written has a cache configuration. Further query the data in the buffer, and the third attribute can be updated according to the query feedback. It can be understood that the data cached in the buffer is data with a cache configuration and has been used recently. At the same time, the buffer also caches the cache identifier related to its own cached data. Each cached data in the buffer corresponds to a cache identifier. Specifically, the cache identifier can include: cache Id, cache address, cache file size, crc (Cyclic Redundancy Check) field, and buffer usage. Among them, adding the crc field to the buffer can further improve the data access speed of the electricity meter.The content included in a specific cache identifier corresponds to the cache information shown in Table 2. The cache Id is similar to the data Id in Table 1 and will not be elaborated here; the cache address is the address of the cache area in the ram type storage; the cache file size indicates the size of the cache data occupying the cache area; when caching the data to be written itself, the crc checksum corresponding to the data to be written is also written to the cache area correspondingly, and the crc field is the crc checksum; the cache area usage is the cache Id corresponding to the cache data in the cache area. At the same time, ValId_offset and ValId_size describe the paragraphs of a single file cached in the cache area, that is, the paragraphs between ValId_offset and ValId_size or between ValId_sizet and ValId_offse are the data of a certain single file. When judging whether the data in the cache area hits the hit status of the data to be written, first judge whether the cache Id of the data in the cache area is the same as the data Id in the first logical identifier of the data to be written. When the cache Id of the data in the cache area is the same as the data Id of the data to be written, the data corresponding to the cache Id is compared with the data to be written to judge whether the data corresponding to the cache Id is the same as the data to be written. If they are the same, it is determined that the data in the cache area hits the data to be written. Otherwise, it is determined that the data in the cache area does not hit or partially hits (partial hit means that some of the data corresponding to the cache Id is the same as the data to be written) the data to be written. At the same time, the third attribute in the above first logical identifier is updated according to the query result. If it is a partial hit, the third attribute Bit4-bit5: 2; if it is a miss, the third attribute Bit4-bit5: 1. When the data in the cache area does not hit or partially hits the data to be written, the electric energy meter reads the first data attribute in the first logical identifier. The first data attribute is the description of the first data attribute field in the data attribute field of the first logical identifier description field. Referring to Table 1, the first attribute occupies Bit0-bit1, and there are three corresponding states. Bit0-bit1: 0 means that the data to be written does not need to be verified (no crc), such as crc verification; Bit0-bit1: 1 means that some of the data to be written needs to be verified (section crc); Bit0-bit1: 2 means that all of the data to be written needs to be verified (file crc). If the first data attribute Bit0-bit1: 0 in the first logical identifier is read, it is determined that the data to be written does not need to be verified, and the memory type to which the data to be written is written is obtained by continuing to read the data Id from the first logical identifier, and the storage address of the data to be written is read from the first logical identifier. According to the obtained memory type and storage address, the data to be written is stored in the main file area correspondingly. The main file area is the main storage area of the data to be written.Optionally, the electricity meter reads the second data attribute in the first logical identifier. As shown in Table 1, the second data attribute occupies four states corresponding to Bit2-bit3. Bit2-bit3: 0 indicates that the data to be written does not need to be backed up (no backup); Bit2-bit3: 1 indicates that the storage type of the backup of the data to be written is logically judged according to the file system (fs, filesystem) built into the system (backup to fs); Bit2-bit3: 2 indicates that the storage type of the backup of the data to be written is eeprom (ep) (backup to ep); Bit2-bit3: 3 indicates that the storage type of the backup of the data to be written is flash (backup to flash). After obtaining the storage type of the backup of the data to be written, combined with the backup address in the first logical identifier, the data to be written is backed up, that is, the data to be written is stored in the backup area.

[0108] Table 2

[0109]

[0110] Optionally, after the step of determining whether the data to be written has a cache configuration, if the data to be written does not have a cache configuration, then execute the step of querying the preset logical file attribute table according to the first data attribute to determine whether the data to be written has a verification configuration.

[0111] Specifically, when the electricity meter reads that the third data attribute is 0, it is determined that the data to be written does not have a cache configuration, skips the step of querying the data in the cache area, and directly executes the step of querying the preset logical file attribute table according to the first data attribute to determine whether the data to be written has a verification configuration.

[0112] Optionally, after the step of querying the cache area to determine whether the data in the cache area hits the data to be written, if the hit status is all hits, then update the data to be written to the cache area, and execute the step of querying the preset logical file attribute table according to the first data attribute to determine whether the data to be written has a verification configuration; if the hit status is partial hits, then determine that the data hit in the cache area is invalid, and execute the step of querying the preset logical file attribute table according to the first data attribute to determine whether the data to be written has a verification configuration.

[0113] Specifically, when the cache ID of the data in the buffer is the same as the data ID of the data to be written, the data corresponding to the cache ID in the buffer is compared with the data to be written. When the two data are completely the same, it is determined that all the data in the buffer hits the data to be written, and the data to be written is correspondingly updated to the buffer. When only part of the two data is the same, it is determined that part of the data in the buffer hits the data to be written, and at the same time, it is determined that the data in the buffer hits invalid, and the step of querying the preset logic file attribute table according to the first data attribute and judging whether there is a verification configuration for the data to be written is executed. In addition, if there is a complete miss, the step of querying the preset logic file attribute table according to the first data attribute and judging whether there is a verification configuration for the data to be written is also directly executed.

[0114] Further, after the step of judging whether there is a verification configuration for the data to be written, if the data to be written has a verification configuration, the integrity verification of the data to be written is performed, and the verification code corresponding to the data to be written is generated, and the verification code is added to the data to be written.

[0115] Specifically, when the first data attribute of the data to be written obtained by the electric energy meter is any one of 1 or 2, it is determined that the data to be written has a verification configuration and needs to be verified. Corresponding to 2, the integrity verification of all the data to be written is performed. It can be understood that based on the above example, the integrity verification is crc verification. The verification code is generated according to the data to be written, and the data to be written and the corresponding generated verification code are written correspondingly. In fact, for crc verification, when writing the data to be written, the verification code is generated according to the written data, and when reading, the crc verification is used based on the verification code to judge whether the data read at this time is damaged. That is, the integrity verification when writing data is actually generating the verification code according to the data, which can be used to judge whether the data read is complete based on the verification code when reading. In addition, regarding crc verification, the current verification technology is relatively mature and will not be elaborated here. At the same time, for the data to be written with a re-verification configuration, in addition to writing the data to be written and the verification code to the main file area correspondingly, if there is a cache configuration or a backup configuration, the data to be written and the verification code are also written to the cache area and the backup area correspondingly.

[0116] It can be understood that Table 2 above is similar to Table 1 and also has variables. The content of Table 2 can be modified by the const method to remove the variables, so that the configuration information of Table 2 can be stored in a flash-type memory to save the ram-type memory, that is, to save the space of the buffer. At the same time, in this embodiment, when the electric energy meter reads and writes data, introducing the concept of cache greatly improves the access efficiency of the electric energy meter data, and the buffer can be set to be used by the data corresponding to a certain cache ID or the data corresponding to multiple cache IDs, flexibly configuring the use of ram resources.

[0117] Step S30: When there is a target data reading request in the electricity meter, obtain the second logical identifier of the reading request.

[0118] It can be understood that in addition to data writing, there is also data reading in the electricity meter. The target data reading request contains a second logical identifier. The second logical identifier is similar to the first logical identifier and also includes: data Id, storage address, backup address, and data attributes. The corresponding data attributes include the first data attribute, the second data attribute, and the third data attribute. That is, the first logical identifier represents the logical identifier configured for the data to be written when data is written, and the second logical identifier represents the logical identifier of the target data carried in the reading request when data is read. The target data is the data to be read. Therefore, the second logical identifier will also have a corresponding relationship with Table 1 above.

[0119] Step S40: Complete the reading of the target data according to the second logical identifier and the preset logical file attribute table.

[0120] It can be understood that the content types in the above second logical identifier are similar to those in the first logical identifier. For specific details, please refer to the relevant description of the first logical identifier and will not be elaborated here.

[0121] Furthermore, query the preset logical file attribute table according to the second logical identifier to determine whether there is a check configuration for the target data. If there is a check configuration, perform an integrity self-check on the target data. If the self-check of the target data fails, perform a data rollback check on the target data. If the self-check of the target data is qualified, query the preset logical file attribute table according to the second logical identifier. After determining that there is a cache configuration for the target data, query the data in the cache area to determine the hit status of the data in the cache area hitting the target data. If the hit status is a complete hit, read the target data from the cache area. If the hit status is a partial hit or a miss, read the target data from the main file area and update the target data to the cache area.

[0122] Specifically, the electricity meter reads the first data attribute in the second logical identifier, determines whether there is a verification configuration for the target data, and performs an integrity self-check verification when there is a verification configuration. The integrity self-check verification is to perform a crc verification on all data corresponding to the data Id in the second logical identifier stored in the electricity meter once. If the self-check verification is qualified and before querying the data in the query buffer, read the third data attribute in the second logical identifier to determine whether there is a cache configuration for the target data. If there is, further query the data in the cache area to determine whether the data in the cache area hits the target data. If it is completely hit, directly read the target data from the cache area. If it is not completely hit (i.e., partially hit or not hit), read the target data from the main file area according to the data Id and storage address in the second logical identifier, update the target data to the cache area, and repair the data corresponding to the cache area and the target data.

[0123] Further, the step of performing data rollback verification on the target data includes: querying the preset logical file attribute table according to the second logical identifier, and after determining that there is a cache configuration for the target data, querying the data in the cache area to determine the hit status of whether the data in the cache area hits the target data. If the hit status is completely hit, perform integrity verification on the target data read from the cache area; if the integrity verification of the target data read from the cache area is qualified, the target data reading is completed; if the integrity verification of the target data read from the cache area is unqualified, read the target data from the main file area and perform integrity verification; if the integrity verification of the target data read from the main file area is qualified, perform data repair on the cache area based on the target data read from the main file area, and the target data reading is completed; if the integrity verification of the target data read from the main file area is unqualified, read the target data from the backup area and perform integrity verification; if the integrity verification of the target data read from the backup area is qualified, perform data repair on the main file and the cache area based on the target data read from the backup area, and the target data reading is completed.

[0124] The above data rollback verification is actually to perform CRC verification on the target data in the cache area, the main file area and the backup area to determine the integrity of the target data. Specifically, if the electric energy meter reads the second logical identifier to determine that the target data has a cache configuration, the data in the cache area is queried to determine whether the cache area hits the target data. If the cache area completely hits the target data, the target data is read from the cache area. It can be understood that at this time, it has been determined that the target data has a verification configuration. Therefore, when the target data is written, a verification code will be generated accordingly. At this time, the target data read will contain a verification code corresponding to the target data. The electric energy meter performs a CRC verification on the target data through the verification code to verify the integrity of the target data. If the integrity of the target data in the cache area is qualified after the CRC verification, the target data is read at this time. If the integrity of the target data in the cache area is unqualified after the CRC verification, the target number is further read from the main file area, and the target data is read from the main file area. Specifically, it can be read according to the data Id and storage address in the second logical identifier. Similarly, a CRC verification is performed through the verification code to verify the integrity of the target data read from the main file area. If the integrity is qualified, the target data is read completely, and the data corresponding to the target data in the cache area is repaired based on the read target data. If the target data read from the main file area fails the integrity check, the target data is read from the backup area according to the data ID and the backup address in the second logical identifier, and a CRC check is performed on the target data read from the backup area. If the integrity check is qualified, the target data is read completely, and the data corresponding to the target data in the main file area and the cache area is repaired based on the target data read from the backup area. At this point, the data rollback check is completed.

[0125] Further, after the step of querying the data in the cache area to determine whether the data in the cache area hits the target data, if the hit status is a partial hit or a miss, the step of reading the target data from the main file area and performing an integrity check is executed.

[0126] Specifically, if there is no complete hit, that is, the complete target data cannot be read from the cache area, at this time, the target data is directly read from the main file area, and the subsequent steps can refer to the subsequent steps when the target data integrity of the cache area is unqualified after the CRC check, which will not be repeated here. In addition, step S10, step S20, step S30 and step S40 in this embodiment do not constitute a limitation on the steps, and the specific implementation order can be set according to actual conditions.

[0127] In this embodiment, when data is written, the electricity meter assigns corresponding logical identifiers to different data generated by different services. According to the assigned logical identifiers, the preset logical file attribute table is queried to classify, store, verify, and back up the generated data, completing the data writing process. At the same time, when data is read, the preset logical file attribute table is queried according to the logical identifier carried in the read request to read, verify, and repair the target data, completing the data reading process. That is, all storage media and all storage requirements in the electricity meter are transformed into a unified function for unified process processing, so that the program developers of the electricity meter do not need to pay attention to the data reading and writing process, shortening the development time and reducing errors.

[0128] In addition, this embodiment also provides an electricity meter data management device, which includes a memory and a processor. An electricity meter data management program is stored on the memory. When the electricity meter data management program is run by the processor, the steps of the above-mentioned electricity meter data management method are implemented.

[0129] The specific implementation manner of the present invention based on the electricity meter data management device is basically the same as that of the above-mentioned embodiments based on the electricity meter data management method, and will not be elaborated here.

[0130] In addition, this embodiment also provides a computer-readable storage medium. An electricity meter data management program is stored on the computer-readable storage medium. When the electricity meter data management program is run by a processor, the steps of the above-mentioned electricity meter data management method are implemented.

[0131] The specific implementation manner of the medium of the present invention is basically the same as that of the above-mentioned embodiments based on the electricity meter data management method, and will not be elaborated here.

[0132] It should be noted that in this article, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or system. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of another identical element in the process, method, article or system including that element.

[0133] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments.

[0134] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-described example methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art can be embodied in the form of a software product. This computer software product is stored in a storage medium as described above (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions for causing a terminal device (which may be a mobile phone, computer, server, electric energy meter, or network device, etc.) to execute the methods described in various embodiments of the present invention.

[0135] The above are only the preferred embodiments of the present invention, and do not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present invention, or directly or indirectly applied in other related technical fields, shall be equally included in the patent protection scope of the present invention.

Claims

1. A method for managing electricity meter data, characterized in that, The electric energy meter data management method includes the following steps: When the electric energy meter generates data to be written, according to the service type of the electric energy meter generating the data to be written, allocate a first logical identifier for the data to be written; Complete the writing of the data to be written according to the first logical identifier and the preset logical file attribute table; When there is a target data reading request in the electric energy meter, obtain the second logical identifier of the target data carried by the reading request; Complete the reading of the target data according to the second logical identifier and the preset logical file attribute table; Wherein, the first logical identifier includes a data Id, a storage address, a backup address, and data attributes. The data attributes include a first data attribute, a second data attribute, and a third data attribute. The step of completing the writing of the data to be written according to the first logical identifier and the preset logical file attribute table includes: Query the preset logical file attribute table according to the third data attribute to determine whether there is a cache configuration for the data to be written; If there is a cache configuration for the data to be written, query the data in the buffer area to determine the hit status of the data in the buffer area hitting the data to be written; If the hit status is not hit, query the preset logical file attribute table according to the first data attribute to determine whether there is a verification configuration for the data to be written; If there is no verification configuration for the data to be written, query the preset logical file attribute table according to the data Id to obtain the storage type; Complete the writing of the data to be written according to the storage type and the storage address, and update the data to be written to the buffer area; Query the preset logical file attribute table according to the second data attribute to determine whether there is a backup configuration for the data to be written; If there is a backup configuration for the data to be written, complete the backup of the data to be written according to the storage type and the backup address; Wherein, the step of completing the reading of the target data according to the second logical identifier and the preset logical file attribute table includes: Query the preset logical file attribute table according to the second logical identifier to determine whether there is a verification configuration for the target data. If there is a verification configuration, perform an integrity self-check verification on the target data; If the self-check verification of the target data is unqualified, perform a data rollback verification on the target data; If the self-check verification of the target data is qualified, query the preset logical file attribute table according to the second logical identifier. After determining that there is a cache configuration for the target data, query the data in the buffer area to determine the hit status of the data in the buffer area hitting the target data; If the hit status is a complete hit, read the target data from the buffer area; If the hit status is a partial hit or not hit, read the target data from the main file area and update the target data to the buffer area.

2. The method for managing electric energy meter data according to claim 1, characterized in that, After the step of determining whether there is a cache configuration for the data to be written, it includes: If there is no cache configuration for the data to be written, perform the step of querying the preset logical file attribute table according to the first data attribute to determine whether there is a verification configuration for the data to be written.

3. The method for managing electric energy meter data according to claim 1, wherein, After the step of, if there is a cache configuration for the data to be written, query the data in the buffer area to determine the hit status of the data in the buffer area hitting the data to be written, include: If the hit status is all hits, update the data to be written to the buffer area, and perform the step of querying the preset logical file attribute table according to the first data attribute to determine whether there is a verification configuration for the data to be written. If the hit status is partial hits, determine that the data hit in the buffer area is invalid, and perform the step of querying the preset logical file attribute table according to the first data attribute to determine whether there is a verification configuration for the data to be written.

4. The electric energy meter data management method according to claim 1, characterized in that, After the step of determining whether there is a verification configuration for the data to be written, include: If there is a verification configuration for the data to be written, perform an integrity verification on the data to be written, correspondingly generate a verification code for the data to be written, and add the verification code to the data to be written.

5. The method for managing electric energy meter data according to claim 1, wherein The step of performing a data rollback verification on the target data includes: Query the preset logical file attribute table according to the second logical identifier, and after determining that there is a cache configuration for the target data, query the data in the buffer area to determine the hit status of the data in the buffer area hitting the target data. If the hit status is full hits, perform an integrity verification on the target data read from the buffer area. If the integrity verification of the target data read from the buffer area is qualified, the reading of the target data is completed. If the integrity verification of the target data read from the buffer area is unqualified, read the target data from the main file area and perform an integrity verification. If the integrity verification of the target data read from the main file area is qualified, perform data repair on the buffer area based on the target data read from the main file area, and the reading of the target data is completed. If the integrity verification of the target data read from the main file area is unqualified, read the target data from the backup area and perform an integrity verification. If the integrity verification of the target data read from the backup area is qualified, perform data repair on the main file and the buffer area based on the target data read from the backup area, and the reading of the target data is completed.

6. The electric energy meter data management method according to claim 5, characterized in that After the step of querying the data in the buffer area to determine the hit status of the data in the buffer area hitting the target data, include: If the hit status is partial hits or no hits, perform the step of reading the target data from the main file area and performing an integrity verification.

7. An electric energy meter data management device, characterized in that, The electric energy meter data management device includes a memory and a processor. An electric energy meter data management program is stored on the memory. When the electric energy meter data management program is run by the processor, the steps of the electric energy meter data management method according to any one of claims 1-6 are implemented.

8. A computer-readable storage medium, characterized in that, A power meter data management program is stored on the computer-readable storage medium. When the power meter data management program is run by a processor, the steps of the power meter data management method according to any one of claims 1-6 are implemented.

Citation Information

Patent Citations

  • Power enterprise user data storage and analysis system

    CN105303455A

  • Power line carrier communication method

    CN106385305A