Electric energy meter data storage method and system

CN120743900BActive Publication Date: 2026-09-18WUHAN SAN FRAN ELECTRONICS CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510628661.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-15
Publication Date
2026-09-18
Estimated Expiration
2045-05-15

AI Technical Summary

Technical Problem

[0005]本发明提供一种电能表数据存储方法及系统,用以解决现有技术中电能表数据存储方式配置灵活度较差的缺陷,提高数据存储的灵活性与可拓展性

Benefits of technology

[0017]The energy meter data storage method and system provided by this invention divides the storage medium into multiple independent subdomains based on object-oriented protocol data identification, achieving physical isolation and classified storage of different types of data objects, enhancing data organization and space management accuracy. Each subdomain is configured with an independent control domain, solidifying the storage structure parameters of the subdomain to ensure the controllability and maintainability of the storage strategy. Furthermore, a mapping relationship between object data attributes and storage configuration is established through a control domain data relationship table, forming a structured index. During data read/write operations, the target subdomain number and object identifier are obtained through parsing commands, and the storage area is quickly located by combining the control domain configuration. Simultaneously, object data attributes are accurately matched according to the relationship table, achieving dual verification of storage location and data characteristics. This achieves orderly storage and efficient management of energy meter data, facilitating precise read/write operations for different types of data objects, and improving the flexibility and efficiency of data storage and access.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120743900B_ABST
    Figure CN120743900B_ABST
Patent Text Reader

Abstract

This invention provides a method and system for storing electricity meter data, applied in the field of electricity meter data storage technology. The method includes: dividing the storage medium of the electricity meter into multiple subdomains according to object-oriented protocol data identifiers; configuring control domain management based on the control domain corresponding to each subdomain to obtain a control domain data relationship table; parsing received data read / write commands to obtain the target subdomain number and the target object data identifier; determining the subdomain management structure configuration corresponding to the control domain to which the target subdomain number belongs to obtain the subdomain storage configuration corresponding to the data read / write command; querying the control domain data relationship table based on the target object data identifier to obtain the object data configuration corresponding to the data read / write command, and determining the read / write type of the object data configuration to achieve itemized or aggregated read / write of object-oriented protocol data. This invention improves the flexibility and scalability of electricity meter data storage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electricity meter data storage technology, and in particular to an electricity meter data storage method and system. Background Technology

[0002] In object-oriented protocols, an object identifier is an encoding of a unique object name. Its content consists of basic data structures and supports reading and writing data item by item and set by set.

[0003] Smart meters typically use EEPROM and FLASH as storage media. Traditional data storage systems rely on pre-allocated starting addresses and spaces for each object when reading and writing data. The application layer needs to pay attention to the starting address and length of the object data storage. When expanding objects, the underlying address and space allocation table needs to be modified. This makes the system inflexible, has poor readability and maintainability, and is highly coupled with the application layer.

[0004] It is evident that the data storage methods for electricity meters in related technologies suffer from poor configuration flexibility. Summary of the Invention

[0005] This invention provides a method and system for storing electricity meter data, which addresses the shortcomings of poor configuration flexibility in existing electricity meter data storage methods and improves the flexibility and scalability of data storage.

[0006] This invention provides a method for storing electricity meter data, comprising the following steps.

[0007] The storage medium of the energy meter is divided into multiple subdomains according to the object-oriented protocol data identifier. Each subdomain corresponds to a type of object-oriented protocol data object. A domain management structure is configured for each subdomain to obtain a control domain corresponding to each subdomain, where the control domain represents the subdomain storage configuration. A control domain management configuration is performed based on the control domain corresponding to each subdomain to obtain a control domain data relationship table, where the control domain data relationship table represents the object data configuration of the subdomain. In response to a received data read / write command, the command is parsed to obtain the target subdomain number and the target object data identifier. The domain management structure configuration corresponding to the control domain to which the target subdomain number belongs is determined, resulting in the subdomain storage configuration corresponding to the data read / write command. The control domain data relationship table is queried based on the target object data identifier to obtain the object data configuration corresponding to the data read / write command, and the read / write type of the object data configuration is determined, where the read / write type includes: set read / write and item read / write.

[0008] According to a data storage method for an electricity meter provided by the present invention, the step of configuring a domain management structure based on each subdomain to obtain a control domain corresponding to each subdomain includes: configuring a domain management structure based on each subdomain to obtain a domain management structure corresponding to each subdomain; instantiating the domain management structure corresponding to each subdomain to obtain a control domain corresponding to each subdomain; wherein, the domain management structure includes at least one of the following: subdomain storage medium, backup configuration, subdomain storage space starting address, subdomain storage space backup area starting address, subdomain allocated space size, subdomain associated data table, and the number of data items in the subdomain associated data table.

[0009] According to a data storage method for an electricity meter provided by the present invention, the step of configuring control domain management based on the control domain corresponding to each subdomain to obtain a control domain data relationship table includes: determining a set of control domains as a control domain management table based on the control domain corresponding to each subdomain; configuring the control domain management table according to a preset structure to obtain a control domain data relationship table; wherein, the control domain data relationship table includes at least one of the following: object data identifier, address offset of object data in the subdomain, object data length, data type, number of object data items, and object data item description table.

[0010] According to a data storage method for an electricity meter provided by the present invention, the data types include: basic type, array type, and structure type; when the data type is the basic type, the number of object data items and the object data item description table are set to invalid; when the data type is the array type, the number of object data items is used to represent the number of elements in the array, and the object data item description table is used to represent the data length of a single element in the array; when the data type is the structure type, the number of object data items is used to represent the number of elements in the structure, and the object data item description table is used to represent the data length of a single element in the structure.

