Address allocation method and system for data in electric energy meter eeprom
By calculating the type of data items in the eeprom in the power meter, and automatically allocating addresses, the waste of time and energy and errors caused by manual allocation are solved, and efficient and accurate address allocation is achieved.
Patent Information
- Application Number
- CN202510577013.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-06
- Publication Date
- 2025-08-15
AI Technical Summary
In the prior art, the address allocation of data in the eeprom in the eeprom relies on manual methods, which consumes a lot of time and energy, and is difficult to ensure accuracy, making it easy to cause errors or waste of storage space.
The data items in the eeprom in the power meter are divided into ordinary types, important types and record types, and the storage space of each data item is calculated through registration information and the address is automatically allocated to avoid manual intervention.
It realizes efficient and accurate data address allocation, saves the time and energy of technicians, reduces manual errors, and improves the utilization rate of storage space.
Smart Images

Figure CN120492364A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of data address allocation, and in particular relates to a method and system for allocating addresses of data in an electric energy meter (EEPROM). Background Art
[0002] Energy meters, as the electricity metering devices at the points of measurement in power systems, typically store their data in EEPROM devices. EEPROMs are powerful non-volatile memory devices suitable for scenarios requiring frequent updates of small amounts of data. Their byte-by-byte erasable and rewritable capabilities offer irreplaceable advantages in certain applications, such as the periodic updating of energy data. Therefore, EEPROMs are often used in energy meters.
[0003] However, data stored in the energy meter's EEPROM is currently typically allocated manually. This involves manually calculating the space occupied by data items in each business module, and then assigning addresses to each business module based on the calculated space. This manual address allocation method has obvious drawbacks. Not only does it consume a significant amount of time and effort for technicians due to the sheer volume of data that needs to be processed, but it also fails to guarantee high accuracy, making it difficult to avoid errors during the allocation process (for example, when manually allocating addresses, attention can be lost due to the sheer volume of the task or high repetitiveness, leading to duplicate or missed allocations). This can easily lead to parameters being overwritten, causing system anomalies or wasting storage space. Summary of the Invention
[0004] The purpose of the present invention is to provide a method and system for allocating addresses of data in an electric energy meter (EEPROM), which is used to solve the problem that the manual address allocation method in the prior art requires technicians to spend a lot of time and energy and is difficult to ensure high accuracy.
[0005] In order to achieve the above object, the present invention provides an address allocation method for data in an electric energy meter eeprom, which divides all data items to be stored in each business module of the electric energy meter eeprom into different data types, including: setting a common type, setting an important type and a record type; Register the information of all data items to obtain the registration information of each data item. The registration information includes the unique data name, data length, data type and fixed order of the data item in its business module. For data items of record type, the data length in the registration information is the data length of a single record and the registration information also includes the number of records in the data item. The base address of the first business module is to set the initial base address. Then, according to the registration information of all data items in the business module and the preset calculation relationship, the storage space occupied by each data item in the business module is calculated and added to obtain the total storage space occupied by the business module data, so as to determine the base address of the next business module in the EEPROM, and the address of the business module is allocated according to the total storage space and base address of the business module data; the calculation relationship is the calculation relationship between the storage space size allocated to data items of different data types and the data length and data type of the data item, or the data length, data type and number of records; After the address allocation of the current service module is completed, the next service module is used as the new current service module and the address allocation is continued.
[0006] Beneficial effects: The present invention provides a new method for allocating addresses for data in the EEPROM of an electricity meter. The method first sets and classifies the data items to be stored in the EEPROM of the electricity meter, that is, each data item is divided into one of the following types: a set common type, a set important type, or a set record type; after the data type division is completed, the information of all data items is registered, and the registration information includes the unique data name of the data item (that is, different data items have only a unique data name corresponding to them, and each data name also has only one certain data item corresponding to it, and the data name is the only mark for identifying the data item), data length, data type, and the fixed order of the data item in its business module. Among them, the definition of the data length of the record type is somewhat different from the other two. It represents the data length of a single record in the data item. Since the registration information includes the number of records in the data item, the length of the entire data item of the record type can be calculated by multiplying the data length by the number of records.
[0007] After all registration information is set, the base address of the first business module is determined (i.e., the initial base address) using the business module as the smallest unit (a business module contains a certain number of data items). Based on the registration information of all data items in the business module and a pre-defined calculation relationship, the total storage space occupied by the business module can be calculated. Different calculation relationships correspond to different data items. For both common and important data items, the storage space is calculated based on the data length and data type of the data item (the storage space setting criteria for common and important data items differ). For record-type data items, the storage space is calculated based on the data length, data type, and number of records. Ultimately, the total storage space occupied by the business module is represented by the sum of the storage space occupied by each data item. In effect, calculating the storage space of the first business module also determines the base address of the next business module (i.e., by adding the base address of the first business module to its storage space). Addresses can then be directly assigned based on this base address. Each subsequent business module to be assigned an address is assigned according to the same method.
[0008] In summary, this method automatically calculates the storage space for each data item and assigns addresses to it, ensuring that different types of data items (each acquired data item of practical significance is classified as one of the predefined common, important, or record types) are allocated accordingly, without requiring human intervention. This method not only saves technicians significant time and effort but also avoids human error (i.e., duplicate or missed allocations due to distracted attention caused by excessive workload or repetitive tasks), resulting in highly accurate address allocation results.
[0009] Furthermore, the preset calculation relationship between the storage space size allocated to data items of different data types and the data length and data type of the data item includes: Allocate one storage space to a single data item of a set common type, and the size of the storage space is at least twice the data length of the data item; Allocate a set number of copies of storage space to a single data item of a set importance type, where the set number of copies is greater than or equal to 2, and the size of each copy of storage space is at least twice the data length of the data item; The size of the storage space allocated to a data item of a single record type is at least the sum of the set length of the record pointer and the data lengths of all records in the data item.
[0010] Furthermore, the method for reading and writing a single data item in a business module with an assigned address includes: obtaining the base address of the business module to which the data item to be read belongs, and finding the fixed order of the data item in its business module based on the unique data name corresponding to the data item, and determining the unique data names of the data items before the data item; calculating the storage space occupied by the data items before the data item based on the registration information corresponding to the unique data names of the data items before the data item and the preset calculation relationship, and then determining the starting address of the data item based on the superposition of these storage spaces and the base address of the business module to which the data item belongs; calculating the storage space occupied by the data item based on the starting address and the registration information of the data item and the preset calculation relationship, so as to read and write the data item.
[0011] Furthermore, the method of verifying the base address of the business module with the assigned address includes: calculating the CRC check value of the stored base address of the business module with the assigned address at set time intervals, and comparing it with the CRC check value calculated using the base address of the business module obtained within the time period of the address allocation process of the business module; if the comparison result is inconsistent, recalculating the base address of the business module according to the registration information carried by the business module.
[0012] Furthermore, the size of each storage space allocated to a single data item of a set important type is a total length obtained by adding one times the data length of the data item and the data length of a CRC check value used to check the data item.
[0013] Furthermore, the data items of the set common type are parameters of the electric energy meter.
[0014] Furthermore, the data item of the set important type is electric energy data of the electric energy meter.
[0015] The present invention also provides an address allocation system for data in an electric energy meter EEPROM, comprising a processor for executing a computer program to implement the steps of the above-mentioned address allocation method for data in an electric energy meter EEPROM.
[0016] The address allocation system for data in the electric energy meter eeprom can achieve the same beneficial effects as the above-mentioned address allocation method for data in the electric energy meter eeprom. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 An example diagram of the corresponding calculation relationship when allocating storage space to different types of data items in an implementation method of the address allocation method for data in an electric energy meter eeprom of the present invention; Figure 2This is an example diagram of the structure of registration information of a single data item in an implementation method of an address allocation method for data in an electric energy meter eeprom of the present invention; Figure 3 This is a flow chart of allocating addresses to the first business module in an implementation method of an address allocation method for data in an electric energy meter eeprom according to the present invention; Figure 4 A flowchart of allocating addresses to the next business module in an implementation of the method for allocating addresses to data in an electric energy meter eeprom according to the present invention; Figure 5 A flow chart of reading and writing a single data item with an assigned address in an implementation of a method for allocating data addresses in an electric energy meter (EEPROM) according to the present invention; Figure 6 The present invention is a flowchart of verifying the base address of a single business module with an assigned address in the implementation of the method for allocating data in an electric energy meter (EEPROM) according to the present invention. DETAILED DESCRIPTION
[0018] In order to make the objectives, technical solutions and advantages of the present invention more clear, the present invention is further described in detail below with reference to the accompanying drawings and implementation methods.
[0019] Implementation method of address allocation method for data in electric energy meter eeprom This embodiment provides a technical solution for a method for allocating addresses for data in an electricity meter's EEPROM. The main idea of this solution is to classify the data items to be stored in the electricity meter's EEPROM (i.e., divide them into different data types), and then calculate the storage space occupied by data items of different data types in different ways based on the pre-registered registration information of each data item, so as to perform address allocation for them in a fully automatic process.
[0020] In this embodiment, all data items to be stored in each business module of the electricity meter's EEPROM are divided into different data types, including common types, important types, and record types. In this embodiment, common data items are set to the meter's parameters (parameter data, such as configuration parameters, which need to remain stable over time); important data items are set to the meter's electrical energy data (this electrical energy data includes voltage data, current data, and total forward active energy data required to be stored in the meter's EEPROM, which is frequently updated). Research has shown that using the same address allocation scheme regardless of the data type can lead to insufficient address space or conflicts. If addresses are not properly planned and large amounts of electrical energy data and parameter data are stored in the same area, this can lead to the erroneous overwriting of parameter data that should be stable. In summary, the address allocation schemes for different types of data (such as the aforementioned electrical energy data and configurable parameter data) should also be different.
[0021] An example of this embodiment can be referred to Figure 1 In this embodiment, data of the normal type is defined as normal data (i.e., represented by "0"); data of the important type is defined as important data (i.e., represented by "1"); and data of the record type is defined as record data (i.e., represented by "2"). Considering that in the application scenario of an energy meter, changes in the meter's electric energy data are generally of particular interest, the electric energy data to be stored in the meter's EEPROM is classified as "important data" (i.e., its data type is classified as a set important type); each parameter is classified as "normal data" (i.e., its data type is classified as a set normal type); and all other data is classified as "record data" (i.e., its data type is classified as record data). In practice, the data type classification in this embodiment is based on the need to improve the storage reliability of the meter's electric energy data. In other embodiments of this implementation, classification can also be based on other principles or other requirements. For example, in one set classification rule, only the voltage data data type is classified as a set important type, while the current data and the total forward active energy data are both classified as set normal types. Different classification methods can be used according to actual circumstances and are not detailed here.
[0022] After the data types of all data items are divided, the information of all data items is registered to obtain the registration information of each data item. Figure 2As shown, the registration information includes the unique data name, data length, data type and fixed order of the data item in its business module. In one embodiment of the present embodiment, the order automatically formed during registration can be directly used as the fixed order of the data item in its business module. That is, when registering the information of all data items, data item ① in business module A is the first to be registered in the business module (that is, the registration order is the first), then the fixed order of data item ① in business module A is determined to be the first. This sorting method does not require additional adjustment operations, which can save costs and reduce complexity. In other embodiments of the present embodiment, the fixed order of data items in their business modules can also be determined according to other methods, but it must be ensured that the data item can be accurately located according to the fixed order. The specific method will not be described here.
[0023] For data items of record type, the data length in the registration information is the data length of a single record and the registration information also includes the number of records in the data item (record-type data items often contain more than one data record). In one embodiment of the present embodiment, the number of records is expressed as the number of rows of records (i.e., one record occupies one row. If a record does not meet the data length set by the row standard (i.e., the data length in the registration information), it can be padded by adding zeros until the data length in the registration information is reached. For example, if the data length in the registration information is 10 bytes, if a record in the record data actually has only 5 bytes, then the other 5 bytes in the row where the record is located are padded with "0"). Expressing the number of records in the form of rows can clearly divide each record and facilitate calculation.
[0024] In another embodiment of the present embodiment, the registration information of ordinary data (i.e., data of ordinary type) and important data (i.e., data of important type) also includes the number of records in the data item, but the values in the registration information are all 0, which means that these two types of data do not involve the number of records and do not need to be paid attention to; while the record data (i.e., data items of record type) are filled with the number of rows of records. For example, if a data item has 100 rows of records, then the value in the registration information is filled with 100. In other embodiments of the present embodiment, other methods can also be used to define the number of records, such as setting a special character as the end character of a single record, that is, if the character is read, it means that the single record ends, and the next character is the content of the next record. The process of address allocation by the first business module is as follows. Figure 3As shown. The base address of the first business module is the set initial base address. Then, based on the registration information of all data items in the business module and the preset calculation relationship, the storage space occupied by each data item in the business module is calculated and then added to obtain the total storage space occupied by the business module data to determine the base address of the next business module in the EEPROM, and the address of the business module is allocated according to the total storage space and base address of the business module data; the calculation relationship is the calculation relationship between the storage space size allocated to data items of different data types and the data length and data type of the data item, or the data length, data type and number of records. In this embodiment, the storage space is calculated based on the data length and data type of the data item (the standard for setting storage space based on the length of the data item is different for setting common type and setting important type) as known quantities; and the storage space is calculated based on the data length, data type and number of records of the data item because the record type data item involves the number of records.
[0025] Specifically, in this embodiment, the preset calculation relationship between the storage space size allocated to data items of different data types and the data length and data type of the data item includes: 1) Allocate one storage space to a single data item of a set common type. The size of the storage space is at least twice the data length of the data item to ensure that the electric energy meter eeprom can store at least one data item of this type.
[0026] 2) Allocate a set number of storage spaces to a single data item of a set important type, the set number of copies is greater than or equal to 2, and the size of each storage space is at least twice the data length of the data item, so as to ensure that the electricity meter eeprom can at least store a data item of this type and a copy of the data item (the content of the data item and the copy of the data item are exactly the same, so as to ensure that in the event that the content of a data item of a set important type is damaged or lost, there is still at least one backup of the data item in the electricity meter eeprom).
[0027] 3) The size of the storage space allocated to a data item of a single record type is at least the sum of the set length of the record pointer and the data length of all records in the data item.
[0028] In this embodiment, considering that the data items of important types are more important and the requirements for their address accuracy are more stringent, additional address verification can be set for such data, specifically including: a) The size of each storage space allocated to a single data item of a set important type can also be set to a total length obtained by adding twice the data length of the data item and the data length of the CRC check value used to verify the data item.
[0029] Specifically, in a preferred embodiment of this embodiment, the base address of service module A (i.e., the first service module) is known to be Addr1 (i.e., the set initial base address). Service module A contains data items ①, ②, ③, and ④. ① is a data item of the important type, with a data length of 10 bytes and requiring a CRC checksum of 2 bytes. ② and ③ are two data items of the ordinary type, with a data length of 5 bytes and a data length of 8 bytes. Data item ④ is a record type data item with 2 records, a data length of 6 bytes, and a record pointer set to a length of 4 bytes.
[0030] Among them, the storage space occupied by data item ① containing the CRC check value is: 2×(10+2)=24 bytes; that is, the size of the storage space is twice the total length of the data item ① plus the data length of the CRC check value.
[0031] In this embodiment, the set number of copies of data items ② and ③ is both 1, so the total storage space occupied by data items ② and ③ is: 1×(5+8)=13 bytes; that is, the size of the storage space is 1 times the sum of the lengths of data items ② and ③.
[0032] The storage space occupied by data item ④ is: 6+4=10 bytes.
[0033] In summary, the total storage space occupied by business module A is calculated as: the storage space occupied by data item ① + the storage space occupied by data item ② + the storage space occupied by data item ③ + the storage space occupied by data item ④, that is, 24+13+10=47 bytes.
[0034] The base address Addr2 of business module B (that is, the base address of the next business module in the eeprom) is determined as follows: Addr2 = Addr1 + 47 bytes, and the base address of Addr2 is located 47 bytes after Addr1.
[0035] Similarly, after the address allocation of the current business module is completed, the next business module will be used as the new current business module, and address allocation will continue until all business modules are allocated. That is, the base address of each subsequent business module is determined according to the above calculation method. Figure 4 In one embodiment of this implementation, the sign that each service module has completed allocation is that the number nCount of service modules to which addresses have been allocated is not less than the set number nNum of service modules.
[0036] refer to Figure 5In this embodiment, the method of reading and writing a single data item in a business module with an assigned address includes: obtaining the base address of the business module to which the data item to be read belongs, and finding the fixed order of the data item in its business module based on the unique data name corresponding to the data item, and determining the unique data names of the data items before the data item. The data name is a unique identifier for identifying the data item.
[0037] Based on the registration information corresponding to the unique data names of the data items before the data item and the preset calculation relationship, the storage space occupied by the data items before the data item is calculated, and then the starting address of the data item is determined based on the superposition of these storage spaces and the base address of the business module to which the data item belongs; based on the starting address and the registration information of the data item and the preset calculation relationship, the storage space occupied by the data item is calculated to read and write the data item.
[0038] In one embodiment of this implementation, if data item ② in business module A needs to be read, the storage space occupied by data item ① can be calculated based on the registration information corresponding to the unique data names of the data items preceding data item ② (in this embodiment, only data item ①) and a preset calculation relationship. The storage space occupied by data item ①, as calculated above, is 24 bytes. Therefore, the starting address of data item ② is: Addr1 + 24 bytes, i.e., the starting address of the storage space of data item ②. As can be seen above, the storage space occupied by data item ② is: 1 × 5 = 5 bytes; therefore, the ending address of the storage space occupied by data item ② is calculated as: Addr1 + 24 + 5 - 1, and the starting address of data item ③ is: Addr1 + 29.
[0039] In this embodiment, the method of verifying the base address of the business module with the assigned address includes: calculating the CRC check value of the stored base address of the business module with the assigned address at set time intervals, and comparing it with the CRC check value calculated using the base address of the business module obtained within the time period of the address allocation process of the business module; if the comparison result is inconsistent, the base address of the business module is recalculated according to the registration information carried by the business module.
[0040] like Figure 6As shown, in one embodiment of this implementation, a check value crc1 is calculated after the address of the service module is automatically assigned during the power-up process. In this embodiment, the timer interval is set to 1 minute. This is equivalent to calculating the stored CRC check value (i.e., crc2) of the base address of the service module with the assigned address every 1 minute after the electricity meter is initially powered on. Assuming that the check value obtained in the first 1 minute after the electricity meter is initially powered on is crc2, crc2 is compared with crc1 to obtain a comparison result. If the comparison result is inconsistent (i.e., crc2 differs from crc1), it indicates that there is an anomaly in the base address Addr1 of service module A. In this case, the base address of the service module is recalculated based on the registration information carried by service module A.
[0041] Implementation method of address allocation system for data in electric energy meter eeprom This embodiment provides a technical solution for an address allocation system for data in an electricity meter EEPROM. The system includes a processor having executable program instructions stored therein. The executable program instructions are used to implement the address allocation method for data in an electricity meter EEPROM as described in the above-mentioned embodiment of the address allocation method for data in an electricity meter EEPROM.
[0042] Since the specific working mode and working principle of the address allocation system for data in the electric energy meter eeprom of this embodiment have been described in detail in the above-mentioned implementation method for address allocation of data in the electric energy meter eeprom, they will not be repeated here.
[0043] It should be understood that the above specific embodiments of the present invention are only used to illustrate or explain the principles of the present invention, and do not constitute a limitation of the present invention.
Claims
1. A method for allocating addresses for data in an electric energy meter (EEPROM), characterized in that: Divide all data items in each business module of the electric energy meter eeprom into different data types, including: setting common type, setting important type and record type; Register the information of all data items to obtain the registration information of each data item. The registration information includes the unique data name, data length, data type and fixed order of the data item in its business module. For data items of record type, the data length in the registration information is the data length of a single record and the registration information also includes the number of records in the data item. The base address of the first business module is to set the initial base address. Then, according to the registration information of all data items in the business module and the preset calculation relationship, the storage space occupied by each data item in the business module is calculated and added to obtain the total storage space occupied by the business module data, so as to determine the base address of the next business module in the EEPROM, and the address of the business module is allocated according to the total storage space and base address of the business module data; the calculation relationship is the calculation relationship between the storage space size allocated to data items of different data types and the data length and data type of the data item, or the data length, data type and number of records; After the address allocation of the current service module is completed, the next service module is used as the new current service module and the address allocation is continued.
2. The method for allocating data addresses in an electric energy meter (EEPROM) according to claim 1, wherein: The preset calculation relationship between the storage space size allocated to data items of different data types and the data length and data type of the data item includes: Allocate one storage space to a single data item of a set common type, and the size of the storage space is at least twice the data length of the data item; Allocate a set number of copies of storage space to a single data item of a set importance type, where the set number of copies is greater than or equal to 2, and the size of each copy of storage space is at least twice the data length of the data item; The size of the storage space allocated to a data item of a single record type is at least the sum of the set length of the record pointer and the data lengths of all records in the data item.
3. The method for allocating data addresses in an electric energy meter (EEPROM) according to claim 1, characterized in that: The method for reading and writing a single data item in a business module with an assigned address includes: obtaining the base address of the business module to which the data item to be read belongs, and finding the fixed order of the data item in its business module based on the unique data name corresponding to the data item, and determining the unique data names of the data items before the data item; calculating the storage space occupied by the data items before the data item based on the registration information corresponding to the unique data names of the data items before the data item and a preset calculation relationship, and then determining the starting address of the data item based on the superposition of these storage spaces and the base address of the business module to which the data item belongs; calculating the storage space occupied by the data item based on the starting address and the registration information of the data item and a preset calculation relationship, so as to read and write the data item.
4. The method for allocating addresses of data in an electric energy meter (EEPROM) according to any one of claims 1 to 3, characterized in that: The method for verifying the base address of the business module with an assigned address includes: calculating the CRC check value of the base address of the stored business module with an assigned address at set intervals, and comparing it with the CRC check value calculated using the base address of the business module obtained within the time period of the address allocation process of the business module; if the comparison result is inconsistent, recalculating the base address of the business module based on the registration information carried by the business module.
5. The method for allocating addresses of data in an electric energy meter (EEPROM) according to any one of claims 1 to 3, characterized in that: The size of each storage space allocated to a single data item of set importance type is a total length obtained by adding twice the data length of the data item and the data length of the CRC check value used to check the data item.
6. The method for allocating addresses of data in an electric energy meter (EEPROM) according to any one of claims 1 to 3, characterized in that: The data items of the set common type are parameters of the electric energy meter.
7. The method for allocating addresses of data in an electric energy meter (EEPROM) according to any one of claims 1 to 3, characterized in that: The data item of the set important type is the electric energy data of the electric energy meter.
8. An address allocation system for data in an electric energy meter (EEPROM), comprising a processor, characterized in that: The processor is used to execute a computer program to implement the steps of the method for allocating addresses of data in an electric energy meter (EEPROM) according to any one of claims 1 to 7.