Service message generation method, communication method and terminal equipment
By adopting a simplified business message generation method in the industrial network system and encapsulating business data based on the preset Ethernet frame protocol, the problems of low real-time performance and low carrying efficiency in the existing technology are solved, and more efficient industrial network communication is achieved. .
Patent Information
- Application Number
- CN202410823271.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2024-09-10
AI Technical Summary
Existing industrial network systems have problems with low real-time performance and uncertainty in communication, and the Ethercat protocol has a complex frame structure and low carrying efficiency, making it difficult to meet the real-time and efficiency requirements in the industrial control field.
A service message generation method is adopted to encapsulate the service data into data units based on the preset Ethernet frame protocol, and generate the service message through the master station, including the message length field, destination address, source address, cycle flag bit, MAC address matching flag bit and alarm flag bit support jumbo frame transmission, simplifying the frame structure and improving bearing efficiency.
It achieves higher real-time performance and load-bearing efficiency, supports long packet transmission, simplifies the frame structure, improves the communication performance of industrial network systems, and avoids the poor real-time performance and structural redundancy issues of periodic polling of the Ethercat protocol.
Smart Images

Figure CN118631395A
Abstract
Description
Technical Field
[0001] The present application relates to the field of industrial communication technology, and in particular to a service message generation method, a communication method and a terminal device. Background Art
[0002] At present, there are many industrial protocols in the field of industrial control (such as manufacturing, energy industry, petrochemical industry, power collection, etc.), such as Modbus protocol, Ethercat protocol, Profinet protocol, CC-link protocol, etc. On the one hand, most of the existing industrial protocols are monopolized by foreign companies. On the other hand, the network systems built using the existing industrial protocols have their own advantages and disadvantages when communicating. For example, some have high real-time performance, but cannot run on Ethernet; some can run on Ethernet, but there is uncertainty. Therefore, in the prior art, when the industrial network system communicates, the selected industrial protocol is always compared and weighed in factors such as bandwidth, latency, and certainty, and the ideal effect cannot be achieved. Summary of the invention
[0003] In view of this, the embodiments of the present application provide a service message generation method, a communication method and a terminal device, which can effectively solve the problems of low real-time performance and uncertainty in existing industrial networks.
[0004] In a first aspect, an embodiment of the present application provides a method for generating a service message, which is applied to an industrial master station and / or at least one slave station communicatively connected to the master station, and the method includes:
[0005] According to the service requirements, each service data is respectively encapsulated into a corresponding data unit in the message data area of the service message to be generated according to the preset Ethernet frame protocol, wherein the actual value of the message length field in the corresponding data unit is determined according to the size of each service data, and the actual value is assigned to the corresponding message length field; wherein the message length field is p1 bytes, 3≥p1≥1;
[0006] Based on the data units encapsulating the service data, respectively generate corresponding data unit sub-messages;
[0007] Based on the multiple data unit sub-messages, the service message is obtained by combining them.
[0008] In some embodiments, the preset Ethernet frame protocol includes an Ethernet frame header area and a message header area; the Ethernet frame header area includes a destination address field and a source address field; the message header area includes a loop flag bit, a MAC address match flag bit and an alarm flag bit;
[0009] When the service message is generated by the master station, the method further includes:
[0010] The value of the destination address field is configured as the address of the first slave station adjacent to the master station, and the value of the source address field is configured as the address of the master station;
[0011] Set the loop flag bit to no, the MAC address match flag bit to no, and the alarm flag bit to no;
[0012] The loop flag is used to identify whether the message is abnormally looped;
[0013] The MAC address match flag is used to indicate whether the MAC address matches;
[0014] The alarm flag is used to identify whether the device parameter monitored by the slave station is abnormal.
[0015] In some embodiments, the preset Ethernet frame protocol includes a plurality of the data units; each of the data units includes a data unit header and a slave address field; the data unit header includes a location flag of the data unit;
[0016] When the service message is generated by the master station, the method further includes:
[0017] Storing the address code of the target slave station corresponding to the data unit sub-message into the slave station address field;
[0018] Setting the position flag of the last data unit to the last data unit flag value;
[0019] Wherein, the slave station address field is used to identify the data unit processed by the target slave station;
[0020] The position flag is used to identify whether the data unit is the last data unit.
[0021] In some embodiments, the data unit includes a data unit header; the data unit header includes an instruction type field;
[0022] When the service message is generated by the master station, the method further includes:
[0023] Set the value of the instruction type field according to business requirements;
[0024] The instruction type field is used to identify the data processing method of the target slave station for the data unit sub-message.
[0025] In some embodiments, when the value of the instruction type field belongs to a first instruction value range, the master station sends the service message to the slave station;
[0026] The slave station determines the data unit to be processed according to the value of the slave station address field in the data unit and its own number, and determines the data processing method for the service data in the data unit according to the first instruction value to generate a response message;
[0027] Among them, the data processing method includes: sequential read, sequential write, sequential read and write, reservation, address read, address write, address read and write, broadcast read, batch write, batch write and read, broadcast read, broadcast write and at least one of broadcast read and write.
[0028] In some embodiments, when the value of the instruction type field belongs to a second range of values, the service data is non-Ethernet data;
[0029] The step of encapsulating each service data into a corresponding data unit in a message data area of a service message to be generated according to a preset Ethernet frame protocol comprises:
[0030] Encapsulating the non-Ethernet data into the data field of the data unit;
[0031] The data processing method includes: determining a data bus type corresponding to receiving the non-Ethernet data.
[0032] In some embodiments, when the value of the instruction type field is a third instruction value, the service data is Ethernet data;
[0033] The step of encapsulating each service data into a corresponding data unit in a message data area of a service message to be generated according to a preset Ethernet frame protocol comprises:
[0034] Encapsulating an Ethernet message obtained by framing the Ethernet data into a data field of the data unit; wherein the Ethernet message includes a destination address, a source address, an Ethernet protocol type and Ethernet frame data;
[0035] The data processing method includes: a method of parsing the Ethernet message.
[0036] In some embodiments, the preset Ethernet frame protocol includes a counting area between a message header area and a message data area;
[0037] When the service message is generated by the master station, the method further includes:
[0038] Set the initial value of the counting area according to business requirements;
[0039] The counting area is used to store the number of slave stations obtained by accumulating the set step value after each slave station connected to the master station for communication receives the service message.
[0040] In a second aspect, an embodiment of the present application provides a terminal device, the terminal device comprising a processor and a memory, the memory storing a computer program, and the processor being used to execute the computer program to implement a service message generation method provided in the first aspect of the present application.
[0041] In a third aspect, an embodiment of the present application provides a communication method for an industrial network system, wherein the industrial network system includes a master station and N slave stations, where N≥1; the master station and the slave stations communicate with each other using business messages generated by a business message generation method such as that provided in the first aspect of the present application.
[0042] The embodiments of the present application have the following beneficial effects:
[0043] In the present application, the actual value of the message length field in the corresponding data unit is determined according to the size of each business data, and the actual value is assigned to the corresponding message length field; wherein, the message length field is p1 bytes, 3≥p1≥1, and corresponding data unit sub-messages are generated based on each data unit encapsulated with each business data; based on multiple data unit sub-messages, the business message is obtained by combining. The message length field in the present application is large enough, and the business message in the present application can be a giant frame (long packet). Compared with Ethercat (maximum effective length 1498 bytes), the business message length of the present application is not limited, and the maximum length of a single Pdu is 65535 bytes. The frame format of the business message in the present application is more concise and has higher carrying efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0045] Figure 1 A schematic diagram of the structure of an industrial network system obtained by adopting a chain networking method in an embodiment of the present application is shown;
[0046] Figure 2 A schematic diagram of the structure of an industrial network system obtained by adopting a ring network redundancy method in an embodiment of the present application is shown;
[0047] Figure 3 A schematic diagram of the structure of an industrial network system obtained by adopting a multi-ring networking method in an embodiment of the present application is shown;
[0048] Figure 4A schematic diagram of the structure of an industrial network system obtained by adopting a star networking method in an embodiment of the present application is shown;
[0049] Figure 5 A first flow chart of the method for generating a service message according to an embodiment of the present application is shown;
[0050] Figure 6 A second flow chart of the method for generating a service message according to an embodiment of the present application is shown;
[0051] Figure 7 A third flow chart of the service message generation method according to an embodiment of the present application is shown;
[0052] Figure 8 A fourth flow chart of the method for generating a service message according to an embodiment of the present application is shown;
[0053] Fig. 9 A fifth flow chart of the method for generating a service message according to an embodiment of the present application is shown;
[0054] Fig.10 A sixth flow chart of the method for generating a service message according to an embodiment of the present application is shown;
[0055] Fig.11 A schematic diagram showing changes in a service message in a process data processing mode in a service message generation method according to an embodiment of the present application is shown;
[0056] Fig.12 A schematic diagram of the ABoE protocol stack in the mailbox mode in the service message generation method of an embodiment of the present application is shown;
[0057] Fig.13 A structural schematic diagram of a service message generating device according to an embodiment of the present application is shown.
[0058] Description of main component symbols:
[0059] 131 - basic message encapsulation module; 132 - sub-message generation module; 133 - service message combination module. DETAILED DESCRIPTION
[0060] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments.
[0061] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0062] Hereinafter, the terms "including", "having" and their cognates that can be used in various embodiments of the present application are intended only to indicate specific features, numbers, steps, operations, elements, components or a combination of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or a combination of the foregoing items or increasing the possibility of one or more features, numbers, steps, operations, elements, components or a combination of the foregoing items. In addition, the terms "first", "second", "third" and the like are only used to distinguish descriptions and cannot be understood as indicating or implying relative importance.
[0063] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.
[0064] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0065] Although the Ethercat protocol has great advantages in transmitting data, it also has some disadvantages. For example, each sub-PDU (data unit) of the Ethernet frame of the Ethercat protocol contains a WKC field, the frame structure is complex, and the protocol carrying efficiency is low, the real-time performance of periodic polling is poor, the functions of the protocol are not easy to expand, and it is not easy to add new functional points, etc. In addition, the Ethercat protocol is favored by the industry for its simple message structure, low latency, and precise synchronization, but the frame structure of the Ethercat protocol is redundant and the carrying efficiency is low. Therefore, the present application proposes a business message generation method, a communication method, and a terminal device, which can effectively solve the problems of low real-time performance and uncertainty, structural redundancy, and low message carrying efficiency in existing industrial networks.
[0066] The present application provides a communication method for an industrial network system, wherein the industrial network system includes a master station and N slave stations, where N≥1; the master station and the slave stations communicate with each other using a service message generated by a service message generation method provided by the present application. Figure 1 , Figure 2 , Figure 3 , Figure 4 As shown, it can be constructed by chain networking, ring networking, multi-ring networking and star networking.
[0067] The service message generation method is described below in conjunction with some specific embodiments.
[0068] Figure 5 The first flow chart of the service message generation method of the embodiment of the present application is shown. Exemplarily, the service message generation method includes the following steps:
[0069] S110, according to the service requirements, encapsulate each service data into a corresponding data unit in the message data area of the service message to be generated according to the preset Ethernet frame protocol, wherein the actual value of the message length field in the corresponding data unit is determined according to the size of each service data, and the actual value is assigned to the corresponding message length field. The message length field is p1 bytes, 3≥p1≥1.
[0070] The preset Ethernet frame protocol in the embodiment of the present application is obtained by improving the Ethercat protocol and is applicable to all industrial bus protocols. The preset Ethernet frame protocol is also called the ABoE protocol (All Bus over Ethernet). Specifically, the preset Ethernet frame protocol includes a message data area (Ethercat Frame), and the message data area includes multiple data units (PDUs). The data unit includes a message length field. Preferably, the message length field is 2 bytes.
[0071] For multiple slave stations, each slave station may perform different services, so the master station uses different data units to store service data of different slave stations. The value of the message length field is filled in according to the size of each service data.
[0072] S120: Generate corresponding data unit sub-messages based on the data units encapsulating the service data. One slave station corresponds to one data unit, and one data unit generates one data unit sub-message.
[0073] S130, combining the multiple data unit sub-messages to obtain the service message.
[0074] The master station combines the service data required by each slave station into one command to obtain a service message.
[0075] The existing EtherCAT only gives a total length of 11b, and the length of the service data stored in the data field Data is limited. In the embodiment of the present application, the message length field in each sub-PDU (data unit) is 2B (bytes), and the service data stored in the embodiment of the present application is not limited. Moreover, the Len field (message length field) is placed in the PDU in the embodiment of the present application, and a length of 2 bytes is given. Therefore, the service message of the present application supports giant frame (long packet) transmission; compared with Ethercat (maximum effective length 1498 bytes), the service message length of the embodiment of the present application is not limited, and the maximum length of a single PDU is 65535 bytes. Further, the preset Ethernet frame protocol includes an Ethernet frame header area and a message header area; the Ethernet frame header area includes a 6-byte destination address field and a 6-byte source address field; the message header area includes a loop flag bit (1bit or 1b), a MAC address match flag bit (1b) and an alarm flag bit (1b).
[0076] like Figure 6 As shown, when the service message is generated by the master station, the method further includes:
[0077] S140, configuring the value of the destination address field to be the address of the first slave station adjacent to the master station; configuring the value of the source address field to be the address of the master station.
[0078] S150, setting the loop flag bit to no, setting the MAC address match flag bit to no, and setting the alarm flag bit to no.
[0079] The loop flag is used to identify whether the message is abnormally looped. In the embodiment of the present application, the loop flag is mentioned in the message header area, which can not only save fields and improve frame utilization, but also improve timeliness. For example, the loop flag can be judged in advance. If the loop flag indicates that the service message has a storm or flooding in the network, the message is immediately intercepted and stopped from being sent.
[0080] The MAC address match flag is used to identify whether the MAC address matches, so that the slave station can exchange the address information in the destination address field and the source address field and reset the value of the MAC address match flag to a non-exchange processing identification value when confirming that there is no match, so as to determine the destination address when the slave station feeds back a response message to the master station.
[0081] The alarm flag is used to identify whether the equipment parameters monitored by the slave station are abnormal. After receiving the alarm flag bit 1, it indicates that there is an alarm in the industrial network system, such as temperature, current, voltage alarm, etc., and it is necessary to stop production immediately for investigation.
[0082] The message header area also includes a 5-bit message type A_TYPE, which is used to determine the type of the received service message, wherein the type of the service message includes a command message and a clock synchronization message.
[0083] Furthermore, the preset Ethernet frame protocol includes a plurality of the data units; each of the data units includes a data unit header and a 4-byte slave address field; and the data unit header includes a position flag bit (1b) of the data unit.
[0084] like Figure 7 As shown, when the service message is generated by the master station, the method further includes:
[0085] S160, storing the address code of the target slave station corresponding to the data unit sub-message into the slave station address field. The slave station address field is used to identify the data unit processed by the target slave station.
[0086] S170, set the position flag of the last data unit to the last data unit flag value. The position flag is used to identify whether the data unit is the last data unit. It is also necessary to set the position flag of the non-last data unit to the non-last data unit flag value. If the data unit is not the last one and is represented by 0, the non-last data unit flag value = 0; if the position flag of the last data unit is set to 1, the last data unit flag value is 1.
[0087] Furthermore, the preset Ethernet frame protocol includes a counting area between the message header area and the message data area, wherein the length of the counting area is 2 bytes.
[0088] like Figure 8 As shown, when the service message is generated by the master station, the method further includes:
[0089] S180, setting an initial value of a counting area according to business requirements; wherein the counting area is used to store the number of slave stations obtained by accumulating a set step value after receiving the business message from each slave station in communication with the master station. In addition, in the embodiment of the present application, more services can be expanded through the counting area, such as sequential reading and writing.
[0090] Preferably, the initial value is 0, and the step value is set to 1. In downlink communication (communication direction from the master station to the last slave station), each slave station increases the value in the counting area by 1 after receiving the service message to obtain the number of slave stations that the current service message passes through.
[0091] In one embodiment, the data unit includes a data unit header; the data unit header includes an instruction type field (5b).
[0092] like Fig. 9 As shown, when the service message is generated by the master station, the method further includes:
[0093] S190, setting the value of the instruction type field according to business requirements, wherein the instruction type field is used to identify the data processing method of the target slave station for the data unit sub-message.
[0094] In the embodiment of the present application, steps S110 to S190 are encapsulated in the process of encapsulating the service message according to the order of the fields in the frame structure.
[0095] For example, Fig.10 As shown, the frame structure defined by the preset Ethernet frame protocol (ABoE protocol) in the embodiment of the present application includes an Ethernet frame header, a message header area, a slave count field NODC, a message data area ABoEFrame and an Ethernet frame tail FCS (4B). The slave count field is used to count the total number of slaves connected to the master station communication, and the specific meanings of each field are shown in Table 1.
[0096] The Ethernet frame header includes the destination address field DMAC (6B or 6Byte), the source address field SMAC (6B), VLAN (4B) and the protocol type EtherType (2B).
[0097] The message header area ABoEHead includes: loop flag bit R, MAC address match flag bit P, alarm flag bit ALM and message type A_TYPE. The description of each field in the ABoEHead structure is shown in Table 2.
[0098] The message data area includes a plurality of data units (sub-Pdus);
[0099] The data unit includes a data unit header PduHead, an address field Address, a message length field LEN and a data field DATA. The structure of the sub-Pdu is shown in Table 3.
[0100] The data unit header PduHead includes: a data unit position flag bit NEXT (1b), a command type field PDU_TYPE, and the structure of PduHead is shown in Table 4, where the position flag bit is also called the last sub-PDU flag.
[0101] The address field Address includes a slave address field ADP and a register field ADP.
[0102] Specifically, the ABoE protocol command frame format is shown in Table 1:
[0103] Table 1 ABoE protocol command frame format
[0104]
[0105] Table 2 ABoEHead structure
[0106]
[0107]
[0108] Table 3 ABoE sub-Pdu structure
[0109]
[0110] Table 4 ABoE sub-Pdu Head structure
[0111]
[0112]
[0113] In one implementation, when the value of the instruction type field belongs to a first instruction value range, the master station sends the service message to the slave station.
[0114] The slave station determines the data unit to be processed according to the value of the slave station address field in the data unit and its own number, and determines the data processing method for the service data in the data unit according to the first instruction value to generate a response message;
[0115] Among them, the data processing method includes: sequential read, sequential write, sequential read and write, reservation, address read, address write, address read and write, broadcast read, batch write, batch write and read, broadcast read, broadcast write and at least one of broadcast read and write.
[0116] Specifically, when the value of the instruction type field is within the first instruction value range, the process data processing mode is set. In the process data processing mode, the process data processing flow of the service message specifically includes:
[0117] S210, the master station constructs a data frame carrying multiple sub-PDUs, obtains a service message, and sends it out through the port of the first adjacent slave station. The value of the instruction type field is any one of the first instruction value range, and the instruction values included in the first instruction value range are shown in Table 5. The DMAC field is set to the first slave station address, the SMAC field is set to the master station address; the EtherType field is set to 0x88F0; the loop flag R is set to 0, the MAC address match flag p is set to 0, the alarm flag ALM is set to 0, the message type A_TYPE is set to 0, the PDU_TYPE is set to 0, the NODC field is set to 0, etc. Fig.11 The business message frame structure between the master station and slave station 1.
[0118] S220, after the first slave station receives the service message, it first checks whether the MAC address match flag setting p is 0. If it is 0, it checks whether the destination address DMAC is its own MAC address. If it is, it processes it, otherwise it discards it. The NODC field is set to 1, and the P of the ABoE Head is set to 1. The first slave station extracts the data in the sub-Pdu whose slave station number address in the ADP is consistent with the number of the first slave station, and processes it. After processing, it forwards the service message processed by the above processing to the second slave station. The service message information processed by the first slave station is as follows Fig.11 Business message between slave 1 and slave 2.
[0119] S230, after receiving the service message, the second slave station matches its own number information with the value in the ADP of each sub-Pdu to extract the data of the corresponding sub-Pdu for processing, and forwards it to the next-level slave station after processing.
[0120] S240, except for the last slave station, the processing method of other slave stations is consistent with step S230, which will not be repeated here. S250, when the last slave station receives the service message, it matches the value in the ADP of each sub-Pdu according to its own number information to extract the data of the corresponding sub-Pdu for processing, and then uses the processed service message as a response message and returns it to the master station through the slave stations at all levels in a transparent transmission manner.
[0121] Table 5 ABoE process data processing instruction types
[0122]
[0123]
[0124] Further, when the value of the instruction type field belongs to the second range of values, the service data is non-Ethernet data;
[0125] The step of encapsulating each service data into a corresponding data unit in a message data area of a service message to be generated according to a preset Ethernet frame protocol comprises:
[0126] Encapsulating the non-Ethernet data into the data field of the data unit;
[0127] The data processing method includes: determining a data bus type corresponding to receiving the non-Ethernet data. Specifically, when the value of the instruction type field is a second range value, it is set to a mailbox mode.
[0128] The service message in the mailbox mode can carry non-Ethernet messages. Non-Ethernet protocols carried by the mailbox mode, such as Modbus, CAN, CC-link and other protocols. Among them, the second range value includes multiple instruction values, and the comparison information of multiple instruction values and each protocol is shown in Table 6:
[0129] Table 6 Command value and bus mapping table in mailbox mode
[0130] Serial number Command value protocol 1 0x41 Modbus 2 0x42 Can 3 0x43 CC-link 4 0x44~0x7E reserve
[0131] The mailbox mode refers to the mailbox mode of Ethercat. The specific ABoE protocol stack is as follows Fig.12 shown.
[0132] In ABoE mailbox mode, in the frame format of the service message generated by the master station, the loop flag R is set to 0 (0 means no, 1 means there is a loop exception), the MAC address match flag P is set to 0, and the alarm flag ALM is set to 0. The NEXT field in the PduHead of the first n-1 PDUs is set to 0, and the NEXT field in the PduHead of the nth PDU is set to 1. The setting value of the PDU_TYPE field in the PduHead ranges from 1000000b to 1111111b. The Address field in the PDU includes the ADP field and the ADO field; the slave station number address is stored in the ADP field. The explanation of each field of the frame message in mailbox mode is shown in Table 7:
[0133] Table 7 Explanation of each field of mailbox mode frame message
[0134]
[0135]
[0136] For example, in mailbox mode, the master station puts the non-Ethernet data into the data field Data, encapsulates it to obtain a service message, and sets the ADP field to the number of the target slave station.
[0137] After the target slave station receives the service message, if the value in the ADP field is the same as the slave station's own number, it processes the service message; if the target slave station corresponds to Modbus based on the PDU_TYPE field value in the service message being 0x41, it takes out the non-Ethernet data in the Data domain of the service message and considers the non-Ethernet data to be a Modbus data frame, then it sends the Modbus data frame to the Modbus bus in the slave station, allowing the Modbus corresponding device to respond.
[0138] Further, when the value of the instruction type field is a third instruction value, the service data is Ethernet data.
[0139] The step of encapsulating each service data into a corresponding data unit in a message data area of a service message to be generated according to a preset Ethernet frame protocol comprises:
[0140] The Ethernet message obtained by framing the Ethernet data is encapsulated into the data field of the data unit; wherein the Ethernet message includes a destination address, a source address, an Ethernet protocol type and Ethernet frame data.
[0141] The data processing method includes: a method of parsing the Ethernet message.
[0142] Specifically, when the value of the instruction type field is the third instruction value, it is set to tunnel mode. Service messages in tunnel mode can carry any Ethernet-based protocol. In tunnel mode, the loop flag R in the frame format of the service message generated by the master station is set to 0 (0 means no, 1 means there is a loop exception), the MAC address match flag P is set to 0, and the alarm flag ALM is set to 0. The NEXT field in the PduHead of the first n-1 PDUs is set to 0, and the NEXT field in the PduHead of the nth PDU is set to 1. The PDU_TYPE field in the PduHead is set to 1111111b. The Address field in the PDU includes the ADP field and the ADO field; the slave station number address is stored in the ADP field. The explanation of each field of the frame message in tunnel mode is shown in Table 8:
[0143] Table 8 Explanation of each field of tunnel mode frame message
[0144]
[0145]
[0146] That is to say, when A_TYPE is 0 and PDU_TYPE is 0x7F, it indicates tunnel mode, and the DATA field stores a complete Ethernet message, that is, the Ethernet message includes the destination address (6B), source address (6B), VLAN (4B), EtherType (2B) and EtherFrame.
[0147] When the value of the ADDRESS address (mainly the slave station number ADP field) in the service message received by the slave station is the same as the slave station number, the slave station extracts the Ethernet message in the DATA field for data processing.
[0148] In the embodiment of the present application, the PDU_Type of PduHead is designed to be 7b, while the PDU_Type of the existing Ethercat is 4b. The embodiment of the present application can expand more business functions through the PDU_Type field.
[0149] In this application, fields such as Index, IRQ (interrupt request register), and WKC are deleted. The frame format of the embodiment of the present application is more concise and has higher carrying efficiency. Compared with Ethercat, the ABoE protocol processes 1000 digital I / Os in 30μs, while the ABoE protocol can process 1032 digital I / Os in the same time.
[0150] In the present application, the WKC in each sub-PDU is removed, and then a slave station count field NODC is added globally, so that the DATA field of the Ethercat frame accounts for a larger proportion of the entire message, thereby improving the carrying efficiency of Ethercat and thus improving the carrying efficiency and saving bandwidth; the WKC field of the sub-PDU is removed to shorten the Ethercat frame, thereby shortening the period for the message to traverse all slave stations, improving the real-time performance of periodic polling; making the function expansion of the Ethercat protocol more convenient; by adding a global slave station count field, it is convenient to count the number of slave stations that the Ethercat message passes through, and many functions can also be extended through the NODC field, such as slave station search and number allocation, sequential reading and writing, broadcast reading and writing, batch reading and writing, etc.
[0151] In summary, the ABoE protocol of the present application is autonomous and controllable, no longer affected by foreign protocols, and is compatible with all Ethernet protocols. The ABoE protocol frame structure is more compact and saves bandwidth. The ABoE protocol frame structure has high carrying efficiency and higher periodic real-time performance. The ABoE protocol supports jumbo frame structure. The ABoE protocol supports the carrying of non-Ethernet messages and uses mailbox mode to implement this function. The ABoE protocol supports the carrying of Ethernet messages and uses tunnel mode to implement this function. The ABoE protocol supports the TSN network mode.
[0152] Fig.13A schematic diagram of the structure of a service message generation device according to an embodiment of the present application is shown. Exemplarily, the service message generation device comprises: a basic message encapsulation module 131 , a sub-message generation module 132 and a service message combination module 133 .
[0153] The basic message encapsulation module 131 is used to encapsulate each business data into the corresponding data unit in the message data area of the business message to be generated according to business needs and the preset Ethernet frame protocol, wherein the actual value of the message length field in the corresponding data unit is determined according to the size of each business data, and the actual value is assigned to the corresponding message length field; wherein the message length field is p1 bytes, 3≥p1≥1.
[0154] The sub-message generating module 132 is used to generate corresponding data unit sub-messages based on the data units encapsulating the service data.
[0155] The service message combining module 133 is used to combine the multiple data unit sub-messages to obtain the service message.
[0156] It can be understood that the device of this embodiment corresponds to the service message generation method of the above embodiment, and the options in the above embodiment are also applicable to this embodiment, so they will not be described repeatedly here.
[0157] The present application also provides a terminal device, which exemplarily includes a processor and a memory, wherein the memory stores a computer program, and the processor runs the computer program to enable the terminal device to execute the functions of each module in the above-mentioned service message generation method or the above-mentioned service message generation device. For example, the terminal device is a master station in an industrial network system.
[0158] Among them, the processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU) and a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. At least one of the general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., which can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application.
[0159] The memory may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc. The memory is used to store a computer program, and the processor may execute the computer program accordingly after receiving an execution instruction.
[0160] The present application also provides a readable storage medium for storing the computer program used in the above-mentioned terminal device.
[0161] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow diagram, and the combination of boxes in the structure diagram and / or the flow diagram, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0162] In addition, the functional modules or units in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0163] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0164] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A method for generating a service message, characterized in that: Applied to an industrial master station and / or at least one slave station communicatively connected to the master station, the method comprises: According to the service requirements, each service data is respectively encapsulated into a corresponding data unit in the message data area of the service message to be generated according to the preset Ethernet frame protocol, wherein the actual value of the message length field in the corresponding data unit is determined according to the size of each service data, and the actual value is assigned to the corresponding message length field; wherein the message length field is p1 bytes, 3≥p1≥1; Based on the data units encapsulating the service data, respectively generate corresponding data unit sub-messages; Based on the multiple data unit sub-messages, the service message is obtained by combining them.
2. The method for generating a service message according to claim 1, characterized in that: The preset Ethernet frame protocol includes an Ethernet frame header area and a message header area; the Ethernet frame header area includes a destination address field and a source address field; the message header area includes a loop flag bit, a MAC address match flag bit and an alarm flag bit; When the service message is generated by the master station, the method further includes: Configuring the value of the destination address field to be the address of the first slave station adjacent to the master station, and configuring the value of the source address field to be the address of the master station; Set the loop flag bit to no, the MAC address match flag bit to no, and the alarm flag bit to no; Among them, the loop flag is used to identify whether the message loops abnormally; the MAC address match flag is used to identify whether the MAC address matches; and the alarm flag is used to identify whether the device parameters monitored by the slave station are abnormal.
3. The method for generating a service message according to claim 1, characterized in that: The preset Ethernet frame protocol includes a plurality of the data units; each of the data units includes a data unit header and a slave station address field; the data unit header includes a position flag of the data unit; When the service message is generated by the master station, the method further includes: Encoding and storing the address of the target slave station corresponding to the data unit sub-message into the slave station address field; Setting the position flag of the last data unit to the last data unit flag value; The slave station address field is used to identify the data unit processed by the target slave station; and the position flag is used to identify whether the data unit is the last data unit.
4. The method for generating a service message according to claim 1, characterized in that: The data unit includes a data unit header; the data unit header includes an instruction type field; When the service message is generated by the master station, the method further includes: Set the value of the instruction type field according to business requirements; The instruction type field is used to identify the data processing method of the target slave station for the data unit sub-message.
5. The method for generating a service message according to claim 4, characterized in that: When the value of the instruction type field belongs to the first instruction value range, the master station sends the service message to the slave station; The slave station determines the data unit to be processed according to the value of the slave station address field in the data unit and its own number, and determines the data processing method for the service data in the data unit according to the first instruction value to generate a response message; Among them, the data processing method includes: sequential read, sequential write, sequential read and write, reservation, address read, address write, address read and write, broadcast read, batch write, batch write and read, broadcast read, broadcast write and at least one of broadcast read and write.
6. The method for generating a service message according to claim 4, characterized in that: When the value of the instruction type field belongs to the second range of values, the service data is non-Ethernet data; The step of encapsulating each service data into a corresponding data unit in a message data area of a service message to be generated according to a preset Ethernet frame protocol comprises: Encapsulating the non-Ethernet data into the data field of the data unit; The data processing method includes: determining a data bus type corresponding to receiving the non-Ethernet data.
7. The method for generating a service message according to claim 4, characterized in that: When the value of the instruction type field is the third instruction value, the service data is Ethernet data; The step of encapsulating each service data into a corresponding data unit in a message data area of a service message to be generated according to a preset Ethernet frame protocol comprises: Encapsulating an Ethernet message obtained by framing the Ethernet data into a data field of the data unit; wherein the Ethernet message includes a destination address, a source address, an Ethernet protocol type and Ethernet frame data; The data processing method includes: a method of parsing the Ethernet message.
8. The method for generating a service message according to any one of claims 1 to 7, characterized in that: The preset Ethernet frame protocol includes a counting area between the message header area and the message data area; When the service message is generated by the master station, the method further includes: Set the initial value of the counting area according to business requirements; The counting area is used to store the number of slave stations obtained by accumulating the set step value after each slave station connected to the master station for communication receives the service message.
9. A terminal device, characterized in that: The terminal device includes a processor and a memory, the memory stores a computer program, and the processor is used to execute the computer program to implement the service message generation method according to any one of claims 1 to 8.
10. A communication method for an industrial network system, characterized in that: The industrial network system includes a master station and N slave stations, N≥1; the master station and the slave stations communicate with each other using a business message generated by the business message generation method according to any one of claims 1 to 8.
Citation Information
Cited By
Batch information acquisition method, information reporting method and industrial control system
CN119225303A
