Communication method and device for automatically identifying unfixed-length universal serial port of electric energy meter, medium and equipment

By adopting a state machine-based reception identification processing method in serial port communication, protocol feature extraction and error correction processing are performed, and the problems of low recognition efficiency and poor anti-interference ability in the prior art are solved, thereby achieving efficient and accurate communication transmission.

CN119603318APending Publication Date: 2025-03-11SHENZHEN TECHRISE ELECTRONICS
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411412582.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

When the existing serial communication method processes uncertain message data, there are problems such as low recognition efficiency, low recognition accuracy of DLT698 and DLT645 protocols, high frame rate and poor anti-interference ability, which cannot meet the high requirements of new power systems for data acquisition and response speed.

Method used

The receiving and identification processing method based on the state machine is adopted, and the uncertain message data is obtained through the reception and identification process, protocol feature extraction and identification are performed, the protocol type to which the message data belongs, and error correction processing is performed based on this type, and normal frames that meet the protocol type are intercepted for communication and transmission.

Benefits of technology

It realizes efficient identification and error correction processing of uncertain long message data, improves communication response rate and accuracy, reduces the impact of missing frame rates and interference, and enhances anti-interference ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119603318A_ABST
    Figure CN119603318A_ABST
Patent Text Reader

Abstract

The invention discloses a communication method, device, medium and equipment for automatically identifying an unfixed-length universal serial port of an electric energy meter, and the method comprises the steps: carrying out the receiving and recognition processing of a communication signal message transmitted by a communication bus based on a state machine, so as to obtain a frame of unfixed-length message data; performing protocol feature extraction on the variable-length message data, and determining a protocol type to which the variable-length message data belongs; and according to the protocol type to which the variable-length message data belongs, carrying out error correction processing based on the extracted protocol characteristics, finding out a normal frame conforming to the corresponding protocol type in the variable-length message data, intercepting the normal frame, and carrying out communication transmission by using the normal frame. According to the invention, receiving of frame data with variable lengths is realized, and the method has good applicability; the protocol type to which the variable-length message data belongs can be automatically identified, and the accuracy is high and the efficiency is high; the method has a self-error correction capability, can eliminate incomplete interference frames, avoids frame leakage, and improves the anti-interference capability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a method, device, medium and equipment for automatically identifying a universal serial port communication with an indefinite length of an electric energy meter. Background Art

[0002] DLT698 is a new generation of intelligent energy meter terminal communication protocol, mainly used for communication between energy meters, acquisition terminals and other equipment in the power system. DLT645-2007 is based on the old generation of intelligent energy meter terminal communication protocol, mainly used for data acquisition and remote meter reading communication.

[0003] The upgrading of each substation is inconsistent. The new generation of smart electricity meters as terminals need to automatically identify DLT698 and DLT645-2007 protocols to adapt to the data collection and call requests of new and old substations.

[0004] With the continuous deepening of the construction of new power systems, various special power consumption scenarios have emerged one after another, which has put forward higher requirements on the collection frequency and response speed of the power consumption information collection system. The existing methods of checking the data frame structure and identifying the protocol in the serial port interruption can no longer fully meet the requirements of timely and efficient data transmission. There are problems such as low serial port processing efficiency, low accuracy in identifying the two protocols, high frame leakage rate, and poor anti-interference ability. Summary of the invention

[0005] In view of the above problems, the present invention is proposed to provide a method, device, medium and equipment for automatically identifying universal serial port communication of indefinite length of electric energy meters, which overcomes the above problems or at least partially solves the above problems.

[0006] Other features and advantages of the present invention will become apparent from the following detailed description, or may be learned in part by practice of the present invention.

[0007] According to a first aspect of an embodiment of the present invention, a method for automatically identifying an electric energy meter with an indefinite length universal serial port communication is provided, the method comprising:

[0008] Based on the state machine, the communication signal message sent by the communication bus is received and identified to obtain a frame of indefinite length message data;