[0011] According to a data storage method for an electricity meter provided by the present invention, the object data identifier includes multiple bytes; when the target byte among the multiple bytes is a preset value, the read / write type of the object data corresponding to the object data identifier is set read / write; when the target byte among the multiple bytes is other values, the read / write type of the object data corresponding to the object data identifier is item read / write, wherein the other values ​​are used to represent the item index of the object data.

[0012] According to the present invention, an energy meter data storage method includes at least one of the following object-oriented protocol data objects: energy class object, maximum demand class object, variable class object, event class object, parameter class object, freeze class object, display class object, and reserved object to be expanded.

[0013] This invention also provides an energy meter data storage system, comprising the following modules: a partitioning module, used to partition the storage medium of the energy meter according to object-oriented protocol data identifiers to obtain multiple subdomains, wherein each subdomain corresponds to a type of object-oriented protocol data object; a subdomain configuration module, used to configure a domain management structure based on each subdomain to obtain a control domain corresponding to each subdomain, wherein the control domain is used to represent the subdomain storage configuration of the subdomain; and a control domain configuration module, used to configure control domain management based on the control domain corresponding to each subdomain to obtain a control domain data relationship table, wherein the control domain data... A relation table is used to represent the object data configuration of the subdomain; a command parsing module is used to parse the data read / write command in response to receiving it, and obtain the target subdomain number and the target object data identifier; a determination module is used to determine the domain management structure configuration corresponding to the control domain to which the target subdomain number belongs, and obtain the subdomain storage configuration corresponding to the data read / write command; a query module is used to query the control domain data relation table based on the target object data identifier, obtain the object data configuration corresponding to the data read / write command, and determine the read / write type of the object data configuration, wherein the read / write type includes: set read / write and item read / write.

[0014] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the energy meter data storage method described above.

[0015] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the energy meter data storage method as described above.

[0016] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the energy meter data storage method described above.

[0017] The energy meter data storage method and system provided by this invention divides the storage medium into multiple independent subdomains based on object-oriented protocol data identification, achieving physical isolation and classified storage of different types of data objects, enhancing data organization and space management accuracy. Each subdomain is configured with an independent control domain, solidifying the storage structure parameters of the subdomain to ensure the controllability and maintainability of the storage strategy. Furthermore, a mapping relationship between object data attributes and storage configuration is established through a control domain data relationship table, forming a structured index. During data read / write operations, the target subdomain number and object identifier are obtained through parsing commands, and the storage area is quickly located by combining the control domain configuration. Simultaneously, object data attributes are accurately matched according to the relationship table, achieving dual verification of storage location and data characteristics. This achieves orderly storage and efficient management of energy meter data, facilitating precise read / write operations for different types of data objects, and improving the flexibility and efficiency of data storage and access. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced one by one below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0019] Figure 1 This is a flowchart illustrating the energy meter data storage method provided by the present invention.

[0020] Figure 2 This is a flowchart of the data reading and writing process of the data storage system provided by the present invention.

[0021] Figure 3 This is a schematic diagram of the structure of the electricity meter data storage system provided by the present invention.

[0022] Figure 4 This is a schematic diagram of the physical structure of the electronic device provided by the present invention. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0024] With the development of smart meters, the traditional DL / T645-2007 protocol can no longer meet the needs of business development. New smart meters require development using the DL / T698.45 object-oriented protocol. Compared with the DL / T645-2007 protocol, there have been significant changes in the data structure. The object-oriented protocol has a wide variety of basic data structures, including arrays, structures, date and time data types, TSA, etc.

[0025] In object-oriented protocols, an object identifier is an encoding of a unique object name, composed of basic data structures, supporting both item-by-item and set-by-set data reading and writing. Smart meters typically use electrically erasable programmable read-only memory (EEPROM) and flash memory (FLASH) as storage media. Traditional data storage systems rely on pre-allocated starting addresses and spaces for each object, limiting reading and writing to either item-by-item or set-by-set operations. The application layer needs to monitor the starting address and length of object data storage. Expanding objects requires modifying the underlying address and space allocation tables, resulting in inflexibility, poor readability, poor maintainability, and high coupling with the application layer. Furthermore, changing the storage of a certain type of data from EEPROM to FLASH, or vice versa, is cumbersome, requiring modification of the underlying starting address and space allocated for each data item. Therefore, it is necessary to design a data storage system based on object-oriented protocols to address this issue.

[0026] Traditional data storage methods cannot simultaneously support object-oriented protocol data segmentation and collection reading and writing. When the application layer reads and writes object data or extends objects, it needs to pay attention to the address and space allocation of the underlying storage medium. This makes it inflexible, has poor readability and maintainability, and is highly coupled with the application layer. When data storage is changed from one storage medium to another, the modification is cumbersome and has a significant impact.

[0027] The purpose of this invention is to provide a data storage method and system for electricity meters, which can perform itemized and aggregated reading and writing of object-oriented protocol data. When the application layer reads, writes and expands objects, it does not need to care about the actual address and space size of the data in the underlying storage medium. It is flexible, scalable, has low coupling between the underlying layer and the application layer, and has little impact when the data storage medium is changed.

[0028] The system framework of the electricity meter data storage system provided by this invention comprises six parts: EEPROM / FLASH driver, storage medium transaction coordination layer, storage medium domain block manager, control domain management table, control domain data relationship table, and database init / read / write interfaces. See Table 1 for details; Table 1 is the data storage system framework table of the electricity meter based on the object-oriented protocol provided by this invention. Table 1

