Methods for dealing with abnormalities of electric energy meters

By dynamically adjusting the division of storage areas in the power meter, the problem of unbalanced wear and tear at each location of the memory is solved, and the balanced wear and efficient utilization of the memory is achieved, and the service life of the power meter is extended.

CN119127090BActive Publication Date: 2025-02-25SHENZHEN INHEMETER
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411586647.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-02-25
Estimated Expiration
2044-11-08

AI Technical Summary

Technical Problem

When the existing power meters are divided into storage areas of fixed locations and sizes, the wear and tear of each location of the memory is uneven, and data damage or storage locations cannot be discovered in time, and the utilization rate of space resources is low.

Method used

By detecting that when the partition adjustment conditions are met, a new partitioning strategy is generated, and the partitioning of storage areas is dynamically adjusted, so that each storage area corresponds to functional modules with different write frequencies, balances the wear of each memory location, and checks data integrity through the data migration process .

Benefits of technology

It achieves the balance of wear and tear at each location of the memory, promptly detects data damage or storage location damage, improves the utilization rate of space resources, and extends the service life of the power meter.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127090B_ABST
    Figure CN119127090B_ABST
Patent Text Reader

Abstract

The present invention discloses an abnormality processing method for an electric energy meter, which belongs to the field of electric energy meters. The method comprises: in the process of dividing the built-in memory of the electric energy meter into multiple storage areas and monitoring the data storage process of each storage area, when the electric energy meter detects that the partition adjustment conditions are met, a new round of partitioning strategy is generated; the electric energy meter re-divides the storage area based on the new round of partitioning strategy, so that the storage area corresponding to the new round of at least one functional module is different from the storage area corresponding to the previous round; after the electric energy meter re-divides the storage area based on the new round of partitioning strategy, it continues to monitor the data storage process of each re-divided storage area; the electric energy meter identifies whether there is an abnormality in the data storage of the electric energy meter based on the monitoring result, and generates corresponding prompt information when there is an abnormality. The present application can balance the wear of each position of the memory when monitoring the data storage process of each storage area.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of electric energy meters, and in particular to an abnormality processing method for electric energy meters. Background Art

[0002] With the implementation of the smart energy meter functional specifications formulated by the State Grid, smart energy meters are required to record and save more data during operation, such as configuration parameters, electric energy, maximum demand, frozen energy, event records, minute freeze, etc. The data that needs to be recorded and saved during the operation of the above-mentioned energy meter is generally saved in the non-volatile memory of the energy meter (such as EEPROM). For this, the energy meter needs to configure the corresponding memory software management strategy in the firmware.

[0003] Since the memory of the electric energy meter usually fails due to long-term and frequent reading and writing, the defects of the electric energy meter memory management strategy are not easy to be identified in the research and development stage, but will gradually appear after the electric energy meter has been running for a long time. In this regard, the solution provided in Patent Document 1 is to divide the built-in memory of the electric energy meter to obtain multiple storage areas, and each storage area is allocated to match the functional module of the electric energy meter; for each storage area obtained after the division, a script table containing data address and data length is established; based on the script table, the actual data length of the corresponding storage area is calculated; the actual data length of the obtained storage area, the capacity of the built-in memory of the electric energy meter, and the storage capacity allocated to each storage area are comprehensively judged, and then the electric energy meter is given corresponding prompts based on the judgment results. Patent Document 1 divides the memory into different storage areas and monitors the data storage status of each storage area during the operation of the electric energy meter, so that the abnormality of the memory can be identified during the operation of the electric energy meter, so as to give an alarm in time.

[0004] However, the solution in Patent Document 1 divides the storage areas for each functional module into fixed positions and sizes, and still has the following deficiencies during the operation of the electric energy meter:

[0005] 1. The data generated by each functional module is stored in a fixed storage area, which may cause some storage locations to be written frequently, while some storage locations are written less frequently, making the frequently written storage locations more susceptible to wear.

[0006] 2. Since the storage areas allocated for each functional module are fixed in position and size, some data are not accessed for a long time, and the electric energy meter cannot detect damage to the data stored in the location or damage to the corresponding storage location as soon as possible.

[0007] 3. It is impossible to optimize the utilization of memory storage space resources according to the actual space requirements of the functional modules of the electric energy meter during operation, and the utilization rate of space resources is low.

[0008] Patent document 1, patent name, electric energy meter built-in memory data storage monitoring method and system; publication number, CN114138201A; publication date, 2022-03-04. Summary of the invention

[0009] The purpose of the present invention is to solve at least one of the technical problems existing in the prior art and to provide an abnormality handling method for an electric energy meter, which can balance the wear of various positions of the memory during the process of dividing the built-in memory of the electric energy meter into multiple storage areas and monitoring the data storage process of each storage area.

[0010] In order to achieve the above-mentioned object of the invention, the present invention provides the following technical solutions:

[0011] A method for handling abnormality of an electric energy meter, the method comprising:

[0012] In the process of dividing the built-in memory of the electric energy meter into a plurality of storage areas and monitoring the data storage process of each storage area, when the electric energy meter detects that the partition adjustment condition is met, a new round of partition strategy is generated; wherein each storage area corresponds to a functional module of the electric energy meter, and the partition strategy includes a base address and an offset length of each storage area obtained when the built-in memory of the electric energy meter is divided;

[0013] The electric energy meter re-divides the storage area based on the new round of partitioning strategy, so that the storage area corresponding to at least one functional module in the new round is different from the storage area corresponding to the previous round;

[0014] After the electric energy meter re-divides the storage area based on the new round of partitioning strategy, it continues to monitor the data storage process of each re-divided storage area;

[0015] The electric energy meter identifies whether there is an abnormality in the data storage of the electric energy meter based on the monitoring result, and generates corresponding prompt information when an abnormality exists.