[0009] Extracting protocol features from the variable-length message data, performing protocol identification based on the extracted protocol features, and determining the protocol type to which the variable-length message data belongs;

[0010] According to the protocol type to which the variable-length message data belongs, error correction processing is performed on the variable-length message data based on the extracted protocol features, normal frames that conform to the corresponding protocol type in the variable-length message data are found, the normal frames are intercepted, and communication transmission is performed using the normal frames.

[0011] In some embodiments of the present invention, the receiving and identifying processing of the communication signal message sent by the communication bus based on the state machine includes:

[0012] Initialize the receiving state of the state machine to the initial serial port state;

[0013] After receiving the communication signal message sent by the communication bus, receiving identification processing is performed, and when it is confirmed that the communication signal message contains a frame start character, the receiving state of the state machine is adjusted to a data receiving state and a timeout timer is started to start receiving data with the frame start character;

[0014] When the timeout timer times out or the data receiving buffer overflows, the receiving state of the state machine is adjusted to the receiving end state, the serial port is closed and the data receiving is ended, and the indefinite length message data is obtained.

[0015] In some embodiments of the present invention, the method further comprises:

[0016] Setting a timeout threshold of the timeout timer according to the communication baud rate;

[0017] Resetting the timeout timer each time a byte of data is received;

[0018] When the timeout timer reaches the timeout threshold, the receiving state of the state machine is adjusted to the receiving end state.

[0019] In some embodiments of the present invention, extracting protocol features from the variable-length message data, performing protocol identification based on the extracted protocol features, and determining the protocol type to which the variable-length message data belongs includes:

[0020] Extracting protocol features from the variable-length message data, performing protocol identification based on the extracted protocol features, and searching for a frame start field in the protocol features;

[0021] The protocol type corresponding to the variable-length message data is confirmed according to the frame start field, and the protocol type includes the DLT698 protocol and the DLT645 protocol.

[0022] In some embodiments of the present invention, the performing error correction processing on the variable-length message data based on the extracted protocol features according to the protocol type to which the variable-length message data belongs includes:

[0023] Determine a protocol frame format according to the protocol type to which the variable-length message data belongs;

[0024] The extracted protocol features are judged in sequence from the first starting character based on the protocol frame format until a data frame conforming to the protocol frame format is obtained, and the data frame is intercepted from the indefinite-length message data as a normal frame.

[0025] In some embodiments of the present invention, the method further includes: reading the extracted protocol features based on the protocol frame format starting from the first starting character, and making judgments in sequence; if no data frame conforming to the protocol frame format is found before the first ending character, continuing to read the indefinite-length message data, and selecting the next starting character as the starting bit for judging the protocol frame format.

[0026] In some embodiments of the present invention, the method further includes: when the number of received characters remaining to be searched in the variable-length message data does not meet a preset number, if no data frame conforming to the protocol frame format is found, all of the variable-length message data is discarded and new variable-length message data is reacquired.

[0027] According to a second aspect of an embodiment of the present invention, there is provided a device for automatically identifying an electric energy meter with an indefinite length universal serial port communication, the device comprising:

[0028] A data receiving module is used to receive and identify the communication signal message sent by the communication bus based on the state machine to obtain a frame of indefinite length message data;

[0029] A protocol identification module, used to extract protocol features from the variable-length message data, perform protocol identification based on the extracted protocol features, and determine the protocol type to which the variable-length message data belongs;

[0030] A data error correction module is used to perform error correction processing on the variable-length message data based on the extracted protocol features according to the protocol type to which the variable-length message data belongs, find normal frames in the variable-length message data that conform to its corresponding protocol type, intercept the normal frames, and use the normal frames for communication transmission.

[0031] According to a third aspect of an embodiment of the present invention, a computer-readable storage medium is provided, in which computer program instructions are stored. The computer program instructions are loaded and executed by a processor to implement the operations performed by any of the methods described above.