[0029] The data storage system adopts a scalable hierarchical design, with the EEPROM / FLASH driver and storage medium transaction coordination layer serving as the underlying storage components, providing interfaces for direct reading and writing of the storage medium. The core components of this data storage system are the storage medium domain block manager, the control domain management table, and the control domain data relationship table.

[0030] Optionally, the electricity meter data storage method in this embodiment can be executed by a server, by a terminal device, or by both a server and a terminal device. For example, the electricity meter data storage method in this embodiment can be executed by an electricity meter device.

[0031] Figure 1 This is a flowchart illustrating the energy meter data storage method provided by the present invention, as shown below. Figure 1 As shown, the method includes the following: Step 101: Divide the storage medium of the electricity meter into multiple subdomains according to the object-oriented protocol data identifier.

[0032] Each of the multiple subdomains corresponds to a type of object-oriented protocol data object.

[0033] In this embodiment of the invention, the storage medium of the energy meter is divided into multiple independent subdomains by a storage medium domain block manager according to the object-oriented protocol data identifier class. Each subdomain identifies a type of object data.

[0034] Based on the object-oriented protocol supported by the electricity meter (such as DL / T698.45), data objects are classified according to the identifier defined by the protocol. Each data object identifier consists of four bytes, where: the first three bytes indicate the data object category (e.g., 40 0102 represents the communication address parameter in the electricity category); the last byte is the operation identifier bit (00 indicates a set operation, and a non-zero value indicates a sub-item operation).

[0035] The storage medium domain block manager divides the storage medium (EEPROM / FLASH) into independent subdomains according to the following rules: object identifiers with the same first three bytes are grouped into the same subdomain; the subdomain storage medium is selected based on data characteristics.

[0036] For example, high-frequency read / write data (such as communication addresses) and small-capacity key parameters are stored in EEPROM; large-capacity historical data (such as freeze records) and low-frequency modification parameters are stored in FLASH.

[0037] Step 102: Configure the domain management structure for each subdomain to obtain the control domain corresponding to each subdomain.

[0038] The control domain is used to represent the subdomain storage configuration of the subdomain.

[0039] In this embodiment of the invention, each subdomain corresponds to a domain management structure to manage this subdomain, and the instantiated object of the domain management structure is called a control domain.

[0040] Domain-based management configuration refers to defining a set of flexibly adjustable storage parameters for each subdomain, forming an independent control domain. The core function of the control domain is to encapsulate the storage configuration information of the subdomains (such as media type, backup strategy, address allocation, etc.) into dynamically manageable objects.

[0041] In some embodiments, subdomain storage configuration refers to the set of storage management parameters and policies defined for each logical subdomain in an energy meter. These parameters specify the storage location, storage method, backup rules, and access logic for the data in that subdomain. Subdomain storage configuration includes parameters such as subdomain storage media, backup policies, and address allocation. For example, a subdomain storage configuration can be a pre-configured subdomain management structure, including at least one of the following: subdomain storage media, backup configuration, subdomain storage space starting address, subdomain storage space backup area starting address, and subdomain allocated space size.

[0042] Step 103: Configure control domain management based on the control domain corresponding to each subdomain to obtain the control domain data relationship table.

[0043] Among them, the control domain data relationship table is used to represent the object data configuration of the subdomain; In this embodiment of the invention, each subdomain corresponds to a domain management structure to manage this subdomain. The instantiated object of the domain management structure is called a control domain, and the collection of all control domains is a control domain management table. By configuring the control domain management table, the storage medium domain block manager can know whether the current subdomain data content is stored in EEPROM or FLASH, whether backup storage is required, the starting address of storage, the backup address and space size, as well as the associated data table and the number of table data items.

[0044] The control domain data relationship table is a logical mapping table generated based on the subdomain control domain configuration. It describes the storage rules and access logic of all data objects within the subdomain. Its core functions include: recording the identifier, logical address, data type, and sub-item information of each data object; dynamically calculating the physical address through logical address offset and storage medium parameters to achieve decoupling between the application layer and the underlying storage medium; and defining sub-item rules for composite data types (arrays, structures) to support fine-grained data operations.

[0045] The control domain data relationship table is a direct representation of the data object information in the object-oriented protocol. It is the foundation for implementing itemized and set reading and writing. The control domain data relationship table is filled with a specific structure. When expanding objects, you only need to add rows after this table.

[0046] By using address offsets, the application layer does not need to worry about the actual address and space allocation of each object data at the underlying level when reading and writing object data.

[0047] Step 104: In response to receiving a data read / write command, parse the data read / write command to obtain the target subdomain number and the target object data identifier.

[0048] In this embodiment of the invention, data read / write command parsing refers to the key steps of extracting the target subdomain number and the target object data identifier from the command received from the application layer. Its core functions include: determining the logical storage partition (subdomain) to which the data belongs through the target subdomain number; locating the specific operation object (such as electrical energy parameters, event records, etc.) within the subdomain through the target object data identifier; and distinguishing between set operations and itemized operations based on the last byte of the target object data identifier, providing a basis for subsequent address calculation.

[0049] In some embodiments, the host computer uses an object-oriented protocol to set the communication address of the electricity meter via RS485, with the object identifier being 40010200; after receiving the setting command, the electricity meter parses the command to obtain 6 bytes of electricity meter communication address data, which includes: the target subdomain number and the target object data identifier; Step 105: Determine the domain management structure configuration corresponding to the control domain to which the target subdomain number belongs, and obtain the subdomain storage configuration corresponding to the data read / write command.

