Distributed electric energy metering data block storage method and system based on dual-mode routing
By acquiring and processing data from the power metering network in a dual-mode routing environment, performing node status analysis and segmentation, the matching problem between data blocks and node storage space is solved, improving the integrity and traceability of data storage.
Patent Information
- Application Number
- CN202611329837.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-31
- Publication Date
- 2026-11-06
AI Technical Summary
In a dual-mode routing environment, the slicing results of electricity metering data blocks are difficult to match with the routing nodes, resulting in a mismatch between the data slice length and the storage space of the target node, which affects the integrity and traceability of data storage.
By acquiring dual-mode routing data and node storage data from the end-point metering network, correlation processing is performed to determine the status of metering nodes. Segmentation processing is carried out according to the node routing hierarchy to select a set of nodes that can be stored. Segment configuration and splitting are then performed, and segment mapping and index arrangement are established to ensure the correspondence between data segments and target nodes.
This approach achieves the matching of the slicing results of electricity metering data blocks with the storage space of the target node, improving the organizational integrity and traceability of data storage, and reducing the occurrence of mismatches between data slice length and available storage space of the node.
Smart Images

Figure CN123055640A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electricity metering data storage technology, and in particular to a distributed electricity metering data block storage method and system based on dual-mode routing. Background Technology
[0002] Currently, as electricity metering terminals continuously generate metering data, the end-point metering network needs to store and retrieve this data locally. End-point metering networks typically support power line carrier communication and wireless communication. Different metering nodes are affected by communication link status, node location, and available storage space, resulting in variations in the range of nodes capable of establishing communication connections and their data carrying capacity.
[0003] In a current technology, electricity metering data blocks are typically divided according to fixed data slicing rules, and different data slices are written to multiple metering nodes based on a pre-determined node correspondence to form distributed storage. However, when the dual-mode communication link changes, the reachable metering nodes within different routing levels may change, and the available storage space of each metering node may differ. The fixed data slicing method is difficult to adjust according to the actual routing structure and node storage status, which can easily lead to a mismatch between the data slice length and the target node's carrying space, further causing deviations in the index relationship between the data slice and the actual storage node.
[0004] In existing technologies, there is a problem that the slicing results of power metering data blocks are difficult to match with routing nodes in a dual-mode routing environment. Summary of the Invention
[0005] This invention provides a distributed energy metering data block storage method and system based on dual-mode routing to solve the problem in the prior art where the slicing results of energy metering data blocks are difficult to match with routing nodes under dual-mode routing environment.
[0006] Firstly, in order to solve the above-mentioned technical problems, the present invention provides a method for storing distributed power metering data blocks based on dual-mode routing, comprising:
[0007] Obtain dual-mode routing data and node storage data of the terminal metering network, and perform association processing on the dual-mode routing data and the node storage data to obtain the metering node status;
[0008] The node routing level is determined based on the metering node status, and the node routing level is segmented to obtain routing segments and candidate node sets.
[0009] Obtain the metering data block to be stored, perform capacity filtering on the candidate node set based on the node storage data to obtain the storable node set, perform fragment configuration processing on the storable node set and the routing segment to obtain the fragment length and target node, perform segmentation processing on the metering data block to be stored based on the fragment length to obtain the data fragment set, and perform corresponding association between the data fragment set and the target node to obtain the fragment mapping;
[0010] The segment index is obtained by indexing and arranging the segments according to the segment mapping.
[0011] The target node corresponding to the data shard set is determined based on the segment index, and each data shard in the data shard set is written to the corresponding target node to obtain distributed metering data.
[0012] Secondly, the present invention provides a distributed energy metering data block storage system based on dual-mode routing, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described above.
[0013] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described above.
[0014] Compared with the prior art, the present invention has the following beneficial effects:
[0015] (1) The present invention obtains the dual-mode routing data and node storage data of the end metering network, and performs association processing on the dual-mode routing data and the node storage data to obtain the metering node status. Then, it forms routing segments and candidate node sets according to the node routing hierarchy, so that the dual-mode communication status and storage status of the metering node form a corresponding relationship, providing a unified data foundation for subsequent screening of storable nodes and allocation of metering data blocks.
[0016] (2) The present invention obtains a set of storable nodes by filtering the candidate node set according to the node storage data, and combines the storable node set with the routing segmentation to configure the segment length and target node. Then, the metering data block to be stored is divided according to the segment length, so that the slicing result of the metering data block can match the storage capacity of the corresponding target node, reducing the situation where the data slice length does not correspond to the available storage space of the node under the fixed slicing method.
[0017] (3) The present invention obtains a segment mapping by associating the data slice set with the target node, obtains a segment index by indexing the segment mapping, and writes each data slice to the corresponding target node according to the segment index, so that the data slice splitting result, storage location and index relationship remain corresponding, which facilitates the location and subsequent reorganization of distributed storage measurement data, and improves the integrity and traceability of measurement data storage organization. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of a distributed power metering data block storage method based on dual-mode routing provided in the first embodiment of the present invention;
[0019] Figure 2 This is a schematic diagram illustrating the change in the number of candidate nodes in each routing segment of a distributed energy metering data block storage method based on dual-mode routing provided in the first embodiment of the present invention.
[0020] Figure 3 This is a schematic diagram illustrating the metering record boundary correction effect of a distributed power metering data block storage method based on dual-mode routing provided in the first embodiment of the present invention.
[0021] Figure 4 This is a schematic diagram showing the changes in the amount of data written to each routing segment in a distributed energy metering data block storage method based on dual-mode routing provided in the first embodiment of the present invention. Detailed Implementation
[0022] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0023] Reference Figure 1 The first embodiment of the present invention provides a method for storing distributed power metering data blocks based on dual-mode routing, comprising the following steps:
[0024] S1, obtain dual-mode routing data and node storage data of the terminal metering network, and perform association processing on the dual-mode routing data and the node storage data to obtain the metering node status;
[0025] S2, determine the node routing level based on the metering node status, and perform segmentation processing on the node routing level to obtain routing segments and candidate node sets;
[0026] S3, obtain the metering data block to be stored, perform capacity filtering on the candidate node set according to the node storage data to obtain the storable node set, perform fragment configuration processing on the storable node set and the routing segment to obtain the fragment length and target node, perform segmentation processing on the metering data block to be stored according to the fragment length to obtain the data fragment set, and perform corresponding association between the data fragment set and the target node to obtain the fragment mapping;
[0027] S4, perform indexing and arrangement according to the segment mapping to obtain the segment index;
[0028] S5, determine the target node corresponding to the data shard set according to the segment index, and write each data shard in the data shard set into the corresponding target node to obtain distributed metering data.
[0029] In step S1, dual-mode routing data and node storage data of the end-metering network are obtained, and the dual-mode routing data and the node storage data are associated to obtain the metering node status.
[0030] The process of associating the dual-mode routing data with the node storage data to obtain the metering node status includes:
[0031] The dual-mode routing data includes carrier link status, wireless link status, and node adjacency relationships; the node storage data includes remaining storage capacity and contiguous writable space.
[0032] The dual-mode routing data is associated with the node storage data according to the metering node to obtain node association data;
[0033] The state of the metering nodes is obtained by performing state aggregation processing on the node-related data.
[0034] In one implementation, the dual-mode routing data is a set of data read from the routing status record of the dual-mode communication controller when the end-metering network executes the current storage process. Each metering node corresponds to a unique metering node identifier, which is read from the communication address field of the metering node in the end-metering network. The dual-mode communication controller maintains neighbor records corresponding to carrier communication mode and wireless communication mode respectively, and each neighbor record is written with the local metering node identifier, the neighbor metering node identifier, and the link connectivity status.
[0035] The carrier link status is the current link connectivity status between the metering node and its neighboring metering nodes under carrier communication mode, recorded by the dual-mode communication controller. The neighbor record corresponding to carrier communication is read, and the local metering node identifier, neighboring metering node identifier, and link connectivity status from the record are written into the carrier link status. The wireless link status is the current link connectivity status between the metering node and its neighboring metering nodes under wireless communication mode, recorded by the dual-mode communication controller. The neighbor record corresponding to wireless communication is read, and the local metering node identifier, neighboring metering node identifier, and link connectivity status from the record are written into the wireless link status.
[0036] It should be noted that the link connectivity status is a status flag written to the neighbor record by the dual-mode communication controller after the most recent link maintenance process. When the dual-mode communication controller receives a link maintenance response from the corresponding neighbor metering node, it keeps the corresponding neighbor record in a connected state; when the corresponding neighbor record is removed from the current valid neighbor relationships, the corresponding link record is set to a disconnected state. This embodiment directly reads the link connectivity status without further scoring or clustering.
[0037] The node adjacency relationship is a set of neighboring metering nodes that form a direct communication relationship with a metering node under both carrier communication and wireless communication modes. In this embodiment, all carrier link states and wireless link states corresponding to the same metering node are read, the identifiers of neighboring metering nodes with a connected link state are merged, and duplicate neighboring metering node identifiers are retained as one adjacency record to obtain the node adjacency relationship.
[0038] When the same metering node and the same neighboring metering node have both carrier communication links and wireless communication links, one adjacency record is retained in the node adjacency relationship, and the link connectivity status of the corresponding communication method is retained in the carrier link status and the wireless link status, respectively.
[0039] In one implementation, the node storage data is returned by the storage manager of the metering node within the same state collection round. The remaining storage capacity is the total data capacity of the currently unallocated storage address range. The node storage data corresponds to the non-metering business storage area in the metering node's communication module or independent data storage module, and is physically or logically isolated from the metering parameter area, frozen data area, and event log area. Data slice writing does not modify the metering business data. When obtaining the remaining storage capacity, the free address range maintained by the storage manager is read, the length of each free address range is determined, and the lengths of all free address ranges are summed to obtain the remaining storage capacity. The free address range is maintained by the internal storage manager of the metering node, and only the remaining storage capacity, contiguous writable space, and logical storage area identifier are returned externally. The specific physical address allocation is completed internally by the node.
[0040] The contiguous writable space is the amount of data that a single contiguous address interval in the current free address range can hold. When acquiring the contiguous writable space, each free address interval is read according to its starting address position, the lengths of each free address interval are compared, and the data corresponding to the free address interval with the longest length is written into the contiguous writable space.
[0041] In this embodiment, the dual-mode routing data and the node storage data are associated according to the metering nodes. During the association process, the metering node identifiers in the dual-mode routing data are read one by one. Storage records with matching metering node identifiers are retrieved from the node storage data. The carrier link status, radio link status, node adjacency relationship, remaining storage capacity, and contiguous writable space corresponding to the same metering node are written into the same node association record to obtain node association data. If no node storage data corresponding to the same metering node is found in the current state collection round, no node association record corresponding to the metering node is generated in the current state collection round.
[0042] This embodiment performs state aggregation processing on the node-associated data. During state aggregation processing, all node-associated records are arranged according to the metering node identifier. The carrier link status, wireless link status, and node adjacency relationship corresponding to the same metering node are written into the communication status field. The remaining storage capacity and the continuous writable space are written into the storage status field to form a metering node status record. All metering node status records formed in the current status collection round are aggregated to obtain the metering node status.
[0043] For example, if a metering node is identified as N12, and the carrier link status between N12 and N05 is read as connected, and the wireless link status between N12 and N09 is also read as connected, then N05 and N09 are recorded in the node adjacency relationship. The storage manager returns three free address intervals, corresponding to data volumes of 48 Mbps, 32 Mbps, and 16 Mbps respectively. The data volumes of the three free address intervals are summed to obtain the remaining storage capacity of 96 Mbps. The data volume corresponding to the longest free address interval, 48 Mbps, is written into the contiguous writable space. After completing the corresponding association and status aggregation according to the metering node identifier N12, the corresponding metering node status record is simultaneously written to N12's carrier link status, wireless link status, node adjacency relationship, 96 Mbps of remaining storage capacity, and 48 Mbps of contiguous writable space.
[0044] In step S2, the node routing level is determined based on the metering node status, and the node routing level is segmented to obtain routing segments and candidate node sets.
[0045] The node routing hierarchy is segmented to obtain routing segments and a candidate node set, including:
[0046] Based on the node routing hierarchy, continuous segments are divided to obtain routing segments;
[0047] The metering nodes with dual-mode communication links are aggregated according to the routing segmentation to obtain a candidate node set.
[0048] In one implementation, the node routing level is the topology level of each metering node relative to the concentrator, and the level number of the node routing level corresponds to the minimum number of link forwardings between the metering node and the concentrator. This embodiment reads the node adjacency relationships corresponding to each metering node from the metering node status, and establishes an adjacency table for the end-metering network based on all node adjacency relationships. Each adjacency table entry records a metering node and its directly connected neighboring metering nodes.
[0049] This embodiment uses a breadth-first search algorithm to determine the node routing level. The concentrator is recorded as a level 0 node and written into a first-in-first-out traversal queue. The current node is read sequentially from the traversal queue, and neighboring metering nodes directly connected to the current node are queried from the adjacency table. For neighboring metering nodes whose routing levels have not yet been recorded, the routing level of the current node is increased by one level and written to the neighboring metering node, which is then written into the traversal queue. For neighboring metering nodes whose routing levels have already been recorded, the already written routing levels are maintained. This process continues until the traversal queue is empty, thus obtaining the node routing level corresponding to each metering node.
[0050] It should be noted that the node adjacency relationships used in the breadth-first search above are derived from the currently valid route maintenance results of the dual-mode communication controller. The determined node routing level is used to form subsequent route segments and does not replace the underlying actual route selection of the dual-mode communication controller. If the dual-mode communication controller has directly provided the currently valid node level, it can also be directly mapped to the node routing level.
[0051] It should be noted that the breadth-first search traverses the network layer by layer from the concentrator outwards. When a metering node has multiple adjacent paths, the first node routing level written corresponds to the minimum number of link forwardings from the metering node to the concentrator. Metering nodes that are not connected to the concentrator through the node adjacency relationship are not written into the current node routing level. In this embodiment, continuous segment division is performed based on the node routing level. First, the maximum level number in the current node routing level is read, and the actual number of route segments generated is determined based on the maximum level number.
[0052] When the maximum level number is not less than 3, the continuous level sequence from the first level to the maximum level number is divided into three continuous segments, and the difference in the number of node routing levels contained in each continuous segment does not exceed one. When the number of node routing levels is not divisible by 3, the remaining node routing levels are written into the preceding continuous segments in order from the concentrator to the end metering nodes. When the maximum level number is 2, the first level is recorded as the first routing segment, and the second level is recorded as the second routing segment. When the maximum level number is 1, the first level is recorded as the first routing segment. When there are no metering nodes other than the concentrator that can form a connection with the concentrator, no routing segment is generated, and the candidate node set is empty.
[0053] In this embodiment, the first, second, and third routing segments are assigned sequentially according to their distance from the concentrator, from closest to furthest. If only one routing segment exists, only the first routing segment is generated; if two routing segments exist, only the first and second routing segments are generated; and if three routing segments exist, all three are generated. Therefore, the number of routing segments is directly determined by the current node's routing hierarchy, and it is not required that three routing segments exist in every storage process.
[0054] This embodiment aggregates metering nodes with dual-mode communication links according to the routing segmentation. The dual-mode communication link is a set of communication link records composed of the carrier link state and the wireless link state. When at least one of the carrier link state or the wireless link state corresponding to the metering node is in a connected state, the metering node is recorded as a metering node with a dual-mode communication link. That is, having a dual-mode communication link indicates that the metering node has dual-mode communication capability and the bearer link corresponding to at least one communication mode is available. It is not required that the carrier communication link and the wireless communication link are in a connected state at the same time. The actual data transmission link is still determined by the active link marker recorded by the subsequent dual-mode communication controller.
[0055] During the aggregation process, the node routing level corresponding to each actually generated routing segment is read one by one. The metering node belonging to that routing level is then searched in the metering node status, and the carrier link status and radio link status corresponding to that metering node are read. When a link in a connected state exists in either the carrier link status or the radio link status, the metering node is written into the candidate node record corresponding to the current routing segment. After processing all actual routing segments, the candidate node records corresponding to each routing segment are aggregated to obtain a candidate node set. This candidate node set retains the association between metering nodes and actual routing segments.
[0056] For example, if the maximum node routing level obtained by the current end-point metering network after breadth-first search is 6, then the first and second layers are written into the first routing segment, the third and fourth layers into the second routing segment, and the fifth and sixth layers into the third routing segment. If a metering node N31 is located in the fourth layer, and the carrier link state record shows that the link between N31 and the third-layer metering node N18 is connected, then N31 is written into the candidate node record corresponding to the second routing segment.
[0057] For example, if the maximum node routing level of the other end metering network is 2, then only the first routing segment and the second routing segment are formed, corresponding to the first layer and the second layer, respectively. Subsequent segment configuration and index orchestration only process the actually existing first routing segment and second routing segment.
[0058] For example, Figure 2 This is a schematic diagram illustrating the changes in the number of candidate nodes in each routing segment. During the 120 status collection rounds, changes in node adjacency relationships caused adjustments to the routing segments to which some metering nodes belonged, resulting in changes in the number of candidate nodes in each routing segment, thus ensuring that the candidate node set corresponds to the current dual-mode communication link status.
[0059] In step S3, a metering data block to be stored is obtained, and the candidate node set is filtered by capacity according to the node storage data to obtain a storable node set. Fragment configuration processing is performed according to the storable node set and the routing segment to obtain the fragment length and target node. The metering data block to be stored is segmented according to the fragment length to obtain a data fragment set. The data fragment set is associated with the target node to obtain a fragment mapping.
[0060] Specifically, the candidate node set is filtered by capacity based on the node storage data to obtain a storable node set, including:
[0061] The remaining usable capacity is obtained by deducting capacity from the remaining storage capacity and the preset reserved capacity.
[0062] The smaller value between the remaining available capacity and the contiguous writable space is determined as the allocatable capacity;
[0063] The candidate node set is filtered by capacity based on a comparison between the allocatable capacity and the preset minimum fragment length to obtain a storable node set.
[0064] In one implementation, the metering data block to be stored is a set of metering records to be distributedly written in the end-point metering network. The metering records in the metering data block are arranged according to their acquisition time, and each metering record includes a record length field, an acquisition time field, and a metering data field. When acquiring the metering data block to be stored, the data block length recorded in the data block header is read to obtain the data volume of the metering data block to be stored. Then, each metering record is parsed sequentially according to its record length field to obtain the start and end positions of each metering record in the metering data block to be stored. The record lengths of each metering record are compared, and the maximum value is recorded as the maximum record length.
[0065] This embodiment reads the node storage data generated in step S1 and queries the remaining storage capacity and contiguous writable space of each metering node recorded in the candidate node set. It should be noted that the preset reserved capacity is written into the storage parameter table by the storage manager of each metering node before the current storage process begins, and different initialization methods are used depending on whether the metering node has any incomplete write history.
[0066] When a metering node has incomplete write history records, it reads all incomplete write history records currently stored by the storage manager, extracts the amount of incomplete write data from each record, compares all the incomplete write data amounts, rounds up the largest amount according to the storage manager's smallest storage allocation granularity, and writes the rounded amount to the preset reserved capacity. This embodiment uses a single write task mutual exclusion mechanism, allowing only one distributed data slice to be in an incomplete write state at the same metering node at any given time. Therefore, reserving the maximum amount of incomplete write data is sufficient to cover the concurrency occupancy boundary.
[0067] The amount of data that has not been written in a single storage process refers to the amount of data that has entered the node's write queue but has not yet returned a write completion status. The minimum storage allocation granularity is directly read from the storage manager's media parameter record. When a metering node has no history of incomplete writes, the write buffer capacity in the storage controller parameter record is read, and the write buffer capacity is rounded up according to the minimum storage allocation granularity. The rounded data amount is used as the initial value of the preset reserved capacity. Newly deployed metering nodes, metering nodes with no history after reinitialization, and metering nodes with normal history all have a clear source of reserved capacity.
[0068] For example, in the incomplete write history currently saved by an already running metering node, the maximum amount of incomplete write data is 6,291,000 bytes. The minimum storage allocation granularity of the storage manager is 4,096 bytes. After rounding up from 4,096 bytes, we get 6,291,456 bytes. 6,291,456 bytes are then written to the preset reserved capacity.
[0069] For example, if a newly deployed metering node has no incomplete write history and the write buffer capacity in the storage controller parameter record is 8 megabytes, then 8 megabytes are read as the initial value of the preset reserved capacity. After the metering node subsequently generates incomplete write history, the preset reserved capacity is updated according to the aforementioned history determination method.
[0070] This embodiment performs capacity deduction processing on the remaining storage capacity. During capacity deduction, the preset reserved capacity is deducted from the remaining storage capacity corresponding to the candidate node, and the deduction result is recorded as the remaining available capacity. When the remaining storage capacity is not greater than the preset reserved capacity, the remaining available capacity is recorded as zero. Subsequently, the remaining available capacity corresponding to the same candidate node and the contiguous writable space are compared, and the data volume with the smaller value is determined as the allocatable capacity of the candidate node.
[0071] It should be noted that the preset minimum fragment length is the minimum data length that the current metering node's storage medium can independently allocate space for. In this embodiment, the minimum storage allocation granularity is read from the storage manager's media parameter record and written into the preset minimum fragment length. For example, if the minimum storage allocation granularity of the current storage medium is 4096 bytes, then 4096 bytes are written into the preset minimum fragment length.
[0072] In this embodiment, the allocatable capacity of each candidate node is compared with the preset minimum segment length. When the allocatable capacity of a candidate node is not less than the preset minimum segment length, the candidate node is written into the storable node record; when the allocatable capacity of a candidate node is less than the preset minimum segment length, the candidate node is not written into the current storable node record.
[0073] After comparing all candidate nodes in the candidate node set, the retained storable node records are aggregated to obtain a storable node set. Each storable node record retains the allocatable capacity and the routing segment to which it belongs for the corresponding metering node.
[0074] For example, a candidate node has a remaining storage capacity of 160 megabytes, and the preset reserved capacity is 8 megabytes. After deducting the remaining capacity, the remaining usable capacity is 152 megabytes. The candidate node has a contiguous writable space of 72 megabytes. Comparing 152 megabytes and 72 megabytes, 72 megabytes is determined as the allocatable capacity of the candidate node. Since 72 megabytes is greater than 4096 bytes, the candidate node is written into the set of storable nodes.
[0075] The process of configuring segments based on the storable node set and the route segments to obtain the segment length and target node includes:
[0076] The storable node set is segmented and aggregated according to the route segmentation to obtain a segmented node set;
[0077] Data carrying capacity is allocated based on the amount of the metering data block to be stored and the allocable capacity of each storable node in the segment node set, and the segment allocation result is obtained.
[0078] The fragment length and target node are determined based on the fragment allocation results.
[0079] In this embodiment, when allocating data capacity, the allocable capacity of each storable node is read sequentially according to the actual route segmentation and the arrangement order of nodes in the segment node set. This capacity is compared with the amount of data to be allocated to determine the amount of data that the current storable node can carry, i.e., the segment length. This node is then recorded as the target node, and the segment length is deducted from the amount of data to be allocated. For non-last data segments, when determining the segment length, data space no less than the maximum record length is reserved from the allocable capacity of the corresponding target node, and the remaining capacity after deducting the reserved space is used as the upper limit for allocating the current segment length. This allocation process is repeated until the segment length and target node are formed for each segment. If the total allocable capacity after traversing all segment node sets is still insufficient to carry the metering data block to be stored, an insufficient space exception is triggered, and the process exits.
[0080] In one implementation, this embodiment determines the initial segmentation positions sequentially according to the order of segment lengths in the segment allocation result. The first initial segmentation position is determined by moving the starting position of the measurement data block to be stored forward by one segment length. After determining the first target segmentation position, the next initial segmentation position is determined by moving the next segment length backward from the previous target segmentation position. This process is repeated segment by segment, with the last data segment extending directly to the end position of the measurement data block to be stored.
[0081] The metering record boundary is the data position between two adjacent complete metering records. In this embodiment, according to the record length field parsed when acquiring the metering data block to be stored, the record length of each metering record is sequentially accumulated starting from the beginning position of the metering data block to be stored, and the end position of each metering record is recorded as the metering record boundary.
[0082] This embodiment determines whether the initial segmentation position coincides with the boundary of a metering record. When the initial segmentation position coincides with the boundary of a metering record, the initial segmentation position is directly determined as the target segmentation position; when the initial segmentation position is located inside a metering record, the end position corresponding to the metering record containing the initial segmentation position is read, and the end position is determined as the target segmentation position.
[0083] It should be noted that the amount of data moved from the initial segmentation position to the end position of the measurement record is less than the maximum record length. For non-end data segments, the segment configuration process has already reserved data space no less than the maximum record length in the allocable capacity of the corresponding target node, and the actual data segment length after boundary correction is no greater than the allocable capacity of the corresponding target node.
[0084] Each subsequent initial segmentation position is redefined from the previous target segmentation position, and segmentation is not continued according to the cumulative byte positions before correction. Boundary correction will not create unallocated data intervals between adjacent data slices.
[0085] The last data slice extends from the last target segmentation position to the end position of the metering data block to be stored. Boundary correction of the preceding data slice only increases the data volume of the preceding data slice and reduces the remaining data volume at the end. The data volume of the last data slice is not greater than the allocatable capacity of the last target node determined during the fragment configuration process.
[0086] In this embodiment, the metering data block to be stored is sequentially segmented according to each target segmentation position. The data between the start position of the metering data block to be stored and the first target segmentation position is written into the first data slice. The data between two adjacent target segmentation positions is sequentially written into subsequent data slices. The data between the last target segmentation position and the end position of the metering data block to be stored is written into the last data slice. All data slices are arranged according to the original data order to obtain a data slice set.
[0087] For example, the data volume of the metering data block to be stored is 21,000 bytes, and the lengths of the first three segments determined in the segment configuration process are 8,500 bytes, 7,500 bytes, and 5,000 bytes, respectively. The first initial split position is located at byte 8,500, and the end position of the corresponding metering record is located at byte 8,800. Byte 8,800 is determined as the first target split position, and the actual length of the first data slice is 8,800 bytes, which is less than the 9,000-byte allocable capacity of the corresponding target node.
[0088] Starting from byte 8800, the second segment is moved forward by 7500 bytes, resulting in the second initial split position at byte 16300. The end position of the corresponding metering record is at byte 16500. Byte 16500 is determined as the second target split position. The actual length of the second data slice is 7700 bytes, which is less than the 8000-byte allocable capacity of the corresponding target node. The remaining 4500 bytes form the third data slice, which is less than the 7000-byte allocable capacity of the third target node, resulting in three data slices.
[0089] For example, Figure 3 This is a schematic diagram illustrating the boundary correction effect of the measurement record. Of the 2779 non-end-of-line split positions, 2768 initial split positions were located inside the measurement record. After boundary correction, all target split positions fall within the measurement record boundaries, preventing the complete measurement record from being split. The maximum amount of corrected data is 506 bytes, and the actual length of all data slices does not exceed the allocatable capacity of the corresponding target node.
[0090] This embodiment establishes a correspondence between the data fragment set and the target node. Fragment numbers are recorded sequentially starting from 1 according to the data fragment arrangement order in the data fragment set. Then, according to the target node arrangement order in the fragment allocation result, data fragments at the same sequential position are associated with the target node.
[0091] Then, the actual route segment to which the target node belongs is read, and the segment number, data fragment, target node and actual route segment are written into the same segment association record. All segment association records are arranged according to the segment number to obtain the segment mapping.
[0092] For example, the first three data segments are recorded as segment number 1, segment number 2 and segment number 3 respectively. The three target nodes in the segment allocation result are N08, N17 and N26 respectively. Then, the correspondence between segment number 1 and N08, segment number 2 and N17, and segment number 3 and N26 is established, and the actual route segments to which N08, N17 and N26 belong are written into the corresponding segment association records to obtain the segment mapping.
[0093] In step S4, the segment index is arranged according to the segment mapping to obtain the segment index, including:
[0094] The segment mapping is segmented and associated according to the correspondence between the target node and the route segment to obtain index entries;
[0095] The index entries are aggregated according to the block of metering data to be stored to obtain a segmented index.
[0096] In one implementation, the segment mapping represents the correspondence between data slices and target nodes formed in step S3. Each segment association record includes a segment number, the corresponding data slice, the target node, and the actual routing segment to which the target node belongs. The segment number is determined according to the original arrangement order of each data slice in the metering data block to be stored.
[0097] This embodiment performs segment association on the fragment mapping based on the correspondence between the target node and the routing segment. During segment association, the fragment association records in the fragment mapping are read one by one. The target node is read from the fragment association records, and the routing segment corresponding to the target node is determined according to the routing segment actually generated in step S2. Subsequently, the fragment sequence number and the fragment length of the corresponding data fragment are read from the fragment association records. The fragment sequence number, target node, routing segment, and fragment length are written into the same index record to obtain an index entry.
[0098] It should be noted that the target nodes and routing segments in the index entries are directly derived from the segment mapping formed in step S3, and node filtering or route calculation is not performed again in step S4. When a target node corresponds to multiple data slices, index entries corresponding to each data slice are generated separately. In this embodiment, the index entries are aggregated according to the metering data block to be stored. During the aggregation process, all index entries formed in the same step S3 for the same metering data block to be stored are written into the same segment index record, and the index entries are arranged in ascending order of segment number.
[0099] Subsequently, the route segments actually generated in step S2 are read, and a segment directory entry is created for each existing route segment. Index entries belonging to the same route segment are associated with their corresponding segment directory entries, forming a segment index. When step S2 generates only the first route segment, the segment index creates only one segment directory entry corresponding to the first route segment. When step S2 generates the first and second route segments, the segment index creates two segment directory entries. When step S2 generates three route segments, the segment index creates three segment directory entries. The number of segment directory entries in the segment index remains consistent with the number of route segments actually generated in step S2; route segment directory entries that do not exist in the current network topology are not created.
[0100] The segmented index is stored using a two-level data structure. The first level records the set of index entries corresponding to the metering data block to be stored, and the second level records the position of each index entry in the set of index entries according to the current actual routing segment. When reading the index information corresponding to a data slice, the corresponding index entry is located according to the segment number, and the target node and routing segment are read from the index entry. Furthermore, the target node internally uses the identifier of the metering data block to be stored and the segment number as logical storage keys, and the target node's storage manager maintains the mapping relationship between this logical storage key and the actual write address to achieve accurate reading of the corresponding data slice.
[0101] It is worth noting that the order of the index entries directly adopts the segment number formed in step S3, without generating additional feature vectors related to the data segment content, and without re-performing the target node inference.
[0102] For example, step S3 yields three data segments with segment numbers 1, 2, and 3, respectively. Segment number 1 corresponds to target node N08, which belongs to the first routing segment; segment number 2 corresponds to target node N17, which belongs to the second routing segment; and segment number 3 corresponds to target node N26, which belongs to the third routing segment. This embodiment generates three index entries and establishes three corresponding segment directory entries.
[0103] For example, when the maximum node routing level in the current network topology is 2, only the first routing segment and the second routing segment exist. If the current data slice is written to the target node in each of the two routing segments, the segment index will only create directory entries for the first routing segment and the second routing segment, and will not create a directory entry for the third routing segment.
[0104] In step S5, the target node corresponding to the data shard set is determined according to the segmentation index, and each data shard in the data shard set is written to the corresponding target node to obtain distributed metering data, including:
[0105] The target node and write order corresponding to each data slice are determined based on the segmented index;
[0106] Each data segment is sent through the dual-mode communication link corresponding to the target node in the writing order, and cyclic redundancy check is performed on each data segment to obtain the check result.
[0107] In response to the verification result satisfying the data consistency condition, the system receives the write confirmation returned by the target node and obtains the distributed metering data.
[0108] In one implementation, this embodiment reads the index entries in the segmented index, determines the write order of each data slice based on the segment number recorded in the index entry, and reads the target node recorded in the same index entry. Data slices with smaller segment numbers are arranged before data slices with larger segment numbers, forming the write sequence corresponding to the current metering data block to be stored.
[0109] This embodiment uses the metering node status formed in step S1 to query the target node, and reads the carrier link status and wireless link status corresponding to the target node. When the target node is currently connected via carrier communication, data fragments are sent through the corresponding carrier communication link. When the target node is currently connected via wireless communication, data fragments are sent through the corresponding wireless communication link. When both the carrier communication link and the wireless communication link are connected, the active link flag of the corresponding target node in the current routing maintenance record of the dual-mode communication controller is read, and data fragments are sent through the communication link corresponding to the active link flag. For target nodes under multi-level routing, data fragments are forwarded hop-by-hop according to the valid routing entries of the target node currently maintained by the dual-mode communication controller. Each hop uses the currently active carrier or wireless link corresponding to the routing entry. This step of reading the active link flag is only used to determine the actual bearer method of data transmission and does not regenerate the underlying route at the application layer.
[0110] When sending data segments, this embodiment reads the data segments one by one according to the writing order, writes the segment number and data payload of the current data segment into the sending buffer, and performs cyclic redundancy check processing on the data payload.
[0111] In one implementation, the cyclic redundancy check (CRC-32) process generates a 32-bit checksum. The sending end performs CRC-32 checksum calculations on the data payload of the current data segment in byte order and appends the resulting 32-bit checksum to the end of the data frame of the current data segment.
[0112] After receiving a data frame, the target node reads the segment sequence number and data payload from the data frame, and re-executes cyclic redundancy check (CRC) on the data payload using the same CRC-32 check parameters as the sender to obtain the receiver check value. Then, it reads the 32-bit check value carried at the end of the data frame and compares it bit by bit with the 32-bit check value carried at the end of the data frame to obtain the check result. When the two 32-bit check values are completely identical, the check result is recorded as data consistency; when there is a binary bit inconsistency, the check result is recorded as data inconsistency. In response to the check result indicating data consistency, the target node writes the corresponding data segment into the contiguous writable space determined in step S3. Specifically, when determining the target node for segment configuration in step S3, the target node's storage manager reserves logically contiguous writable space that meets the segment length for the corresponding segment and records the logical storage area identifier. In the actual writing phase of this step, the target node completes the actual address allocation based on the logical storage area identifier and generates a write confirmation after completing the storage write. The write confirmation record includes the fragment number, target node, and write status of the current data slice, where the write status record indicates that the write is complete.
[0113] This embodiment receives the write confirmation returned by the target node and locates the corresponding index entry in the segment index according to the fragment sequence number in the write confirmation. The target node in the write confirmation is read and compared with the target node recorded in the corresponding index entry. When the fragment sequence number and target node match and the write status is "write complete," the write status of the corresponding index entry is recorded as "written." When the verification result indicates data inconsistency, the target node does not record the currently received data payload as a data fragment that has been written, and the corresponding index entry remains in an unwritten state.
[0114] In this embodiment, all index entries in the segmented index are checked sequentially according to the writing order. When the writing status of all index entries is recorded as "written", all data slices distributed in different target nodes and their corresponding segmented indexes are recorded as distributed metering data corresponding to the same metering data block to be stored.
[0115] For example, the three index entries in the segmented index correspond to segment number 1, segment number 2, and segment number 3, respectively, with target nodes N08, N17, and N26. In this embodiment, the data segment corresponding to segment number 1 is first sent to N08. The 32-bit checksum calculated by N08 matches the 32-bit checksum carried at the end of the data frame. N08 completes the data segment writing and returns a write confirmation corresponding to segment number 1. Subsequently, the data segments corresponding to segment numbers 2 and 3 are sent to N17 and N26 respectively, following the same process. When the write status of all three index entries is recorded as written, the three data segments stored in N08, N17, and N26, along with their corresponding segmented indexes, are recorded as the distributed metering data corresponding to the currently stored metering data block.
[0116] For example, Figure 4 This diagram illustrates the changes in the amount of data written to each routing segment. As data slices are sent sequentially and write confirmations are returned, the amount of data written to each routing segment gradually increases. In this test, a total of 2848 data slices passed verification and were written successfully, while 11 data slices with inconsistent verification remained unwritten. In 120 rounds, 40 rounds were terminated due to insufficient space, and 69 data blocks were fully written and passed byte-by-byte reassembly verification. The diagram shows the data slices that have been confirmed written, excluding partially written data blocks from being counted as complete.
[0117] In summary, this invention, by associating dual-mode routing data and node storage data of the end-metering network, determines the node routing hierarchy and forms routing segments corresponding to the current topology. It then combines the allocable capacity of candidate nodes to configure and segment the metering data blocks to be stored, establishes a segment mapping between data slices, target nodes, and actual routing segments, generates a segment index based on the segment mapping, and writes each data slice to the corresponding target node. This achieves the matching of energy metering data block slicing results with the storage capacity of routing nodes and the indexed storage of distributed metering data in a dual-mode routing environment.
[0118] The second embodiment of the present invention provides a distributed energy metering data block storage system based on dual-mode routing, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the aforementioned distributed energy metering data block storage method based on dual-mode routing.
[0119] In one implementation, the memory stores the computer program, dual-mode routing data, node storage data, metering node status, routing segments, segment mapping, and segment index required to execute the aforementioned method. The processor reads the computer program and sequentially executes the aforementioned data association, routing segmentation, capacity filtering, segment configuration, data splitting, index arrangement, and data writing processes.
[0120] The third embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it implements the aforementioned method for storing distributed power metering data blocks based on dual-mode routing.
[0121] The above describes specific embodiments of the present invention. Those skilled in the art can make corresponding adjustments to the data organization form, storage medium form, and communication bearer form based on the technical content described in this specification, thereby forming corresponding implementation methods without changing the aforementioned data processing relationships.
[0122] In summary, this invention determines the node routing hierarchy and forms routing segments by associating dual-mode routing data and node storage data of the end-metering network. It then configures and segments the metering data blocks to be stored based on the allocable capacity of candidate nodes, establishes a segment mapping between data slices, target nodes, and routing segments, generates a segment index based on the segment mapping, and writes each data slice to the corresponding target node. This achieves the matching of the energy metering data block slicing results with the storage capacity of routing nodes and the indexed storage of distributed metering data in a dual-mode routing environment.
[0123] The second embodiment of the present invention provides a distributed energy metering data block storage system based on dual-mode routing, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the method described above.
[0124] It should be noted that the distributed energy metering data block storage system based on dual-mode routing provided in this embodiment of the invention is used to execute all the process steps of the distributed energy metering data block storage method based on dual-mode routing in the above embodiment. The working principles and beneficial effects of the two are one-to-one, so they will not be described again.
[0125] It should be noted that the system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0126] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention for those skilled in the art.
Claims
1. A method for storing distributed power metering data blocks based on dual-mode routing, characterized in that, include: Obtain dual-mode routing data and node storage data of the terminal metering network, and perform association processing on the dual-mode routing data and the node storage data to obtain the metering node status; The node routing level is determined based on the metering node status, and the node routing level is segmented to obtain routing segments and candidate node sets. Obtain the metering data block to be stored, perform capacity filtering on the candidate node set based on the node storage data to obtain the storable node set, perform fragment configuration processing on the storable node set and the routing segment to obtain the fragment length and target node, perform segmentation processing on the metering data block to be stored based on the fragment length to obtain the data fragment set, and perform corresponding association between the data fragment set and the target node to obtain the fragment mapping; The segment index is obtained by indexing and arranging the segments according to the segment mapping. The target node corresponding to the data shard set is determined based on the segment index, and each data shard in the data shard set is written to the corresponding target node to obtain distributed metering data.
2. The distributed energy metering data block storage method based on dual-mode routing according to claim 1, characterized in that, The step of associating the dual-mode routing data with the node storage data to obtain the metering node status includes: The dual-mode routing data includes carrier link status, radio link status, and node adjacency relationships; the node storage data includes remaining storage capacity and contiguous writable space. The dual-mode routing data is associated with the node storage data according to the metering node to obtain node association data; The state of the metering nodes is obtained by performing state aggregation processing on the node-related data.
3. The distributed energy metering data block storage method based on dual-mode routing according to claim 1, characterized in that, The segmentation of the node routing hierarchy to obtain routing segments and candidate node sets includes: Based on the node routing hierarchy, continuous segments are divided to obtain routing segments; The metering nodes with dual-mode communication links are aggregated according to the routing segmentation to obtain a candidate node set.
4. The distributed energy metering data block storage method based on dual-mode routing according to claim 2, characterized in that, The step of filtering the candidate node set based on the node storage data to obtain a storable node set includes: The remaining usable capacity is obtained by deducting capacity from the remaining storage capacity and the preset reserved capacity. The smaller value between the remaining available capacity and the contiguous writable space is determined as the allocatable capacity; The candidate node set is filtered by capacity based on a comparison between the allocatable capacity and the preset minimum fragment length to obtain a storable node set.
5. The distributed energy metering data block storage method based on dual-mode routing according to claim 1, characterized in that, The step of performing fragment configuration processing based on the storable node set and the route segment to obtain the fragment length and target node includes: The storable node set is segmented and aggregated according to the route segmentation to obtain a segmented node set; Data carrying capacity is allocated based on the amount of the metering data block to be stored and the allocable capacity of each storable node in the segment node set, and the segment allocation result is obtained. The fragment length and target node are determined based on the fragment allocation results.
6. The method for storing distributed power metering data blocks based on dual-mode routing according to claim 1, characterized in that, The step of segmenting the metering data block to be stored according to the segment length to obtain a data fragment set includes: The initial segmentation position is determined in the block of metering data to be stored based on the segment length; Identify the boundary of the measurement record in the block of measurement data to be stored, and perform boundary correction on the initial segmentation position according to the boundary of the measurement record to obtain the target segmentation position; The measurement data block to be stored is segmented according to the target segmentation position to obtain a data fragment set.
7. The distributed energy metering data block storage method based on dual-mode routing according to claim 1, characterized in that, The step of indexing and arranging according to the fragment mapping to obtain a segmented index includes: The segment mapping is segmented and associated according to the correspondence between the target node and the route segment to obtain index entries; The index entries are aggregated according to the block of metering data to be stored to obtain a segmented index.
8. The method for storing distributed power metering data blocks based on dual-mode routing according to claim 1, characterized in that, The step of determining the target node corresponding to the data shard set based on the segmentation index, and writing each data shard in the data shard set to the corresponding target node to obtain distributed metering data includes: The target node and write order corresponding to each data slice are determined based on the segmented index; Each data segment is sent through the dual-mode communication link corresponding to the target node in the writing order, and cyclic redundancy check is performed on each data segment to obtain the check result. In response to the verification result satisfying the data consistency condition, the system receives the write confirmation returned by the target node and obtains the distributed metering data.
9. A distributed energy metering data block storage system based on dual-mode routing, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method according to any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method described in any one of claims 1 to 8.