[0032] According to a fourth aspect of an embodiment of the present invention, there is provided an electronic device, comprising a processor and a memory, wherein the memory stores computer program instructions that can be executed by the processor, and when the processor executes the computer program instructions, it implements instructions of any of the methods described above.

[0033] The technical solution provided in the embodiments of the present invention has at least the following technical effects or advantages:

[0034] The embodiments of the present invention provide a method, device, medium and equipment for automatically identifying the indefinite-length universal serial port communication of an electric energy meter. The method for automatically identifying the indefinite-length universal serial port communication of an electric energy meter described in the embodiments of the present invention realizes the reception of indefinite-length frame data, and at the same time, can be used without distinguishing the communication implementation method generally used in the communication channel, and has better applicability; it can automatically identify the protocol type to which the indefinite-length message data belongs, and can perform feature recognition on the entire frame on the basis of ensuring the communication response rate, with high accuracy and efficiency; it has self-correction capability, and can exclude incomplete interference frames mixed in the front, middle and back of normal frames, and obtain normal frames. It can also accurately process abnormal frames such as continuous frames to avoid frame leakage, thereby improving anti-interference capability.

[0035] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0037] Figure 1 A flow chart of a method for automatically identifying a universal serial port communication of an electric energy meter with an indefinite length provided by an embodiment of the present invention;

[0038] Figure 2 A reference schematic diagram of the process of serial port receiving and processing of indefinite length message data of the present invention;

[0039] Figure 3 A schematic diagram showing the process of protocol identification according to the present invention;

[0040] Figure 4 A reference diagram of the error correction process based on the DLT645 protocol;

[0041] Figure 5A reference diagram of the error correction process based on the DLT698 protocol;

[0042] Figure 6 A schematic diagram of the principle structure of a general serial port communication device for automatically identifying an electric energy meter with an indefinite length provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0043] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings.

[0044] Various structural schematic diagrams according to embodiments of the present disclosure are shown in the accompanying drawings. These figures are not drawn to scale, and some details are magnified and some details may be omitted for the purpose of clear expression. The shapes of various regions and layers shown in the figures and the relative sizes and positional relationships therebetween are only exemplary, and may deviate in practice due to manufacturing tolerances or technical limitations, and those skilled in the art may further design regions / layers with different shapes, sizes, and relative positions according to actual needs.

[0045] In the context of the present disclosure, when a layer / element is referred to as being "on" another layer / element, the layer / element may be directly on the other layer / element, or there may be an intervening layer / element therebetween. Additionally, if a layer / element is "on" another layer / element in one orientation, the layer / element may be "below" the other layer / element when the orientation is reversed. In the context of the present disclosure, similar or identical components may be denoted by the same or similar reference numerals.

[0046] In order to better understand the above-mentioned technical scheme, the above-mentioned technical scheme will be described in detail below in combination with specific implementation methods. It should be understood that the embodiments of the present disclosure and the specific features in the embodiments are detailed descriptions of the technical scheme of the present invention, rather than limitations on the technical scheme of the present invention. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.

[0047] Figure 1 1 is a flow chart of a method for automatically identifying a universal serial port communication method of an electric energy meter with an indefinite length provided by an embodiment of the present invention. Figure 1 As shown, the method for automatically identifying the indefinite length universal serial port communication of the electric energy meter includes the following steps:

[0048] S1. Based on the state machine, a communication signal message sent by the communication bus is received and identified to obtain a frame of indefinite length message data.

[0049] In the embodiment of the present invention, the source of the communication signal message is not limited to a single channel, and may be from infrared, RS485 channel, HPLC, micro-power wireless, etc., which has better applicability.

[0050] The state machine is used to control the data receiving state of the universal serial port in the embodiment of the present invention, and obtains a complete frame of indefinite length message data after receiving and identifying the communication signal message sent by the communication bus.

[0051] Combination Figure 2 As shown, it is a reference schematic diagram of the process of serial port receiving processing of indefinite length message data of the present invention. Specifically, the state of the state machine includes an initial serial port state, a data receiving state and a receiving end state, which respectively control the serial port to be in an idle state, a receiving state (receiving data) and a receiving end state (stop receiving data). Then, the embodiment of the present invention performs receiving identification processing on the communication signal message sent by the communication bus based on the state machine, including: initializing the receiving state of the state machine to the initial serial port state; performing receiving identification processing after receiving the communication signal message sent by the communication bus, and when confirming that the communication signal message contains a frame start character, adjusting the receiving state of the state machine to the data receiving state and starting the timeout timer, and starting to receive data with the frame start character; when the timeout timer times out or the data receiving buffer overflows, adjusting the receiving state of the state machine to the receiving end state, closing the serial port and ending the data reception, and obtaining the indefinite length message data.

[0052] For example, the initial serial port state is "idle state -- DLC_STATE_IDLE". In order to respond promptly to the serial port interrupt reception of data, when specific characters such as the frame start character "0x68 -- frame start character" are received, the state machine controls the serial port reception state to switch to "receiving DLC_RECIVING" and starts the timeout timer. When the timeout timer overflows or the receiving buffer overflows, it is determined that a frame is received. The serial port reception state switches to "receiving end DLC_RECIVED", the serial port reception is closed, and the protocol identification and frame parsing are handled by the ordinary thread.

[0053] Of course, it should be noted that the embodiment of the present invention can also set the timeout threshold of the timeout timer according to the communication baud rate. For example, the communication baud rate can be 300bps, 600bps, 1200bps, 2400bps, 4800bps, 9600bps, 19200bps, 38400bps, 57600bps, 115200bps, etc., and the timeout threshold of the timer can be set to 3 times the communication baud rate; the embodiment of the present invention resets the timeout timer each time a byte of data is received, and when the timeout timer reaches the timeout threshold, the receiving state of the state machine is adjusted to the receiving end state.

[0054] On the other hand, if the received communication signal message is too long, when the received data causes the data receiving buffer to overflow, the embodiment of the present invention will also adjust the receiving state of the state machine to the receiving end state, close the serial port and end data reception.

[0055] S2. Extract protocol features from the variable-length message data, perform protocol identification based on the extracted protocol features, and determine the protocol type to which the variable-length message data belongs.

[0056] The embodiment of the present invention comprises: extracting protocol features of the variable-length message data, performing protocol identification based on the extracted protocol features, and determining the protocol type to which the variable-length message data belongs, including: extracting protocol features of the variable-length message data, performing protocol identification based on the extracted protocol features, and searching for a frame start field in the protocol features; confirming the protocol type corresponding to the variable-length message data according to the frame start field, wherein the protocol types include DLT698 protocol and DLT645 protocol.

[0057] Combination Figure 3 As shown, it is a reference schematic diagram of the process of protocol identification of the present invention. In an embodiment of the present invention, the frame start field refers to a combination of a frame start character and subsequent fields that can be used to distinguish between the DLT698 protocol and the DLT645 protocol. Due to different protocol types, the protocol frame format is also different. Accordingly, the protocol type to which the indefinite length message data belongs can be determined by the first several bytes.

[0058] For the DLT645 protocol, the corresponding protocol frame format is shown in Table 1 below:

[0059] Table 1DLT645 protocol frame format

[0060]

[0061] For the DLT698 protocol, the corresponding protocol frame format is shown in Table 2 below:

[0062] Table 2DLT698 protocol frame format

[0063]

[0064] For example, the received indefinite length message data may be: 68A0 A1 A2 A3 A4 A5 68C LDATA ... CS16, then after receiving 10 bytes, it can be determined whether it belongs to the DLT645 protocol.

[0065] For example, the received indefinite length message data may be: 68L0 L1 C SA A0 A1 A2 A3A4 A5CAHCS0 HCS1 APDU ... FCS0 FCS116, then receiving at least 9 bytes / at most 14 bytes can determine whether it belongs to the DLT698 protocol.

[0066] In the embodiment of the present invention, the protocol feature is an identifier for identifying the protocol type. Accordingly, for the DLT645 protocol, the protocol feature corresponds to: start character (0x68), length field (L), header check (HCS), frame check (FCS) and end character (16H); for the DLT698 protocol, the protocol feature corresponds to: frame start character (0x68), data field length (L), check code (CS) and end character (0x16).

[0067] S3. According to the protocol type to which the variable-length message data belongs, error correction processing is performed on the variable-length message data based on the extracted protocol features, normal frames that conform to the corresponding protocol type in the variable-length message data are found, the normal frames are intercepted, and communication transmission is performed using the normal frames.

[0068] Since there may be interference frames in the received indefinite-length message data, for example, there are incomplete interference frames in front of, in the middle of or after the normal frame, the interference frames are eliminated to obtain the normal frame for communication transmission. In an embodiment of the present invention, according to the protocol type to which the indefinite-length message data belongs, error correction processing is performed on the indefinite-length message data based on the extracted protocol features, including: determining the protocol frame format according to the protocol type to which the indefinite-length message data belongs; judging the extracted protocol features in sequence from the first starting character based on the protocol frame format until a data frame that conforms to the protocol frame format is obtained, and intercepting the data frame from the indefinite-length message data as a normal frame.

[0069] Combination Figure 4-5 As shown, Figure 4 This is a reference diagram of the error correction process based on the DLT645 protocol. Figure 5 The present invention is a reference diagram of the error correction process based on the DLT698 protocol. Specifically, the embodiment of the present invention reads the extracted protocol features based on the protocol frame format starting from the first starting character and makes judgments in sequence. If no data frame conforming to the protocol frame format is found before the first ending character, the indefinite-length message data continues to be read, and the next starting character is selected as the starting bit for judging the protocol frame format.

[0070] At the same time, when the number of received characters remaining to be searched in the variable-length message data does not meet the preset number, if no data frame conforming to the protocol frame format is found, all of the variable-length message data are discarded and new variable-length message data are acquired again.

[0071] For example, the first starting character (0x68) is searched in the indefinite length message data, the frame start bit is located, and then the judgment is made from the start bit in sequence according to the extracted protocol features. If it is determined that it does not meet the protocol features, the frame start bit is relocated, that is, the next 0x68 is searched from the frame after the first 0x68 as the start character, and then the judgment is made from the start character in sequence. This is repeated until a frame that meets the protocol is found or the number of remaining received characters that have not been found is less than 12 (the minimum received frame is 12 characters, and the preset number can be defined as 12 characters). In this way, the incomplete interference frames mixed in the front, middle and back of the normal frame can be excluded, and the normal frame can be obtained to avoid frame leakage and improve the communication response speed.

[0072] Compared with the prior art, the method for automatically identifying the indefinite-length universal serial port communication of an electric energy meter according to the embodiment of the present invention has the following advantages:

[0073] 1. Through the state machine combined with the "interrupt + specific character + timeout" mechanism, it is determined whether a complete request frame is received, the reception is stopped, and the protocol identification process is entered, or the reception is abnormal and a new frame is received again, thereby realizing the reception of frame data of indefinite length. At the same time, it can not distinguish the communication channel. The common communication implementation method can be infrared, RS485 channel, HPLC, micro-power wireless, etc., with better applicability;

[0074] 2. Automatically identify whether it is DLT645 protocol or DLT698 protocol, and can perform feature recognition on the entire frame on the basis of ensuring the communication response rate, with high accuracy and efficiency;

[0075] 3. It has self-correction capability, which can eliminate incomplete interference frames mixed in the front, middle and back of normal frames and obtain normal frames. It can also accurately process abnormal frames such as continuous frames to avoid frame leakage and improve anti-interference capability.

[0076] Based on the above embodiment, as the above Figure 1 The present invention provides an embodiment of a device for automatically identifying a universal serial port communication device with an indefinite length of an electric energy meter. Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices, see Figure 6 As shown, the automatic identification electric energy meter variable length universal serial port communication device comprises:

[0077] The data receiving module 100 is used to receive and identify the communication signal message sent by the communication bus based on the state machine to obtain a frame of indefinite length message data;

[0078] The protocol identification module 200 is used to extract protocol features of the variable-length message data, perform protocol identification based on the extracted protocol features, and determine the protocol type to which the variable-length message data belongs;

[0079] The data error correction module 300 is used to perform error correction processing on the variable-length message data based on the extracted protocol features according to the protocol type to which the variable-length message data belongs, find the normal frames in the variable-length message data that conform to its corresponding protocol type, intercept the normal frames, and use the normal frames for communication transmission.

[0080] The automatic identification of electric energy meter indefinite length universal serial port communication device described in the embodiment of the present invention can execute the automatic identification of electric energy meter indefinite length universal serial port communication method provided in the above embodiment. The automatic identification of electric energy meter indefinite length universal serial port communication device has the corresponding functional steps and beneficial effects of the automatic identification of electric energy meter indefinite length universal serial port communication method described in the above embodiment. Please refer to the embodiment of the above-mentioned automatic identification of electric energy meter indefinite length universal serial port communication method for details. The embodiment of the present invention will not be repeated here.

[0081] The embodiment of the present invention also provides an electronic device, which may include a processor and a memory, wherein the processor and the memory may be connected via a bus or other means. The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components and other chips, or a combination of the above-mentioned various types of chips. The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs, non-transient computer executable programs and modules, such as the program instructions / modules corresponding to the method for automatically identifying the indefinite length universal serial communication of the electric energy meter in the embodiment of the present invention. The processor executes various functional applications and data processing of the processor by running the non-transient software programs, instructions and modules stored in the memory, that is, the method for automatically identifying the indefinite length universal serial communication of the electric energy meter in the above method embodiment is realized.

[0082] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. The one or more modules are stored in the memory, and when executed by the processor, the method for automatically identifying the variable-length universal serial port communication of the electric energy meter in the above-mentioned method embodiment is executed. The specific details of the above-mentioned electronic device can be understood by corresponding to the corresponding descriptions and effects in the above-mentioned method embodiment, and will not be repeated here. Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and the program, when executed, may include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a read-only memory (ROM), a random access memory (RAM), a flash memory (Flash Memory), a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above types of memory.

[0083] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0084] Similarly, it should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the intention that the claimed invention requires more features than those expressly recited in each claim. Rather, as reflected in the claims, inventive aspects lie in less than all of the features of the individual embodiments previously disclosed. Therefore, the claims that follow the detailed description are hereby expressly incorporated into the detailed description, with each claim itself serving as a separate embodiment of the present invention.

[0085] It should be noted that the above-mentioned embodiments illustrate rather than limit the invention and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims.

Claims

1. A method for automatically identifying an electric energy meter with an indefinite length universal serial port communication, characterized in that: The method for automatically identifying the indefinite-length universal serial port communication of an electric energy meter comprises: Based on the state machine, the communication signal message sent by the communication bus is received and identified to obtain a frame of indefinite length message data; Extracting protocol features from the variable-length message data, performing protocol identification based on the extracted protocol features, and determining the protocol type to which the variable-length message data belongs; According to the protocol type to which the variable-length message data belongs, error correction processing is performed on the variable-length message data based on the extracted protocol features, normal frames that conform to the corresponding protocol type in the variable-length message data are found, the normal frames are intercepted, and communication transmission is performed using the normal frames.