[0050] In this embodiment of the invention, the control domain (domain management structure) to which the target subdomain belongs is quickly located by the target subdomain number, and the storage configuration parameters of the subdomain (such as media type, address allocation, backup strategy) are obtained to provide the basis for data read and write operations.

[0051] During system initialization, a unique subdomain number (such as 0x01, 0x02) is assigned to each subdomain according to predefined subdomain partitioning rules (such as protocol data identifier classification); the subdomain number is bound to its corresponding control domain (domain management structure) to form a static or dynamic mapping table, which is stored in non-volatile memory.

[0052] Upon receiving a data read / write command, extract the target subdomain number from the command. Retrieve the corresponding control domain structure (i.e., subdomain storage configuration) from the mapping table using the subdomain number; extract the key parameters (i.e., subdomain storage configuration) from the control domain, which include at least one of the following: storage media type (EEPROM / FLASH); primary storage area start address; backup policy (enabled / disabled); and backup area address.

[0053] Step 106: Query the control domain data relationship table based on the target object data identifier to obtain the object data configuration corresponding to the data read / write command, and determine the read / write type of the object data configuration. The read / write type includes: set read / write and item read / write.

[0054] The target object data identifier consists of four bytes (e.g., 40 01 02 04), and its structure is defined as follows: The first three bytes: identify the category of the data object (e.g., 40 01 02 represents the communication address parameter in the electrical energy category); the last byte: operation type identifier, 00 indicates a set operation (reading and writing the complete object), and a non-zero value (e.g., 04) indicates a sub-item operation (reading and writing array elements or structure members).

[0055] Extract the first three bytes: determine the subdomain category to which the data object belongs (such as electrical energy category, event category); parse the last byte: if it is 00, perform set operation; if it is a non-zero value (such as 04), perform itemization operation and record the itemization index value (4 here).

[0056] It should be noted that traditional data storage methods cannot simultaneously support object-oriented protocol data segmentation and collection reading and writing. When the application layer reads and writes object data or extends objects, it needs to pay attention to the address and space allocation of the underlying storage medium. This makes it inflexible, has poor readability and maintainability, and is highly coupled with the application layer. When data storage is changed from one storage medium to another, the modification is cumbersome and has a significant impact.

[0057] In this embodiment of the invention, the control domain data relationship table contains a type of data in the object-oriented protocol. The last byte of the object data identifier indicates whether it is a read / write item or a set. Data item and set read / write can be realized through data type, number of data items, and data item descriptor.

[0058] The following describes an example of the electricity meter data storage method provided by the present invention in a practical application.

[0059] Example 1: Storing the communication address of the electricity meter: Step 1: The host computer uses an object-oriented protocol to set the communication address of the electricity meter via RS485, with the object identifier being 40010200.

[0060] Step 2: After receiving the setting command, the electricity meter parses the command and obtains 6 bytes of electricity meter communication address data.

[0061] Step 3: Call the database db_write interface function to store data. In the interface function, the subdomain number is the parameter data management control domain, and the data identifier id is 40010200.

[0062] Step 4: The storage system obtains the domain management structure object corresponding to the control domain based on the subdomain number. Based on the storage method in the domain management structure object, it is determined that the data exists in EEPROM and needs to be backed up.

[0063] Step 5: Obtain the control domain data relationship table based on the domain management structure object.

[0064] Step 6: Based on the control domain data relationship table, obtain the actual address and space size of the data stored in the EEPROM. This object data is a simple data type, so there is no need to consider the cases of sub-items and sets.

[0065] Step 7: Calculate the verification. Through the EEPROM transaction coordination layer interface, write the data and verification into EEPROM and back them up in the backup area.

[0066] Example 2: Reading the number of time periods in a time zone from an electricity meter using a collection method: Step 1: The host computer uses an object-oriented protocol to read the time zone and time period of the electricity meter via RS485. The object identifier is 400c0200. Step 2: After receiving the read command, the electricity meter parses the command and determines that it needs to read the number of time periods in the electricity meter's time zone, and that it is a set read. Step 3: Call the database db_read interface function to store data. In the interface function, the subdomain number is the parameter data management control domain, and the data identifier id is 400c0200. Step 4: The storage system retrieves the domain management structure object corresponding to the control domain based on the subdomain number. Based on the storage method within the domain management structure object, it determines that the data resides in EEPROM and requires backup. Step 5: Obtain the control domain data relationship table based on the domain management structure object. Step 6: Based on the control domain data relationship table and data identifier, it is determined that the data being read is a collection of data, and the data type is a structure. Therefore, the offset address of the data item is the offset address that needs to be read. Step 7: Based on the offset address, obtain the actual address and size of the data stored in the EEPROM. Step 8: Read data from EEPROM through the EEPROM transaction coordination layer interface and verify the accuracy of the data. Step 9: If the verification is successful, return the data content. Step 10: If the verification is incorrect, retrieve the data from the backup area. If the data retrieval verification is still abnormal, return a read failure message.

[0067] Example 3: Reading the rate from the time zone period count of the electricity meter using the itemized method: Step 1: The host computer uses an object-oriented protocol to read the tariff data from the time zone period of the electricity meter via RS485. The object identifier is 400c0204. Step 2: After receiving the read command, the electricity meter parses the command and determines that it needs to read the rate number from the time period of the electricity meter, and that it needs to read the rate number item by item. Step 3: Call the database db_read interface function to store data. In the interface function, the subdomain number is the parameter data management control domain, and the data identifier id is 400c0204. Step 4: The storage system retrieves the domain management structure object corresponding to the control domain based on the subdomain number. Based on the storage method within the domain management structure object, it determines that the data resides in EEPROM and requires backup. Step 5: Obtain the control domain data relationship table based on the domain management structure object. Step 6: Based on the control domain data relationship table and data identifier, it is determined that the data being read is a collection of data, and the data type is a structure. Therefore, the offset address of the data item is the offset address that needs to be read. Step 7: Based on the offset address, obtain the actual address and size of the data stored in the EEPROM. Step 8: Read data from EEPROM through the EEPROM transaction coordination layer interface and verify the accuracy of the data. Step 9: If the verification is successful, return the data content. Step 10: If the verification is incorrect, retrieve the data from the backup area. If the data retrieval verification is still abnormal, return a read failure message.