[0016] Beneficial effect: Compared with the prior art in which the position and size of each storage area are fixed during the operation of the electric energy meter, resulting in uneven wear of each position of the memory, in the present application, when the electric energy meter detects that the partition adjustment conditions are met during operation, a new partition strategy is generated, and the division of each storage area of ​​the memory is adjusted according to the new partition strategy, so that each storage area can correspond to the functional modules with different write frequencies, and the wear of each position of the memory is balanced. And because the storage area divided for each functional module needs to migrate data during dynamic adjustment, when the electric energy meter reads the data for migration, it can detect the damage of the data stored in the position or the damage of the corresponding storage position as soon as possible by checking whether the read data is the same as the written data.

[0017] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The present invention is further described below in conjunction with the accompanying drawings and embodiments;

[0019] Figure 1 A schematic diagram of a flow chart of a method for handling an abnormality of an electric energy meter in an embodiment;

[0020] Figure 2 is a flow chart of an effective data migration process in one embodiment;

[0021] Figure 3 is a flow chart of a method for handling an abnormality of an electric energy meter in yet another embodiment;

[0022] Figure 4 A schematic diagram of a storage area bound to a functional module A in one embodiment;

[0023] Figure 5 A schematic diagram of a storage area bound to a functional module A in another embodiment;

[0024] Figure 6 A schematic diagram of storage areas obtained by partitioning using different partitioning strategies in the i-th round and the i+1-th round in one embodiment;

[0025] Figure 7 The figure is a schematic diagram of the principle of an effective data migration process in an embodiment. DETAILED DESCRIPTION

[0026] This section will describe in detail the specific embodiments of the present invention. The preferred embodiments of the present invention are shown in the accompanying drawings. The purpose of the accompanying drawings is to supplement the description of the text part of the specification with graphics, so that people can intuitively and vividly understand each technical feature and the overall technical solution of the present invention, but it cannot be understood as a limitation on the scope of protection of the present invention.

[0027] like Figure 6As shown, in one embodiment, a method for handling anomalies of an electric energy meter is provided, in the partition strategy of the i-th round, corresponding storage areas are divided for the four functional modules A, B, C, and D of the electric energy meter. Specifically, the size and position of each storage area can be represented by the base address and offset length, wherein the base address of the functional module A is 0x1000, the offset length b is 20 (0x14 in hexadecimal) bytes, and the offset at the base address 0x1000 is 0, so the address range of the functional module A is 0x1000 to 0x1013. The base address of the functional module B is 0x1014, the base address of the functional module C is 0x103C, the base address of the functional module D is 0x1063, and the base address of the redundant area of ​​the built-in memory is 0x1073. Figure 6 The shaded part in the storage area bound to the four functional modules A, B, C, and D of the electric energy meter in the i-th round of partitioning strategy is valid data, that is, data that needs to be migrated when the partitioning strategy is updated. This data can be data that has not been uploaded to the electric energy meter, or data that has been uploaded but still needs to be saved in the electric energy meter due to regulatory requirements.

[0028] like Figure 6 As shown, in one embodiment, in order to solve the problem of uneven wear of different positions of the built-in memory due to the fixed position and size of each storage area in Patent Document 1, it is necessary to adjust the position and size of the storage area corresponding to each functional module when the partition adjustment condition is met. Specifically, Figure 6 As shown, in the i+1th round of partitioning strategy, the base address of function module C is 0x1000, the base address of function module D is 0x1021, the base address of function module A is 0x1038, the base address of function module B is 0x105C, and the base address of the redundant area of ​​the built-in memory is still 0x1073.

[0029] It should be noted that in order to balance the wear and tear and minimize the overlap between the storage area bound to the same functional module after executing the i+1th round of partitioning strategy and the storage area under the i-th round of partitioning strategy, the following formula can be used to determine the arrangement number of each functional module (p_k) in the i+1th round (the arrangement number mentioned here refers to the order of the base addresses of the storage areas bound to each functional module in the built-in memory. The smaller the base address, the higher the arrangement number of the functional module corresponding to the storage area): (F(p_k_i)+2) mod N_P; where F(p_k_i) is the arrangement number of the functional module p_k in the i-th round, mod is the remainder operation, and N_P is the total number of functional modules involved in the sorting. As in Figure 6 In the example, there are four function modules, so N_P is 4. For function module A (hereinafter referred to as p_k_A), the arrangement number F(p_k_A) in the i-th round is 1, and the arrangement number of function module A in the i+1th round is 3. Figure 6 As shown, by adjusting the position of the storage area bound to each functional module according to the above formula, the storage area bound to the same functional module after executing the i+1th round of partitioning strategy can overlap as little as possible with the storage area under the i-th round of partitioning strategy. By dynamically adjusting the partitioning strategy, each functional module can use storage areas at different positions in the built-in memory under different partitioning strategies to achieve balanced wear. On the other hand, the size of the storage area bound to the same functional module in the i+1th round and the i-th round can be the same or different.

[0030] like Figure 1 As shown, in one embodiment, a method for handling abnormality of an electric energy meter is provided, the method comprising:

[0031] Step S202, during the process of dividing the built-in memory of the electric energy meter into multiple storage areas and monitoring the data storage process of each storage area, when the electric energy meter detects that the partition adjustment conditions are met, a new round of partitioning strategy is generated; wherein each storage area corresponds to a functional module of the electric energy meter, and the partitioning strategy includes the base address and offset length of each storage area obtained when the built-in memory of the electric energy meter is divided.

[0032] Step S204: the electric energy meter re-divides the storage area based on the new round of partitioning strategy, so that the storage area corresponding to the new round of at least one functional module is different from the storage area corresponding to the previous round.

[0033] Step S206: After the electric energy meter re-divides the storage area based on the new round of partitioning strategy, it continues to monitor the data storage process of each re-divided storage area.

[0034] Step S208, the electric energy meter identifies whether there is an abnormality in the data storage of the electric energy meter based on the monitoring result, and generates corresponding prompt information when an abnormality exists.

[0035] How to monitor the storage process abnormally in step S206 and step S208 can be implemented by those skilled in the art using the solution of patent document 1, which will not be described here. Compared with the prior art in which the position and size of each storage area are fixed during the operation of the electric energy meter, resulting in uneven wear of each position of the memory, in this application, when the electric energy meter detects that the partition adjustment conditions are met during operation, a new partition strategy is generated, and the division of each storage area of ​​the memory is adjusted according to the new partition strategy, so that each storage area can correspond to a functional module with different write frequencies, and the wear of each position of the memory is balanced.

