Method and system for batch upgrading of internet of things electric energy meter based on multicast and differential compression
By using multicast and differential compression technologies, a three-tiered IoT energy meter batch upgrade system was constructed, which solved the problems of low upgrade efficiency, resource waste, and high risk of erroneous upgrades in existing technologies, and achieved efficient and reliable energy meter batch upgrades.
Patent Information
- Application Number
- CN202611060108.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-16
- Publication Date
- 2026-11-17
AI Technical Summary
Existing methods for batch upgrading IoT energy meters are inefficient, consume significant communication resources, waste bandwidth, have redundant upgrade packages, and are difficult to efficiently group and control heterogeneous devices. Furthermore, frequent confirmation storms occur in low-voltage distribution area communication environments, leading to complex upgrade task scheduling, numerous repeated transmissions, and a high risk of erroneous upgrades.
An upgrade method based on multicast and differential compression is adopted. The master station obtains the compressed and segmented upgrade file, the substation converged terminal configures the multicast address to send the multicast, and the IoT energy meter upgrades according to the received multicast data. By combining differential compression technology and multicast transmission, a three-level architecture high-efficiency upgrade system is constructed, reducing the master station load and realizing efficient, reliable and secure batch upgrades.
It enables efficient, reliable, and secure batch upgrades in low-bandwidth distribution area communication environments, reduces the communication pressure on the main station, improves upgrade efficiency, reduces the risk of erroneous upgrades, and optimizes the utilization of distribution area communication resources.
Smart Images

Figure CN123123149A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power Internet of Things (IoT) technology, and more specifically, to a method and system for batch upgrading IoT energy meters based on multicast and differential compression. Background Technology
[0002] Currently, the industry standard for upgrading IoT meters is a full-scale upgrade method involving point-to-point communication between the master station and the substation's integrated terminal. In this architecture, the master station controls the entire upgrade process, while the substation's integrated terminal only handles simple data transmission, establishing a dedicated communication connection and transmitting the upgrade package to only one IoT meter at a time. The core flaws of this model have been fully exposed in actual operation and maintenance: 1) The upgrade efficiency is extremely low and the batch maintenance cost is high: When upgrading in batches, the main station needs to complete the entire process of "command interaction - connection establishment - full packet transmission - verification confirmation" with each IoT meter in sequence. Communication resources are occupied serially, and the upgrade time increases linearly with the number of devices.
[0003] 2) Overload of the main station and communication link: The main station needs to handle a large number of upgrade connection requests and full upgrade package data transmission at the same time. When the upgrade scale reaches hundreds or even thousands of tables, the CPU and memory resources of the main station will be quickly exhausted, which can easily cause system response delays or even crashes.
[0004] 3) Redundant upgrade package size, wasting bandwidth resources: Traditional full upgrade methods require the transmission of the entire firmware file. Even if there are only 1%-5% code differences between the old and new versions, the entire firmware image must still be transmitted. This significantly prolongs the single-table upgrade time and increases the probability of packet loss and verification failure during data transmission.
[0005] Furthermore, in the actual operating environment of low-voltage distribution areas, IoT energy meters typically exhibit heterogeneous characteristics such as inconsistent device models, manufacturers, application types, and current firmware versions. Multiple upgrade target groups may exist simultaneously within the same distribution area. Traditional point-to-point transparent upgrade methods from the main site struggle to efficiently group and control different versions and models, easily leading to complex upgrade task scheduling, numerous repeated transmissions, and a high risk of erroneous upgrades.
[0006] Meanwhile, low-voltage power line carrier communication links are characterized by low bandwidth, strong noise interference, large fluctuations in packet loss rate, and unstable communication latency. If each electricity meter is required to respond to each data block packet by packet during multicast transmission, a large number of acknowledgment messages will be generated, forming an acknowledgment storm, which will exacerbate communication congestion in the distribution area. Therefore, how to achieve packet multicast for heterogeneous electricity meters, low-overhead receive status feedback, and efficient packet loss retransmission without increasing the load on the master station is a problem that existing electricity meter batch upgrade technologies have not yet effectively solved.
[0007] Therefore, a method for batch upgrading IoT energy meters based on multicast and differential compression is needed. Summary of the Invention
[0008] This invention proposes a batch upgrade method and system for IoT energy meters based on multicast and differential compression, in order to solve the problem of how to efficiently realize large-scale remote firmware upgrades of IoT energy meters.
[0009] To address the aforementioned problems, according to one aspect of the present invention, a method for batch upgrading of IoT energy meters based on multicast and differential compression is provided, the method comprising: The main station obtains the compressed and segmented upgrade file, determines the upgrade task, and sends the upgrade file and upgrade task to the substation converged terminal; The integrated terminal of the distribution area configures a multicast address based on the upgrade task and sends the upgrade file via multicast through the multicast address; The IoT energy meter upgrades itself based on the multicast data it receives.
[0010] Preferably, the main station obtains the compressed and segmented upgrade file, including: The main station generates or receives upgrade files generated by the upgrade package generator. Specifically, the main station or upgrade package generator obtains device information of IoT energy meters within the target area, divides the energy meters to be upgraded into one or more upgrade groups based on the device information, determines the compressed target upgrade package corresponding to each upgrade group, segments the target upgrade package into blocks, and determines a unique upgrade package identifier, multicast address, and upgrade description file corresponding to each target upgrade package based on the upgrade group division and segmentation results, thereby determining the upgrade file. IoT energy meters within the same upgrade group use the same upgrade package, upgrade description file, and multicast address.
[0011] Preferably, the energy meters to be upgraded are divided into one or more upgrade groups based on the device information, including: Based on the device model, APP identifier, current firmware version number and target firmware version number, the IoT energy meters to be upgraded are divided into at least one upgrade group; Where the kth upgrade group is G_k, then: G_k={m_j|Model_j=Model_k, App_j=App_k, V_old_j=V_old_k, V_new_j=V_new_k} Where m_j represents the j-th IoT energy meter, Model_j represents the device model, App_j represents the type of APP to be upgraded, V_old_j represents the current firmware version number, and V_new_j represents the target firmware version number.
[0012] Preferably, determining the compressed target upgrade package corresponding to each upgrade group includes: In the scenario of upgrading from an old version, the original firmware currently running on the target IoT energy meter and the new version firmware to be upgraded are obtained. A differential patch package containing only the differences between the old and new firmware is generated through a preset differential algorithm. The differential patch package is then losslessly compressed to obtain a differential compressed upgrade package. In scenarios such as new installation, first-time installation, or when the original firmware cannot be obtained, the complete new firmware version is losslessly compressed to form a full compressed upgrade package. When the IoT energy meter supports differential restoration, and there is an old firmware version number that matches the current version, and |P_diff|≤α×|P_full| is satisfied, the differential compressed upgrade package is selected as the target upgrade package P=P_diff; otherwise, the full compressed upgrade package is selected as the target upgrade package P=P_full. Where P_diff is the differential compression upgrade package; P_full is the full compression upgrade package; and P is the target upgrade package.
[0013] Preferably, the target upgrade package is divided into blocks, including: The number of data blocks N is determined by N=ceil(|P| / B). The i-th data block Block_i is represented as: Block_i=P[(i-1)×B:min(i×B,|P|)-1]; where i=1,2,...,N, and |P| is the length of the upgrade package; The overall packet checksum H_P and the checksum H_i of each data block are calculated as follows: H_P=Hash(P),H_i=Hash(Block_i), Use the private key to sign the key fields in the upgrade description file to obtain the digital signature Sig: Sig = Sign_SK(Manifest), Here, SK represents the signing private key held by the upgrade package generator or the main site, and Manifest represents the upgrade description file.
[0014] Preferably, the upgrade description file includes: upgrade package identifier, upgrade package type, target version number, original version number, target device model, compression algorithm identifier, differential algorithm identifier, total length of upgrade package, block size, number of data blocks, full package checksum, checksum of each data block, target multicast address, and digital signature information.
[0015] Preferably, the substation convergence terminal configures a multicast address based on the upgrade task and sends the upgrade file via multicast through the multicast address, including: After receiving the upgrade package and upgrade description file, the integrated terminal in the distribution area establishes a local upgrade task state machine and determines the actual execution time of the upgrade task based on the service avoidance time window in the upgrade description file and the current collection service load. Configure the multicast address for the IoT energy meters to be upgraded in the transformer area according to the upgrade group number and target multicast address in the upgrade description file. Based on the configured multicast address, data blocks are sent sequentially according to the number of data blocks N and the block size B in the upgrade description file.
[0016] Preferably, the method further includes: The converged terminal in the distribution area adaptively adjusts multicast transmission parameters based on the communication quality of the distribution area. Specifically, when the converged terminal detects that the packet loss ratio of multiple consecutive data blocks is higher than a preset threshold, it reduces the multicast transmission rate or increases the transmission interval; when the packet loss ratio of multiple consecutive data blocks is lower than the preset threshold, it increases the multicast transmission rate or decreases the transmission interval. Let the multicast transmission interval in the r-th round be T_r, and the average packet loss rate in the r-th round be L_r. Then the transmission interval can be adjusted according to the following rules: If L_r ≥ L_high, then T_{r+1} = min(T_r + ΔT, T_max). If L_r ≤ L_low, then T_{r+1} = max(T_r - ΔT, T_min). Otherwise, T_{r+1}=T_r, Where L_high represents the high packet loss rate threshold, L_low represents the low packet loss rate threshold, ΔT represents the transmission interval adjustment step size, and T_max and T_min represent the maximum and minimum transmission intervals, respectively.
[0017] Preferably, the IoT energy meter upgrades itself based on the received multicast data, including: The IoT energy meter checks whether the upgrade package identifier, upgrade group number, multicast address, device model, APP identifier, and original version number in the upgrade description file of the multicast data match. If they match, the data block is written to the local cache, and the upgrade package in the data block is sequentially checked for CRC, digest, and signature. If the checks pass, the decompression, firmware writing, and upgrade confirmation are performed sequentially to perform the upgrade. If they do not match, the multicast data is discarded.
[0018] Preferably, the method further includes: After writing the data block into the local buffer, the IoT energy meter marks the corresponding data block number as received in the receiving status bitmap, and reports the complete receiving status bitmap to the substation convergence terminal after the multicast phase ends.
[0019] Preferably, the method further includes: The integrated terminal in the distribution area receives the received status bitmap (Bitmap_j) or the lost block number set (Loss_j) reported by all IoT energy meters, counts the missing data of each data block, determines the retransmission method based on the packet loss ratio or retransmission cost, and retransmits the data block according to the determined retransmission method.
[0020] Preferably, the method further includes: After receiving the retransmitted data block, the IoT energy meter updates its local reception status bitmap and reports the reception status to the distribution area convergence terminal again. This allows the distribution area convergence terminal to repeatedly execute the packet loss statistics and retransmission process until the reception status bitmaps of all IoT energy meters show complete reception, or until the preset maximum number of retransmissions is reached. For IoT energy meters that have not received complete reception even after reaching the maximum number of retransmissions, the distribution area convergence terminal marks them as upgrade abnormal devices, records the cause of the abnormality, the missing data block number, the number of retransmissions, and the last communication time, and reports the list of abnormal devices and the cause of the abnormality to the main station when summarizing the upgrade results.
[0021] According to another aspect of the present invention, a batch upgrade system for IoT energy meters based on multicast and differential compression is provided, the system comprising: The main station is used to obtain the compressed and segmented upgrade file, determine the upgrade task, and send the upgrade file and upgrade task to the substation converged terminal. The integrated terminal is configured with a multicast address based on the upgrade task, and sends the upgrade file via multicast through the multicast address. IoT energy meters are used for upgrades based on received multicast data.
[0022] This invention provides a method and system for batch upgrading of IoT energy meters based on multicast and differential compression, comprising: a master station acquiring a compressed and segmented upgrade file, determining an upgrade task, and distributing the upgrade file and upgrade task to a distribution area convergence terminal; the distribution area convergence terminal configuring a multicast address based on the upgrade task and sending the upgrade file via multicast through the multicast address; and the IoT energy meter upgrading according to the received multicast data. This invention decentralizes the core control logic of the upgrade process from the master station to the distribution area convergence terminal, fully utilizing the storage and computing capabilities of the distribution area convergence terminal as a distribution area hub. Combined with multicast transmission and differential compression technology, it constructs an efficient upgrade system adapted to the three-tier architecture of the power IoT, enabling efficient, reliable, and secure batch upgrades in low-bandwidth distribution area communication environments. Attached Figure Description
[0023] Exemplary embodiments of the present invention can be more fully understood by referring to the following figures: Figure 1A flowchart of a batch upgrade method for IoT energy meters based on multicast and differential compression according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the system architecture according to an embodiment of the present invention; Figure 3 This is a schematic diagram illustrating the division of a heterogeneous energy meter upgrade group according to an embodiment of the present invention; Figure 4 This is a flowchart illustrating the generation process of a differentiated compression upgrade package according to an embodiment of the present invention. Figure 5 This is a schematic diagram illustrating multicast transmission, bitmap feedback, and packet loss retransmission according to an embodiment of the present invention; Figure 6 This is a schematic diagram illustrating the local upgrade and safety rollback of an IoT energy meter according to an embodiment of the present invention; Figure 7 This is a schematic diagram of the structure of a batch upgrade system 700 for IoT energy meters based on multicast and differential compression according to an embodiment of the present invention. Detailed Implementation
[0024] Exemplary embodiments of the invention will now be described with reference to the accompanying drawings. However, the invention may be embodied in many different forms and is not limited to the embodiments described herein. These embodiments are provided to fully and completely disclose the invention and to fully convey its scope to those skilled in the art. The terminology used in the exemplary embodiments illustrated in the drawings is not intended to limit the invention. In the drawings, the same units / elements are referred to by the same reference numerals.
[0025] Unless otherwise stated, the terms used herein (including technical terms) have their common meaning as understood by one of ordinary skill in the art. Furthermore, it is understood that terms defined in commonly used dictionaries should be understood to have a meaning consistent with the context of their relevant field, and not to be interpreted as having an idealized or overly formal meaning.
[0026] Figure 1 This is a flowchart of a batch upgrade method 100 for IoT energy meters based on multicast and differential compression according to an embodiment of the present invention. Figure 1As shown, the IoT energy meter batch upgrade method based on multicast and differential compression provided by this invention decentralizes the core control logic of the upgrade process from the master station to the distribution area convergence terminal. It fully utilizes the storage and computing capabilities of the distribution area convergence terminal as the distribution area hub, and combines multicast transmission and differential compression technologies to construct an efficient upgrade system adapted to the three-tier architecture of the power IoT, enabling efficient, reliable, and secure batch upgrades in low-bandwidth distribution area communication environments. The IoT energy meter batch upgrade method 100 based on multicast and differential compression provided by this invention begins at step 101. In step 101, the master station obtains the compressed and segmented upgrade file, determines the upgrade task, and sends the upgrade file and upgrade task to the distribution area convergence terminal.
[0027] The main station generates or receives upgrade files generated by the upgrade package generator. Specifically, the main station or upgrade package generator obtains device information of IoT energy meters within the target area, divides the energy meters to be upgraded into one or more upgrade groups based on the device information, determines the compressed target upgrade package corresponding to each upgrade group, segments the target upgrade package into blocks, and determines a unique upgrade package identifier, multicast address, and upgrade description file corresponding to each target upgrade package based on the upgrade group division and segmentation results, thereby determining the upgrade file. IoT energy meters within the same upgrade group use the same upgrade package, upgrade description file, and multicast address.
[0028] Preferably, the energy meters to be upgraded are divided into one or more upgrade groups based on the device information, including: Based on the device model, APP identifier, current firmware version number and target firmware version number, the IoT energy meters to be upgraded are divided into at least one upgrade group; Where the kth upgrade group is G_k, then: G_k={m_j|Model_j=Model_k, App_j=App_k, V_old_j=V_old_k, V_new_j=V_new_k} Where m_j represents the j-th IoT energy meter, Model_j represents the device model, App_j represents the type of APP to be upgraded, V_old_j represents the current firmware version number, and V_new_j represents the target firmware version number.
[0029] Preferably, determining the compressed target upgrade package corresponding to each upgrade group includes: In the scenario of upgrading from an old version, the original firmware currently running on the target IoT energy meter and the new version firmware to be upgraded are obtained. A differential patch package containing only the differences between the old and new firmware is generated through a preset differential algorithm. The differential patch package is then losslessly compressed to obtain a differential compressed upgrade package. In scenarios such as new installation, first-time installation, or when the original firmware cannot be obtained, the complete new firmware version is losslessly compressed to form a full compressed upgrade package. When the IoT energy meter supports differential restoration, and there is an old firmware version number that matches the current version, and |P_diff|≤α×|P_full| is satisfied, the differential compressed upgrade package is selected as the target upgrade package P=P_diff; otherwise, the full compressed upgrade package is selected as the target upgrade package P=P_full. Where P_diff is the differential compression upgrade package; P_full is the full compression upgrade package; and P is the target upgrade package.
[0030] Preferably, the target upgrade package is divided into blocks, including: The number of data blocks N is determined by N=ceil(|P| / B). The i-th data block Block_i is represented as: Block_i=P[(i-1)×B:min(i×B,|P|)-1]; where i=1,2,...,N, and |P| is the length of the upgrade package; The overall packet checksum H_P and the checksum H_i of each data block are calculated as follows: H_P=Hash(P),H_i=Hash(Block_i), Use the private key to sign the key fields in the upgrade description file to obtain the digital signature Sig: Sig = Sign_SK(Manifest), Here, SK represents the signing private key held by the upgrade package generator or the main site, and Manifest represents the upgrade description file.
[0031] Preferably, the upgrade description file includes: upgrade package identifier, upgrade package type, target version number, original version number, target device model, compression algorithm identifier, differential algorithm identifier, total length of upgrade package, block size, number of data blocks, full package checksum, checksum of each data block, target multicast address, and digital signature information.
[0032] In this invention, an upgrade package is generated using a main site or an upgrade package generator. The upgrade package generator can be a main site, an upgrade management platform, or an APP manufacturer's platform.
[0033] by Figure 2 Taking the generation of upgrade packages using the upgrade package generator as an example, before generating the upgrade package, the upgrade package generator first obtains the device information of the IoT energy meters in the target area. The device information includes at least the device address, manufacturer identifier, device model, APP identifier, current firmware version number, target firmware version number, differential restoration capability identifier, decompression capability identifier, and remaining storage space information.
[0034] Combination Figure 3 As shown, in this invention, the upgrade package generator divides the IoT energy meter to be upgraded into at least one upgrade group based on the device model, APP identifier, current firmware version number, and target firmware version number. Let the k-th upgrade group be G_k, then: G_k={m_j|Model_j=Model_k, App_j=App_k, V_old_j=V_old_k, V_new_j=V_new_k} Where m_j represents the j-th IoT energy meter, Model_j represents the device model, App_j represents the type of APP to be upgraded, V_old_j represents the current firmware version number, and V_new_j represents the target firmware version number.
[0035] Among them, IoT energy meters within the same upgrade group use the same upgrade package, upgrade description file, and multicast address.
[0036] Combination Figure 4 Therefore, in this invention, let the target new firmware be F_new, the old firmware currently running on the IoT energy meter be F_old, the differential algorithm be Diff, and the lossless compression algorithm be Comp. Then, in the old version upgrade scenario, the upgrade package generator first generates a differential patch package D: D = Diff(F_old, F_new), Then, the differential patch package D is losslessly compressed to obtain the differential compression upgrade package P_diff: P_diff=Comp(D).
[0037] In scenarios such as new installations, first-time installations, unavailable older firmware versions, or IoT energy meters that do not support differential restoration, the upgrade package generator directly performs lossless compression on the target new firmware F_new to obtain a full compressed upgrade package P_full: P_full = Comp(F_new) The upgrade package generator selects the final target upgrade package P based on the upgrade package length, device capabilities, and a preset compression benefit threshold. Let |P_diff| represent the data length of the differentially compressed upgrade package, |P_full| represent the data length of the full-compressed upgrade package, and α represent the differential upgrade benefit threshold, where 0 < α < 1. Then, the upgrade package selection rule is as follows: When the IoT energy meter supports differential restoration, and an older firmware F_old matching the current version exists, and the following condition is met: |P_diff|≤α×|P_full|, the differential compression upgrade package is selected as the target upgrade package: P=P_diff; otherwise, the full compression upgrade package is selected as the target upgrade package: P=P_full. Here, α can be set according to the field communication rate, the IoT energy meter's computing power, and storage space, for example, a value of 0.7, 0.8, or 0.9. This judgment rule avoids using differential upgrades when the benefits of differential package compression are not significant, the computational overhead of differential restoration is too high, or the device does not support differential restoration.
[0038] After generating the target upgrade package P, the upgrade package generator divides the package into blocks according to a preset block size B. Let the upgrade package length be |P|, then the number of data blocks N is: N=ceil(|P| / B) The i-th data block, Block_i, is represented as: Block_i=P[(i-1)×B:min(i×B, |P|)-1] Where i = 1, 2, ..., N.
[0039] The upgrade package generator calculates the overall package checksum H_P and the checksum H_i of each data block respectively: H_P = Hash(P) H_i = Hash(Block_i) The hash can use CRC, SHA-256, or SM3 algorithms. The upgrade package generator further uses a private key to sign key fields in the upgrade description file, resulting in a digital signature Sig: Sig = Sign_SK(Manifest) Here, SK represents the signing private key held by the upgrade package generator or the main site, and Manifest represents the upgrade description file.
[0040] The upgrade description file should include at least the following: upgrade package identifier, upgrade task number, upgrade group number, target multicast address, manufacturer identifier, device model, APP identifier, original version number, target version number, upgrade package type, compression algorithm identifier, differential algorithm identifier, total length of upgrade package, block size, number of data blocks, full package checksum, checksum of each data block, maximum number of resends, resend strategy parameters, upgrade effective time, business avoidance time window, and digital signature information.
[0041] Through the aforementioned upgrade description file, the integrated terminal of the distribution area can complete the upgrade package distribution and packet loss retransmission without relying on the continuous participation of the main station; the IoT energy meter can independently determine whether it belongs to this upgrade target and complete data block integrity verification, whole packet verification, signature verification, decompression, differential restoration and local firmware writing.
[0042] The upgrade package generator generates a differentiated compressed upgrade package based on the current running version of the target IoT energy meter and the version to be upgraded. The upgrade package generator can be a main site, an upgrade management platform, or an APP vendor's platform.
[0043] In upgrade scenarios involving older versions, the upgrade package generator obtains the current firmware of the target IoT energy meter and the new firmware to be upgraded to. It then uses a preset differential algorithm to generate a patch file containing only the differences between the old and new firmware. For example, a bsdiff-type differential algorithm can be used to generate a differential patch package. After generating the patch file, it is compressed using a lossless compression algorithm, such as zlib, LZMA, or other lossless compression algorithms suitable for embedded devices, ultimately forming a differential compressed upgrade package.
[0044] In scenarios such as new installations, first-time installations, or when matching original firmware cannot be obtained, the upgrade package generator does not perform differential calculations. Instead, it directly performs lossless compression on the complete new version firmware to form a full-compressed upgrade package.
[0045] After the upgrade package is generated, the upgrade package generator produces an upgrade description file. This file includes at least the upgrade package identifier, upgrade package type, target version number, original version number, target device model, compression algorithm identifier, differential algorithm identifier, total upgrade package length, block size, number of data blocks, overall package checksum, checksum of each data block, target multicast address, and digital signature information. The IoT energy meter uses the upgrade description file to determine if it is a target for this upgrade and accordingly completes the upgrade package reception, verification, and restoration.
[0046] This invention dynamically selects compression strategies for different upgrade scenarios. When upgrading older versions, a combination of differential and lossless compression is used to reduce the upgrade package size; when installing new versions or when the older version is incompatible, full lossless compression is used to avoid invalid differential calculations. Simultaneously, an upgrade description file establishes the link between upgrade package distribution, verification, resending, and local upgrades, enabling the converged terminal in the distribution area to independently complete subsequent upgrade distribution control.
[0047] After the upgrade package is determined, the main station establishes a secure communication connection with the target area's converged terminal and transmits the compressed upgrade package completely to the local storage module of the converged terminal.
[0048] In step 102, the substation convergence terminal configures a multicast address based on the upgrade task and sends the upgrade file via multicast through the multicast address.
[0049] Preferably, the substation convergence terminal configures a multicast address based on the upgrade task and sends the upgrade file via multicast through the multicast address, including: After receiving the upgrade package and upgrade description file, the integrated terminal in the distribution area establishes a local upgrade task state machine and determines the actual execution time of the upgrade task based on the service avoidance time window in the upgrade description file and the current collection service load. Configure the multicast address for the IoT energy meters to be upgraded in the transformer area according to the upgrade group number and target multicast address in the upgrade description file. Based on the configured multicast address, data blocks are sent sequentially according to the number of data blocks N and the block size B in the upgrade description file.
[0050] Preferably, the method further includes: The converged terminal in the distribution area adaptively adjusts multicast transmission parameters based on the communication quality of the distribution area. Specifically, when the converged terminal detects that the packet loss ratio of multiple consecutive data blocks is higher than a preset threshold, it reduces the multicast transmission rate or increases the transmission interval; when the packet loss ratio of multiple consecutive data blocks is lower than the preset threshold, it increases the multicast transmission rate or decreases the transmission interval. Let the multicast transmission interval in the r-th round be T_r, and the average packet loss rate in the r-th round be L_r. Then the transmission interval can be adjusted according to the following rules: If L_r ≥ L_high, then T_{r+1} = min(T_r + ΔT, T_max). If L_r ≤ L_low, then T_{r+1} = max(T_r - ΔT, T_min). Otherwise, T_{r+1}=T_r, Where L_high represents the high packet loss rate threshold, L_low represents the low packet loss rate threshold, ΔT represents the transmission interval adjustment step size, and T_max and T_min represent the maximum and minimum transmission intervals, respectively.
[0051] Preferably, the method further includes: The integrated terminal in the distribution area receives the received status bitmap (Bitmap_j) or the lost block number set (Loss_j) reported by all IoT energy meters, counts the missing data of each data block, determines the retransmission method based on the packet loss ratio or retransmission cost, and retransmits the data block according to the determined retransmission method.
[0052] In this invention, after the substation convergence terminal receives the upgrade package, it first performs a CRC check on the upgrade package. If the check fails, it sends an error code to the master station, triggering the master station to retransmit. After receiving the confirmation message, the master station no longer needs to participate in the subsequent upgrade package distribution process; it only needs to wait for the upgrade results from the substation convergence terminal to be summarized. This design can reduce the communication load on the master station by more than 90%.
[0053] After receiving the upgrade package and upgrade description file, the converged terminal in the distribution area establishes a local upgrade task state machine. The state machine includes at least the following states: task reception state, upgrade package verification state, multicast preparation state, multicast transmission state, reception status summary state, packet loss retransmission state, upgrade execution waiting state, result summary state, and task completion state.
[0054] The integrated terminal in the distribution area determines the actual execution time of the upgrade task based on the service avoidance time window in the upgrade description file and the current data collection load. When centralized meter reading, frozen data collection, event collection, or other high-priority services are being performed within the distribution area, the integrated terminal pauses or delays the multicast transmission of the upgrade packet; the upgrade task resumes once the communication link is idle or the allowed upgrade time window is entered. In this way, the upgrade process will not significantly affect the normal data collection services of the electricity meters.
[0055] In this invention, the substation convergence terminal distributes upgrade packages via multicast and can also prevent packet loss. Specifically, the substation convergence terminal acts as a multicast source, configuring multicast addresses for the IoT energy meters within the substation to be upgraded based on the upgrade group number and target multicast address in the upgrade description file. Each upgrade group corresponds to a multicast address, and only IoT energy meters whose device model, APP identifier, original version number, and multicast address all match will receive and process the data blocks for that upgrade group; other IoT energy meters will discard the corresponding data frames.
[0056] The converged terminal in the distribution area sends data blocks numbered 1 to N sequentially according to the number of data blocks N and the block size B in the upgrade description file. Each multicast data frame includes at least: upgrade packet identifier, upgrade group number, multicast address, data block number, total number of data blocks, data block length, data block checksum, transmission round number, and data block content.
[0057] Upon receiving a multicast data frame, the IoT energy meter first checks whether the upgrade package identifier, upgrade group number, multicast address, device model, APP identifier, and original version number match. If they do not match, the data frame is discarded. If they match, the data block is verified. After successful verification, the IoT energy meter writes the data block to its local buffer and marks the corresponding data block number as received in the receive status bitmap.
[0058] Let Bitmap_j be the bitmap representing the receiving status of the j-th IoT energy meter, and Bitmap_j[i] represent the receiving status of the i-th data block. Then: When the i-th data block is successfully received and verified: Bitmap_j[i]=1 When the i-th data block is not received, the reception times out, or the verification fails: Bitmap_j[i]=0 In this invention, during the multicast transmission phase, the IoT energy meter does not respond to each data block individually. Instead, after the substation fusion terminal completes one round of multicast transmission, it uniformly reports the reception status bitmap (Bitmap_j) or the set of unreceived data block numbers (Loss_j). This round-based feedback method avoids the confirmation storm caused by multiple IoT energy meters simultaneously responding to each data block.
[0059] Furthermore, the converged terminal in the distribution area can adaptively adjust multicast transmission parameters based on the communication quality of the distribution area. When the converged terminal detects that the packet loss ratio of multiple consecutive data blocks is higher than a preset threshold, it reduces the multicast transmission rate or increases the transmission interval; when the packet loss ratio of multiple consecutive data blocks is lower than the preset threshold, it increases the multicast transmission rate or decreases the transmission interval. Let the multicast transmission interval of the r-th round be T_r, and the average packet loss rate of the r-th round be L_r, then the transmission interval can be adjusted according to the following rules: If L_r ≥ L_high, then T_{r+1} = min(T_r + ΔT, T_max) If L_r ≤ L_low, then T_{r+1} = max(T_r - ΔT, T_min) Otherwise, T_{r+1}=T_r Where L_high represents the high packet loss rate threshold, L_low represents the low packet loss rate threshold, ΔT represents the transmission interval adjustment step size, and T_max and T_min represent the maximum and minimum transmission intervals, respectively.
[0060] Through the above methods, the integrated terminal in the distribution area can dynamically adjust the multicast rhythm according to the quality of the low-voltage carrier link on site, thereby reducing packet loss rate and communication congestion risk while ensuring upgrade efficiency.
[0061] In this invention, the substation convergence terminal receives the reception status reported by the electricity meters. After receiving a data block, each IoT meter records the received data block information in real time and reports the complete reception status to the substation convergence terminal after the multicast phase ends.
[0062] This invention deeply integrates multicast technology with a three-tier architecture of "master station - integrated terminal - IoT table". By leveraging the hub advantage of the integrated terminal, the serial transmission pressure of the master station is transferred to the parallel multicast capability of the integrated terminal, and the efficiency of batch upgrades is no longer limited by the communication resources of the master station.
[0063] Combination Figure 5 As shown, in this invention, the integrated terminal for the distribution area uniformly manages packet loss retransmission. Specifically, after the multicast transmission phase ends, the integrated terminal for the distribution area initiates the packet loss retransmission process. The integrated terminal for the distribution area receives the receive status bitmap_j or the packet loss block number set Loss_j reported by all IoT energy meters, and counts the missing data for each data block.
[0064] Let M be the number of IoT energy meters participating in this upgrade, and Loss_j be the packet loss set of the j-th IoT energy meter. Then, for the i-th data block, the set Miss_i of IoT energy meters that failed to successfully receive the data block is: Miss_i={m_j|i∈Loss_j, j=1, 2,...,M} The number of missing data blocks n_i is: n_i = |Miss_i|, The packet loss ratio R_i of the i-th data block is: R_i = n_i / M.
[0065] The integrated distribution terminal selects the retransmission method based on the packet loss ratio or the retransmission cost. In one implementation, when R_i is greater than or equal to the preset packet loss ratio threshold β, it indicates that the data block is generally missing in multiple IoT energy meters, and the integrated distribution terminal retransmits the data block using multicast. When R_i is less than β, it indicates that the data block is missing only in a few IoT energy meters, and the integrated distribution terminal retransmits the data block to the corresponding IoT energy meters using a point-to-point method.
[0066] Right now: If R_i≥β, then Mode_i=Multicast; If R_i < β, then Mode_i = Unicast; Here, Mode_i represents the retransmission method for the i-th data block, Multicast represents multicast retransmission, Unicast represents point-to-point retransmission, and β can be set according to the on-site communication quality, for example, set to 5%.
[0067] In another preferred implementation, the substation convergence terminal dynamically selects the retransmission method based on the multicast retransmission cost and the point-to-point retransmission cost. Let the cost of retransmitting the i-th data block once via multicast be C_m(i), and the cost of retransmitting the i-th data block once via point-to-point be C_u(i). Then the total cost of retransmitting the i-th data block using point-to-point retransmission is: C_uni(i) = n_i × C_u(i); The cost of using multicast retransmission is: C_multi(i) = C_m(i); When C_multi(i) ≤ C_uni(i), the converged terminal in the distribution area uses multicast to resend the i-th data block; otherwise, it uses point-to-point to resend the i-th data block. This method can dynamically select a better resend method based on the actual number of missing devices and communication costs, avoiding invalid multicasting of data blocks missing from only a few devices, and also avoiding unicasting data blocks missing from a large number of devices one by one.
[0068] After receiving the retransmitted data block, the IoT energy meter updates its local reception status bitmap and reports the reception status to the substation convergence terminal again. The substation convergence terminal repeats the packet loss statistics and retransmission process until the reception status bitmaps of all IoT energy meters show complete reception, or the preset maximum number of retransmissions Q_max is reached.
[0069] For IoT energy meters that have reached the maximum number of retransmission attempts but still have not received a complete data block, the substation converged terminal marks them as upgrade anomalies and records the reason for the anomaly, the missing data block number, the number of retransmission attempts, and the last communication time. Anomalies do not affect other IoT energy meters that have already received a complete data block and can continue to perform local upgrades. When summarizing the upgrade results, the substation converged terminal reports the list of anomalies and the reasons for the anomalies to the main station.
[0070] Through the above mechanism, packet loss statistics, retransmission decision-making, and retransmission closed loop are all completed locally by the integrated terminal of the distribution area. The main station does not need to interact with each IoT energy meter separately, thereby reducing the communication pressure on the main station and reducing redundant transmissions in the distribution area communication link.
[0071] In step 103, the IoT energy meter upgrades itself based on the received multicast data.
[0072] Preferably, the main station obtains the compressed and segmented upgrade file, including: Preferably, the IoT energy meter upgrades itself based on the received multicast data, including: The IoT energy meter checks whether the upgrade package identifier, upgrade group number, multicast address, device model, APP identifier, and original version number in the upgrade description file of the multicast data match. If they match, the data block is written to the local cache, and the upgrade package in the data block is sequentially checked for CRC, digest, and signature. If the checks pass, the decompression, firmware writing, and upgrade confirmation are performed sequentially to perform the upgrade. If they do not match, the multicast data is discarded.
[0073] Preferably, the method further includes: After writing the data block into the local buffer, the IoT energy meter marks the corresponding data block number as received in the receiving status bitmap, and reports the complete receiving status bitmap to the substation convergence terminal after the multicast phase ends.
[0074] Preferably, the method further includes: After receiving the retransmitted data block, the IoT energy meter updates its local reception status bitmap and reports the reception status to the distribution area convergence terminal again. This allows the distribution area convergence terminal to repeatedly execute the packet loss statistics and retransmission process until the reception status bitmaps of all IoT energy meters show complete reception, or until the preset maximum number of retransmissions is reached. For IoT energy meters that have not received complete reception even after reaching the maximum number of retransmissions, the distribution area convergence terminal marks them as upgrade abnormal devices, records the cause of the abnormality, the missing data block number, the number of retransmissions, and the last communication time, and reports the list of abnormal devices and the cause of the abnormality to the main station when summarizing the upgrade results.
[0075] Combination Figure 6 As shown, in this invention, after confirming that the upgrade package has been fully received, the IoT table initiates the local upgrade process, and the specific steps are as follows: Upgrade packet verification: The IoT meter first performs a CRC check on the received upgrade packet to confirm the data is complete and error-free. This check value is generated by the master station and sent to the substation converged terminal through a secure channel, and then multicast to the IoT meter by the substation converged terminal. If the verification fails, the IoT meter will send a "verification failed" feedback to the substation converged terminal, triggering the substation converged terminal to retransmit the corresponding data block.
[0076] In addition to CRC check, the IoT energy meter can also perform digest and signature verification on the upgrade package. Specifically, the IoT energy meter calculates the digest value of the locally received upgrade package based on the full packet digest value in the upgrade description file. If the two match, it confirms that the upgrade package content has not been tampered with. Simultaneously, the IoT energy meter uses a pre-set public key or security module to verify the upgrade package signature. Only after successful verification is the decompression and firmware writing operation allowed. If digest or signature verification fails, the IoT energy meter refuses to perform the upgrade and reports a security verification failure status to the substation converged terminal.
[0077] To improve upgrade reliability, the IoT energy meter records the current running version number and the state before the upgrade before performing firmware writing, and writes the firmware to be upgraded to the backup storage area or temporary upgrade area. After the writing is completed and the verification is successful, the startup flag is switched so that the IoT energy meter loads the new version firmware on the next restart. If the new version firmware fails to start after restarting, the IoT energy meter restores the original startup flag and rolls back to the old version firmware, while reporting the upgrade failure and rollback event to the substation converged terminal.
[0078] The above mechanism can prevent IoT energy meters from becoming unusable due to damaged upgrade packages, illegal upgrade packages, power outages, or abnormal writing, thereby improving the safety and reliability of on-site batch upgrades.
[0079] Upgrade package decompression: The IoT meter calls the built-in decompression module to decompress the upgrade package.
[0080] Firmware restoration and writing: In the case of upgrading an older version: the IoT meter calls a preset restoration algorithm (such as the bspatch algorithm) to merge the decompressed differential patch package with the local original firmware to generate a complete new version firmware.
[0081] For a new installation scenario: the IoT meter directly writes the decompressed full firmware to the storage module.
[0082] Upgrade Confirmation: After the firmware is written, the IoT meter will automatically restart, load the new firmware version, generate an upgrade event, and actively report it to the converged terminal of the distribution area.
[0083] Before performing decompression and differential restoration, the IoT energy meter also performs a consistency check on its current local running version based on the original version number in the upgrade description file. If the current local running version number is inconsistent with the original version number in the upgrade description file, the IoT energy meter refuses to perform differential restoration and reports a version mismatch status to the substation converged terminal. This method avoids firmware errors after differential restoration due to inconsistencies in the original firmware version.
[0084] During the differential restoration process, the IoT energy meter generates the target new firmware in the following manner: F_restore = Patch(F_local, D) Here, F_local represents the currently running firmware on the IoT energy meter, D represents the decompressed differential patch package, and Patch represents the differential restoration algorithm. If the digest value of F_restore matches the target firmware digest value in the upgrade description file, the differential restoration is confirmed to be successful; otherwise, the differential restoration is confirmed to have failed, and the upgrade process is terminated.
[0085] To improve upgrade reliability, IoT-enabled energy meters employ a dual-zone or temporary upgrade zone writing mechanism. The IoT energy meter writes the restored new firmware version to the backup storage area and performs a digest verification on the firmware in the backup storage area after writing is complete. Only when the firmware in the backup storage area passes verification does the IoT energy meter switch its startup flag and restart. If the new firmware version fails to start after restarting, the IoT energy meter automatically restores the original startup flag, reverts to the old firmware version, and reports the upgrade failure and rollback event to the substation's converged terminal.
[0086] Furthermore, the IoT energy meter records key states during the upgrade process, including upgrade package reception completion status, whole package verification status, signature verification status, decompression status, differential restoration status, firmware writing status, startup switching status, and rollback status. These states are used by the substation convergence terminal to summarize upgrade results and locate faults.
[0087] In this invention, the integrated distribution terminal can also report upgrade results to the main station. Specifically, the integrated distribution terminal collects, processes, and packages the upgrade events reported by the electricity meters and uploads them to the main station, thus completing the upgrade process.
[0088] This invention does not simply combine multicast transmission, differential upgrade, and data compression in parallel. Instead, it constructs a closed-loop upgrade control mechanism for communication environments characterized by low speed, packet loss, and heterogeneous equipment in distribution areas. This mechanism uses upgrade description files as indexes, distribution area converged terminals as local upgrade control nodes, and IoT energy meter receiving status bitmaps as feedback.
[0089] In this mechanism, the master station or upgrade package generator first divides the IoT energy meters to be upgraded into one or more upgrade groups based on the device model, manufacturer identification, APP type, current firmware version, and target firmware version. Each upgrade group corresponds to a unique upgrade package identifier, multicast address, and upgrade description file. After receiving the upgrade task, the substation convergence terminal uses the upgrade description file to complete upgrade package caching, segmentation, multicast transmission, reception status summarization, packet loss retransmission, and upgrade result reporting. The IoT energy meter only receives and processes the corresponding upgrade data when the upgrade package identifier, device model, APP identifier, original version number, and multicast address all match, thereby avoiding erroneous upgrades between devices of different models, manufacturers, or versions.
[0090] The upgrade system described in this invention includes three types of nodes: a master station, a distribution area convergence terminal, and IoT energy meters. The master station is used to generate or receive upgrade packages, determine upgrade tasks, send upgrade packages and upgrade strategies to the target distribution area's distribution area convergence terminal, and receive the upgrade results summarized by the distribution area convergence terminal. The distribution area convergence terminal is used to cache complete upgrade packages, configure multicast addresses according to upgrade tasks, multicast the upgrade packages in blocks, collect the reception status of IoT energy meters, count lost packets, and perform retransmission. The IoT energy meters are used to receive multicast data blocks, record the data block reception status, report packet loss information, perform upgrade package verification, decompression, differential restoration, and local firmware writing.
[0091] The upgrade package generator in this invention can be a main station, an upgrade management platform, or an APP vendor platform. Based on the current and target version information of the target IoT energy meter, the upgrade package generator automatically selects either differential compression or full compression to generate the upgrade package and generates a corresponding upgrade description file. The upgrade description file includes at least the upgrade package identifier, target version number, original version number, upgrade package type, compression algorithm identifier, differential algorithm identifier, total upgrade package length, block size, number of data blocks, overall package checksum, checksum of each data block, and upgrade package signature information. The substation convergence terminal and the IoT energy meter complete the block reception, verification, retransmission, and upgrade execution based on the upgrade description file.
[0092] Through the above structure, this invention does not simply apply differential compression and multicast transmission separately to the upgrade of electricity meters. Instead, it forms a complete upgrade closed loop in a three-level architecture, which includes "one-time distribution from the main station, local caching of the integrated terminal in the distribution area, multicast distribution from the integrated terminal in the distribution area, closed-loop re-distribution from the integrated terminal in the distribution area, and local restoration of the IoT meter". This reduces the communication pressure on the main station and improves the efficiency of batch upgrades within the distribution area.
[0093] Specifically, the technical solution of the present invention includes innovative designs in the following three core dimensions: 1) Multicast transmission mechanism for converged terminals in the distribution area: The master station sends the upgrade package to the converged terminals in the distribution area in one go, and then the converged terminals distribute the upgrade package in parallel to all IoT meters to be upgraded in the distribution area via power line carrier multicast. This design transforms the master station's "one-to-many" serial transmission into the converged terminals' "one-to-many" parallel transmission, and the efficiency of batch upgrades is no longer limited by the number of communication ports of the master station; 2) "Differential + Lossless Compression" combined strategy: Dynamically selects the compression scheme for different upgrade scenarios (upgrading old firmware versions, first-time installation on new devices)—when upgrading old versions, a differential patch package is first generated between the old and new firmware using a differential algorithm, and then the patch package is losslessly compressed; when installing new devices, the entire firmware is directly losslessly compressed. This strategy can compress the upgrade package size to 5%-10% of the original size, significantly reducing bandwidth usage; 3) Substation Convergence Terminal Caching and Packet Loss Retransmission Mechanism: The substation convergence terminal caches the complete upgrade package locally. After receiving multicast data, the IoT table reports the lost packet block number to the substation convergence terminal, which then retransmits the packet. This design avoids individual interaction between the main station and each IoT table, transferring the burden of packet loss handling from the main station to the substation convergence terminal, further alleviating the load on the main station.
[0094] The present invention specifically solves the following technical problems: 1) By using the local multicast distribution of the integrated terminal in the distribution area, multiple IoT energy meters in the same upgrade group can receive the upgrade package in parallel, which solves the problem that the upgrade time increases linearly with the number of energy meters under the traditional point-to-point upgrade method. 2) The main station only needs to send the upgrade package and upgrade description file to each target area converged terminal once. Subsequent distribution, reception status collection, packet loss retransmission and result summary are all completed locally by the area converged terminal, which solves the problem of excessive communication pressure on the main station; 3) Based on the current version of the target energy meter, the target version, and the device model, the "differential + lossless compression" upgrade package or the full lossless compression upgrade package is dynamically selected, which solves the problem of redundancy in upgrade package volume; 4) By using the IoT energy meter to receive the status bitmap and the round-robin feedback mechanism, the energy meter only reports the missing data block number after one round of multicast, which solves the confirmation storm problem caused by packet-by-packet response in the multicast transmission of the distribution area. 5) The integrated terminal of the distribution area dynamically selects multicast retransmission or point-to-point retransmission based on the packet loss ratio or retransmission cost of each data block, which solves the problem of repeated transmission caused by the fluctuation of packet loss rate of low-voltage carrier link. 6) By using the device model, manufacturer identifier, APP identifier, original version number, target version number, multicast address, digest check value, and digital signature information in the upgrade description file, the legality of the upgrade object and upgrade package is constrained, thus solving the risk of erroneous upgrades of heterogeneous energy meters; 7) Improve the reliability of batch remote upgrades by writing to the backup storage area, switching the start flag, and implementing a failure rollback mechanism, and solve the problem of electricity meters becoming unusable due to upgrade failures.
[0095] Compared with the prior art, the present invention has the following significant technical effects: 1) Significantly improved efficiency in batch upgrades. In the traditional point-to-point full upgrade method, the master station needs to transmit the complete upgrade package to each IoT energy meter individually. The main transmission time increases linearly with the number of meters to be upgraded. Let the number of IoT energy meters to be upgraded be M, the size of the full upgrade package be S_full, and the communication rate be R. Then, the theoretical raw transmission time of the traditional method is approximately: T_traditional=M×S_full×8 / R In this invention, the master station only needs to transmit the target upgrade package once to the integrated terminal in the distribution area, and the integrated terminal then distributes it in parallel to the IoT energy meters within the distribution area via multicast. Let the size of the target upgrade package generated by this invention be S_opt, and the packet loss retransmission time be T_repair. Then, the main transmission time of this invention is approximately: T_invention = S_opt × 8 / R + T_repair. Since S_opt, after differential and lossless compression, is usually much smaller than S_full, and the multicast distribution time does not increase linearly with the number of IoT energy meters M, the efficiency improvement factor of this invention compared to the traditional point-to-point full upgrade method can be approximately expressed as: Gain=T_traditional / T_invention =[M×S_full×8 / R] / [S_opt×8 / R+T_repair] When S_opt is compressed to 5% to 10% of S_full, and there are multiple IoT energy meters in the transformer area that need to be upgraded, the efficiency improvement becomes more significant as M increases.
[0096] Taking a certain area with 50 IoT energy meters, an original full upgrade package of 254KB, a differential compression upgrade package of 18KB, and a carrier communication rate of 9600bps as an example, the theoretical raw transmission time of traditional point-to-point full transmission is approximately: 50×254×1024×8 / 9600≈10837 seconds, approximately 180 minutes.
[0097] After employing differential compression and multicast distribution, the theoretical raw transmission time of this invention is approximately: 18×1024×8 / 9600≈15.4 seconds.
[0098] In practical low-voltage carrier environments, factors such as protocol frame overhead, multicast transmission interval, channel contention, retransmission and resending, task scheduling and device write time also need to be considered. However, since this invention avoids repeatedly transmitting the complete upgrade package to each IoT energy meter, the overall upgrade time can still be significantly reduced.
[0099] 2) The communication load on the master station is significantly reduced. The master station only needs to send the upgrade package and upgrade description file to the integrated terminal in the distribution area once, without establishing an independent upgrade session with each IoT energy meter, nor participating in the retransmission of lost packets for each data block. The data transmission volume on the master station side is reduced from M×S_full in the traditional method to approximately S_opt. The reduction in data transmission volume can be expressed as: Reduction = 1 - S_opt / (M × S_full) When M=50, S_full=254KB, and S_opt=18KB, the reduction rate of the upgrade packet transmission volume on the main station side is approximately: Reduction=1-18 / (50×254)≈99.86% 3) Significantly reduced upgrade package size. A combined strategy of differential compression and lossless compression is employed, allowing only the differences between the old and new firmware to be transmitted in older version upgrade scenarios. Furthermore, lossless compression further reduces the patch package size. For app firmware upgrades with minor functional changes, the target upgrade package size can be compressed to 5% to 10% of the full firmware size.
[0100] 4) Enhanced adaptability to low-bandwidth links. This invention reduces the number of duplicate transmissions and acknowledgment messages in low-voltage carrier links by using multicast distribution, bitmap feedback, dynamic retransmission, and adaptive adjustment of transmission intervals, thereby reducing the risk of communication congestion.
[0101] 5) Enhanced security and reliability. This invention prevents unauthorized upgrades, accidental upgrades, and upgrade failures that could render the device unusable by implementing upgrade description file signing, full package digest verification, data block verification, original version consistency verification, backup storage area writing, and failure rollback mechanisms.
[0102] 6) Strong hardware compatibility. This invention is mainly achieved through software upgrades of the main station, the integrated terminal of the distribution area, and the IoT energy meter. It does not require large-scale modifications to the existing hardware architecture and is suitable for promotion and application in the already deployed new generation of IoT energy meter systems.
[0103] The following specific examples illustrate the embodiments of the present invention. In an embodiment of the present invention, taking the APP firmware upgrade of 50 new-generation IoT energy meters in a certain distribution area as an example, all IoT energy meters in the distribution area communicate with the integrated terminal of the distribution area through power line carrier. The carrier communication rate is 9600bps. The original full firmware of the APP to be upgraded is 254KB. The target upgrade version has only a few functional code changes compared to the current running version.
[0104] First, the upgrade package generator obtains the current firmware version and the target firmware version, uses a differential algorithm to generate a differential patch package, and performs lossless compression on the differential patch package, ultimately generating a differentially compressed upgrade package of approximately 18KB. Simultaneously, an upgrade description file is generated, which includes the upgrade package identifier, target version number, original version number, chunk size, number of data blocks, overall package checksum, checksum of each data block, compression algorithm identifier, differential algorithm identifier, multicast address, and signature information.
[0105] The main station sends the differential compression upgrade package and upgrade description file to the target distribution area's converged terminal in one go. After completing the whole package verification, the distribution area's converged terminal configures the IoT energy meters to be upgraded to the corresponding multicast addresses and splits the upgrade package into multiple data blocks according to the preset block size. Subsequently, the distribution area's converged terminal sends each data block sequentially to 50 IoT energy meters in the distribution area via multicast at preset intervals, such as 3 seconds.
[0106] After receiving a multicast data block, each IoT energy meter determines whether it belongs to the target of this upgrade based on the upgrade packet identifier and multicast address. If a match is found, the data block is verified and written to the local cache, while the reception status bitmap is recorded. After the substation convergence terminal completes one round of multicast transmission, each IoT energy meter reports the data block number that was not received or failed to be verified to the substation convergence terminal.
[0107] The integrated terminal in the distribution area aggregates packet loss information from 50 IoT energy meters and calculates the packet loss ratio for each data block. For data blocks with a packet loss ratio greater than or equal to 5%, the integrated terminal uses multicast to resend them; for data blocks missing only from a few IoT energy meters, the integrated terminal uses point-to-point resends. After resending, the IoT energy meters report their reception status again, and the integrated terminal repeatedly executes the resend process until all IoT energy meters have received the data completely, or the preset maximum number of resends is reached.
[0108] After confirming the complete receipt of the upgrade package, the IoT energy meter first performs full packet CRC check, digest check, and signature check. Upon successful verification, the IoT energy meter decompresses the upgrade package and uses a differential restoration algorithm to combine the differential patch package with the local original firmware to form the target new firmware version. Subsequently, the IoT energy meter writes the new firmware version to the backup storage area. After writing is complete and verification is successful, the startup flag is switched and the meter restarts. Upon successful restart, the IoT energy meter loads the new version of the app, generates an upgrade success event, and reports it to the substation convergence terminal. The substation convergence terminal then aggregates the upgrade results from 50 IoT energy meters and reports them uniformly to the main station.
[0109] In this embodiment, the master station only needs to transmit an upgrade package of approximately 18KB to the integrated terminal in the distribution area once, instead of transmitting the full 254KB firmware to each of the 50 IoT energy meters individually. Compared to the traditional point-to-point full upgrade method, this embodiment significantly reduces the amount of communication data for the master station and the transmission time in the distribution area, reduces the probability of packet loss, and improves the efficiency of batch upgrades of energy meters.
[0110] Figure 7 This is a schematic diagram of the structure of a batch upgrade system 700 for IoT energy meters based on multicast and differential compression according to an embodiment of the present invention. Figure 7 As shown, the IoT energy meter batch upgrade system 700 based on multicast and differential compression provided in this embodiment of the invention includes: a master station 701, a transformer area fusion terminal 702, and an IoT energy meter 703.
[0111] Preferably, the master station 701 is used to obtain the compressed and segmented upgrade file, determine the upgrade task, and send the upgrade file and upgrade task to the substation converged terminal.
[0112] Preferably, the main station 701 acquires the compressed and segmented upgrade file, including: The main station generates or receives upgrade files generated by the upgrade package generator. Specifically, the main station or upgrade package generator obtains device information of IoT energy meters within the target area, divides the energy meters to be upgraded into one or more upgrade groups based on the device information, determines the compressed target upgrade package corresponding to each upgrade group, segments the target upgrade package into blocks, and determines a unique upgrade package identifier, multicast address, and upgrade description file corresponding to each target upgrade package based on the upgrade group division and segmentation results, thereby determining the upgrade file. IoT energy meters within the same upgrade group use the same upgrade package, upgrade description file, and multicast address.
[0113] Preferably, the master station or the receiving upgrade package generator divides the energy meters to be upgraded into one or more upgrade groups based on the device information, including: Based on the device model, APP identifier, current firmware version number and target firmware version number, the IoT energy meters to be upgraded are divided into at least one upgrade group; Where the kth upgrade group is G_k, then: G_k={m_j|Model_j=Model_k, App_j=App_k, V_old_j=V_old_k, V_new_j=V_new_k} Where m_j represents the j-th IoT energy meter, Model_j represents the device model, App_j represents the type of APP to be upgraded, V_old_j represents the current firmware version number, and V_new_j represents the target firmware version number.
[0114] Preferably, the main station or the receiving upgrade package generator determines the compressed target upgrade package corresponding to each upgrade group, including: In the scenario of upgrading from an old version, the original firmware currently running on the target IoT energy meter and the new version firmware to be upgraded are obtained. A differential patch package containing only the differences between the old and new firmware is generated through a preset differential algorithm. The differential patch package is then losslessly compressed to obtain a differential compressed upgrade package. In scenarios such as new installation, first-time installation, or when the original firmware cannot be obtained, the complete new firmware version is losslessly compressed to form a full compressed upgrade package. When the IoT energy meter supports differential restoration, and there is an old firmware version number that matches the current version, and |P_diff|≤α×|P_full| is satisfied, the differential compressed upgrade package is selected as the target upgrade package P=P_diff; otherwise, the full compressed upgrade package is selected as the target upgrade package P=P_full. Where P_diff is the differential compression upgrade package; P_full is the full compression upgrade package; and P is the target upgrade package.
[0115] Preferably, the main station or the receiving upgrade package generator divides the target upgrade package into blocks, including: The number of data blocks N is determined by N=ceil(|P| / B). The i-th data block Block_i is represented as: Block_i=P[(i-1)×B:min(i×B,|P|)-1]; where i=1,2,...,N, and |P| is the length of the upgrade package; The overall packet checksum H_P and the checksum H_i of each data block are calculated as follows: H_P=Hash(P),H_i=Hash(Block_i), Use the private key to sign the key fields in the upgrade description file to obtain the digital signature Sig: Sig = Sign_SK(Manifest), Here, SK represents the signing private key held by the upgrade package generator or the main site, and Manifest represents the upgrade description file.
[0116] Preferably, the upgrade description file includes: upgrade package identifier, upgrade package type, target version number, original version number, target device model, compression algorithm identifier, differential algorithm identifier, total length of upgrade package, block size, number of data blocks, full package checksum, checksum of each data block, target multicast address, and digital signature information.
[0117] Preferably, the substation convergence terminal 702 is configured to send the upgrade file via multicast address based on the multicast address configured for the upgrade task.
[0118] Preferably, the substation convergence terminal 702, based on the upgrade task configuration multicast address, sends the upgrade file via multicast through the multicast address, including: After receiving the upgrade package and upgrade description file, the integrated terminal in the distribution area establishes a local upgrade task state machine and determines the actual execution time of the upgrade task based on the service avoidance time window in the upgrade description file and the current collection service load. Configure the multicast address for the IoT energy meters to be upgraded in the transformer area according to the upgrade group number and target multicast address in the upgrade description file. Based on the configured multicast address, data blocks are sent sequentially according to the number of data blocks N and the block size B in the upgrade description file.
[0119] Preferably, the substation convergence terminal 702 is further used for: The multicast transmission parameters are adaptively adjusted based on the communication quality of the distribution area. Specifically, when the converged terminal of the distribution area detects that the packet loss ratio of multiple consecutive data blocks is higher than a preset threshold, the multicast transmission rate is reduced or the transmission interval is increased; when the packet loss ratio of multiple consecutive data blocks is lower than the preset threshold, the multicast transmission rate is increased or the transmission interval is decreased. Let the multicast transmission interval of the r-th round be T_r, and the average packet loss rate of the r-th round be L_r. Then the transmission interval can be adjusted according to the following rules: If L_r ≥ L_high, then T_{r+1} = min(T_r + ΔT, T_max). If L_r ≤ L_low, then T_{r+1} = max(T_r - ΔT, T_min). Otherwise, T_{r+1}=T_r, Where L_high represents the high packet loss rate threshold, L_low represents the low packet loss rate threshold, ΔT represents the transmission interval adjustment step size, and T_max and T_min represent the maximum and minimum transmission intervals, respectively.
[0120] Preferably, the IoT energy meter 703 is used to perform upgrades based on the received multicast data.
[0121] Preferably, the IoT energy meter 703 upgrades itself based on the received multicast data, including: The IoT energy meter checks whether the upgrade package identifier, upgrade group number, multicast address, device model, APP identifier, and original version number in the upgrade description file of the multicast data match. If they match, the data block is written to the local cache, and the upgrade package in the data block is sequentially checked for CRC, digest, and signature. If the checks pass, the decompression, firmware writing, and upgrade confirmation operations are performed sequentially to perform the upgrade. If they do not match, the multicast data is discarded.
[0122] Preferably, the IoT energy meter 703 is further used for: After writing the data block to the local buffer, the corresponding data block number is marked as received in the receive status bitmap, and the complete receive status bitmap is reported to the substation convergence terminal after the multicast phase ends.
[0123] Preferably, the substation convergence terminal 702 is further used for: Receive the receive status bitmap_j or the lost block number set Loss_j reported by all IoT energy meters, count the missing data of each data block, determine the retransmission method according to the packet loss ratio or retransmission cost, and retransmit the data block according to the determined retransmission method.
[0124] Preferably, the system further includes: The IoT energy meter 703 is used to update the local reception status bitmap after receiving the retransmitted data block, and report the reception status to the distribution area convergence terminal again, so that the distribution area convergence terminal repeatedly executes the packet loss statistics and retransmission process until the reception status bitmap of all IoT energy meters shows complete reception, or stops when the preset maximum number of retransmissions is reached. The integrated distribution terminal 702 is used to mark IoT energy meters that have not received complete data even after reaching the maximum number of retransmissions as abnormal upgrade devices, record the cause of the abnormality, the missing data block number, the number of retransmissions, and the last communication time, and report the list of abnormal devices and the cause of the abnormality to the main station when summarizing the upgrade results.
[0125] The IoT energy meter batch upgrade system 700 based on multicast and differential compression in an embodiment of the present invention corresponds to the IoT energy meter batch upgrade method 100 based on multicast and differential compression in another embodiment of the present invention, and will not be described again here.
[0126] The present invention has been described with reference to a few embodiments. However, it will be apparent to those skilled in the art that other embodiments besides those disclosed above fall equivalently within the scope of the present invention.
[0127] Generally, all terms used in this invention are interpreted according to their ordinary meaning in the art, unless otherwise expressly defined herein. All references to “a / the / the [device, component, etc.]” are openly interpreted as at least one instance of said device, component, etc., unless otherwise expressly stated. The steps of any method disclosed herein need not be performed in the exact order disclosed, unless explicitly stated otherwise.
[0128] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0129] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0130] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0131] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the protection scope of the present invention.
Claims
1. A method for batch upgrading of Internet of Things electricity meters based on multicast and differential compression, characterized in that, The method includes: The main station obtains the compressed and segmented upgrade file, determines the upgrade task, and sends the upgrade file and upgrade task to the substation converged terminal; The integrated terminal of the distribution area configures a multicast address based on the upgrade task and sends the upgrade file via multicast through the multicast address; The IoT energy meter upgrades itself based on the multicast data it receives.
2. The method of claim 1, wherein, The main station obtains the compressed and segmented upgrade file, including: The main station generates or receives upgrade files generated by the upgrade package generator. Specifically, the main station or upgrade package generator obtains device information of IoT energy meters within the target area, divides the energy meters to be upgraded into one or more upgrade groups based on the device information, determines the compressed target upgrade package corresponding to each upgrade group, segments the target upgrade package into blocks, and determines a unique upgrade package identifier, multicast address, and upgrade description file corresponding to each target upgrade package based on the upgrade group division and segmentation results, thereby determining the upgrade file. IoT energy meters within the same upgrade group use the same upgrade package, upgrade description file, and multicast address.
3. The method of claim 2, wherein, Based on the device information, the electricity meters to be upgraded are divided into one or more upgrade groups, including: Based on the device model, APP identifier, current firmware version number and target firmware version number, the IoT energy meters to be upgraded are divided into at least one upgrade group; Where the kth upgrade group is G_k, then: G_k={m_j|Model_j=Model_k, App_j=App_k, V_old_j=V_old_k, V_new_j=V_new_k} Where m_j represents the j-th IoT energy meter, Model_j represents the device model, App_j represents the type of APP to be upgraded, V_old_j represents the current firmware version number, and V_new_j represents the target firmware version number.
4. The method of claim 2, wherein, Determine the compressed target upgrade package for each upgrade group, including: In the scenario of upgrading from an old version, the original firmware currently running on the target IoT energy meter and the new version firmware to be upgraded are obtained. A differential patch package containing only the differences between the old and new firmware is generated through a preset differential algorithm. The differential patch package is then losslessly compressed to obtain a differential compressed upgrade package. In scenarios such as new installation, first-time installation, or when the original firmware cannot be obtained, the complete new firmware version is losslessly compressed to form a full compressed upgrade package. When the IoT energy meter supports differential restoration, and there is an old firmware version number that matches the current version, and |P_diff|≤α×|P_full| is satisfied, the differential compressed upgrade package is selected as the target upgrade package P=P_diff; otherwise, the full compressed upgrade package is selected as the target upgrade package P=P_full. Where P_diff is the differential compression upgrade package; P_full is the full compression upgrade package; and P is the target upgrade package.
5. The method of claim 2, wherein, The target upgrade package is divided into blocks, including: The number of data blocks N is determined by N=ceil(|P| / B). The i-th data block Block_i is represented as: Block_i=P[(i-1)×B:min(i×B,|P|)-1]; where i=1,2,...,N, and |P| is the length of the upgrade package; The overall packet checksum H_P and the checksum H_i of each data block are calculated as follows: H_P=Hash(P),H_i=Hash(Block_i), Use the private key to sign the key fields in the upgrade description file to obtain the digital signature Sig: Sig = Sign_SK(Manifest), Here, SK represents the signing private key held by the upgrade package generator or the main site, and Manifest represents the upgrade description file.
6. The method of claim 1, wherein, The upgrade description file includes: upgrade package identifier, upgrade package type, target version number, original version number, target device model, compression algorithm identifier, differential algorithm identifier, total length of upgrade package, block size, number of data blocks, full package check value, check value of each data block, target multicast address, and digital signature information.
7. The method of claim 1, wherein, The integrated terminal in the distribution area configures a multicast address based on the upgrade task and sends the upgrade file via multicast address, including: After receiving the upgrade package and upgrade description file, the integrated terminal in the distribution area establishes a local upgrade task state machine and determines the actual execution time of the upgrade task based on the service avoidance time window in the upgrade description file and the current collection service load. Configure the multicast address for the IoT energy meters to be upgraded in the transformer area according to the upgrade group number and target multicast address in the upgrade description file. Based on the configured multicast address, data blocks are sent sequentially according to the number of data blocks N and the block size B in the upgrade description file.
8. The method according to claim 1, characterized in that, The method further includes: The converged terminal in the distribution area adaptively adjusts multicast transmission parameters based on the communication quality of the distribution area. Specifically, when the converged terminal detects that the packet loss ratio of multiple consecutive data blocks is higher than a preset threshold, it reduces the multicast transmission rate or increases the transmission interval; when the packet loss ratio of multiple consecutive data blocks is lower than the preset threshold, it increases the multicast transmission rate or decreases the transmission interval. Let the multicast transmission interval in the r-th round be T_r, and the average packet loss rate in the r-th round be L_r. Then the transmission interval can be adjusted according to the following rules: If L_r ≥ L_high, then T_{r+1} = min(T_r + ΔT, T_max). If L_r ≤ L_low, then T_{r+1} = max(T_r - ΔT, T_min). Otherwise, T_{r+1}=T_r, Where L_high represents the high packet loss rate threshold, L_low represents the low packet loss rate threshold, ΔT represents the transmission interval adjustment step size, and T_max and T_min represent the maximum and minimum transmission intervals, respectively.
9. The method according to claim 1, characterized in that, The IoT energy meter upgrades itself based on the received multicast data, including: The IoT energy meter checks whether the upgrade package identifier, upgrade group number, multicast address, device model, APP identifier, and original version number in the upgrade description file of the multicast data match. If they match, the data block is written to the local cache, and the upgrade package in the data block is sequentially checked for CRC, digest, and signature. If the checks pass, the decompression, firmware writing, and upgrade confirmation are performed sequentially to perform the upgrade. If they do not match, the multicast data is discarded.
10. The method according to claim 9, characterized in that, The method further includes: After writing the data block into the local buffer, the IoT energy meter marks the corresponding data block number as received in the receiving status bitmap, and reports the complete receiving status bitmap to the substation convergence terminal after the multicast phase ends.
11. The method according to claim 10, characterized in that, The method further includes: The integrated terminal in the distribution area receives the received status bitmap (Bitmap_j) or the lost block number set (Loss_j) reported by all IoT energy meters, counts the missing data of each data block, determines the retransmission method based on the packet loss ratio or retransmission cost, and retransmits the data block according to the determined retransmission method.
12. The method according to claim 11, characterized in that, The method further includes: After receiving the retransmitted data block, the IoT energy meter updates its local reception status bitmap and reports the reception status to the distribution area convergence terminal again. This allows the distribution area convergence terminal to repeatedly execute the packet loss statistics and retransmission process until the reception status bitmaps of all IoT energy meters show complete reception, or until the preset maximum number of retransmissions is reached. For IoT energy meters that have not received complete reception even after reaching the maximum number of retransmissions, the distribution area convergence terminal marks them as upgrade abnormal devices, records the cause of the abnormality, the missing data block number, the number of retransmissions, and the last communication time, and reports the list of abnormal devices and the cause of the abnormality to the main station when summarizing the upgrade results.
13. A batch upgrade system for IoT energy meters based on multicast and differential compression, characterized in that, The system includes: The main station is used to obtain the compressed and segmented upgrade file, determine the upgrade task, and send the upgrade file and upgrade task to the substation converged terminal. The integrated terminal is configured with a multicast address based on the upgrade task, and sends the upgrade file via multicast through the multicast address. IoT energy meters are used for upgrades based on received multicast data.