[0068] Through the steps described in this embodiment of the invention, the storage medium is divided into multiple independent subdomains based on object-oriented protocol data identifiers, achieving physical isolation and classified storage of different types of data objects, enhancing data organization and space management accuracy. An independent control domain is configured for each subdomain, solidifying the storage structure parameters of the subdomain to ensure the controllability and maintainability of the storage strategy. Furthermore, a mapping relationship between object data attributes and storage configurations is established through a control domain data relationship table, forming a structured index. During data read / write operations, the target subdomain number and object identifier are obtained through parsing commands, and the storage area is quickly located in conjunction with the control domain configuration. Simultaneously, object data attributes are accurately matched based on the relationship table, achieving dual verification of storage location and data characteristics. This achieves orderly storage and efficient management of electricity meter data, facilitating precise read / write operations for different types of data objects, and improving the flexibility and efficiency of data storage and access.

[0069] According to the present invention, a data storage method for an electricity meter is provided, which configures a domain-based management structure for each subdomain to obtain a control domain corresponding to each subdomain, including: Based on the domain management structure configuration for each subdomain, the domain management structure corresponding to each subdomain is obtained; Instantiate the domain management structure corresponding to each subdomain to obtain the control domain corresponding to each subdomain; The domain management structure includes at least one of the following: subdomain storage media, backup configuration, subdomain storage space starting address, subdomain storage space backup area starting address, subdomain allocated space size, subdomain associated data table, and the number of data items in the subdomain associated data table.

[0070] In this embodiment of the invention, domain management is performed according to object-oriented protocol data identifier classes, dividing the data into multiple independent subdomains. Each subdomain identifies a type of object data. Each subdomain corresponds to a domain management structure to manage this subdomain, and the instantiated object of the domain management structure is called a control domain. Refer to Table 2, which is the domain management structure table of the storage medium provided by this invention: Table 2

[0071] For example, based on the four-byte data identifier defined in the protocol, objects with the same first three bytes are grouped into the same subdomain. A domain management structure is defined for each subdomain, and the configuration parameters include at least one of the following: subdomain storage medium, backup configuration, subdomain storage space starting address, subdomain storage space backup area starting address, subdomain allocated space size, subdomain associated data table, and the number of data items in the subdomain associated data table.

[0072] Here, the subdomain storage medium is used to specify the type of storage media used by the subdomain (such as Flash, RAM, EEPROM). The backup configuration is used to define whether backup is enabled and the backup policy.

[0073] The domain management structure parameters are encapsulated into operable logical objects (i.e., control domains). Specifically, this involves: writing the domain management structure parameters into the configuration area of ​​non-volatile memory (such as FLASH); assigning a unique subdomain number (e.g., 0x01, 0x02) to each subdomain; and establishing a mapping table between subdomain numbers and control domains. During system initialization, the control domain parameters of each subdomain are loaded into memory according to the mapping table; during dynamic runtime, the control domain is quickly located using the subdomain number, and data read / write operations are performed.

[0074] Through the embodiments of the present invention, physical isolation and dynamic resource allocation of storage space are achieved, which significantly improves data security (preventing loss through backup mechanisms), access performance (optimizing read and write speeds based on fixed addresses and dedicated media) and resource utilization (allocating space on demand and limiting the number of data items).

[0075] According to the present invention, a method for storing electricity meter data includes a control domain management configuration based on the control domain corresponding to each subdomain, resulting in a control domain data relationship table, comprising: Based on the control domain corresponding to each subdomain, a set of control domains is determined as the control domain management table; Configure the control domain management table according to the preset structure to obtain the control domain data relationship table; The control domain data relationship table includes at least one of the following: object data identifier, address offset of object data in subdomain, object data length, data type, number of object data items, and object data item description table.

[0076] In this embodiment of the invention, the set of all control domains is a control domain management table. By configuring the control domain management table, the storage medium domain block manager can know whether the current subdomain data content is stored in EEPROM or FLASH, whether backup storage is required, the starting address of the storage, the backup address and the space size, as well as the associated data table and the number of table data items.

[0077] The control domain data relationship table is a direct representation of the data object information in the object-oriented protocol and is fundamental to implementing itemized and set-based reading and writing. The control domain data relationship table is populated according to a specific structure. When expanding objects, it is only necessary to add rows after this table. Refer to Table 3, which is the control domain data relationship table provided by this invention: Table 3

[0078] In this embodiment of the invention, by using the address offset method, the application layer does not need to pay attention to the actual address and space allocation of each object data at the underlying level when reading and writing object data.

[0079] Through the embodiments of the present invention, the management table and relationship table generated based on the control domain set clarify the location (address offset), attributes (data type, length) and sub-structure (number of sub-items and description table) of object data in the storage medium (EEPROM / FLASH).

[0080] According to the present invention, a method for storing electricity meter data includes data types such as basic types, array types, and structure types. When the data type is a basic type, set the number of object data items and the object data item description table to invalid; When the data type is array, the number of object data items is used to represent the number of array elements, and the object data item description table is used to represent the data length of a single element of the array; When the data type is a structure, the number of object data items is used to represent the number of elements in the structure, and the object data item description table is used to represent the data length of a single element in the structure.