[0036] In one embodiment, after the electric energy meter re-partitions the storage areas based on the new partitioning strategy and before continuing to monitor the data storage process of each storage area, the method further includes:

[0037] Migrate the valid data of each functional module stored in the storage area corresponding to the previous round to the storage area corresponding to the new round.

[0038] Specifically, Figure 2 As shown, the migration of valid data stored in the storage area corresponding to the previous round of each functional module to the storage area corresponding to the new round specifically includes:

[0039] Step S101, let j=1, record the previous round as the i-th round, and the new round as the i+1-th round; wherein i and j are both positive integers.

[0040] Step S102, taking the functional module p_k corresponding to the element with arrangement number j in the two-dimensional array I as the target module; wherein the elements in the two-dimensional array I are four-dimensional data {i+1, p_k, Addr, b} recording the partition strategy corresponding to each functional module p_k in the i+1th round; Addr is the base address, and b is the offset length; the elements in the two-dimensional array I are sorted in order of the base address size.

[0041] Step S103 , copying the data of the target module in the storage area bound in the (i+1) round to the redundant area of ​​the built-in memory.

[0042] The step of copying the data of the target module in the storage area bound in the (i+1) round to the redundant area of ​​the built-in memory specifically includes:

[0043] Step S1031, taking an element in the two-dimensional array U that intersects with the element with arrangement number j in the two-dimensional array I and the element corresponding to the functional module p_k whose arrangement number in the i+1 round is greater than j as the target element; wherein the elements in the two-dimensional array U are four-dimensional data {i+1, p_k, Addr, b} that record the partition strategy corresponding to each functional module p_k in the i-th round; the target element in the two-dimensional array U that intersects with the element with arrangement number j in the two-dimensional array I means that there is at least a partial overlapping area between the storage area bound to the functional module corresponding to the target element in the two-dimensional array U in the i-th round and the storage area bound to the target module in the i+1 round.

[0044] Step S1032, by modifying the base address of the target element, a temporary storage area corresponding to the size of each target element is divided in the redundant area of ​​the built-in memory and the data of the functional module corresponding to each target element is copied to the corresponding temporary storage area, and the corresponding target element is deleted from the two-dimensional array U; at the same time, the target element with the modified base address is added to the two-dimensional array N.

[0045] Step S104, copying the valid data corresponding to the target module in the i-th round to the storage area bound to the target module in the i+1th round.

[0046] Step S105, add 1 to the value of j and determine whether it is greater than the preset number of elements. If so, end the effective data migration process; if not, jump to step S102.

[0047] Specifically, refer to Figure 6 and Figure 7 , the above effective data migration process is illustrated by an example. In one example, the storage areas bound by each functional module A, B, C, D in the i-th round and the i+1-th round are as follows Figure 6 As shown. Specifically, in the i-th round of partitioning strategy, the base address of function module A is 0x1000, the base address of function module B is 0x1014, the base address of function module C is 0x103C, and the base address of function module D is 0x1063. The two-dimensional array U is {{i, p_k_A, 0x1000, 0x14}, {i, p_k_B, 0x1014, 0x28}, {i, p_k_C, 0x103C, 0x27}, {i, p_k_D, 0x1063, 0x10}}. In the i+1-th round of partitioning strategy, the base address of function module C is 0x1000, the base address of function module D is 0x1021, the base address of function module A is 0x1038, the base address of function module B is 0x105C, and the base address of the redundant area of ​​the built-in memory is still 0x1073. The two-dimensional array I is {{i+1, p_k_C, 0x1000, 0x21}, {i+1, p_k_D, 0x1021, 0x17}, {i+1, p_k_A, 0x1038, 0x24}, {i+1, p_k_B, 0x105C, 0x17}}. It can be seen that the elements in the two-dimensional array I are sorted as follows: p_k_C (module C), p_k_D (module D), p_k_A (module A), p_k_B (module B), that is, the arrangement number of function module C in the i+1th round is 1, the arrangement number of function module D in the i+1th round is 2, the arrangement number of function module A in the i+1th round is 3, and the arrangement number of function module B in the i+1th round is 4.

[0048] When j=1, the function module C is the target module, such as Figure 6As shown, at this time, the storage area bound to the function module A and the function module B corresponding to the two elements {i, p_k_A, 0x1000, 0x14}, {i, p_k_B, 0x1014, 0x28} in the two-dimensional array U in the i-th round has an overlapping area with the storage area bound to the target module (i.e., function module C) in the i+1th round, and the arrangement numbers of the function module A and the function module B corresponding to these two elements in the i+1th round are 3 and 4 respectively, both greater than 1, so according to step S1031, the two elements {i, p_k_A, 0x1000, 0x14}, {i, p_k_B, 0x1014, 0x28} in the two-dimensional array U are used as target elements. Further according to step S1032, the base address of the target element is modified, so that the data corresponding to the function modules A and B are copied to the corresponding temporary storage area. Specifically, two temporary storage areas are divided in the redundant area according to the size of the storage area bound to the function modules A and B in the i-th round, and then the data of the storage area bound to the function modules A and B in the i-th round are copied to the corresponding temporary storage area. Specifically, the four-dimensional data of the two target elements after the base address is modified is {i, p_k_A, 0x1073, 0x14}, {i, p_k_B, 0x1087, 0x28}, as shown in FIG. Figure 7 As shown in (a). At this time, after deleting the above two target elements from the two-dimensional array U, the two-dimensional array U is {{i, p_k_C, 0x103C, 0x27}, {i, p_k_D, 0x1063, 0x10}}. Among them, the two-dimensional array N is used to record the data of the temporary storage area divided by the redundant area at this time. At this time, the two-dimensional array N is {{i, p_k_A, 0x1073, 0x14}, {i, p_k_B, 0x1087, 0x28}}. Further according to step S104, the valid data corresponding to the functional module C in the i-th round is copied to the storage area bound to the functional module C in the i+1 round. At this time, the state of the built-in memory is as follows. Figure 7 (b) Then, according to step S105, j+1 is added. In this example, the preset number of elements is 4, which is the number of functional modules.

[0049] When j=2, the function module D is the target module. Since the storage area bound by the function module D in the i+1th round does not overlap with the storage area corresponding to the remaining elements in the two-dimensional array U, there is no target element in the two-dimensional array U at this time, and the process directly jumps to step S104. Figure 7 As shown in (c), the valid data corresponding to the functional module D in the i-th round in the built-in memory is directly copied to the storage area bound to the functional module D in the i+1th round.

[0050] When j=3, function module A is the target module. Although the storage area bound by function module A in the i+1th round overlaps with the storage area corresponding to the remaining elements {i, p_k_C, 0x103C, 0x27}, {i, p_k_D, 0x1063, 0x10} in the two-dimensional array U, the function modules C and D corresponding to these two elements are arranged in the i+1th round with the numbers 1 and 2 respectively, which cannot meet the condition greater than 3. Therefore, there is no target element in the two-dimensional array U at this time, and the process directly jumps to step S104. Figure 7 As shown in (d), the valid data corresponding to the function module A in the i-th round in the built-in memory is directly copied to the storage area bound to the function module A in the i+1-th round.

[0051] When j=4, function module B is the target module. Although the storage area bound by function module B in the i+1th round overlaps with the storage area corresponding to the remaining elements {i, p_k_C, 0x103C, 0x27}, {i, p_k_D, 0x1063, 0x10} in the two-dimensional array U, the function modules C and D corresponding to these two elements are arranged in order of 1 and 2 in the i+1th round respectively, which cannot meet the condition greater than 4. Therefore, there is no target element in the two-dimensional array U at this time, and the process directly jumps to step S104, as shown in FIG. Figure 7 As shown in (e), the valid data corresponding to the functional module B in the i-th round in the built-in memory is directly copied to the storage area bound to the functional module B in the i+1-th round.

[0052] When j=5, the migration process ends. So far, the migration of valid data has been completed.

[0053] It can be understood that, in this example, the temporary storage area is set in the redundant area of ​​the built-in memory. In addition, the electric energy meter is generally also equipped with an external memory, and the temporary storage area can be divided using the external memory of the electric energy meter.

[0054] like Figure 7 As shown in (a), in step S1032, by only modifying the base address of the target element, a temporary storage area corresponding to the size of each target element is divided in the redundant area of ​​the built-in memory and the valid data of the functional module corresponding to each target element is copied to the corresponding temporary storage area. When j=1, all the data in the storage area corresponding to the entire functional module A and the functional module B are directly copied in this step. In step S104, when the valid data corresponding to the target module in the i-th round is copied to the storage area bound to the target module in the i+1th round, only the valid data needs to be copied.

[0055] like Figure 3 In one embodiment, the method further comprises:

[0056] Step S302, establish a write cumulative counter and a reporting position indicator for each storage area obtained after the division; wherein the write cumulative counter is used to count the total data length of the data accumulated written to the corresponding storage area under the corresponding partitioning strategy; the reporting position indicator is used to indicate the reporting status of the data written in the corresponding storage area.

[0057] Step S304: determining the actual data length of the corresponding storage area at any time based on the write cumulative counter and the reporting position indicator.

[0058] Specifically, the write accumulation counter counts the total data length of the data accumulated in the corresponding storage area under the corresponding partition strategy, specifically including:

[0059] After the electric energy meter detects that data is successfully written into the storage area each time, it adds the value of the corresponding write cumulative counter to the length of the written data to count the total data length a of the accumulated data written into the corresponding storage area under the corresponding partition strategy.

[0060] It can be seen that the write cumulative counter is a piece of data maintained by the electric energy meter. By reading the value recorded in the write cumulative counter, the total data length of the data accumulated written to a certain storage area under the current partition strategy can be known.

[0061] Specifically, the reporting position indicator indicates the reporting status of the data written in the corresponding storage area, specifically including:

[0062] Step S402, obtaining a reporting start position L corresponding to a corresponding storage area recorded by a reporting position indicator; wherein the reporting start position L is an offset of the first byte of unreported data in the corresponding storage area relative to a base address of the corresponding storage area;

[0063] It can be seen that the reporting position indicator is a data maintained by the electric energy meter. By reading the value recorded in the reporting position indicator, the starting position for data reporting (i.e., the reporting starting position L) can be known, that is, the offset of the first byte of the unreported data relative to the base address of the corresponding storage area, and then starting from the reporting starting position L, the data in the unreported state will be reported.

[0064] like Figure 4As shown, in one example, L=6, T=12, that is, L≤T, the storage area bound by function module A in the i-th round of partitioning strategy, the offset length of the storage area is 20, assuming that under the current partitioning strategy, the electric energy meter collects 13 data through function module A, and function module A writes 13 data in the storage area in the order of collection 13 times, that is, the total data length a=13, each data is one byte, and the write address is allocated according to the process from step S502 to step S508. Among them, 6 data corresponding to addresses 0x1000 to 0x1005 have been reported, and 7 data are still to be reported due to network interruption and other reasons, Figure 4 The shaded area is the unreported data, and the corresponding addresses are 0x1006 to 0x100C. The first byte of the unreported data corresponds to the address 0x1006, and the offset relative to the base address in this storage area is 6, that is, the reporting starting position L=6. Specifically, each time the electric energy meter reports data for each functional module, it starts from the first byte of the unreported data in the storage area bound to the functional module, and uploads the data marked as being in the unreported state frame by frame according to the address sequence of the unreported data. For example, if Figure 4 As shown, in one example, three bytes correspond to one transmission frame, and firstly, the three bytes with addresses 0x1006 to 0x1008 are encapsulated into a transmission frame and reported, and after receiving a successful response to the transmission frame report, the three bytes 0x1009 to 0x100B are encapsulated into a transmission frame and reported, and so on. It can be understood that if the remaining unreported data is less than three bytes, it is encapsulated according to one byte per transmission frame. Specifically, the reporting status of the data written in the storage area can be determined according to step S404.

[0065] Step S404: determining the reporting status of the data written into the corresponding storage area based on the reporting start position L.

[0066] The reported state includes the unreported state; when L≤T, the data whose address range belongs to the set {X1|(Addr+ L)≤X1≤(Addr +T)} is marked as being in the unreported state. T=(a mod b)-1, mod is the remainder operation, a is the total data length of the corresponding storage area accumulated by the write accumulation counter under the corresponding partition strategy, and b is the offset length of the storage area.

[0067] Known, such as Figure 4As shown, when L≤T, the unreported data are all located in a continuous area, that is, the unreported data are all located in a continuous area with addresses from 0x1006 to 0x100C. In this case, each time the electric energy meter reports data for each functional module, it starts from the first byte of the unreported data in the storage area bound to the functional module, and uploads the data marked as being in the unreported state frame by frame according to the address sequence of the unreported data.

[0068] When L>T, the data whose address range belongs to the set {X2|(Addr≤X2≤(Addr+T)) and ((Addr+L)≤X2≤(Addr+b-1))} is marked as being in an unreported state.

[0069] like Figure 5 As shown, in one example, L=16, T=2, LT=14, so L>T in this example. At this time, the unreported data is stored in two discontinuous areas, namely, area 1: address 0x1010 to 0x1013, and area 2: address 0x1000 to 0x1002. In this case, the unreported data corresponding to area 1, that is, ((Addr+L)≤X2≤(Addr+b-1)) is first encapsulated and reported. After the unreported data of area 1 is reported, the unreported data of area 2, that is, (Addr≤X2≤(Addr+T)) is encapsulated and reported, which is equivalent to splicing the unreported data of area 1 and area 2 and then reporting them, with area 1 in front and area 2 in the back.

[0070] In one example, specifically, determining the actual data length of the corresponding storage area at any time based on the write cumulative counter and the reported position indicator includes:

[0071] When L≤T, the actual data length of the corresponding storage area is (T-L+1) bytes; where L is the offset of the first byte of the unreported data in the corresponding storage area relative to the base address of the storage area; T=(a mod b)-1, mod is the remainder operation, a is the total data length of the data accumulated in the corresponding storage area under the corresponding partition strategy obtained by the write accumulation counter, and b is the offset length of the storage area.

[0072] In one example, the storage area bound to the functional module A is as follows: Figure 4 As shown, the offset length of the storage area is b=20. The total length of data written to the storage area under the current partition strategy is 73 bytes. In the order of writing time, the first 66 corresponding data have been reported. Figure 4As shown, there are still 7 bytes in the unreported state. It can be seen that T = (73 mod 20) - 1 = 12, and L = 6, so L ≤ T, and the actual data length of the current storage area is (12-6 + 1) = 7 bytes, that is, the area covered by the shadow, and its address range is 0x1006 to 0x100C, so the actual data length of the storage area is the data length of the valid data.

[0073] When L>T, the actual data length of the corresponding storage area is (T+b-L+1) bytes.

[0074] In one example, the storage area bound to the functional module A is as follows: Figure 5 As shown, the offset length of the storage area is b=20. The total length of data written to the storage area under the current partition strategy is 63 bytes. In the order of writing time, the first 56 corresponding data have been reported. Figure 5 As shown, there are still 7 bytes in the unreported state. It can be seen that T = (63 mod 20) - 1 = 2, and L = 16, so L>T, and the actual data length of the current storage area is (2 + 20 - 16 + 1) = 7 bytes, that is, the area covered by the shadow, whose address range is 0x1010 to 0x1013 and 0x1000 to 0x1002, so the actual data length of the storage area is the data length of the valid data.

[0075] Compared with Patent Document 1, which requires the use of a script table to record the address and length of each data entry and the data length corresponding to each storage area can only be counted by traversing the script table, in this embodiment, only two numerical values ​​corresponding to the write cumulative counter and the reported position indicator need to be maintained. By substituting them into the formula, the data length of each storage area can be quickly obtained, thereby saving the storage space resources of the electricity meter and calculating the actual data length of each storage area more quickly.

[0076] In one embodiment, the method further comprises the step of allocating, by the functional module that needs to perform the write operation, a corresponding write address in the storage area for the write operation based on the write accumulation counter:

[0077] Step S502, obtaining the data length corresponding to the data to be written as the target data length d.

[0078] Step S504, calculating the write address c based on the following formula 1.

[0079] Formula 1: c = Addr + (a mod b); where Addr is the base address, mod is the remainder operation, a is the total data length of the corresponding storage area accumulated by the write accumulation counter under the corresponding partition strategy, and b is the offset length of the storage area.

[0080] Step S506, determining the temporary destination address e based on formula 2 e=c+d-1.

[0081] Step S508, determine whether the temporary end address exceeds the range of the current storage area. If the temporary end address does not exceed the range of the current storage area, generate a write command based on the write address, and write the data to be written into the built-in memory through one write command; if the temporary end address exceeds the range of the current storage area, generate two write commands based on the write address and the base address of the current storage area respectively, and divide the data to be written into two parts, which are written into the built-in memory through two write commands respectively.

[0082] In one example, the base address Addr of the storage area bound to the functional module p_k is 0x1000, the offset length b=20, the total data length a=6 of the data accumulated in the corresponding storage area under the corresponding partition strategy obtained by the write cumulative counter, the data length corresponding to the data to be written is 7 bytes, and the write address c= 0x1000+(6mod 20)=0x1006 is calculated by substituting into formula 1, and the corresponding temporary end address e=0x1006+7-1=0x100C. It is known that the range of the current storage area is 0x1000 to 0x1013, and it can be known that the temporary end address e=0x100C does not exceed the range of the current storage area, so a write command is generated based on the write address c=0x1006, and the data to be written is written into the built-in memory through a write command. Specifically, in this example, the built-in memory is an EEPROM. After determining the write address and the corresponding data length for writing data to the EEPROM, the microcontroller of the electric energy meter can control the EEPROM to write data to the specified write address c according to the write command. The process of writing data to the specified address by the EEPROM belongs to the prior art and will not be repeated here.

[0083] In another example, the base address Addr of the storage area bound to the functional module p_k is 0x1000, the offset length b=20, the total data length a=16 of the data accumulated in the corresponding storage area under the corresponding partition strategy obtained by the write cumulative counter, and the data length corresponding to the data to be written is 7 bytes. Substituting into formula 1, the write address c= 0x1000+(16 mod 20)=0x1010 is calculated, and the corresponding temporary end address e=0x1010+7-1=0x1016. It is known that the range of the current storage area is 0x1000 to 0x1013, and it can be known that the temporary end address e=0x1016 exceeds the range of the current storage area, so two write commands are generated based on the write address c=0x1010 and the base address 0x1000, and the 7 bytes of data are divided into two parts. Specifically, using formula 3: the last address 0x1013 of the current storage area minus the write address c=0x1010 and then adding 1, the partition indicator f=0x1013 - 0x1010 +1=4 is obtained. Therefore, the first 4 bytes of data are stored in the built-in memory using a write command generated based on the write address c=0x1010, and the storage range of this part of data is 0x1010 to 0x1013; and the remaining data (i.e. 3 bytes) are stored in the built-in memory using a write command generated based on the base address 0x1000, and the storage range of this part of data is 0x1000 to 0x1002. Specifically, in this example, the built-in memory is an EEPROM. After determining the write address and the corresponding data length of the data to be written to the EEPROM, the microcontroller of the electric energy meter can control the EEPROM to write the data to the specified address according to the write command. The process of writing data to the specified address by the EEPROM belongs to the prior art and will not be repeated here.

[0084] In this embodiment, when data needs to be written into the storage area corresponding to a certain functional module, the corresponding write address needs to be allocated according to Formula 1, and the address allocated by Formula 1 for each newly written data is related to the total data length a of the accumulated data written to the corresponding storage area under the current partition strategy, and the law embodied is: through the remainder operation, each position in the storage area can be dynamically allocated for writing data, so as to achieve the effect of balanced wear of each position in the storage area. At the same time, since the temporary end address is judged whether it exceeds the range each time, and then different write data strategies are executed (i.e., one or two write commands are generated), it is possible to detect whether there is an error in data being written to other storage areas when the corresponding write address in the storage area is allocated for the write operation, thereby reducing the error rate of the storage data writing process.

[0085] In one embodiment, the valid data corresponding to each functional module is determined by the following steps:

[0086] When L≤T and T-L+1≥λ, the set corresponding to the address range of valid data is {X3|(Addr+L)≤X3≤(Addr+T)}.

[0087] When L≤T and T-L+1<λ, the set corresponding to the address range of valid data is {X4|(Addr + T-λ+1)≤X4≤(Addr +T)}.

[0088] When L>T and (T+b-L+1)≥λ, the set corresponding to the address range of valid data is {X5|(Addr≤X5≤(Addr+T)) and ((Addr+L)≤X5≤(Addr+b-1))}.

[0089] When L>T and (T+b-L+1)<λ, the set corresponding to the address range of valid data is {X6|(Addr≤X6≤(Addr+T)) and ((Addr+b+T-λ+1)≤X6≤(Addr+b-1))}.

[0090] Among them, λ is a preset coefficient, and its specific value is determined by the relevant specifications of the smart meter. For example, the corresponding function module A requires at least three recently recorded data to be retained. If each data is one byte, then λ is 3. That is, although these data have been reported to the master station, they still need to be saved in the local built-in memory of the electric energy meter according to the specification requirements. Therefore, when migrating data, these data also need to be migrated as valid data.

[0091] Reference Figure 4 and Figure 5 It can be seen that when L≤T and T-L+1≥λ or when L>T and (T+b-L+1)≥λ, it means that the data length of the unreported data is not less than λ, that is, only retaining the unreported data on the electric energy meter can meet the requirements of the specification, and the corresponding storage location of the reported data can be directly overwritten without causing any impact. When L≤T and T-L+1<λ or when L>T and (T+b-L+1)<λ, it means that the data length of the unreported data is less than λ. If the unreported data is only copied, its data length does not meet the requirements of the specification. Therefore, it is necessary to factor some of the reported data as valid data on the electric energy meter.

[0092] Specifically, after each round of partitioning strategy is executed, a set of five-dimensional data {i, p_k, Addr, b, a} corresponding to each functional module will be recorded. The five-dimensional data can facilitate the back-end server to analyze the frequency of data writing of each functional module and the total number of write times of each location on the built-in memory, so that when the server detects that the number of write times is close to the write limit, it can prompt to replace the corresponding electricity meter in advance, providing more information for monitoring the abnormality of the electricity meter.

[0093] In one embodiment, satisfying the partition adjustment condition specifically includes:

[0094] The energy meter runs for a preset time; or the number of writes to any storage area reaches a preset threshold.

[0095] For example, with six months as a cycle, the electric energy meter generates a new round of partitioning strategy every six months, or a new round of partitioning strategy is generated when the number of write times in any storage area reaches a preset number threshold.

[0096] Specifically, the number of storage area writes w is calculated by the following steps:

[0097] Get the total data length a of the accumulated written data counted by the write accumulation counter of the current storage area;

[0098] The number of storage area write times w is calculated based on the following formula 4: w=((a-(a mod b)) / b).

[0099] Since the write address is allocated according to steps S502 to S508, it is ensured that the storage units at each position of a storage area can be written evenly. Therefore, the storage area write count w can be calculated according to the formula w=((a-(a mod b)) / b). The storage area write count w can reflect the number of times the storage units at each position of the storage area are written, and the error is only ±1. Therefore, in this embodiment, the number of times the storage units at each position in the storage area are written can be obtained without monitoring the number of times the storage units at each position are written, thereby saving the overhead of monitoring the number of times the storage units at each position are written.

[0100] It should be noted that the size of the storage area bound to each functional module in the i+1th round and the ith round (i.e., the offset length) can be the same or can be changed. In order to make the number of times the storage area bound to each functional module is written closer, thereby avoiding the situation where some storage areas are written very many or very few times, and then optimizing the space resource utilization of the built-in memory according to the actual situation of different functional modules.

[0101] In one embodiment, the offset length of the storage area bound to the function module with index k in the set M in the i+1th round is determined by the following formula 5: ;

[0102] Formula 5 ;

[0103] Wherein, M is a set of all functional modules. For example, the set includes four modules, namely, functional modules A, B, C, and D, and their indexes are 1, 2, 3, and 4 respectively; is the offset length of the storage area bound to the function module with index k in set M in round i, is the number of writes to the storage area bound to the function module with index k in set M in round i, Calculated using formula 4, is the average number of write times of the storage areas bound to all functional modules in set M in the i-th round.

[0104] The above formula is used to determine the offset length of the storage area bound to the function module with index k in the set M in the i+1th round. ; It can make the number of write times of the storage area bound to all functional modules close to the same, so as to achieve wear leveling of the built-in memory. The principle is as follows: the offset length of the storage area Represents the size of the storage area. The write frequency is an inherent characteristic of each functional module. Some functional modules have a high write frequency, while others have a low write frequency. At the end of the i-th round, the ratio of the number of writes to the storage area bound to each functional module to the offset length of the storage area is defined as α, then α is a constant, α= / , the value of α represents the write frequency of the function module with index k in the set M, which is the inherent characteristic of each function module. Therefore, in order to make the number of writes to the storage area bound by the function module with index k reach , then we have the equation / = / =α, we get = ,Since the total size of the storage area bound to each functional module in the set M in this embodiment remains unchanged in each round, for example, the total size is constant at 256KB, it is necessary to multiply it by a scaling factor , we get formula 5.

[0105] This embodiment adjusts the size of the storage area bound to each functional module in the i+1th round through Formula 5, so that the number of write times of the storage area bound to each functional module tends to be the same, thereby achieving balanced wear of the built-in memory. At the same time, the number of times the storage area bound to each functional module is written is closer, thereby avoiding the situation where some storage areas are written very many or very few times, and then improving the space resource utilization of the built-in memory according to the actual situation of different functional modules.

[0106] In one embodiment, the method further comprises the step of determining a timing for performing the step of migrating the valid data stored in the storage area corresponding to the previous round of each functional module to the storage area corresponding to the new round:

[0107] After a new round of partitioning strategies is generated, when it is detected that the electric energy meter has performed a data reporting operation for each functional module and completed the data reporting operation, an effective data migration process is executed.

[0108] Since the migration is performed after the data reporting operation is executed, the length of the valid data is shorter at this time, saving the computer resource overhead of data migration.

[0109] In one embodiment, an electric energy meter abnormality processing device is also provided, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the steps of the electric energy meter abnormality processing method when executing the program. The steps of the electric energy meter abnormality processing method here may be the steps in the above-mentioned various embodiments.

[0110] In one embodiment, a computer-readable storage medium is further provided, wherein the computer-readable storage medium stores computer-executable instructions, wherein the computer-executable instructions are used to enable a computer to execute the steps of the above-mentioned method for handling anomalies of electric energy meters. The steps of the method for handling anomalies of electric energy meters here may be the steps of the method for handling anomalies of electric energy meters in the above-mentioned embodiments.

[0111] In one embodiment, an electric energy meter is further provided. The electric energy meter includes a controller and an electric energy metering chip. The controller is used to execute the above-mentioned electric energy meter abnormality processing method.

[0112] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRA), memory bus (Rambus) direct RAM (RDRA), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0113] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

Claims

1. A method for handling abnormality of an electric energy meter, characterized in that: The method comprises: In the process of dividing the built-in memory of the electric energy meter into a plurality of storage areas and monitoring the data storage process of each storage area, when the electric energy meter detects that the partition adjustment condition is met, a new round of partition strategy is generated; wherein each storage area corresponds to a functional module of the electric energy meter, and the partition strategy includes a base address and an offset length of each storage area obtained when the built-in memory of the electric energy meter is divided; The electric energy meter re-divides the storage area based on the new round of partitioning strategy, so that the storage area corresponding to at least one functional module in the new round is different from the storage area corresponding to the previous round; After the electric energy meter re-divides the storage area based on the new round of partitioning strategy, it continues to monitor the data storage process of each re-divided storage area; The electric energy meter identifies whether there is an abnormality in the data storage of the electric energy meter based on the monitoring result, and generates corresponding prompt information when an abnormality exists; The partition adjustment conditions are met, specifically including: The number of writes to any storage area reaches the preset threshold; Specifically, the number of storage area writes w is calculated by the following steps: Get the total data length a of the accumulated written data counted by the write accumulation counter of the current storage area; The number of storage area writes w is calculated based on the following formula 4: w = ((a-(a mod b)) / b); where a is the total data length of the corresponding storage area accumulated under the corresponding partition strategy obtained by the write accumulation counter, and b is the offset length of the storage area; The previous round is called the i-th round, and the new round is called the i+1-th round. The offset length of the storage area bound to the function module with index k in the set M in the i+1-th round is determined by the following formula: ; ; Among them, M is the set of all functional modules, is the offset length of the storage area bound to the function module with index k in set M in round i, is the number of writes to the storage area bound to the function module with index k in set M in round i, is the average number of write times of the storage areas bound to all functional modules in set M in the i-th round.

2. The method for handling abnormality of an electric energy meter according to claim 1, characterized in that: After the electric energy meter re-divides the storage areas based on the new partitioning strategy and before continuing to monitor the data storage process of each storage area, the method further includes: Migrate the valid data of each functional module stored in the storage area corresponding to the previous round to the storage area corresponding to the new round.

