CN111770055A - Multi-protocol communication frame rapid distinguishing method applied to electric energy meter - Google Patents
Multi-protocol communication frame rapid distinguishing method applied to electric energy meter Download PDFInfo
- Publication number
- CN111770055A CN111770055A CN202010477485.9A CN202010477485A CN111770055A CN 111770055 A CN111770055 A CN 111770055A CN 202010477485 A CN202010477485 A CN 202010477485A CN 111770055 A CN111770055 A CN 111770055A
- Authority
- CN
- China
- Prior art keywords
- executing
- protocol
- receiving
- byte
- bytes
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 38
- 238000004891 communication Methods 0.000 title claims abstract description 25
- 230000005540 biological transmission Effects 0.000 claims abstract description 10
- 238000012545 processing Methods 0.000 claims abstract description 9
- 239000000872 buffer Substances 0.000 claims description 2
- 239000000203 mixture Substances 0.000 claims description 2
- 239000002994 raw material Substances 0.000 claims description 2
- 230000009191 jumping Effects 0.000 description 3
- 230000004075 alteration Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/18—Multiprotocol handlers, e.g. single devices capable of handling multiple protocols
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/22—Parsing or analysis of headers
Abstract
The invention relates to a multi-protocol communication frame rapid distinguishing method applied to an electric energy meter, which is characterized by comprising the following steps: the method comprises the steps of S1, receiving and judging whether the initial bytes are matched, if so, executing S2, and if not, continuing executing S1; s2, receiving and judging whether the protocol type bytes are matched, if so, executing S3, and if not, continuing executing S1; s3, receiving and judging the validity of the length field, if the length field is legal, calculating the length of the protocol data and executing S4, otherwise, continuing executing S1; s4, receiving protocol data and judging whether the receiving is overtime, if yes, executing S1, and if not, executing S5; and S5, analyzing the received protocol data transmission by adopting a corresponding protocol processing flow. The method greatly improves the communication efficiency.
Description
Technical Field
The invention relates to the technical field of communication, in particular to a multi-protocol communication frame rapid distinguishing method applied to an electric energy meter.
Background
The prior electric energy meter can support communication of various application protocols, and in the future, if the electric energy meter is used as a water meter, a gas meter and other terminals in a network, communication transfer of the terminals also supports more communication protocols; and inside, different internal functional modules need to use an application protocol to carry out high-speed communication.
Because multiple protocols are supported, the electric energy meter cannot know whether the received data flow is redundant data or legal communication frame data at the bottom, so that each byte of the received data must be judged, namely, collision is carried out between the starting byte and each protocol characteristic, if any protocol is not met at a certain position, the starting byte is discarded, and new collision is restarted from the next byte until a legal frame is met or all data are discarded.
If the received data stream contains a large amount of redundant data, frequent useless collisions can be generated, and because of supporting multiple protocols, the electric energy meter needs to perform a large amount of collisions when finding which protocol the received legal frame belongs to, and the more the supported protocols are, the more frequent the brought useless collisions are; when two parties communicate based on a high-speed channel, such as an SPI bus, it is additionally ensured that the consumption speed for receiving byte collision is higher than the transmission speed of the SPI bus, otherwise, frame loss due to buffer fullness can be caused, and the communication efficiency is low due to the reason.
Disclosure of Invention
In view of the above problems, an object of the present invention is to provide a method for quickly determining a multiprotocol communication frame applied to an electric energy meter, which can improve communication efficiency.
In order to achieve the purpose, the technical scheme of the invention is as follows: a multi-protocol communication frame rapid distinguishing method applied to an electric energy meter is characterized in that: comprises the steps of (a) preparing a mixture of a plurality of raw materials,
s1, receiving and judging whether the initial bytes are matched, if so, executing S2, and if not, continuing executing S1;
s2, receiving and judging whether the protocol type bytes are matched, if so, executing S3, and if not, continuing executing S1;
s3, receiving and judging the validity of the length field, if the length field is legal, calculating the length of the protocol data and executing S4, otherwise, continuing executing S1;
s4, receiving protocol data and judging whether the receiving is overtime, if yes, executing S1, and if not, executing S5;
and S5, analyzing the received protocol data transmission by adopting a corresponding protocol processing flow.
Further, the start byte is 0x 55.
Further, the protocol category byte is 0xAX, where a low nibble X indicates a protocol category.
Further, the S2 temporarily stores the low nibble before performing S3 when the protocol type bytes match.
Further, the length field includes two bytes to constitute a 16-bit number.
Further, the method further includes determining whether the header check byte is correct before performing S4, and if so, performing S4, otherwise, performing S1.
Further, the method further includes determining whether the frame check byte is correct before performing S5, and if so, performing S5, otherwise, performing S1.
Further, the header check byte is the accumulated sum of the start byte, the protocol category byte and the length field data.
Further, the frame check byte is the accumulated sum of all the transmission data except the frame check byte.
Further, the protocol data length is composed of 6 fixed bytes and the length of the application protocol data.
Compared with the prior art, the invention has the advantages that:
the method can enable the communication receiver to quickly judge which kind of protocol the received data frame belongs to and the data length in the data receiving process, thereby avoiding useless collision of redundant bytes and irrelevant protocols, improving the communication processing speed and efficiency, and avoiding the frame loss problem possibly generated when a high-speed communication channel is used for transmission.
Drawings
Fig. 1 is a flowchart of the receiver's operation in the method of the present application.
Fig. 2 is a flowchart of the operation of the sender in the method of the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
Referring to fig. 1 to 2, which are flowcharts of a receiver and a sender, respectively, according to the method of the present invention, as shown in the drawings, the method for rapidly determining a multiprotocol communication frame applied to an electric energy meter includes,
s1, receiving and judging whether the initial bytes are matched, if so, executing S2, and if not, continuing executing S1;
s2, receiving and judging whether the protocol type bytes are matched, if so, executing S3, and if not, continuing executing S1;
s3, receiving and judging the validity of the length field, if the length field is legal, calculating the length of the protocol data and executing S4, otherwise, continuing executing S1;
s4, receiving protocol data and judging whether the receiving is overtime, if yes, executing S1, and if not, executing S5;
and S5, analyzing the received protocol data transmission by adopting a corresponding protocol processing flow.
Specifically, the transmission format of the method during data transmission is as follows:
wherein, the concrete meaning of each byte is shown in the following table,
as a communication sender, the implementation process is as follows:
a) organizing application protocol data, and transmitting the application protocol data to a sending processing flow to start sending;
b) first, start byte 0x55 is sent;
c) sending a corresponding protocol category byte;
d) calculating the total length of data to be transmitted and sending a length field, and sending a low byte and then sending a high byte during sending; the total length of data consists of 6 fixed bytes and the length of application protocol data;
e) sending a header check byte;
f) sending protocol data;
g) transmitting a frame check byte;
as a communication receiver, each received byte is judged one by one in a receiving process, and the specific implementation process is as follows:
a) judging whether the received initial byte is 0x55, if not, discarding, and jumping to the next step until the initial byte of 0x55 is received;
b) judging whether the high nibble of the byte received immediately next is 0xA, if not, returning to the step a for re-judgment, otherwise, temporarily storing the low nibble, and simultaneously jumping to the next step;
c) judging the validity of the received length field which is combined into 16-bit number by 2 bytes, returning to the step a for judging again if the validity is not correct, otherwise calculating the length of the protocol data, and jumping to the next step;
d) calculating the checksum of the bytes received in the steps a), b) and c), comparing the checksum with the bytes received immediately, returning to the step a for judging again if the checksum is not equal to the bytes received immediately, and otherwise, skipping to the next step;
e) receiving the protocol data with the length according to the protocol data length calculated in the step c, returning to the step a for judging again if the time is out in the process, otherwise, skipping to the next step;
f) calculating the checksum of the bytes received in the steps a), b), c), d) and e), comparing the checksum with the bytes received immediately, returning to the step a for judging again if the checksum is not equal to the bytes received immediately, and otherwise, skipping to the next step;
g) and c, analyzing the received protocol data by adopting a protocol processing flow corresponding to the protocol type in the step b. .
The method enables a communication receiver to quickly judge which type of protocol and data length the received data frame belongs to in a data receiving process, thereby avoiding useless collision on redundant bytes and irrelevant protocols caused by a collision method used in the background technology and improving the communication processing speed and efficiency; meanwhile, the method also avoids the frame loss problem which can be generated when a high-speed communication channel is used for transmission, because the method ensures that the processing time of each byte transmitted in is fixed, thereby improving the expandability.
While embodiments of the invention have been shown and described, it will be understood by those skilled in the art that: various changes, modifications, substitutions and alterations can be made to the embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
Claims (10)
1. A multi-protocol communication frame rapid distinguishing method applied to an electric energy meter is characterized in that: comprises the steps of (a) preparing a mixture of a plurality of raw materials,
s1, receiving and judging whether the initial bytes are matched, if so, executing S2, and if not, continuing executing S1;
s2, receiving and judging whether the protocol type bytes are matched, if so, executing S3, and if not, continuing executing S1;
s3, receiving and judging the validity of the length field, if the length field is legal, calculating the length of the protocol data and executing S4, otherwise, continuing executing S1;
s4, receiving protocol data and judging whether the receiving is overtime, if yes, executing S1, and if not, executing S5;
and S5, analyzing the received protocol data transmission by adopting a corresponding protocol processing flow.
2. The method of claim 1, wherein:
the start byte is 0x 55.
3. The method of claim 1, wherein:
the protocol category byte is 0xAX, where the lower nibble X indicates the protocol category.
4. The method of claim 1, wherein:
the S2 also buffers the low nibble before performing S3 when the protocol class bytes match.
5. The method of claim 1, wherein:
the length field includes two bytes to make up a 16-bit number.
6. The method of claim 1, wherein:
the method further includes determining whether the header check byte is correct before performing S4, and if so, performing S4, otherwise, performing S1.
7. The method of claim 1, wherein:
the method further includes determining whether the frame check byte is correct before performing S5, and if so, performing S5, otherwise, performing S1.
8. The method of claim 6, wherein:
the header check byte is the accumulated sum of the start byte, the protocol category byte and the length field data.
9. The method of claim 7, wherein:
the frame check byte is the accumulated sum of all transmitted data except the frame check byte.
10. The method of claim 1, wherein:
the protocol data length in S3 is composed of 6 fixed bytes and the length of the application protocol data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010477485.9A CN111770055A (en) | 2020-05-29 | 2020-05-29 | Multi-protocol communication frame rapid distinguishing method applied to electric energy meter |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010477485.9A CN111770055A (en) | 2020-05-29 | 2020-05-29 | Multi-protocol communication frame rapid distinguishing method applied to electric energy meter |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111770055A true CN111770055A (en) | 2020-10-13 |
Family
ID=72719785
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010477485.9A Pending CN111770055A (en) | 2020-05-29 | 2020-05-29 | Multi-protocol communication frame rapid distinguishing method applied to electric energy meter |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111770055A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112671721A (en) * | 2020-12-11 | 2021-04-16 | 浙江万胜智能科技股份有限公司 | Message analysis method of intelligent electric energy meter |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101834864A (en) * | 2010-04-30 | 2010-09-15 | 中兴通讯股份有限公司 | Method and device for preventing attack in three-layer virtual private network |
CN104052758A (en) * | 2014-07-14 | 2014-09-17 | 威胜集团有限公司 | Self-adaptive method of multiple communication protocols of electric energy meter |
CN104780140A (en) * | 2014-01-12 | 2015-07-15 | 盛吉高科(北京)科技有限公司 | Configurable communication protocol identifying and parsing system |
US20150373169A1 (en) * | 2014-06-19 | 2015-12-24 | XPLIANT, Inc | Method of representing a generic format header using continuous bytes and an apparatus thereof |
CN105554002A (en) * | 2015-12-22 | 2016-05-04 | 曙光信息产业股份有限公司 | Tunnel message analyzing method and device |
CN105681134A (en) * | 2016-03-04 | 2016-06-15 | 西安航天动力技术研究所 | General multiple serial port communication protocol detection and identification method |
CN107769992A (en) * | 2017-09-15 | 2018-03-06 | 通鼎互联信息股份有限公司 | A kind of packet parsing shunt method and device |
CN107770181A (en) * | 2017-10-26 | 2018-03-06 | 南京诚思机器人科技有限公司 | A kind of exchange method of robot system, interaction process apparatus and system |
CN109510759A (en) * | 2018-10-22 | 2019-03-22 | 智强通达科技(北京)有限公司 | A kind of Universal-purpose quick multi-protocol gateway realization system and method |
CN111130690A (en) * | 2019-11-12 | 2020-05-08 | 广西电网有限责任公司 | Processing method and device for multiple communication protocols of IR46 smart electric meter |
-
2020
- 2020-05-29 CN CN202010477485.9A patent/CN111770055A/en active Pending
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101834864A (en) * | 2010-04-30 | 2010-09-15 | 中兴通讯股份有限公司 | Method and device for preventing attack in three-layer virtual private network |
CN104780140A (en) * | 2014-01-12 | 2015-07-15 | 盛吉高科(北京)科技有限公司 | Configurable communication protocol identifying and parsing system |
US20150373169A1 (en) * | 2014-06-19 | 2015-12-24 | XPLIANT, Inc | Method of representing a generic format header using continuous bytes and an apparatus thereof |
CN104052758A (en) * | 2014-07-14 | 2014-09-17 | 威胜集团有限公司 | Self-adaptive method of multiple communication protocols of electric energy meter |
CN105554002A (en) * | 2015-12-22 | 2016-05-04 | 曙光信息产业股份有限公司 | Tunnel message analyzing method and device |
CN105681134A (en) * | 2016-03-04 | 2016-06-15 | 西安航天动力技术研究所 | General multiple serial port communication protocol detection and identification method |
CN107769992A (en) * | 2017-09-15 | 2018-03-06 | 通鼎互联信息股份有限公司 | A kind of packet parsing shunt method and device |
CN107770181A (en) * | 2017-10-26 | 2018-03-06 | 南京诚思机器人科技有限公司 | A kind of exchange method of robot system, interaction process apparatus and system |
CN109510759A (en) * | 2018-10-22 | 2019-03-22 | 智强通达科技(北京)有限公司 | A kind of Universal-purpose quick multi-protocol gateway realization system and method |
CN111130690A (en) * | 2019-11-12 | 2020-05-08 | 广西电网有限责任公司 | Processing method and device for multiple communication protocols of IR46 smart electric meter |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112671721A (en) * | 2020-12-11 | 2021-04-16 | 浙江万胜智能科技股份有限公司 | Message analysis method of intelligent electric energy meter |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
USRE45570E1 (en) | Data transmission method using packet aggregation | |
KR100711738B1 (en) | Bitmap-based automatic repeat request engine and method for the same | |
US8494001B2 (en) | Concatenated frame structure for data transmission | |
US8166227B2 (en) | Apparatus for processing peripheral component interconnect express protocol | |
CN109257143B (en) | Method for fragmenting data packets for transmission in network transmission protocol with length limitation | |
WO2010075795A1 (en) | Method and device for fragment information processing | |
WO2018171641A1 (en) | Method and device for transmitting and receiving network management information, transmitting apparatus and receiving apparatus | |
WO2019144754A1 (en) | Signal receiving method | |
WO2012119116A1 (en) | System and/or method for transmitting data packets in a hardware command interface | |
EP2436161B1 (en) | Apparatus and method for supporting higher data rates on links with variable frame sizes | |
CN111770055A (en) | Multi-protocol communication frame rapid distinguishing method applied to electric energy meter | |
CN109728879B (en) | Synchronous error correction method for serial burst access application layer SLIP protocol message | |
CN112565105A (en) | Method, device and equipment for reducing time-sensitive frame forwarding time delay | |
US9210093B2 (en) | Alignment circuit and receiving apparatus | |
US7701968B2 (en) | Device and method thereof for transmitting a MAC service data unit in a network system | |
KR100631270B1 (en) | Data transmission apparatus using packet aggregation | |
US7701977B2 (en) | Method and apparatus to align and standardize packet based parallel interfaces | |
JP2002176460A (en) | Transmitter and communication system | |
US20230345303A1 (en) | Communications device and method for receiving aggregate packet | |
CN114598756B (en) | ALP data packet processing method, storage medium and electronic equipment | |
CN102801617A (en) | High-performance network data packet filtering method based on hardware CAM (Central Address Memory) chip | |
CN112291256B (en) | UART gateway data transmission method | |
WO2010148969A1 (en) | Data sending/receiving methods and devices for etc system | |
CN108733598B (en) | Data transmission method and data transmission device | |
CN116150063A (en) | Interface conversion method of multi-class hardware based on ZYNQ |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20201013 |
|
RJ01 | Rejection of invention patent application after publication |