Communication protocol system of electric energy meter and upper computer

By adaptively adjusting the baud rate and automatic verification mechanism, the problem of insufficient transmission stability of traditional communication solutions in smart power systems is solved, the stability and convenience of communication between the electricity meter and the host computer are achieved, and the efficiency and reliability of data interaction are improved.

CN120602046APending Publication Date: 2025-09-05LONGYUAN BEIJING WIND POWER ENG TECH +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510820678.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-18
Publication Date
2025-09-05

AI Technical Summary

Technical Problem

Traditional communication solutions in smart power systems have problems such as insufficient transmission stability, imperfect automatic verification mechanisms, and inconvenient and unsophisticated data interaction. These solutions are particularly inefficient and prone to data interaction confusion in complex interaction scenarios with multiple data points and multi-functional areas.

Method used

The transmission status data of multiple historical messages is obtained through the host computer, the current baud rate is determined, a request frame is constructed and sent to the electricity meter, and the electricity meter sends a response frame and a data frame after correctness verification. Combined with the bit error rate adjustment strategy and retransmission mechanism, adaptive adjustment of the baud rate and automatic verification of key information are achieved.

Benefits of technology

It improves the stability and convenience of communication between the electricity meter and the host computer, ensures the reliability and efficiency of data transmission, simplifies the development process, and reduces code redundancy and debugging cycle.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120602046A_ABST
    Figure CN120602046A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of data communication, and provides a communication protocol system of an electric energy meter and an upper computer, which comprises the upper computer and the electric energy meter, the upper computer is used for acquiring transmission state data of a plurality of historical messages, determining a current baud rate according to the transmission state data, constructing a request frame, and sending the request frame to the electric energy meter according to the current baud rate; the electric energy meter is used for performing correctness verification on first key information in the request frame, if the verification is passed, sending a response frame to the upper computer, analyzing key identification information in the request frame, querying target data according to an analysis result, and constructing and sending a data frame to the upper computer according to the queried target data; and the upper computer is also used for analyzing the data frame to obtain the target data if the data frame is subsequently received and the second key information in the data frame passes the correctness verification after the response frame is received within the set duration. According to the scheme, the stability and convenience of a communication link between the electric energy meter and the upper computer can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data communication, and in particular to a communication protocol system between an electric energy meter and a host computer. Background Art

[0002] In smart power systems, communication between energy meters and host computers is a key component in power data collection, equipment monitoring, and parameter configuration. Current systems must support real-time display of energy data and equipment status, as well as remote control of meter operating modes, relay control, and other functions. This places higher demands on data transmission stability, flexibility, and development efficiency.

[0003] In related technologies, traditional communication solutions have exposed certain flaws in smart power system data interaction scenarios. On the one hand, while custom protocols based on UART, TCP, and UDP can meet specific needs, developers need to independently design data transmission formats, error handling logic, and multi-data point access mechanisms. For example, for the multi-level data points divided by pages and functional areas in the power meter host computer, custom protocols need to develop parsing rules one by one, resulting in long debugging cycles, high code redundancy, and difficulty in ensuring transmission stability. On the other hand, the MODBUS protocol, as a common industry solution, only provides basic message formats for reading and writing coils and registers, and lacks built-in packet loss identification and error retransmission mechanisms. In the power meter communication scenario, developers need to additionally implement packet unpacking, data parsing, and unified access logic across pages or functional areas. For example, when multiple data points in a specific functional area of ​​a page need to be accessed, MODBUS needs to split the read and write operations multiple times, which is inefficient and easily leads to data interaction confusion.

[0004] Therefore, when faced with complex interactive scenarios with multiple data points and multi-functional areas, traditional communication solutions have technical problems such as insufficient transmission stability, imperfect automatic verification mechanisms, and insufficient simplicity and convenience in data interaction. Summary of the Invention

[0005] The present invention provides a communication protocol system between an electric energy meter and a host computer, which is used to solve the defects of traditional communication solutions, such as insufficient transmission stability, imperfect automatic verification mechanism, and insufficient simplicity and convenience in data interaction.

[0006] The present invention provides a communication protocol system between an electric energy meter and a host computer, comprising: a host computer and an electric energy meter; The host computer is used to obtain transmission status data of multiple historical messages, determine the current baud rate according to the transmission status data, construct a request frame, and send the request frame to the electric energy meter at the current baud rate; The electric energy meter is configured to, after receiving the request frame, perform a correctness check on the first key information in the request frame, and if the check passes, send a response frame to the host computer, parse the key identification information in the request frame, query the target data according to the parsing result, and construct and send a data frame to the host computer based on the queried target data; The host computer is further configured to, after receiving the response frame within a set time period, parse the data frame to obtain the target data if the data frame is subsequently received and the second key information in the data frame passes the correctness check.

[0007] According to the communication protocol system between the electric energy meter and the host computer provided by the present invention, the host computer determines the current baud rate according to the transmission status data, including: Calculating an actual bit error rate based on the transmission status data; Comparing the actual bit error rate with a preset bit error rate upper limit and a preset bit error rate lower limit, respectively, to obtain a comparison result; determining a baud rate adjustment strategy based on the comparison result; The set baud rate is adjusted according to the baud rate adjustment strategy to obtain the current baud rate.

[0008] According to the communication protocol system between the electric energy meter and the host computer provided by the present invention, a baud rate adjustment strategy is determined based on the comparison result, including: If the comparison result is that the bit error rate deviation exceeds the bit error rate upper limit, determining that the baud rate adjustment strategy is to reduce the baud rate according to the first adjustment amount; If the comparison result is that the bit error rate deviation is lower than the bit error rate lower limit, the baud rate adjustment strategy is determined to be to increase the baud rate according to the second adjustment amount.

[0009] According to the communication protocol system between the electric energy meter and the host computer provided by the present invention, after the host computer sends the request frame to the electric energy meter at the current baud rate, if the host computer does not receive the response frame within the set time length, and after resending the request frame at the current baud rate for a set number of times and still does not receive the response frame within the set time length, the current baud rate is adjusted to the set baud rate, and a fault prompt message is issued.

[0010] According to the communication protocol system between the electric energy meter and the host computer provided by the present invention, the host computer is further used to construct and send a remote control frame to the electric energy meter; The electric energy meter is also used to check the correctness of the third key information in the remote control frame after receiving the remote control frame. If the check passes, a response frame is sent to the host computer so that the host computer stops timing after receiving the response frame. The electric energy meter is also used to parse the remote control frame, obtain the remote control instruction content, and execute the operation corresponding to the remote control instruction content.

[0011] According to the communication protocol system between the electric energy meter and the host computer provided by the present invention, if the electric energy meter detects error information when executing the operation corresponding to the remote control instruction content, it sends an error frame to the host computer, wherein the error frame includes an error code indicating the error type; After receiving the error frame, the host computer determines the error type according to the error code, and resends the remote control frame to the electric energy meter according to the error type.

[0012] According to the communication protocol system between the electric energy meter and the host computer provided by the present invention, the host computer resends the remote control frame to the electric energy meter according to the error type, including: Determine the current number of retransmissions; Determining a retransmission strategy based on the current number of retransmissions and the error type; Resend the remote control frame to the electric energy meter according to the retransmission strategy.

[0013] According to the communication protocol system between the electric energy meter and the host computer provided by the present invention, a retransmission strategy is determined based on the current number of retransmissions and the error type, including: If the current number of retransmissions is one, and the error type is a CRC check error, the retransmission strategy is to extend the sending time interval to a target duration, and resend the remote control frame to the electric energy meter according to the target duration; If the current number of retransmissions is two and the error type is a data format error, the retransmission strategy is to send a status query frame to the electric energy meter, determine a retransmission communication channel based on the communication status fed back by the electric energy meter, and resend the remote control frame to the electric energy meter according to the retransmission communication channel; If the current number of retransmissions is more than three times, and the data type is a data format error, a duplicate serial number, or a function area error, the retransmission strategy is to send a manual intervention request to the user to resend the remote control frame to the electricity meter under manual intervention.

[0014] According to the communication protocol system between the electric energy meter and the host computer provided by the present invention, the request frame includes: a first frame header, a first total length, a first frame type, a first sequence number, a page number, a function area number, a data point identifier, a first frame footer, and a first CRC16 check value; The data frame includes: a second frame header, a second total length, a second frame type, a second sequence number, a data point structure, a second frame tail and a second CRC16 check value.

[0015] According to the communication protocol system between the electric energy meter and the host computer provided by the present invention, the second key information includes: a second CRC16 check value and a key data field in the data point structure; The second key information in the data frame passes the correctness check and is determined by the following process: Performing a correctness check on the second CRC16 check value to obtain a first check result; Performing a sum check on the key data field to obtain a second check result; If both the first verification result and the second verification result are passed, it is determined that the second key information in the data frame passes the correctness verification.

[0016] The communication protocol system between an electric energy meter and a host computer provided by the present invention cooperates with the host computer. The host computer obtains transmission status data of multiple historical messages, determines the current baud rate based on the transmission status data, constructs a request frame, and sends the request frame to the electric energy meter at the current baud rate. After receiving the request frame, the electric energy meter performs a correctness check on the first key information in the request frame. If the check passes, the electric energy meter sends a response frame to the host computer, parses the key identification information in the request frame, queries the target data based on the parsed result, and constructs and sends a data frame to the host computer based on the queried target data. After the host computer receives the response frame within a set time, if it subsequently receives a data frame and the second key information in the data frame passes the correctness check, the data frame is parsed to obtain the target data. Since the current baud rate used for data transmission is determined based on the transmission status data, adaptive adjustment of the baud rate of the communication link can be achieved. At the same time, the automatic verification operation of the correctness of the key information in the request frame and the data frame can improve the stability and convenience of the communication link between the electric energy meter and the host computer. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0018] Figure 1 It is a structural diagram of a communication protocol system between an electric energy meter and a host computer provided by an embodiment of the present invention; Figure 2 This is a schematic diagram of the implementation principle of the host computer requesting data; Figure 3 It is a schematic diagram of the implementation principle of the upper computer and lower control link. DETAILED DESCRIPTION

[0019] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.

[0020] The following combination Figures 1 to 3 The detailed scheme of the communication protocol system between the electric energy meter and the host computer provided by the embodiment of the present invention is described.

[0021] Figure 1 It is a structural diagram of a communication protocol system between an electric energy meter and a host computer provided by an embodiment of the present invention.

[0022] like Figure 1 As shown, the communication protocol system between the electric energy meter and the host computer provided in the embodiment of the present invention specifically includes: a host computer 110 and an electric energy meter 120.

[0023] The host computer 110 is used to obtain transmission status data of multiple historical messages, determine the current baud rate according to the transmission status data, construct a request frame, and send the request frame to the electric energy meter 120 according to the current baud rate.

[0024] The electric energy meter 120 is used to verify the correctness of the first key information in the request frame after receiving the request frame. If the verification passes, a response frame is sent to the host computer 110, the key identification information in the request frame is parsed, the target data is queried according to the parsing result, and the data frame is constructed and sent to the host computer 110 based on the queried target data.

[0025] The host computer 110 is further configured to, after receiving a response frame within a set time period, parse the data frame to obtain target data if a data frame is subsequently received and the second key information in the data frame passes the correctness check.

[0026] like Figure 2 As shown in the figure, when the upper computer requests data, it first sends a request frame. After the electric energy meter receives and sends the message, it performs corresponding analysis and judgment. If the message is correct, that is, the first key information in the request frame passes the correctness check, it first sends a response frame to indicate that it has correctly received the message, and then sends a data frame to send the data requested by the upper computer.

[0027] If the message contains an error, that is, the first key information in the request frame fails the correctness check, the energy meter will determine the error type and send an error frame to notify the host computer. If the host computer receives the error frame or does not receive the response frame, it needs to resend the request frame to the energy meter.

[0028] In one embodiment, the host computer determines the current baud rate based on the transmission status data, specifically including: The first step is to calculate the actual bit error rate based on the transmission status data.

[0029] In this embodiment, a sliding window can be set to monitor the transmission status of historical messages through a sliding window detection method. For example, the transmission status data of the most recent 10 historical messages can be continuously obtained through the sliding window. By counting the number of errors (such as CRC errors that cause bit errors) in these 10 historical messages and dividing the number by 10, the actual bit error rate for that period can be obtained. This sliding window mechanism can reflect the accuracy of recent data transmission in real time, providing a data basis for the system to adjust the baud rate based on the actual bit error rate.

[0030] In the second step, the actual bit error rate is compared with the preset bit error rate upper limit value and the bit error rate lower limit value to obtain a comparison result.

[0031] In this embodiment, the upper limit value of the bit error rate and the lower limit value of the bit error rate can be reasonably set according to actual communication requirements.

[0032] The third step is to determine the baud rate adjustment strategy based on the comparison results.

[0033] In a specific implementation, a baud rate adjustment strategy is determined based on the comparison result, specifically including: If the comparison result is that the bit error rate deviation exceeds the bit error rate upper limit, the baud rate adjustment strategy is determined to be to reduce the baud rate according to the first adjustment amount.

[0034] In this embodiment, the upper limit of the bit error rate can be 30%. In the smart power system, during communication between the energy meter and the host computer, when the system monitors the actual bit error rate of data transmission in real time and detects that it reaches or exceeds 30%, it indicates that the data transmission reliability is insufficient and automatically triggers the operation of reducing the baud rate. In some embodiments, the first adjustment amount can be set to 4800bps. For example, the set baud rate can be reduced from 9600bps to 4800bps to improve data transmission reliability.

[0035] If the comparison result shows that the bit error rate deviation is lower than the bit error rate lower limit, the baud rate adjustment strategy is determined to be to increase the baud rate according to the second adjustment amount.

[0036] In this embodiment, the lower limit of the bit error rate can be 5%. During the communication process of the smart power system, when the actual bit error rate of data transmission is less than or equal to 5%, and this low bit error rate state remains stable, an operation to increase the baud rate will be triggered, thereby improving the data transmission speed. For example, if the actual bit error rate is less than 5% during 30 consecutive message transmissions and this state remains stable, the baud rate will be increased according to the set baud rate adjustment strategy. For example, if the hardware supports it, in some embodiments, the second adjustment amount can be set to 9600bps, for example, to increase the set baud rate from 9600bps to 19200bps, to achieve adaptive adjustment of the baud rate and optimize communication performance.

[0037] The fourth step is to adjust the set baud rate according to the baud rate adjustment strategy to obtain the current baud rate.

[0038] It is understandable that the baud rate adjustment range can be determined based on what the hardware can actually support. For example, the baud rate range supported by the hardware is from 2400bps to 19200bps, which means that the baud rate adjustment strategy adopted by the system must be selected within the above range to ensure that the hardware can meet the data transmission requirements.

[0039] Based on this, in actual applications, after adjusting the set baud rate according to the baud rate adjustment strategy and obtaining the current baud rate, it is also possible to determine whether the current baud rate is within the feasible baud rate range. If it is within the feasible baud rate range, the current baud rate is retained. If it exceeds the feasible baud rate range, it means that the current baud rate obtained after adjustment is unusable. At this time, the current baud rate needs to be adjusted to the lower limit value or upper limit value of the feasible baud rate range that is closest to the current wave characteristics.

[0040] It can be understood that the baud rate adaptive adjustment scheme can improve the stability and reliability of communication during the communication between the host computer and the electric energy meter.

[0041] In one embodiment, after the upper computer sends a request frame to the electric energy meter at the current baud rate, if the upper computer does not receive a response frame within a set time period, and if the request frame is resent a set number of times at the current baud rate and still does not receive a response frame within the set time period, the current baud rate is adjusted to the set baud rate, and a fault prompt message is issued.

[0042] In this embodiment, if multiple communication failures occur continuously during the subsequent communication process, the communication failure here mainly refers to the situation where there is no response or the sending of an error frame, such as the energy meter not sending a response frame to the host computer within the set time. If such continuous failures occur, it means that the newly switched baud rate may not be suitable for the current communication environment. The system will take measures to fall back to the value before the baud rate adjustment to ensure the stability of the communication link.

[0043] At the same time, the host computer will send a fault prompt to the user and record the fault. Recording the fault will help with subsequent analysis and troubleshooting of communication problems. For example, it can help understand under what circumstances switching the baud rate will cause communication failures, so as to further optimize the communication mechanism. For example, after adjusting the baud rate, if the host computer sends a request frame and the energy meter does not respond normally for five consecutive times, the host computer can adjust the current baud rate back to the previously set value and record the fault information.

[0044] In one embodiment, the host computer is further configured to construct and send a remote control frame to the electric energy meter.

[0045] The electric energy meter is also used to check the correctness of the third key information in the remote control frame after receiving the remote control frame. If the check passes, a response frame is sent to the host computer so that the host computer stops timing after receiving the response frame. The electric energy meter is also used to parse the remote control frame, obtain the remote control instruction content, and execute the operation corresponding to the remote control instruction content.

[0046] like Figure 3 As shown in the figure, when the host computer controls the energy meter, it first sends a remote control frame. After receiving and sending the message, the energy meter parses and judges the corresponding information. If the message is correct, that is, the third key information in the remote control frame passes the correctness check, it first sends a response frame to indicate that it has correctly received the message. If the message is incorrect, that is, the third key information in the remote control frame fails the correctness check, the energy meter will determine the error type and send an error frame to notify the host computer. If the host computer receives an error frame or does not receive a response frame, it needs to resend the remote control frame.

[0047] In one embodiment, if the electric energy meter detects error information when executing the operation corresponding to the remote control command content, it sends an error frame to the host computer, wherein the error frame includes an error code indicating the error type.

[0048] After receiving the error frame, the host computer determines the error type based on the error code and resends the remote control frame to the electric energy meter based on the error type.

[0049] During communication between the host computer and the energy meter in a smart power system, when the energy meter receives and processes the remote control frame sent by the host computer, if an error is detected, it will immediately send an error frame to the host computer. In practical applications, the error frame contains an error code that clearly indicates the type of error that occurred during the remote control frame processing. For example, bits 0-7 of the error code correspond to data format error, frame type error, page error, function area error, ID error, CRC error, data type error, and decimal place error, respectively. The host computer can use these error codes to analyze the cause of the error and take appropriate measures, such as resending the remote control frame or checking the data settings.

[0050] Among them, when the error code is bit0, it indicates a data format error; when the error code is bit1, it indicates a frame type error; when the error code is bit2, it indicates a page number error; when the error code is bit3, it indicates a function area error; when the error code is bit4, it indicates an ID error; when the error code is bit5, it indicates a CRC check error; when the error code is bit6, it indicates a data type error; when the error code is bit7, it indicates an error in the number of decimal places.

[0051] In one embodiment, the host computer resends the remote control frame to the electric energy meter according to the error type, specifically including: First, determine the current number of retransmissions.

[0052] Then, the retransmission strategy is determined based on the current number of retransmissions and the error type.

[0053] Finally, the remote control frame is resent to the electricity meter according to the retransmission strategy.

[0054] In a specific implementation, a retransmission strategy is determined based on the current number of retransmissions and the error type, including: If the current number of retransmissions is one and the error type is a CRC check error, the retransmission strategy is to extend the sending time interval to the target duration and resend the remote control frame to the electric energy meter according to the target duration.

[0055] If the current number of retransmissions is two and the error type is data format error, the retransmission strategy is to send a status query frame to the electric energy meter, determine the retransmission communication channel based on the communication status feedback from the electric energy meter, and resend the remote control frame to the electric energy meter according to the retransmission communication channel.

[0056] If the current retransmission times are more than three times, and the data type is data format error, sequence number duplication or function area error, the retransmission strategy is to send a manual intervention request to the user to resend the remote control frame to the electricity meter under manual intervention.

[0057] The above-mentioned process of determining the retransmission strategy is only described with several typical examples. In actual applications, corresponding retransmission strategies can be adopted for different error types and different current retransmission times.

[0058] Specifically, if the error type is a CRC error, the error is essentially due to data bit distortion during transmission (such as electromagnetic interference or baud rate mismatch). If the current retransmission count is 1, the corresponding retransmission strategy may be to extend the transmission interval, for example, extending the original 100ms interval to the target duration, such as 200ms, to avoid communication conflicts with other devices. If the current retransmission count is 2, the corresponding retransmission strategy may be to reduce the baud rate or extend the transmission interval. For example, if the current baud rate is ≥9600bps, the baud rate may be reduced by one level, such as from 9600bps to 4800bps, to reduce signal distortion. If the baud rate is already at the minimum baud rate, such as 2400bps, the transmission interval may be extended to 300ms. If the current retransmission count is 3 or higher, a backup channel switch operation may be triggered, such as switching from the RS485 main channel to the power line carrier (PLC) channel.

[0059] For errors involving data format errors, the nature of the error is an invalid data field value, such as a Boolean value that is not 0 / 1 or an out-of-range value. When the current retransmission count is 1, the corresponding retransmission strategy can be to re-verify the data format before retransmitting. Specifically, the data point ID in the error frame can be parsed to check whether the corresponding data field complies with the protocol specification, such as the energy value must be ≥0, and then retransmitted after correcting it to a valid value. When the current retransmission count is 2, the corresponding retransmission strategy can be to send a status query frame to the energy meter, determine the retransmission communication channel based on the communication status feedback from the energy meter, and resend the remote control frame to the energy meter according to the retransmission communication channel. When the current retransmission count is 3 or more, the default parameters can be restored. If multiple corrections fail, a "data parameter abnormality" message can be displayed to the host computer to trigger a manual intervention mechanism.

[0060] If the error type is a functional area error, the error is essentially an invalid functional area number. When the current retransmission count is 1, the corresponding retransmission strategy can be to check the functional area mapping table and then retransmit, check the local functional area configuration of the host computer, and correct it to a valid functional area number before retransmitting the remote control frame. When the current retransmission count is 2, the corresponding retransmission strategy can be to send a functional area query frame to obtain a list of all functional areas of the electricity meter, and then retransmit the remote control frame after dynamically updating the host computer configuration. If the current retransmission count is 3 or more, if the functional areas are always mismatched, it is determined that the electricity meter firmware is incompatible with the host computer version and needs to be upgraded simultaneously.

[0061] It should be noted that this embodiment, as an application layer communication protocol, can be transplanted and used in different data links. The message types involved mainly include five frame types: request frame, data frame, remote control frame, response frame and error frame.

[0062] In one embodiment, the request frame specifically includes: a first frame header, a first total length, a first frame type, a first sequence number, a page number, a function area number, a data point identifier, a first frame tail, and a first CRC16 check value.

[0063] In this embodiment, the request frame is used by the host computer to request data from the energy meter to obtain the data value measured in real time by the energy meter and the current working status and configuration status. The data format of the request frame is as follows: 55 AA__ __01__ __ __ __ __FF FF__ __.

[0064] In actual applications, page numbers start at 1, and function area numbers and data point identifiers both start at 0. A function area number of 0 indicates access to the specified point data in all function areas of the page, and a data point identifier of 0 indicates access to all data points in the function area. Each time the host computer sends a request frame, the sequence number increases by 1.

[0065] The data frame includes: a second frame header, a second total length, a second frame type, a second sequence number, a first data point structure, a second frame footer, and a second CRC16 check value. The data format of the data frame is specifically: 55 AA__ __02__ __ __ __ __ __ __ __ ...... __ __ __ __ __ __FF FF____.

[0066] In this embodiment, the data frame is used by the electric energy meter to send the specific data requested by the upper computer. In actual applications, the electric energy meter encapsulates the queried data according to the data frame format, sets the second frame header, the second total length, the second frame type, the second serial number and other fields, fills the data into the first data point structure, calculates the CRC16 check value, and then sends the data frame to the upper computer through the RS-485 bus.

[0067] In this embodiment, the remote control frame is used by the host computer to send configuration data and control signals to the electric energy meter. The remote control frame specifically includes: a third frame header, a third total length, a third frame type, a third sequence number, a second data point structure, a third frame footer, and a third CRC16 checksum. The data format of the remote control frame is specifically: 55 AA__ __03__ __ __ __ __ __ __ __FF FF__ __.

[0068] In this embodiment, the error frame is used to indicate errors that occur during the communication process between the host computer and the electric energy meter. When the receiver finds an error when processing the message, it will send the error frame to the sender. Specifically, the error frame includes: a fourth frame header, a fourth total length, a fourth frame type, a fourth sequence number, an error code, a fourth frame trailer, and a fourth CRC16 checksum. The data format of the error frame is as follows: 55 AA__ __05__ __ __FF FF__ __.

[0069] In this embodiment, the response frame is used when the sender sends a message. The receiver should first send a response frame to notify the sender that it has received the message. If the sender does not receive the response frame, the message retransmission mechanism will be triggered. Specifically, the response frame includes: a fifth frame header, a fifth total length, a fifth frame type, a fifth sequence number, a fifth frame trailer, and a fifth CRC16 checksum. The data format of the response frame is as follows: 55 AA__ __04__ __FF FF__ __.

[0070] In one embodiment, the second key information includes: a second CRC16 check value and a key data field in the data point structure.

[0071] Furthermore, the second key information in the data frame passes the correctness check, which can be specifically determined through the following process: On the one hand, the second CRC16 check value is checked for correctness to obtain a first check result.

[0072] On the other hand, a sum check is performed on the key data field to obtain a second check result.

[0073] Finally, if both the first verification result and the second verification result are passed, it is determined that the second key information in the data frame passes the correctness verification.

[0074] In this embodiment, in addition to checking the CRC16 checksum, a sum check can be added to the data structure of the data frame and remote control frame for key data fields, such as the key configuration parameters of the energy meter or real-time energy data. Specifically, the data bytes can be summed and the lower 8 bits taken. After the CRC16 checksum is verified, the receiver performs a sum check on the key data fields. This double check ensures data accuracy and integrity, further improving communication reliability.

[0075] For example, for the real-time forward total electric energy data of the electric energy meter, after following the verification process of the CRC16 check value, the key data bytes representing the data are then checked. If the check result is inconsistent with the calculation by the sender, it is determined that the data transmission is incorrect and requires to be resent.

[0076] In summary, the communication protocol system between the electric energy meter and the host computer provided in this embodiment defines the message header, message tail, frame type, data type, error code and function of each byte. Developers can use them directly without defining them themselves, which effectively improves development efficiency.

[0077] On the other hand, the data frame defines page code bits, functional area bits, and ID bits, allowing developers to flexibly access data and increasing the flexibility of data access. At the same time, the data frame also defines a type byte that is compatible with the various data types of the electricity meter, allowing different data types to be transmitted in the same data frame. Developers only need to perform receiving processing and do not need to send different request messages for different types, which improves the convenience of program development. The data frame defines the message sequence number, and the received sequence number can be used to determine whether there is packet loss, triggering a retransmission mechanism, thereby effectively improving the stability of data transmission. In addition, an error retransmission mechanism has been added to the data frame transmission link to improve the accuracy of data transmission.

[0078] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A communication protocol system between an electric energy meter and a host computer, characterized in that: include: Host computer and electric energy meter; The host computer is used to obtain transmission status data of multiple historical messages, determine the current baud rate according to the transmission status data, construct a request frame, and send the request frame to the electric energy meter at the current baud rate; The electric energy meter is configured to, after receiving the request frame, perform a correctness check on the first key information in the request frame, and if the check passes, send a response frame to the host computer, parse the key identification information in the request frame, query the target data according to the parsing result, and construct and send a data frame to the host computer based on the queried target data; The host computer is further configured to, after receiving the response frame within a set time period, parse the data frame to obtain the target data if the data frame is subsequently received and the second key information in the data frame passes the correctness check.

2. The communication protocol system between the electric energy meter and the host computer according to claim 1, characterized in that: The host computer determines the current baud rate according to the transmission status data, including: Calculating an actual bit error rate based on the transmission status data; Comparing the actual bit error rate with a preset bit error rate upper limit and a preset bit error rate lower limit, respectively, to obtain a comparison result; determining a baud rate adjustment strategy based on the comparison result; The set baud rate is adjusted according to the baud rate adjustment strategy to obtain the current baud rate.

3. The communication protocol system between the electric energy meter and the host computer according to claim 2, characterized in that: Determining a baud rate adjustment strategy based on the comparison result includes: If the comparison result is that the bit error rate deviation exceeds the bit error rate upper limit, determining that the baud rate adjustment strategy is to reduce the baud rate according to the first adjustment amount; If the comparison result is that the bit error rate deviation is lower than the bit error rate lower limit, the baud rate adjustment strategy is determined to be to increase the baud rate according to the second adjustment amount.

4. The communication protocol system between an electric energy meter and a host computer according to any one of claims 1 to 3, characterized in that: After the host computer sends the request frame to the electricity meter at the current baud rate, if the host computer does not receive the response frame within the set time period, and if the response frame is still not received within the set time period after resending the request frame at the current baud rate a set number of times, the current baud rate is adjusted to the set baud rate, and a fault prompt message is issued.

5. The communication protocol system between the electric energy meter and the host computer according to claim 1, characterized in that: The host computer is also used to construct and send a remote control frame to the electric energy meter; The electric energy meter is also used to check the correctness of the third key information in the remote control frame after receiving the remote control frame. If the check passes, a response frame is sent to the host computer so that the host computer stops timing after receiving the response frame. The electric energy meter is also used to parse the remote control frame, obtain the remote control instruction content, and execute the operation corresponding to the remote control instruction content.

6. The communication protocol system between the electric energy meter and the host computer according to claim 5, characterized in that: If the electric energy meter detects error information when executing the operation corresponding to the remote control instruction content, it sends an error frame to the host computer, wherein the error frame includes an error code indicating the error type; After receiving the error frame, the host computer determines the error type according to the error code, and resends the remote control frame to the electric energy meter according to the error type.

7. The communication protocol system between the electric energy meter and the host computer according to claim 6, characterized in that: The host computer resends the remote control frame to the electric energy meter according to the error type, including: Determine the current number of retransmissions; Determining a retransmission strategy based on the current number of retransmissions and the error type; Resend the remote control frame to the electric energy meter according to the retransmission strategy.

8. The communication protocol system between the electric energy meter and the host computer according to claim 7, characterized in that: Determining a retransmission strategy based on the current number of retransmissions and the error type includes: If the current number of retransmissions is one, and the error type is a CRC check error, the retransmission strategy is to extend the sending time interval to a target duration, and resend the remote control frame to the electric energy meter according to the target duration; If the current number of retransmissions is two and the error type is a data format error, the retransmission strategy is to send a status query frame to the electric energy meter, determine a retransmission communication channel based on the communication status fed back by the electric energy meter, and resend the remote control frame to the electric energy meter according to the retransmission communication channel; If the current number of retransmissions is more than three times, and the data type is a data format error, a duplicate serial number, or a function area error, the retransmission strategy is to send a manual intervention request to the user to resend the remote control frame to the electricity meter under manual intervention.

9. The communication protocol system between the electric energy meter and the host computer according to claim 1, characterized in that: The request frame includes: a first frame header, a first total length, a first frame type, a first sequence number, a page number, a function area number, a data point identifier, a first frame tail, and a first CRC16 check value; The data frame includes: a second frame header, a second total length, a second frame type, a second sequence number, a data point structure, a second frame tail and a second CRC16 check value.

10. The communication protocol system between the electric energy meter and the host computer according to claim 9, characterized in that: The second key information includes: a second CRC16 check value and a key data field in the data point structure; The second key information in the data frame passes the correctness check and is determined by the following process: Performing a correctness check on the second CRC16 check value to obtain a first check result; Performing a sum check on the key data field to obtain a second check result; If both the first verification result and the second verification result are passed, it is determined that the second key information in the data frame passes the correctness verification.

Citation Information

Cited By

  • Embedded device centralized configuration management method and system based on RS485 bus

    CN121644345A