[0081] In this embodiment of the invention, object-oriented protocol data types are summarized and integrated. The data types in the control domain data relation table structure are mainly divided into three categories: simple data types, array types, and structure types, which can cover all object-oriented protocol data types. Refer to Table 4, which is a data type classification table provided by this invention: Table 4

[0082] In this embodiment of the invention, when the data type is a basic type, it is not necessary to support itemized reading, so the last two items in the control domain data relationship table structure do not function.

[0083] When the data type is array, the number of object data items represents the number of array elements, and the object data item description table describes the data length of a single array element.

[0084] When the data type is a structure, the number of object data items represents the number of elements in the structure, and the object data item description table describes the data length of each element in the structure.

[0085] In this embodiment of the invention, basic types represent data as a single value and do not support itemized operations (such as integers, floating-point numbers, and strings). Setting the number of items in the object data of a basic type to an invalid value (such as 0x00 or an empty field) indicates that no itemized operation is required; setting the itemized description table of the object data of a basic type to an invalid pointer (such as NULL) indicates that there is no requirement for itemized description.

[0086] Array types represent data as a fixed-length collection of elements (such as time zone tables or frozen data blocks). The number of data items in an array type object indicates the number of elements in the array; the data item description table of an array type object records the fixed length of each element, where the last byte is the item index value; the item offset can be calculated as: element length × item index.

[0087] A structure type represents a variable-length collection of members. The number of data items in a structure type object indicates the number of members in the structure; the data item description table of a structure type object records the actual length of each member in member order (e.g., 8 bytes for a timestamp, 1 byte for an event type).

[0088] Through the embodiments of the present invention, fine-grained control of electricity meter data storage is achieved by flexibly defining data types (basic types, array types, structure types) and their associated metadata (number of sub-items, sub-item description table).

[0089] According to the present invention, an energy meter data storage method is provided, wherein the object data identifier includes multiple bytes; When the target byte in a multi-byte array is a preset value, the read / write type of the object data corresponding to the object data identifier is set read / write; When the target byte in multiple bytes is a different value, the read / write type of the object data corresponding to the object data identifier is itemized read / write, where the other values ​​are used to represent the itemized index of the object data.

[0090] In this embodiment of the invention, the object data identifier, like the object-oriented protocol data identifier, consists of four bytes. The last byte being 00 represents collection reading and writing, and the last byte being any other value represents the item index when reading and writing items separately. The index value cannot exceed the number of items in the object data.

[0091] The object data identifier consists of four bytes, and its encoding rules and read / write type determination logic are as follows: The first three bytes: indicate the category of the data object (e.g., 40 01 02 represents the communication address parameter of the electrical energy category); The fourth byte (last byte): defines the read / write type and item index: The last byte is 00: indicates a set operation (reading and writing object data in a set); The last byte is a non-zero value (e.g., 01, 02): indicates an item operation (reading and writing array elements or structure members), and the non-zero value is the item index value.

[0092] Among them, the item index value must be less than or equal to the number of items defined in the data relationship table.

[0093] Through the embodiments of the present invention, the last byte value clearly distinguishes between collection reading and writing and item reading and writing, avoiding operational ambiguity; the item index value is directly mapped to the item description table, supporting fine-grained data access.

[0094] According to the present invention, an energy meter data storage method includes an object-oriented protocol data object that includes at least one of the following: an energy class object, a maximum demand class object, a variable class object, an event class object, a parameter class object, a freeze class object, a display class object, and a reserved object to be expanded.

[0095] In this embodiment of the invention, the storage medium is managed by domain according to the object-oriented protocol data identifier class, and divided into multiple independent subdomains. Each subdomain identifies a type of object data. Refer to Table 5, which is the storage medium domain table provided by the present invention: Table 5

[0096] In some embodiments, the database init / read / write interfaces in the data storage system provide services to the application layer. The application layer reads and writes data through these interfaces. The interface functions implement logic such as data lookup, read / write, backup, verification calculation, itemization, and set processing. Refer to Table 6, which is a schematic table of database interface functions provided by this invention: Table 6

[0097] In this embodiment of the invention, the storage medium domain block manager divides the object-oriented protocol data into domains. Each subdomain can be configured as needed, such as configuring whether the data is stored in EEPROM or FLASH according to the frequency of read and write operations, or configuring whether backup is required according to the importance of the data. Each subdomain has a pre-allocated starting address and space size. When the application layer reads and writes data through the database interface function, it does not need to care about the actual address and allocated space size of the data in EEPROM and FLASH, but can access it through the subdomain number and data identifier.

[0098] The control domain data relationship table contains a type of data in the object-oriented protocol. The last byte of the data identifier indicates whether it is a read / write item or a set. Data item and set read / write can be implemented through data type, number of data items, and data item descriptor.

[0099] Regardless of whether the data is stored in EEPROM or FLASH, the database interface provides only one interface to the application layer. The application layer does not need to care about which medium it is stored in. If the storage medium needs to be changed, only the storage method of the control block of the corresponding subdomain in the control domain management table needs to be changed, which will not affect the application layer.

[0100] refer to Figure 2 , Figure 2 This is a flowchart illustrating the data reading and writing process of the data storage system provided by this invention. Specifically, it includes the following steps: Step 1, read / write data.

[0101] Step 2: Determine the control domain to which the subdomain belongs based on the subdomain number.

[0102] Step 3: Obtain the control domain data relationship table.

[0103] Step 4: Search the control domain data relationship table based on the ID.

