CN114338656B - Method and system for rapidly upgrading firmware of electric energy meter and readable storage medium - Google Patents

Method and system for rapidly upgrading firmware of electric energy meter and readable storage medium Download PDF

Info

Publication number
CN114338656B
CN114338656B CN202210245270.3A CN202210245270A CN114338656B CN 114338656 B CN114338656 B CN 114338656B CN 202210245270 A CN202210245270 A CN 202210245270A CN 114338656 B CN114338656 B CN 114338656B
Authority
CN
China
Prior art keywords
electric energy
energy meter
upgrading
sub
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210245270.3A
Other languages
Chinese (zh)
Other versions
CN114338656A (en
Inventor
丁国茂
周冬冬
屈玉帅
徐斐虹
沙川
朱明�
李敏
郑继丰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Sunrise Technology Co ltd
Original Assignee
Hangzhou Sunrise Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Sunrise Technology Co ltd filed Critical Hangzhou Sunrise Technology Co ltd
Priority to CN202210245270.3A priority Critical patent/CN114338656B/en
Publication of CN114338656A publication Critical patent/CN114338656A/en
Application granted granted Critical
Publication of CN114338656B publication Critical patent/CN114338656B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention discloses a method, a system and a readable storage medium for rapidly upgrading electric energy meter firmware, which directly broadcast a start upgrading command frame to an electric energy meter receiving a broadcast address through gateway equipment by adopting a broadcasting form, so that the electric energy meter executes upgrading according to the start upgrading command frame.

Description

Method and system for rapidly upgrading firmware of electric energy meter and readable storage medium
Technical Field
The invention relates to the field of data analysis and processing, in particular to a method and a system for quickly upgrading firmware of an electric energy meter and a readable storage medium.
Background
The electric energy meter is an indispensable component in the power industry, is a terminal device directly facing users, and the stability and timeliness of the device are very important parameters. Currently, in an electric energy data acquisition project for an electric energy meter, the connection between the electric energy meter and a communication gateway mostly adopts a communication mode of an RS485 bus, a small wireless or power line carrier. In fact, a communication gateway is usually connected to a plurality of electric energy meters at the same time to form a serial communication environment, and in such a serial communication environment, a plurality of electric energy meters communicate with the gateway at the same time, which may interfere with each other, so the communication mode between the communication gateway and the electric energy meters is usually a polling communication mode one by one.
Due to the limitation of communication between the current communication gateway and the multiple electric energy meters, when the firmware of the electric energy meter needs to be upgraded online, the existing method for upgrading the firmware of the electric energy meter is that the communication gateway issues upgrading commands and upgrading files to the hung electric energy meters one by one, the upgrading efficiency is low, and the time required by upgrading is in direct proportion to the number of the electric energy meters.
Disclosure of Invention
In view of the foregoing problems, an object of the present invention is to provide a method, a system and a readable storage medium for quickly upgrading firmware of an electric energy meter, which can improve the efficiency of upgrading the electric energy meter by issuing a new upgrade command and an upgrade file, and simultaneously ensure that mutual interference is not generated when multiple meters communicate simultaneously.
The invention provides a method for quickly upgrading firmware of an electric energy meter in a first aspect, which comprises the following steps:
loading an upgrade file and splitting the upgrade file according to a preset sub-package size to obtain sub-upgrade file packages and sub-package quantity;
and sending a starting upgrading command frame to gateway equipment by taking a broadcast address as an equipment address, so that the gateway equipment broadcasts the starting upgrading command frame to a corresponding electric energy meter based on the broadcast address, the electric energy meter executes upgrading according to the starting upgrading command frame, and the starting upgrading command frame carries the version number of the upgrading file, all the sub-upgrading file packets and the sub-packet number.
In this scheme, sending a start upgrading command frame to a gateway device with a broadcast address as a device address, so that the gateway device further includes, after broadcasting the start upgrading command frame to a corresponding electric energy meter based on the broadcast address:
acquiring electric energy meter information in the gateway equipment, wherein the electric energy meter information comprises the number of electric energy meters and the address of the electric energy meter equipment;
sending upgrading confirmation frames to the corresponding electric energy meters one by one according to the electric energy meter equipment addresses;
and after the electric energy meter executes upgrading according to the upgrading starting command frame, receiving upgrading success confirmation information sent by the electric energy meter.
In this scheme, the electric energy meter executes upgrading according to the upgrade starting command frame, specifically including:
the electric energy meter initializes a file receiving state bit table according to the sub-packet quantity;
the electric energy meter updates the file receiving state bit table according to the received serial number of the sub-upgrading file packet;
and if all the status bits of the file receiving status bit table are updated, the electric energy meter executes upgrading and sends upgrading success confirmation information.
In this scheme, still include:
calculating the characteristic value of the received sub-upgrade file package;
judging whether the characteristic value is repeated with the received characteristic value of the sub-upgrade file package;
if so, it is discarded.
In this scheme, the executing of the upgrade by the electric energy meter according to the upgrade start command frame further includes:
and if the existing state bit of the file receiving state bit table is not updated, the electric energy meter returns the file receiving state bit table.
In this scheme, if the existing status bit of the file receiving status bit table is not updated, the returning of the file receiving status bit table by the electric energy meter further includes:
according to the file receiving state bit table and the equipment address of the electric energy meter, the sub-upgrading file packet with the sequence number corresponding to the non-updated state bit is sent to the electric energy meter, the electric energy meter updates the file receiving state bit table and returns confirmation information;
and returning to send the upgrading confirmation frame to the electric energy meter again.
The second aspect of the present invention further provides a system for rapidly upgrading firmware of an electric energy meter, including a memory and a processor, where the memory includes a program of a method for rapidly upgrading firmware of an electric energy meter, and when the program of the method for rapidly upgrading firmware of an electric energy meter is executed by the processor, the following steps are implemented:
loading an upgrade file and splitting the upgrade file according to a preset sub-package size to obtain sub-upgrade file packages and sub-package quantity;
and sending a starting upgrading command frame to gateway equipment by taking a broadcast address as an equipment address, so that the gateway equipment broadcasts the starting upgrading command frame to a corresponding electric energy meter based on the broadcast address, the electric energy meter executes upgrading according to the starting upgrading command frame, and the starting upgrading command frame carries the version number of the upgrading file, all the sub-upgrading file packets and the sub-packet number.
In this scheme, sending a start upgrading command frame to a gateway device with a broadcast address as a device address, so that the gateway device broadcasts the start upgrading command frame to a corresponding electric energy meter based on the broadcast address further includes:
acquiring electric energy meter information in the gateway equipment, wherein the electric energy meter information comprises the number of electric energy meters and the address of the electric energy meter equipment;
sending upgrading confirmation frames to the corresponding electric energy meters one by one according to the electric energy meter equipment addresses;
and after the electric energy meter executes upgrading according to the upgrading starting command frame, receiving upgrading success confirmation information sent by the electric energy meter.
In this scheme, the electric energy meter executes upgrading according to the upgrade starting command frame, specifically including:
the electric energy meter initializes a file receiving state bit table according to the sub-packet quantity;
the electric energy meter updates the file receiving state bit table according to the received serial number of the sub-upgrading file packet;
and if all the status bits of the file receiving status bit table are updated, the electric energy meter executes upgrading and sends upgrading success confirmation information.
A third aspect of the present invention provides a computer-readable storage medium, where the computer-readable storage medium includes a program of a method for quickly upgrading firmware of an electric energy meter of a machine, and when the program of the method is executed by a processor, the method for quickly upgrading firmware of an electric energy meter realizes the steps of the method for quickly upgrading firmware of an electric energy meter.
The invention discloses a method and a system for rapidly upgrading firmware of an electric energy meter. The upgrading method and the upgrading device further ensure the upgrading state of the electric energy meter by sending the upgrading confirmation frame to the electric energy meter one by one, and the upgrading success rate is improved. In addition, the electric energy meter which misses sending the sub-upgrading file package is directionally and additionally sent to the corresponding sub-upgrading file package based on the file receiving state bit table, omission of the sub-upgrading file package is avoided, and upgrading integrity is guaranteed.
Drawings
FIG. 1 is a flowchart illustrating a method for rapidly upgrading firmware of an electric energy meter according to the present application;
fig. 2 shows a block diagram of a system for rapidly upgrading firmware of an electric energy meter according to the present invention.
Detailed Description
In order that the above objects, features and advantages of the present invention can be more clearly understood, a more particular description of the invention will be rendered by reference to the appended drawings. It should be noted that the embodiments and features of the embodiments of the present application may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, however, the present invention may be practiced in other ways than those specifically described herein, and therefore the scope of the present invention is not limited by the specific embodiments disclosed below.
Fig. 1 shows a flowchart of a method for rapidly upgrading firmware of an electric energy meter according to the present application.
As shown in fig. 1, the present application discloses a method for quickly upgrading firmware of an electric energy meter, which includes the following steps:
s101, loading an upgrade file and splitting the upgrade file according to a preset sub-package size to obtain sub-upgrade file packages and sub-package quantity;
s102, sending a start upgrading command frame to gateway equipment by taking a broadcast address as an equipment address, so that the gateway equipment broadcasts the start upgrading command frame to a corresponding electric energy meter based on the broadcast address, the electric energy meter executes upgrading according to the start upgrading command frame, and the start upgrading command frame carries the version number of the upgrading file, all the sub upgrading file packets and the sub-packet number.
It should be noted that the upgrade file is loaded in a complete file package form, and after the upgrade file is loaded, the upgrade file is split according to a preset sub-package size. After a plurality of sub-upgrade file packages are obtained through splitting, each sub-upgrade file package is marked to the last sub-upgrade file package according to the sequence and corresponding to the serial numbers, such as package 1, package 2 and the like. And recombining the sub-upgrade file packages according to the serial numbers to form a complete upgrade file.
It should be noted that, after the upgrade file is loaded and split, and the sub-upgrade file package and the sub-package number are obtained, the start upgrade command frame is sent to the gateway device by using the broadcast address as the device address, and the start upgrade command frame is broadcasted to all the electric energy meters receiving the broadcast address by the gateway device, and all the electric energy meters receiving the broadcast address respond. The broadcast address can be issued to all the electric energy meters by the gateway device in advance, or the broadcast address can be issued to all the electric energy meters after the broadcast address of the upgrading command frame is determined to be started. And the starting upgrading command frame comprises the version number of the complete upgrading file, all the split sub upgrading file packets and the number of sub packets. After the gateway device broadcasts the start-up upgrading command frame to the electric energy meter, the electric energy meter receives the start-up upgrading command frame and executes the upgrading instruction, and it can be understood that the upgrading of the electric energy meter can be carried out one by one according to the sequence of the sub upgrading file packages, or the sub upgrading file packages can be reassembled into a complete upgrading file according to the sequence and then carried out the upgrading.
According to the embodiment of the present invention, the sending a start upgrade command frame to a gateway device with a broadcast address as a device address, so that after the gateway device broadcasts the start upgrade command frame to a corresponding electric energy meter based on the broadcast address, the method further includes:
acquiring electric energy meter information in the gateway equipment, wherein the electric energy meter information comprises the number of electric energy meters and the equipment address of the electric energy meter;
sending upgrading confirmation frames to the corresponding electric energy meters one by one according to the electric energy meter equipment addresses;
and after the electric energy meter executes upgrading according to the upgrading starting command frame, receiving upgrading success confirmation information sent by the electric energy meter.
It should be noted that, the gateway device may store electric energy meter information in advance, where the electric energy meter information includes the number of electric energy meters connected to the gateway device and the address of the electric energy meter device. Different from the broadcast addresses described in the above embodiments, the device address is unique address information of one electric energy meter, one device address corresponds to only one electric energy meter, and one broadcast address may correspond to a plurality of electric energy meters. After the start upgrading command frame is broadcast and issued, in order to ensure the success of upgrading, upgrading confirmation frames are further sent to the corresponding electric energy meters one by one according to the equipment addresses of the electric energy meters. After the electric energy meter executes upgrading according to the starting upgrading command frame, the electric energy meter returns upgrading success confirmation information according to the upgrading confirmation frame, and then the electric energy meter can be indicated to execute upgrading successfully. It can be understood that after the upgrade command frame is started to be broadcast to the electric energy meter, the electric energy meter only needs to perform the task of loading and upgrading the upgrade file without replying any information, and after the electric energy meter receives the upgrade confirmation frame, the electric energy meter needs to reply and returns the upgrade confirmation information in response to the upgrade confirmation frame.
It should be noted that, after the electric energy meter receives the start-up upgrade command frame in a broadcast manner, the file receiving state bit table in the electric energy meter is initialized first, and the file receiving state bit table determines an actual bit number according to the number of packets in the start-up upgrade command frame, for example, if the number of the packet tables is 3, the file receiving state bit table is initialized to a 3-bit table. No matter how many bits of the file receiving state bit table are before the file receiving state bit table receives the start-up upgrading command frame, the file receiving state bit table is reset to the file receiving state bit table which meets the next upgrading requirement after the initialization processing.
According to the embodiment of the invention, the electric energy meter executes upgrading according to the upgrading starting command frame, which specifically comprises the following steps:
the electric energy meter initializes a file receiving state bit table according to the sub-packet quantity;
the electric energy meter updates the file receiving state bit table according to the received serial number of the sub-upgrade file packet;
and if all the status bits of the file receiving status bit table are updated, the electric energy meter executes upgrading and sends upgrading success confirmation information.
It should be noted that, after the electric energy meter initializes the file receiving status BIT table, the file receiving status BIT table is updated according to the sequence number of the received sub-upgrade file packet, for example, the BIT records the receiving status of the corresponding sub-packet sequence number, or simply records the receiving status of the sub-upgrade file packet by 0 and 1, where 0 represents not received and 1 represents received. In the file receiving state bit table, each bit state bit table represents a sub-upgrading file packet with a corresponding serial number, and in the process of receiving all the sub-upgrading file packets, the sub-upgrading file packets can be sent one by one in sequence or randomly without repeated sending, and the file receiving state bit table can be updated only by confirming the serial numbers of the sub-upgrading file packets in all the sub-upgrading file packets.
It should be noted that, after the electric energy meter receives the upgrade confirmation frame, it is checked whether all the status bits of the file receiving status bit table are updated, and if the file receiving status bit table shows that all the sub-upgrade file packets are successfully received, the electric energy meter executes the upgrade and returns the upgrade success confirmation information.
According to the embodiment of the invention, the method further comprises the following steps:
calculating the characteristic value of the received sub-upgrade file package;
judging whether the characteristic value is repeated with the received characteristic value of the sub-upgrade file package;
if so, it is discarded.
It should be noted that, in order to avoid receiving the sub upgrade file package repeatedly, the feature value of the sub upgrade file package needs to be calculated, and then compared with the feature value of the received sub upgrade file package, if the sub upgrade file package is repeated, it indicates that there is a repeated sub upgrade file package, and the sub upgrade file package is discarded. The method of the invention can improve the receiving and processing efficiency.
According to an embodiment of the present invention, the performing, by the electric energy meter, the upgrade according to the upgrade start command frame further includes:
and if the existing state bit of the file receiving state bit table is not updated, the electric energy meter returns the file receiving state bit table.
It should be noted that, if the status bit in the file reception status bit table is not updated, after the electric energy meter finishes analyzing the start-up upgrade command frame, the file reception status bit table with the un-updated status bit is returned. The corresponding non-updated status bit in the file receiving status bit table represents that the electric energy meter does not successfully receive the sub-upgrade file packet with the corresponding serial number.
According to the embodiment of the present invention, if the existing status bit of the file receiving status bit table is not updated, the returning of the file receiving status bit table by the electric energy meter further includes:
according to the file receiving state bit table and the equipment address of the electric energy meter, the sub-upgrading file packet with the sequence number corresponding to the non-updated state bit is sent to the electric energy meter, the electric energy meter updates the file receiving state bit table and returns confirmation information;
and returning to send the upgrading confirmation frame to the electric energy meter again.
After receiving the file receiving state bit table with the updated existing state bit, the file receiving state bit table is analyzed to determine the device address of the electric energy meter, so that the missing sub-upgrade file packet is directionally sent to the electric energy meter according to the device address of the electric energy meter, and the electric energy meter returns the determination information again. The electric energy meter can sequentially return confirmation information aiming at each missing sub-upgrading file packet, and can also return the confirmation information once after the file receiving state bit tables in the electric energy meter are completely updated. And if the first confirmation information returning mode is adopted, the upgrading confirmation frame is sent to the electric energy meter again after the last missing sub upgrading file packet is sent and the confirmation information is returned, and if the second confirmation information returning mode is adopted, the upgrading confirmation frame is sent to the electric energy meter again after the returned confirmation information is received.
According to the embodiment of the invention, the method further comprises the following steps:
confirming a preset sub-upgrade file package according to the specification of the electric energy meter to be upgraded;
calculating a characteristic value according to the preset sub-upgrade file package;
matching the number of items according to the characteristic value of the receiving sub-upgrading file packet of the updated state bit table of the updated electric energy meter and the characteristic value of the preset sub-upgrading file packet;
the item number matching comprises characteristic value sequence matching and characteristic value sum matching;
and if the item number is correctly matched, the electric energy meter is successfully upgraded.
It should be noted that, in order to check whether the electric energy meter is upgraded successfully, the sum of the eigenvalue sequence and the eigenvalue calculated by the preset sub-upgrade file package is matched with the sum of the eigenvalue sequence and the eigenvalue of the receiving sub-upgrade file package of the state bit table after the electric energy meter is upgraded, and if the matching is successful, the electric energy meter is upgraded successfully.
According to the embodiment of the invention, the method further comprises the following steps:
if the electric energy meter file receiving state bit table exists that the state bit is not updated, judging whether the un-updated state bit has a matching vacancy of the sub-upgrade file packet;
if the sub-upgrade file packet is matched with the vacancy, returning according to the non-updated state bit and the electric energy meter equipment address;
formatting and resetting the electric energy meter state position table to be a last version state position table;
and updating and upgrading the state bit table according to the formatted reset electric energy meter.
It should be noted that, if the receiving status bit table of the electric energy meter file has a status bit that is not updated, it is determined whether the un-updated status bit has a sub-upgrade file packet mismatch condition, that is, a sub-upgrade file packet matching vacancy occurs, if the sub-upgrade file packet matching vacancy exists, a return is made according to the un-updated status bit and the electric energy meter device address, the electric energy meter status bit table is formatted and reset to the previous version status bit table, and then the status bit table is updated and updated according to the electric energy meter after the formatting and resetting.
According to the embodiment of the invention, the method further comprises the following steps:
marking the state bit to be updated according to the corresponding updated state bit table of the electric energy meter to be updated;
editing and positioning the sub-upgrade file packet according to the state bit to be updated;
arranging the characteristic values of the corresponding sub-upgrade file packages according to the editing positioning to generate a characteristic value array;
and performing arrangement fitting on the characteristic values of the sub-upgrade file package of the electric energy meter after the upgrade is completed and the characteristic value array, and if the fitting degree is 1, successfully upgrading the electric energy meter.
It should be noted that, the state bit to be updated is marked according to the corresponding update state bit table of the electric energy meter to be updated, editing and positioning are performed according to the sub-update file packet corresponding to the state bit to be updated, then the eigenvalue of the corresponding sub-update file packet is arranged according to the editing and positioning to generate the eigenvalue array, arrangement and fitting are performed according to the eigenvalue of the sub-update file packet of the electric energy meter after the update is completed and the eigenvalue array of the editing and positioning, and if the fitting degree is 1, the electric energy meter is successfully updated.
Fig. 2 shows a block diagram of a system for rapidly upgrading firmware of an electric energy meter according to the present invention.
As shown in fig. 2, the present invention discloses a system for quickly upgrading firmware of an electric energy meter, which includes a memory 21 and a processor 22, where the memory 21 includes a program of a method for quickly upgrading firmware of an electric energy meter, and when the program of the method for quickly upgrading firmware of an electric energy meter is executed by the processor 22, the following steps are implemented:
loading an upgrade file and splitting the upgrade file according to a preset sub-package size to obtain sub-upgrade file packages and sub-package quantity;
and sending a starting upgrading command frame to gateway equipment by taking a broadcast address as an equipment address, so that the gateway equipment broadcasts the starting upgrading command frame to a corresponding electric energy meter based on the broadcast address, the electric energy meter executes upgrading according to the starting upgrading command frame, and the starting upgrading command frame carries the version number of the upgrading file, all the sub-upgrading file packets and the sub-packet number.
It should be noted that the upgrade file is loaded in a complete file package form, and after the upgrade file is loaded, the upgrade file is split according to a preset sub-package size. After a plurality of sub-upgrade file packages are obtained through splitting, each sub-upgrade file package is marked to the last sub-upgrade file package according to the sequence and corresponding to the serial numbers, such as package 1, package 2 and the like. And recombining the sub upgrading file packets according to the serial numbers to form a complete upgrading file.
It should be noted that, after the upgrade file is loaded and split, and the sub-upgrade file package and the sub-package number are obtained, the start upgrade command frame is sent to the gateway device by using the broadcast address as the device address, and the start upgrade command frame is broadcasted to all the electric energy meters receiving the broadcast address by the gateway device, and all the electric energy meters receiving the broadcast address respond. The broadcast address can be issued to all the electric energy meters by the gateway device in advance, or the broadcast address can be issued to all the electric energy meters after the broadcast address of the upgrading command frame is determined to be started. And the starting upgrading command frame comprises the version number of the complete upgrading file, all the split sub upgrading file packets and the number of sub packets. After the gateway device broadcasts the start-up upgrading command frame to the electric energy meter, the electric energy meter receives the start-up upgrading command frame and executes the upgrading instruction, and it can be understood that the upgrading of the electric energy meter can be carried out one by one according to the sequence of the sub upgrading file packages, or the sub upgrading file packages can be reassembled into a complete upgrading file according to the sequence and then carried out the upgrading.
According to the embodiment of the present invention, the sending a start upgrade command frame to a gateway device with a broadcast address as a device address, so that after the gateway device broadcasts the start upgrade command frame to a corresponding electric energy meter based on the broadcast address, the method further includes:
acquiring electric energy meter information in the gateway equipment, wherein the electric energy meter information comprises the number of electric energy meters and the address of the electric energy meter equipment;
sending upgrading confirmation frames to the corresponding electric energy meters one by one according to the electric energy meter equipment addresses;
and after the electric energy meter executes upgrading according to the upgrading starting command frame, receiving upgrading success confirmation information sent by the electric energy meter.
It should be noted that, the gateway device may store electric energy meter information in advance, where the electric energy meter information includes the number of all connected electric energy meters of the gateway device and the address of the electric energy meter device. Different from the broadcast addresses described in the above embodiments, the device address is unique address information of one electric energy meter, one device address corresponds to only one electric energy meter, and one broadcast address may correspond to a plurality of electric energy meters. After the start upgrading command frame is broadcast and issued, in order to ensure the success of upgrading, upgrading confirmation frames are further sent to the corresponding electric energy meters one by one according to the equipment addresses of the electric energy meters. After the electric energy meter executes upgrading according to the starting upgrading command frame, the electric energy meter returns upgrading success confirmation information according to the upgrading confirmation frame to indicate that the electric energy meter executes upgrading successfully. It can be understood that after the upgrade command frame is started to be broadcast to the electric energy meter, the electric energy meter only needs to perform the task of loading and upgrading the upgrade file without replying any information, and after the electric energy meter receives the upgrade confirmation frame, the electric energy meter needs to reply and returns the upgrade confirmation information in response to the upgrade confirmation frame.
It should be noted that, after the electric energy meter receives the start-up upgrade command frame in a broadcast manner, the file receiving state bit table in the electric energy meter is initialized first, and the file receiving state bit table determines an actual bit number according to the number of packets in the start-up upgrade command frame, for example, if the number of the packet tables is 3, the file receiving state bit table is initialized to a 3-bit table. No matter how many bits of the file receiving state bit table are before the file receiving state bit table receives the start-up upgrading command frame, the file receiving state bit table is reset to the file receiving state bit table which meets the next upgrading requirement after the initialization processing.
According to the embodiment of the invention, the electric energy meter executes upgrading according to the starting upgrading command frame, which specifically comprises the following steps:
the electric energy meter initializes a file receiving state bit table according to the sub-packet quantity;
the electric energy meter updates the file receiving state bit table according to the received serial number of the sub-upgrading file packet;
and if all the status bits of the file receiving status bit table are updated, the electric energy meter executes upgrading and sends upgrading success confirmation information.
It should be noted that, after the electric energy meter initializes the file receiving status BIT table, the file receiving status BIT table is updated according to the sequence number of the received sub-upgrade file packet, for example, the BIT records the receiving status of the corresponding sub-packet sequence number, or simply records the receiving status of the sub-upgrade file packet by 0 and 1, where 0 represents not received and 1 represents received. In the file receiving state bit table, each bit state bit table represents a sub-upgrading file packet with a corresponding serial number, and in the process of receiving all the sub-upgrading file packets, the sub-upgrading file packets can be sent one by one in sequence or randomly without repeated sending, and the file receiving state bit table can be updated only by confirming the serial numbers of the sub-upgrading file packets in all the sub-upgrading file packets.
It should be noted that, after the electric energy meter receives the upgrade confirmation frame, it is checked whether all the status bits of the file receiving status bit table are updated, and if the file receiving status bit table shows that all the sub-upgrade file packets are successfully received, the electric energy meter executes the upgrade and returns the upgrade success confirmation information.
According to the embodiment of the invention, the method further comprises the following steps:
calculating the characteristic value of the received sub-upgrade file package;
judging whether the characteristic value is repeated with the received characteristic value of the sub-upgrade file package;
if so, it is discarded.
It should be noted that, in order to avoid receiving the sub upgrade file package repeatedly, the feature value of the sub upgrade file package needs to be calculated, and then compared with the feature value of the received sub upgrade file package, if the sub upgrade file package is repeated, it indicates that there is a repeated sub upgrade file package, and the sub upgrade file package is discarded. The method of the invention can improve the receiving and processing efficiency.
According to an embodiment of the present invention, the performing, by the electric energy meter, the upgrade according to the upgrade start command frame further includes:
and if the existing state bit of the file receiving state bit table is not updated, the electric energy meter returns the file receiving state bit table.
It should be noted that, if the status bit in the file reception status bit table is not updated, after the electric energy meter finishes analyzing the start-up upgrade command frame, the file reception status bit table with the un-updated status bit is returned. The corresponding non-updated status bit in the file receiving status bit table represents that the electric energy meter does not successfully receive the sub-upgrade file packet with the corresponding serial number.
According to the embodiment of the present invention, if the existing status bit of the file receiving status bit table is not updated, the returning of the file receiving status bit table by the electric energy meter further includes:
according to the file receiving state bit table and the equipment address of the electric energy meter, the sub-upgrading file packet with the sequence number corresponding to the non-updated state bit is sent to the electric energy meter, the electric energy meter updates the file receiving state bit table and returns confirmation information;
and returning to send the upgrading confirmation frame to the electric energy meter again.
After receiving the file receiving state bit table with the updated existing state bit, the file receiving state bit table is analyzed to determine the device address of the electric energy meter, so that the missing sub-upgrade file packet is directionally sent to the electric energy meter according to the device address of the electric energy meter, and the electric energy meter returns the determination information again. The electric energy meter can sequentially return confirmation information aiming at each missing sub-upgrade file packet, and can also return the confirmation information once after the file receiving state bit tables in the electric energy meter are completely updated. And if the first confirmation information returning mode is adopted, the upgrading confirmation frame is sent to the electric energy meter again after the last missing sub upgrading file packet is sent and the confirmation information is returned, and if the second confirmation information returning mode is adopted, the upgrading confirmation frame is sent to the electric energy meter again after the returned confirmation information is received.
According to the embodiment of the invention, the method further comprises the following steps:
confirming a preset sub-upgrade file package according to the specification of the electric energy meter to be upgraded;
calculating a characteristic value according to the preset sub-upgrade file package;
matching the number of items according to the characteristic value of the receiving sub-upgrading file packet of the updated state bit table of the updated electric energy meter and the characteristic value of the preset sub-upgrading file packet;
the item number matching comprises characteristic value sequence matching and characteristic value sum matching;
and if the item number is correctly matched, the electric energy meter is successfully upgraded.
It should be noted that, in order to check whether the electric energy meter is upgraded successfully, the sum of the characteristic value sequence and the characteristic value calculated by the preset sub-upgrade file packet is matched with the sum of the characteristic value sequence and the characteristic value of the receiving sub-upgrade file packet of the state bit table updated by the upgraded electric energy meter, and if the matching is successful, the electric energy meter is upgraded successfully.
According to the embodiment of the invention, the method further comprises the following steps:
if the electric energy meter file receiving state bit table exists that the state bit is not updated, judging whether the un-updated state bit has a matching vacancy of the sub-upgrade file packet;
if the sub-upgrade file packet is matched with the vacancy, returning according to the non-updated state bit and the electric energy meter equipment address;
formatting and resetting the electric energy meter state bit table into a last version state bit table;
and updating and upgrading the state bit table according to the formatted reset electric energy meter.
It should be noted that, if the receiving status bit table of the electric energy meter file has a status bit that is not updated, it is determined whether the un-updated status bit has a sub-upgrade file packet mismatch condition, that is, a sub-upgrade file packet matching vacancy occurs, if the sub-upgrade file packet matching vacancy exists, a return is made according to the un-updated status bit and the electric energy meter device address, the electric energy meter status bit table is formatted and reset to the previous version status bit table, and then the status bit table is updated and updated according to the electric energy meter after the formatting and resetting.
According to the embodiment of the invention, the method further comprises the following steps:
marking the state bit to be updated according to the corresponding updated state bit table of the electric energy meter to be updated;
editing and positioning the sub-upgrade file packet according to the state bit to be updated;
arranging the characteristic values of the corresponding sub-upgrade file packages according to the editing positioning to generate a characteristic value array;
and performing arrangement fitting on the characteristic values of the sub-upgrade file packages of the electric energy meter after upgrading is completed and the characteristic value array, and if the fitting degree is 1, successfully upgrading the electric energy meter.
It should be noted that, the state bit to be updated is marked according to the corresponding update state bit table of the electric energy meter to be updated, editing and positioning are performed according to the sub-update file packet corresponding to the state bit to be updated, then the eigenvalue of the corresponding sub-update file packet is arranged according to the editing and positioning to generate the eigenvalue array, arrangement and fitting are performed according to the eigenvalue of the sub-update file packet of the electric energy meter after the update is completed and the eigenvalue array of the editing and positioning, and if the fitting degree is 1, the electric energy meter is successfully updated.
A third aspect of the present invention provides a computer-readable storage medium, where the computer-readable storage medium includes a program of a method for quickly upgrading firmware of an electric energy meter of a machine, and when the program of the method is executed by a processor, the method for quickly upgrading firmware of an electric energy meter realizes the steps of the method for quickly upgrading firmware of an electric energy meter.
The invention discloses a method, a system and a readable storage medium for rapidly upgrading firmware of an electric energy meter. The upgrading method and the upgrading device further ensure the upgrading state of the electric energy meter by sending the upgrading confirmation frame to the electric energy meter one by one, and the upgrading success rate is improved. In addition, the electric energy meter which misses sending the sub-upgrading file package is directionally and additionally sent to the corresponding sub-upgrading file package based on the file receiving state bit table, omission of the sub-upgrading file package is avoided, and upgrading integrity is guaranteed.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described device embodiments are merely illustrative, for example, the division of the unit is only a logical functional division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between the devices or units may be electrical, mechanical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units; can be located in one place or distributed on a plurality of network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, all the functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately regarded as one unit, or two or more units may be integrated into one unit; the integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium includes: a mobile storage device, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and various media capable of storing program codes.
Alternatively, the integrated unit of the present invention may be stored in a computer-readable storage medium if it is implemented in the form of a software functional module and sold or used as a separate product. Based on such understanding, the technical solutions of the embodiments of the present invention may be essentially implemented or a part contributing to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the methods described in the embodiments of the present invention. And the aforementioned storage medium includes: a removable storage device, a ROM, a RAM, a magnetic or optical disk, or various other media that can store program code.

Claims (5)

1. A method for rapidly upgrading firmware of an electric energy meter is characterized by comprising the following steps:
loading an upgrade file and splitting the upgrade file according to a preset sub-package size to obtain sub-upgrade file packages and sub-package quantity;
sending a start upgrading command frame to gateway equipment by taking a broadcast address as an equipment address, so that the gateway equipment broadcasts the start upgrading command frame to a corresponding electric energy meter based on the broadcast address, the electric energy meter executes upgrading according to the start upgrading command frame, and the start upgrading command frame carries the version number of the upgrading file, all the sub-upgrading file packets and the sub-packet number;
the sending a start upgrading command frame to a gateway device with a broadcast address as a device address, so that the broadcasting of the start upgrading command frame to a corresponding electric energy meter by the gateway device based on the broadcast address further includes:
acquiring electric energy meter information in the gateway equipment, wherein the electric energy meter information comprises the number of electric energy meters and the equipment address of the electric energy meter;
sending upgrading confirmation frames to the corresponding electric energy meters one by one according to the electric energy meter equipment addresses;
after the electric energy meter executes upgrading according to the upgrading starting command frame, receiving upgrading success confirmation information sent by the electric energy meter;
the electric energy meter executes upgrading according to the upgrading starting command frame, and the upgrading method specifically comprises the following steps:
the electric energy meter initializes a file receiving state bit table according to the sub-packet quantity;
the electric energy meter updates the file receiving state bit table according to the received serial number of the sub-upgrading file packet;
if all the status bits of the file receiving status bit table are updated, the electric energy meter executes upgrading and sends upgrading success confirmation information;
further comprising:
calculating the characteristic value of the received sub-upgrade file package;
judging whether the characteristic value is repeated with the received characteristic value of the sub-upgrade file package;
if so, discarding;
further comprising:
confirming a preset sub-upgrade file package according to the specification of the electric energy meter to be upgraded;
calculating a characteristic value according to the preset sub-upgrade file package;
according to the characteristic value of the receiving sub-upgrade file packet of the updated state bit table of the updated electric energy meter and the preset sub-upgrade
Matching the number of terms of the characteristic values of the level file packet;
the item number matching comprises characteristic value sequence matching and characteristic value sum matching;
if the item number is correctly matched, the electric energy meter is successfully upgraded;
further comprising:
if the electric energy meter file receiving state bit table exists that the state bit is not updated, judging whether the un-updated state bit has a matching vacancy of the sub-upgrade file packet;
if the sub-upgrade file packet is matched with the vacancy, the electric energy meter equipment is connected with the non-updated state bit
Returning the address;
formatting and resetting the electric energy meter state bit table into a last version state bit table;
and updating and upgrading the state bit table according to the formatted reset electric energy meter.
2. The method for rapidly upgrading firmware of an electric energy meter according to claim 1, wherein the step of performing upgrading by the electric energy meter according to the start-up upgrading command frame further comprises the steps of:
and if the existing state bit of the file receiving state bit table is not updated, the electric energy meter returns the file receiving state bit table.
3. The method for rapidly upgrading firmware of an electric energy meter according to claim 2, wherein if the status bit of the file reception status bit table is not updated, the method further includes, after the electric energy meter returns the file reception status bit table:
according to the file receiving state bit table and the equipment address of the electric energy meter, the sub-upgrading file packet with the sequence number corresponding to the non-updated state bit is sent to the electric energy meter, the electric energy meter updates the file receiving state bit table and returns confirmation information;
and returning to send the upgrading confirmation frame to the electric energy meter again.
4. The system for rapidly upgrading the firmware of the electric energy meter is characterized by comprising a memory and a processor, wherein the memory comprises a program of a method for rapidly upgrading the firmware of the electric energy meter, and the program of the method for rapidly upgrading the firmware of the electric energy meter realizes the following steps when being executed by the processor:
loading an upgrade file and splitting the upgrade file according to a preset sub-package size to obtain sub-upgrade file packages and sub-package quantity;
sending a start upgrading command frame to gateway equipment by taking a broadcast address as an equipment address, so that the gateway equipment broadcasts the start upgrading command frame to a corresponding electric energy meter based on the broadcast address, the electric energy meter executes upgrading according to the start upgrading command frame, and the start upgrading command frame carries the version number of the upgrading file, all the sub-upgrading file packets and the sub-packet number;
the sending a start upgrading command frame to a gateway device with a broadcast address as a device address, so that the broadcasting of the start upgrading command frame to a corresponding electric energy meter by the gateway device based on the broadcast address further includes:
acquiring electric energy meter information in the gateway equipment, wherein the electric energy meter information comprises the number of electric energy meters and the address of the electric energy meter equipment;
sending upgrading confirmation frames to the corresponding electric energy meters one by one according to the equipment addresses of the electric energy meters;
after the electric energy meter executes upgrading according to the upgrading starting command frame, receiving upgrading success confirmation information sent by the electric energy meter;
the electric energy meter executes upgrading according to the upgrading starting command frame, and the upgrading method specifically comprises the following steps:
the electric energy meter initializes a file receiving state bit table according to the sub-packet quantity;
the electric energy meter updates the file receiving state bit table according to the received serial number of the sub-upgrading file packet;
if all the status bits of the file receiving status bit table are updated, the electric energy meter executes upgrading and sends upgrading success confirmation information;
further comprising:
calculating the characteristic value of the received sub-upgrade file package;
judging whether the characteristic value is repeated with the received characteristic value of the sub-upgrade file package;
if so, discarding;
further comprising:
confirming a preset sub-upgrade file package according to the specification of the electric energy meter to be upgraded;
calculating a characteristic value according to the preset sub-upgrade file package;
according to the characteristic value of the receiving sub-upgrade file packet of the updated state bit table of the updated electric energy meter and the preset sub-upgrade
Matching the number of terms of the characteristic values of the level file packet;
the item number matching comprises characteristic value sequence matching and characteristic value sum matching;
if the item number is matched correctly, the electric energy meter is upgraded successfully;
further comprising:
if the electric energy meter file receiving state bit table exists that the state bit is not updated, judging whether the un-updated state bit has a matching vacancy of the sub-upgrade file packet;
if the sub-upgrade file packet is matched with the vacancy, the electric energy meter equipment is connected with the non-updated state bit
Returning the address;
formatting and resetting the electric energy meter state bit table into a last version state bit table;
and updating and upgrading the state bit table according to the formatted reset electric energy meter.
5. A computer-readable storage medium, characterized in that the computer-readable storage medium includes a program of a method for quickly upgrading firmware of an electric energy meter, and when the program of the method is executed by a processor, the steps of a method for quickly upgrading firmware of an electric energy meter according to any one of claims 1 to 3 are implemented.
CN202210245270.3A 2022-03-14 2022-03-14 Method and system for rapidly upgrading firmware of electric energy meter and readable storage medium Active CN114338656B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210245270.3A CN114338656B (en) 2022-03-14 2022-03-14 Method and system for rapidly upgrading firmware of electric energy meter and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210245270.3A CN114338656B (en) 2022-03-14 2022-03-14 Method and system for rapidly upgrading firmware of electric energy meter and readable storage medium

Publications (2)

Publication Number Publication Date
CN114338656A CN114338656A (en) 2022-04-12
CN114338656B true CN114338656B (en) 2022-07-19

Family

ID=81033861

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210245270.3A Active CN114338656B (en) 2022-03-14 2022-03-14 Method and system for rapidly upgrading firmware of electric energy meter and readable storage medium

Country Status (1)

Country Link
CN (1) CN114338656B (en)

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101093398B1 (en) * 2010-09-03 2011-12-14 엘에스산전 주식회사 Energy management system and smart meter
TW201344576A (en) * 2012-04-17 2013-11-01 Hon Hai Prec Ind Co Ltd Firmware upgrade method and system and terminal device using the method
CN109002303A (en) * 2017-05-26 2018-12-14 中兴通讯股份有限公司 A kind of intelligent electric meter firmware upgrade method, equipment and storage medium
CN108664262A (en) * 2018-05-09 2018-10-16 顺丰科技有限公司 Firmware batch upgrading method, system and the storage medium of wireless sorting device
CN110471678A (en) * 2019-07-04 2019-11-19 中国电力科学研究院有限公司 A kind of method that electric energy meter firmware uses cast communication mode to upgrade
CN110597539A (en) * 2019-09-05 2019-12-20 威胜集团有限公司 Electric energy meter upgrading method, system and storage medium
CN111145523B (en) * 2020-01-03 2021-05-04 重庆邮电大学 Method for upgrading micropower wireless communication module in electricity consumption information acquisition system
CN111538515A (en) * 2020-04-17 2020-08-14 杭州海兴电力科技股份有限公司 Method, device and equipment for upgrading electric energy meter program
CN112583646A (en) * 2020-12-25 2021-03-30 宁波三星医疗电气股份有限公司 Remote upgrading method for intelligent electric meter
CN113778484A (en) * 2021-09-03 2021-12-10 珠海格力电器股份有限公司 Method, device and system for upgrading equipment firmware, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN114338656A (en) 2022-04-12

Similar Documents

Publication Publication Date Title
CN108460115B (en) Message pushing method and device, computer equipment and storage medium
CN104834602A (en) Program issuing method, device and system
CN110286918B (en) Circuit board software downloading method, software downloading device and storage medium
CN105187444A (en) Key information burning method and device
CN105704241A (en) Client terminal program updating method and system and a service platform
CN111638891A (en) Equipment upgrading method and device, terminal equipment and storage medium
CN114025032B (en) Transmission protocol method, system, equipment and storage medium of EMS and BMS
CN103200022A (en) Handing method, equipment and system of data downloading abnormity
CN112286565A (en) Embedded system differential upgrading method based on storage container
CN114221866A (en) Method, device and medium for upgrading terminal
CN114338656B (en) Method and system for rapidly upgrading firmware of electric energy meter and readable storage medium
CN107888426B (en) Configuration method and device of network terminal equipment, batch processing equipment and storage medium
CN102722404A (en) Management system, device and method for application software in intelligent terminal
JPH11143730A (en) Method for testing computer system device
CN101197959B (en) Terminal control method, system and equipment
CN108600296B (en) Merchant information processing method and device, electronic equipment and storage medium
CN113050980B (en) Function configuration information acquisition method and device and computer readable storage medium
CN114285739A (en) Node information batch configuration method, device, terminal and storage medium
CN110225097B (en) Information processing method, device and storage medium
CN106412657B (en) A kind of method and system of set-top box programming sequence code
CN111507447A (en) Label identification method and device
CN110347683B (en) Data table merging processing method and device
CN113076111A (en) Customized cluster configuration method, system, terminal and storage medium
CN114579166A (en) Component module upgrading method, component module and financial robot
CN116107603B (en) Firmware upgrading method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant