Method for priority mapping from EtherCAT to TSN messages
By introducing a priority correction mechanism for CoS, DSCP, and sub-message type identification during the mapping process of EtherCAT messages to TSN messages, the problem of priority confusion of EtherCAT messages in the TSN network is solved, and the real-time performance and transmission stability of the network are improved.
Patent Information
- Application Number
- CN202510996193.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-18
- Publication Date
- 2025-09-05
AI Technical Summary
When EtherCAT messages are mapped in a TSN network, the existing priority mapping mechanism fails to effectively distinguish between periodic and non-periodic data, resulting in priority confusion and affecting the real-time performance of network transmission.
By extracting the CoS, DSCP, and sub-message type identifier of the EtherCAT message, calculating the priority mapping coefficient, and writing it into the 802.1Q frame header of the TSN message, ensuring that the priority is in the range of 0-7, priority mapping from EtherCAT to TSN messages is achieved.
It improves the real-time performance of EtherCAT open networking, reduces the transmission jitter of periodic messages, and meets the delay requirements of the IEC 61784-3 Class C standard.
Smart Images

Figure CN120602256A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of industrial Internet technology, and in particular to a priority mapping method from EtherCAT to TSN messages. Background Art
[0002] Ethernet for Control Automation Technology (EtherCAT) is a real-time industrial Ethernet fieldbus protocol. By utilizing "on-the-fly" technology to process and forward Ethernet-based data frames simultaneously, it achieves minimal latency and high frame utilization, making it one of the industry's preferred bus technologies for real-time performance. In the context of the convergence of Information Technology (IT) and Operational Technology (OT) within the Industrial Internet, EtherCAT faces application scenarios involving mixed multi-protocol services and cross-segment transmission in an open networking model, lacking guarantees for real-time performance.
[0003] Time Sensitive Networking (TSN) is a new industrial communication technology being promoted internationally. Through time synchronization, traffic shaping, and bandwidth reservation, it ensures real-time performance, low latency, and low jitter. Both TSN and EtherCAT are derived from Ethernet and share similar data architectures. By combining these technologies and creating hybrid networks, TSN addresses the real-time performance challenges inherent in EtherCAT's open networking.
[0004] The transmission of EtherCAT messages in a TSN network requires message conversion. Because the message structures of both are identical, CoS priorities are typically assigned based on preconfigured port information to map EtherCAT to TSN messages. When multiple EtherCAT applications are deployed in a TSN network, messages of different priorities may be converted to the same priority. For example, periodic control messages and non-periodic data messages may be mapped to the same priority. In this case, control messages with a higher priority may be executed after data messages with a lower priority, increasing transmission jitter and affecting the real-time performance of network transmission.
[0005] Currently, there is no patent to supplement the priority mapping mechanism of EtherCAT messages. Therefore, it is urgent to explore a priority mapping method from EtherCAT to TSN messages that can improve the existing mapping mechanism and improve the real-time performance of EtherCAT open networking. Summary of the Invention
[0006] The purpose of the present invention is to provide a priority mapping method from EtherCAT to TSN messages, which can improve the existing mapping mechanism and improve the real-time performance of EtherCAT open networking.
[0007] An embodiment of the present invention provides a method for mapping priorities from EtherCAT to TSN messages, comprising:
[0008] Step S1: Extract the CoS priority (P CoS )、DSCP priority (P DSCP ), sub-message type identifier (Q sgn );
[0009] Step S2: By formula P=max{P CoS , P DSCP}+Q sgn , by calculating the priority mapping coefficient; where max is the maximum value operation, P is the priority mapping coefficient, and its value range is 0-8;
[0010] Step S3: Using P S =min{P,7} to correct the priority; where min is the minimum value operation, P S The priority of the EtherCAT message after conversion to the TSN message;
[0011] Step S4: P S Write the PRI field of the 802.1Q frame header of the TSN message to complete the priority mapping. S Write the 12-14 bits of the PCP field in the VLAN tag of the TSN frame and configure the switch queue mapping through the register TSN_PRI_CTRL.
[0012] Furthermore, the P CoS The extraction method is to parse the 3-bit PRI field of the EtherCAT message VLAN tag and directly obtain the priority value of 0-7. That is, P is converted to S Enforce the constraint to be in the range of 0-7 to avoid priority overflow.
[0013] Furthermore, the P DSCP The extraction includes: extracting the 6-bit DSCP value from the IP layer ToS field, which ranges from 0 to 63; and converting it into an equivalent priority of 0 to 7 through a preset mapping table. The mapping rules are:
[0014] DSCP, 0~7→0;
[0015] DSCP, 8-15→1;
[0016] DSCP, 16-23 → 2;
[0017] DSCP, 24-31→3;
[0018] DSCP, 32-39 → 4;
[0019] DSCP, 40-47→5;
[0020] DSCP, 48-55→6;
[0021] DSCP, 56~53→7.
[0022] Furthermore, the Q sgn The judgment rule is that when the command field is a logical addressing instruction (LRD / LWR / LRW) or a time synchronization instruction (FRMW / ARMW), Q sgn =1 (periodic data); when the command field is a device addressing instruction (FPRD / FPWR / FPRW), Q sgn =0 (non-periodic data).
[0023] Furthermore, Q sgn =1 or =0, it distinguishes the priority of periodic / non-periodic messages through DSCP mapping and sub-message type correction mechanism.
[0024] Furthermore, in step S2, priority mapping coefficients are calculated, where Q sgn As a priority boost factor, the priority of periodic data is increased by 1 level.
[0025] Furthermore, the priority mapping method also includes boundary processing. When P≥7, P S Always set to 7 to ensure compliance with the TSN priority field length limit.
[0026] Furthermore, the technical effect of the priority mapping method is to reduce the periodic message transmission jitter in the TSN network. The jitter suppression amount is calculated as follows:
[0027] Δt=D proc +L / R
[0028] Among them D proc is the processing delay, L is the message length, and R is the link bandwidth.
[0029] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least: the priority mapping method from EtherCAT to TSN messages described in the embodiment of the present invention introduces a correction mechanism for the IP layer DSCP priority and the EtherCAT sub-message type identifier during the conversion of EtherCAT to TSN messages, thereby improving the real-time performance issues in EtherCAT open networking applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 This is a schematic diagram of EtherCAT and TSN messages.
[0031] Figure 2 This is a flow chart of priority mapping from EtherCAT to TSN messages provided by the present invention.
[0032] Figure 3 It is a comparison effect diagram of the measured data of the embodiment provided by the present invention. DETAILED DESCRIPTION
[0033] The following describes in further detail the EtherCAT to TSN message priority mapping method proposed in the present invention, with reference to the accompanying drawings and specific embodiments. The advantages and features of the present invention will become more apparent from the following description and claims. It should be noted that the drawings are highly simplified and not to exact scale, and are intended solely to facilitate and clearly illustrate the embodiments of the present invention.
[0034] like Figure 1 As shown in the figure, by comparing the EtherCAT message and TSN message structures, it is found that the two have the same frame header structure: the destination MAC address, source MAC address, VLAN tag, frame type, and FCS check have the same position distribution and word length. There are only minor differences in the data payload field, and they are directly compatible in message structure.
[0035] like Figure 2 As shown, the present invention provides a priority mapping method from EtherCAT to TSN messages, comprising the following steps:
[0036] S1: Extract the CoS priority value P from the PRI field in the VLAN tag in the EtherCAT message CoS , extract the DSCP priority from the IP layer ToS field, and obtain the type identifier from the EtherCAT sub-message command field; among them, CoS represents the second-layer message priority, DSCP represents the third-layer message priority, and the sub-message type identifier represents the EtherCAT message priority.
[0037] S2: The CoS priority field is 3 bits long and has a value of 0-7. It can be used directly and is denoted as P CoS The DSCP priority field is 6 bits long and has a value range of 0-63. A priority mapping to CoS must be established through a mapping table to maintain the same value range. After mapping, the value range is 0-7, which is recorded as P DSCP , as shown in the following table;
[0038] Mapping rule table
[0039]
[0040]
[0041] The sub-message type identifier is marked as Q sgn , used to identify the priority of EtherCAT periodic process data and non-periodic mailbox data. When the command is identified as periodic data such as logical addressing instructions or time synchronization instructions, the priority is high and the value is 1; when the command is identified as non-periodic data such as device addressing instructions, the priority is low and the identification value is 0;
[0042] In this embodiment, the first group of EtherCAT messages are periodic synchronization messages, and the CoS value is P CoS1 =6, DSCP1 = 56, the priority value after mapping using the industry equipment manufacturer general mapping table shown in Table 1 is P DSCP1 =7, the EtherCAT sub-message command is recognized as the ARMW (13) time synchronization instruction, Q sgn1 =1; the second group of EtherCAT messages is the device addressing message, and the CoS value is P CoS2 =6, DSCP2 = 50, the priority value after mapping using the industry equipment manufacturer general mapping table shown in Table 1 is P DSCP2 =6, EtherCAT sub-message command is recognized FPRD (4) device addressing instruction, Q sgn2 =0.
[0043] S3: Calculate the priority mapping coefficient, the calculation formula is: P = max{P CoS , P DSCP}+Q sgn , where max is the maximum value operation, and P is the priority mapping coefficient, with a value of 0-8.
[0044] In this embodiment, P1=max{P CoS1 , P DSCP1}+Q sgn1 =8, P2=max{P CoS2 , P DSCP2}+Q sgn2 =6.
[0045] S4: According to the priority mapping coefficient calculated in S3, the priority is corrected. The correction formula is: P S =max{P,7}, where P S The priority of the EtherCAT message after conversion to the TSN message has a value of 0-7 and is written into the PRI field of the TSN message to complete the priority mapping from EtherCAT to TSN messages. In this embodiment, P S1 =max{P1,7}=7,P S2 =max{P2,7}=6.
[0046] In the embodiment of the present invention, when two groups of EtherCAT are openly applied in a TSN network, using only the CoS priority mechanism based on pre-configured port information will result in a periodic control message with a higher priority being processed after a non-periodic data message with a lower priority, causing a transmission jitter of t in the periodic message, Δt=D proc +D trans , where D proc It is the operation time of message parsing, table lookup, and forwarding decision, which is a fixed value related to chip performance. trans =L / R is the time it takes to send and receive messages, where L is the message length and R is the link bandwidth.
[0047] In the embodiment of the present invention, by introducing a correction mechanism for DSCP priority and EtherCAT sub-message type identification, the real-time performance of periodic control messages with higher priority is guaranteed, transmission jitter is avoided, and the real-time performance problem in EtherCAT open networking applications is improved.
[0048] Specifically, Figure 3 As shown, the measured data comparison:
[0049]
[0050] Furthermore, the mapping method of the embodiment of the present invention has a 99% percentile delay of periodic messages of ≤200 μs under 80% network load, meeting the IEC 61784-3 Class C standard.
[0051] The above description is only a description of the preferred embodiments of the present invention and does not limit the scope of the present invention. Any changes and modifications made by ordinary technicians in the field of the present invention based on the above disclosure shall fall within the scope of protection of the claims.
Claims
1. A priority mapping method from EtherCAT to TSN messages, characterized in that: The steps include: Step S1: Extract the CoS priority (P CoS )、DSCP priority (P DSCP ), sub-message type identifier (Q sgn ); Step S2: By formula P=max{P CoS , P DSCP }+Q sgn , by calculating the priority mapping coefficient; where max is the maximum value operation, P is the priority mapping coefficient, and its value range is 0-8; Step S3: Using P S =min{P,7} to correct the priority; where min is the minimum value operation, P S The priority of the EtherCAT message after conversion to the TSN message; Step S4: P S Write the PRI field of the 802.1Q frame header of the TSN message to complete the priority mapping.
2. The priority mapping method from EtherCAT to TSN messages according to claim 1, wherein: The P CoS The extraction method is to parse the 3-bit PRI field of the EtherCAT message VLAN tag and directly obtain the priority value of 0-7.
3. The priority mapping method from EtherCAT to TSN messages according to claim 1, wherein: The P DSCP The extraction includes: extracting the 6-bit DSCP value from the IP layer ToS field, which ranges from 0 to 63; and converting it into an equivalent priority of 0 to 7 through a preset mapping table. The mapping rules are: DSCP, 0~7→0; DSCP, 8-15→1; DSCP, 16-23 → 2; DSCP, 24-31→3; DSCP, 32-39 → 4; DSCP, 40-47→5; DSCP, 48-55→6; DSCP, 56~53→7.
4. The priority mapping method from EtherCAT to TSN messages according to claim 1, wherein: The Q sgn The judgment rule is that when the command field is a logical addressing instruction or a time synchronization instruction, Q sgn =1; when the command field is a device addressing instruction, Q sgn =0.
5. The priority mapping method from EtherCAT to TSN messages according to claim 4, wherein: where Q sgn =1 or =0, it distinguishes the priority of periodic / non-periodic messages through DSCP mapping and sub-message type correction mechanism.
6. The priority mapping method from EtherCAT to TSN messages according to claim 1, wherein: Step S2 Priority mapping coefficient calculation, its Q sgn As a priority boost factor, the priority of periodic data is increased by 1 level.
7. The priority mapping method from EtherCAT to TSN messages according to claim 1, wherein: The priority mapping method also includes boundary processing. When P≥7, P S Always set to 7 to ensure compliance with the TSN priority field length limit.
8. The priority mapping method from EtherCAT to TSN messages according to any one of claims 1 to 7, characterized in that: The technical effect of the priority mapping method is to reduce the periodic message transmission jitter in the TSN network. The jitter suppression amount is calculated as follows: Δt=D proc +L / R Among them D proc is the processing delay, L is the message length, and R is the link bandwidth.