[0104] Step 5: Obtain the address offset, space size, data type, number of sub-items, and sub-item descriptor information of the ID data in the subdomain.

[0105] Step 6: Determine whether it is a sub-item based on the ID.

[0106] If yes, proceed to step 7; otherwise, proceed to step 8.

[0107] Step 7: Calculate the offset address of the item in the control domain data relationship table based on the data type, number of items, and item descriptor.

[0108] Step 8: Obtain the address of the subdomain based on whether the backup area is read or written.

[0109] Step 9: Calculate the actual address based on the subdomain address and the offset address of the data in the data table.

[0110] Step 10: Determine if EEPROM is present in the storage method.

[0111] If yes, proceed to step 11; otherwise, proceed to step 12.

[0112] Step 11: Read and write EEPROM according to the calculated actual address and space size.

[0113] Step 12: Read and write FLASH based on the calculated actual address and space size.

[0114] Step 13: Determine if the reading and writing are correct.

[0115] If yes, then end; otherwise, proceed to step 14.

[0116] Step 14: Determine whether the backup area is being read or written.

[0117] If yes, end; otherwise, read and write the backup area and return to step 8.

[0118] Through the above embodiments of the present invention, the problem that traditional data storage systems do not support object-oriented protocol itemized and collection read / write of data is solved. It conforms to the object-oriented protocol and is very convenient to use when reading and writing data. When the application layer reads, writes and expands objects, it does not need to care about the actual address and space size of the data in the underlying storage medium. It is flexible, scalable, and has low coupling between the underlying layer and the application layer. The data storage method can be flexibly configured through the storage medium domain block manager without affecting the application layer.

[0119] The energy meter data storage system provided by the present invention is described below. The energy meter data storage system described below can be referred to in correspondence with the energy meter data storage method described above.

[0120] refer to Figure 3 , Figure 3 This is a schematic diagram of the structure of the electricity meter data storage system provided by the present invention.

[0121] The partitioning module 301 is used to partition the storage medium of the energy meter according to the object-oriented protocol data identifier to obtain multiple subdomains, wherein each subdomain corresponds to a type of object-oriented protocol data object. The subdomain configuration module 302 is used to configure the domain management structure based on each subdomain to obtain the control domain corresponding to each subdomain. The control domain is used to represent the subdomain storage configuration of the subdomain. The control domain configuration module 303 is used to perform control domain management configuration based on the control domain corresponding to each subdomain, and obtain a control domain data relationship table, wherein the control domain data relationship table is used to represent the object data configuration of the subdomain; The command parsing module 304 is used to parse the data read / write command in response to the received data read / write command, and obtain the target subdomain number and the target object data identifier. The determination module 305 is used to determine the subdomain management structure configuration corresponding to the control domain to which the target subdomain number belongs, and to obtain the subdomain storage configuration corresponding to the data read and write commands. The query module 306 is used to query the control domain data relationship table based on the target object data identifier, obtain the object data configuration corresponding to the data read / write command, and determine the read / write type of the object data configuration, wherein the read / write type includes: set read / write and item read / write.

[0122] Specifically, the energy meter data storage device provided by the present invention can implement all the method steps implemented in the above-described energy meter data storage method embodiments and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiments and the beneficial effects will not be described in detail.

[0123] Figure 4 This is a schematic diagram of the physical structure of the electronic device provided by the present invention, such as... Figure 4 As shown, the electronic device may include: a processor 410, a communications interface 420, a memory 430, and a communications bus 440, wherein the processor 410, the communications interface 420, and the memory 430 communicate with each other through the communications bus 440. The processor 410 can call logical instructions in the memory 430 to execute a data storage method for an electricity meter. This method includes: dividing the storage medium of the electricity meter according to an object-oriented protocol data identifier to obtain multiple subdomains, where each subdomain corresponds to a type of object-oriented protocol data object; configuring a domain management structure for each subdomain to obtain a control domain corresponding to each subdomain, where the control domain represents the subdomain storage configuration; configuring control domain management based on the control domain corresponding to each subdomain to obtain a control domain data relationship table, where the control domain data relationship table represents the object data configuration of the subdomain; responding to a received data read / write command, parsing the data read / write command to obtain a target subdomain number and a target object data identifier; determining the domain management structure configuration corresponding to the control domain to which the target subdomain number belongs to obtain the subdomain storage configuration corresponding to the data read / write command; and querying the control domain data relationship table based on the target object data identifier to obtain the object data configuration corresponding to the data read / write command.

[0124] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0125] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the electricity meter data storage method provided by the above methods. The method includes: dividing the storage medium of the electricity meter according to the object-oriented protocol data identifier to obtain multiple subdomains, wherein each subdomain corresponds to a type of object-oriented protocol data object; configuring a domain management structure based on each subdomain to obtain a control domain corresponding to each subdomain, wherein the control domain is used to represent the subdomain storage configuration of the subdomain; configuring a control domain management based on the control domain corresponding to each subdomain to obtain a control domain data relationship table, wherein the control domain data relationship table is used to represent the object data configuration of the subdomain; responding to receiving a data read / write command, parsing the data read / write command to obtain a target subdomain number and a target object data identifier; determining the domain management structure configuration corresponding to the control domain to which the target subdomain number belongs to obtain the subdomain storage configuration corresponding to the data read / write command; and querying the control domain data relationship table based on the target object data identifier to obtain the object data configuration corresponding to the data read / write command.