3. The method for handling abnormality of an electric energy meter according to claim 2, characterized in that: The migrating of valid data stored in the storage area corresponding to the previous round of each functional module to the storage area corresponding to the new round specifically includes: Step S101, let j=1, record the previous round as the i-th round, and the new round as the i+1-th round; where i and j are both positive integers; Step S102, taking the function module p_k corresponding to the element with the arrangement number j in the two-dimensional array I as the target module; wherein the elements in the two-dimensional array I are four-dimensional data {i+1, p_k, Addr, b} recording the partition strategy corresponding to each function module p_k in the i+1th round; Addr is the base address, and b is the offset length; the elements in the two-dimensional array I are sorted in the order of the base address size; Step S1031, an element in the two-dimensional array U that intersects with an element with an arrangement number j in the two-dimensional array I and whose corresponding function module p_k has an arrangement number greater than j in the i+1 round is taken as a target element; wherein the elements in the two-dimensional array U are four-dimensional data {i+1, p_k, Addr, b} that record the partition strategy corresponding to each function module p_k in the i-th round; the intersection of the target element in the two-dimensional array U and the element with an arrangement number j in the two-dimensional array I means that the storage area bound to the function module corresponding to the target element in the two-dimensional array U in the i-th round and the storage area bound to the target module in the i+1 round have at least a partial overlapping area; Step S1032, by modifying the base address of the target element, a temporary storage area corresponding to the size of each target element is divided in the redundant area of ​​the built-in memory, and the data of the functional module corresponding to each target element is copied to the corresponding temporary storage area, and the corresponding target element is deleted from the two-dimensional array U; at the same time, the target element with the modified base address is added to the two-dimensional array N; Step S104, copying the valid data corresponding to the target module in the i-th round to the storage area bound to the target module in the i+1th round; Step S105, add 1 to the value of j and determine whether it is greater than the preset number of elements. If so, end the effective data migration process; if not, jump to step S102.

4. The method for handling abnormality of an electric energy meter according to claim 3, characterized in that: The method further comprises: A write cumulative counter and a reporting position indicator are established for each storage area obtained after the division; wherein the write cumulative counter is used to count the total data length of the data accumulated in the corresponding storage area under the corresponding partitioning strategy; and the reporting position indicator is used to indicate the reporting status of the data written in the corresponding storage area; Based on the write cumulative counter and the reported position indicator, the actual data length of the corresponding storage area at any time is determined.

5. The method for handling abnormality of an electric energy meter according to claim 4, characterized in that: The determining of the actual data length of the corresponding storage area at any time based on the write cumulative counter and the reported position indicator specifically includes: When L≤T, the actual data length of the corresponding storage area is T-L+1 bytes; where L is the offset of the first byte of the unreported data in the corresponding storage area relative to the base address of the storage area; T=(a mod b)-1, mod is the remainder operation, a is the total data length of the corresponding storage area accumulated by the write accumulation counter under the corresponding partition strategy, and b is the offset length of the storage area; When L>T, the actual data length of the corresponding storage area is T+b-L+1 bytes.

6. The method for handling abnormality of an electric energy meter according to claim 4, characterized in that: The method further comprises the step of allocating a corresponding write address in a storage area for the write operation based on a write accumulation counter by a function module that needs to perform the write operation: Obtain the data length corresponding to the data to be written as the target data length; The write address c is calculated based on the following formula 1; Formula 1: c = Addr + (a mod b); where Addr is the base address, mod is the remainder operation, a is the total data length of the corresponding storage area accumulated under the corresponding partition strategy obtained by the write accumulation counter, and b is the offset length of the storage area; Calculate the sum of the write address and the target data length to obtain the temporary end point address; Determine whether the temporary end point address exceeds the range of the current storage area. If the temporary end point address does not exceed the range of the current storage area, generate a write command based on the write address, and write the data to be written into the built-in memory through one write command; if the temporary end point address exceeds the range of the current storage area, generate two write commands based on the write address and the base address of the current storage area respectively, divide the data to be written into two parts, and write them into the built-in memory through two write commands respectively.

7. The method for handling abnormality of an electric energy meter according to claim 4, characterized in that: The write accumulation counter counts the total data length of the data accumulated in the corresponding storage area under the corresponding partition strategy, specifically including: After the electric energy meter detects that data is successfully written into the storage area each time, it adds the value of the corresponding write cumulative counter to the length of the written data to count the total data length of the accumulated data written into the corresponding storage area under the corresponding partition strategy.

8. The method for handling abnormality of an electric energy meter according to claim 5, characterized in that: The reporting position indicator indicates the reporting status of the data written in the corresponding storage area, including: Obtaining a reporting start position L corresponding to a corresponding storage area recorded by a reporting position indicator; wherein the reporting start position L is an offset of the first byte of unreported data in the corresponding storage area relative to a base address of the corresponding storage area; Determine the reporting status of the data written in the corresponding storage area based on the reporting starting position L; Among them, the reported status includes an unreported status; when L≤T, the data whose address range belongs to the set {X1|(Addr + L)≤X1≤(Addr +T)} is marked as being in an unreported status; when L>T, the data whose address range belongs to the set {X2|(Addr≤X2≤(Addr+T)) and ((Addr+L)≤X2≤(Addr+b-1))} is marked as being in an unreported status.

9. The method for handling abnormality of an electric energy meter according to claim 8, characterized in that: Determine the valid data corresponding to each functional module by following the steps below: When L≤T and T-L+1≥λ, the set corresponding to the address range of valid data is {X3|(Addr + L)≤X3≤(Addr +T)}; where λ is a preset coefficient; When L≤T and T-L+1<λ, the set corresponding to the address range of valid data is {X4|(Addr + T-λ+1)≤X4≤(Addr +T)}; When L>T and (T+b-L+1)≥λ, the set corresponding to the address range of valid data is {X5|(Addr≤X5≤(Addr+T)) and ((Addr+L)≤X5≤(Addr+b-1))}; When L>T and (T+b-L+1)<λ, the set corresponding to the address range of valid data is {X6|(Addr≤X6≤(Addr+T)) and ((Addr+b+T-λ+1)≤X6≤(Addr+b-1))}.

Citation Information

Patent Citations

  • Method and system for monitoring data storage of built-in memory of electric energy meter

    CN114138201A

  • Memory partitioning method and device, equipment and storage medium

    CN118394263A