2. The method for automatically identifying an electric energy meter with an indefinite length universal serial port communication according to claim 1, characterized in that: The receiving and identifying processing of the communication signal message sent by the communication bus based on the state machine includes: Initialize the receiving state of the state machine to the initial serial port state; After receiving the communication signal message sent by the communication bus, receiving identification processing is performed, and when it is confirmed that the communication signal message contains a frame start character, the receiving state of the state machine is adjusted to a data receiving state and a timeout timer is started to start receiving data with the frame start character; When the timeout timer times out or the data receiving buffer overflows, the receiving state of the state machine is adjusted to the receiving end state, the serial port is closed and the data receiving is ended, and the indefinite length message data is obtained.

3. The method for automatically identifying an electric energy meter with an indefinite length universal serial port communication according to claim 2 is characterized in that: The method further comprises: Setting a timeout threshold of the timeout timer according to the communication baud rate; Resetting the timeout timer each time a byte of data is received; When the timeout timer reaches the timeout threshold, the receiving state of the state machine is adjusted to the receiving end state.

4. The method for automatically identifying an electric energy meter with an indefinite length universal serial port communication according to claim 1, characterized in that: The extracting protocol features of the variable-length message data, performing protocol identification based on the extracted protocol features, and determining the protocol type to which the variable-length message data belongs includes: Extracting protocol features from the variable-length message data, performing protocol identification based on the extracted protocol features, and searching for a frame start field in the protocol features; The protocol type corresponding to the variable-length message data is confirmed according to the frame start field, and the protocol type includes the DLT698 protocol and the DLT645 protocol.

5. The method for automatically identifying an electric energy meter with an indefinite length universal serial port communication according to claim 1, characterized in that: According to the protocol type to which the variable-length message data belongs, performing error correction processing on the variable-length message data based on the extracted protocol features includes: Determine a protocol frame format according to the protocol type to which the variable-length message data belongs; The extracted protocol features are judged in sequence from the first starting character based on the protocol frame format until a data frame conforming to the protocol frame format is obtained, and the data frame is intercepted from the indefinite-length message data as a normal frame.

6. The method for automatically identifying an electric energy meter with an indefinite length universal serial port communication according to claim 5, characterized in that: The method also includes: reading the extracted protocol features starting from the first starting character based on the protocol frame format, and making judgments in sequence. If no data frame that conforms to the protocol frame format is found before the first ending character, continue reading the indefinite length message data, and select the next starting character as the starting bit for judging the protocol frame format.

7. The method for automatically identifying an electric energy meter with an indefinite length universal serial port communication according to claim 5, characterized in that: The method also includes: when the number of received characters remaining to be searched in the variable-length message data does not meet a preset number, if no data frame conforming to the protocol frame format is found, all of the variable-length message data are discarded and new variable-length message data are acquired again.

8. A device for automatically identifying an electric energy meter with an indefinite length universal serial port communication, applied to the method described in any one of claims 1 to 7, characterized in that: The automatic identification electric energy meter variable length universal serial port communication device comprises: A data receiving module is used to receive and identify the communication signal message sent by the communication bus based on the state machine to obtain a frame of indefinite length message data; A protocol identification module, used to extract protocol features from the variable-length message data, perform protocol identification based on the extracted protocol features, and determine the protocol type to which the variable-length message data belongs; A data error correction module is used to perform error correction processing on the variable-length message data based on the extracted protocol features according to the protocol type to which the variable-length message data belongs, find normal frames in the variable-length message data that conform to its corresponding protocol type, intercept the normal frames, and use the normal frames for communication transmission.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, which are loaded and executed by a processor to implement the operations performed by the method according to any one of claims 1 to 7.

10. An electronic device comprising a processor and a memory, characterized in that: The memory stores computer program instructions that can be executed by the processor, and when the processor executes the computer program instructions, the processor implements instructions of any one of the methods described in claims 1-7.

Citation Information

Patent Citations

  • Message analysis method of intelligent electric energy meter

    CN112671721A

  • Multi-protocol data acquisition method, system and device and computer readable storage medium

    CN112788018A

  • Passive industrial internet asset identification method and system based on multi-dimensional detection

    CN115695593A