[0126] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the electricity meter data storage method provided by the above methods. The method includes: dividing the storage medium of the electricity meter according to an object-oriented protocol data identifier to obtain multiple subdomains, wherein each subdomain corresponds to a type of object-oriented protocol data object; configuring a domain management structure based on each subdomain to obtain a control domain corresponding to each subdomain, wherein the control domain is used to represent the subdomain storage configuration of the subdomain; configuring a control domain management based on the control domain corresponding to each subdomain to obtain a control domain data relationship table, wherein the control domain data relationship table is used to represent the object data configuration of the subdomain; responding to a received data read / write command, parsing the data read / write command to obtain a target subdomain number and a target object data identifier; determining the domain management structure configuration corresponding to the control domain to which the target subdomain number belongs to obtain the subdomain storage configuration corresponding to the data read / write command; and querying the control domain data relationship table based on the target object data identifier to obtain the object data configuration corresponding to the data read / write command.

[0127] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0128] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, 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 can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0129] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for storing electricity meter data, characterized in that, include: The storage medium of the electricity meter is divided according to the object-oriented protocol data identifier to obtain multiple subdomains, wherein each of the multiple subdomains corresponds to a type of object-oriented protocol data object. Based on the domain-based management structure configuration of each subdomain, a control domain corresponding to each subdomain is obtained, wherein the control domain is used to represent the subdomain storage configuration of the subdomain; Based on the control domain corresponding to each subdomain, control domain management configuration is performed to obtain a control domain data relationship table, wherein the control domain data relationship table is used to represent the object data configuration of the subdomain; In response to receiving a data read / write command, the data read / write command is parsed to obtain the target subdomain number and the target object data identifier; Determine the domain management structure configuration corresponding to the control domain to which the target subdomain number belongs, and obtain the subdomain storage configuration corresponding to the data read / write command; Based on the target object data identifier, the control domain data relationship table is queried to obtain the object data configuration corresponding to the data read / write command, and the read / write type of the object data configuration is determined, wherein the read / write type includes: set read / write and item read / write; The step of configuring control domain management based on the control domain corresponding to each subdomain to obtain a control domain data relationship table includes: Based on the control domain corresponding to each subdomain, a set of control domains is determined as the control domain management table; Configure the control domain management table according to the preset structure to obtain the control domain data relationship table; The control domain data relationship table includes at least one of the following: object data identifier, address offset of object data in subdomain, object data length, data type, number of object data items, and object data item description table.

2. The electricity meter data storage method according to claim 1, characterized in that, The configuration of the domain-based management structure based on each subdomain to obtain the control domain corresponding to each subdomain includes: Based on the configuration of the domain management structure for each subdomain, the domain management structure corresponding to each subdomain is obtained; Instantiate the domain management structure corresponding to each subdomain to obtain the control domain corresponding to each subdomain; The domain management structure includes at least one of the following: subdomain storage medium, backup configuration, subdomain storage space starting address, subdomain storage space backup area starting address, subdomain allocated space size, subdomain associated data table, and the number of data items in the subdomain associated data table.

3. The electricity meter data storage method according to claim 1, characterized in that, The data types include: basic types, array types, and structure types; When the data type is the basic type, the number of object data items and the object data item description table are set to invalid; When the data type is the array type, the number of object data items is used to represent the number of elements in the array, and the object data item description table is used to represent the data length of a single element in the array; When the data type is the structure type, the number of object data items is used to represent the number of elements in the structure, and the object data item description table is used to represent the data length of a single element in the structure.

4. The electricity meter data storage method according to claim 1, characterized in that, The object data identifier includes multiple bytes; When the target byte among the plurality of bytes is a preset value, the read / write type of the object data corresponding to the object data identifier is set read / write; When the target byte among the plurality of bytes is other values, the read / write type of the object data corresponding to the object data identifier is itemized read / write, wherein the other values ​​are used to represent the itemized index of the object data.

5. The electricity meter data storage method according to claim 1, characterized in that, The object-oriented protocol data object includes at least one of the following: electrical energy object, maximum demand object, variable object, event object, parameter object, freeze object, display object, and reserved object to be expanded.

6. An energy meter data storage system, characterized in that, include: The partitioning module is used to partition the storage medium of the electricity meter according to the object-oriented protocol data identifier to obtain multiple subdomains, wherein each subdomain corresponds to a type of object-oriented protocol data object. The subdomain configuration module is used to configure the domain management structure based on each subdomain to obtain the control domain corresponding to each subdomain, wherein the control domain is used to represent the subdomain storage configuration of the subdomain; The control domain configuration module is used to perform control domain management configuration based on the control domain corresponding to each subdomain, and obtain a control domain data relationship table, wherein the control domain data relationship table is used to represent the object data configuration of the subdomain; The command parsing module is used to parse the received data read / write command in response to obtain the target subdomain number and the target object data identifier. The determination module is used to determine the domain management structure configuration corresponding to the control domain to which the target subdomain number belongs, and to obtain the subdomain storage configuration corresponding to the data read / write command. The query module is used to query the control domain data relationship table based on the target object data identifier to obtain the object data configuration corresponding to the data read / write command, and to determine the read / write type of the object data configuration, wherein the read / write type includes: set read / write and item read / write; Specifically, the control domain configuration module is further used for: Based on the control domain corresponding to each subdomain, a set of control domains is determined as the control domain management table; Configure the control domain management table according to the preset structure to obtain the control domain data relationship table; The control domain data relationship table includes at least one of the following: object data identifier, address offset of object data in subdomain, object data length, data type, number of object data items, and object data item description table.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the electricity meter data storage method as described in any one of claims 1 to 5.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the electricity meter data storage method as described in any one of claims 1 to 5.

9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the electricity meter data storage method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Data storage management method for electric energy meter

    CN107463506A