Double-loop network communication method and system

Through the combination of fast forwarding and slow forwarding mode of the dual-ring network communication method, the problem of large delay in EtherCAT communication is solved, and the low delay, high synchronization and real-time nature of the distributed real-time control system is realized, and the efficient closed-loop control is met. need.

CN119211111AActive Publication Date: 2024-12-27NANJING HZ ELECTRIC CO LTD +1

Patent Information

Application Number
CN202411710477.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2024-12-27
Estimated Expiration
2044-11-27

AI Technical Summary

Technical Problem

In distributed real-time control systems, EtherCAT communication delay is large and cannot meet the closed-loop control cycle requirements of 50us or even smaller. Especially when the number of nodes is large, it makes it difficult to guarantee system synchronization and real-time.

Method used

Using the dual-ring network communication method, the host's summoning message is forwarded through the fast forwarding mode, and the slave's local messages and the received local messages from the front slave are forwarded through the slow forwarding mode, so as to realize the fast forwarding and slow forwarding mode. Switch to reduce forwarding delay.

Benefits of technology

It minimizes signal forwarding delay, ensures the synchronization and real-time nature of the distributed real-time control system, and improves the system's response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119211111A_ABST
    Figure CN119211111A_ABST
Patent Text Reader

Abstract

The invention discloses a double-loop network communication method, which comprises the following steps that: a first communication port of a host sends a call message; a first slave receives the call message, quickly forwards the call message to a second slave, switches to a slow forwarding mode, forwards a local message to the second slave; the second slave quickly forwards the call message to a third slave, and switches to the slow forwarding mode; forwarding the local message to a third slave, and forwarding the received local message to the third slave until the calling message and the local message of the slave are returned to a second communication port of the host; the second communication port of the host sends a call message, the Nth slave receives the call message and quickly forwards the call message to the (N-1) th slave, the Nth slave is switched to a slow forwarding mode, a local message is forwarded to the (N-1) th slave, the (N-1) th slave quickly forwards the call message to the (N-2) th slave, the Nth slave is switched to a slow forwarding mode, and the local message is forwarded to the (N-2) th slave. And forwarding the received local message to the (N-2) th slave, and returning the calling message and the local message of the slave to the first communication port of the host.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a network-based real-time control system, and in particular to a dual-ring network communication method and system. Background Art

[0002] For power electronic equipment based on modular multi-level topology architecture, such as high-voltage direct-mounted SVG (reactive power compensation device) and energy storage systems, there are hundreds of power modules on each phase bridge arm, and the number of three-phase power modules is very large. The control system is divided into three levels, the top level is the control and protection equipment, the middle level is the valve control unit, and the bottom level is the power module. Due to the large number of power modules, each phase is controlled by multiple valve control units. Each valve control unit can manage hundreds of power modules. Traditionally, the valve control unit communicates with the power module through point-to-point optical fiber. This results in a very spectacular optical fiber connection on the back of each valve control unit, and the failure rate caused by the optical fiber remains high, which brings great challenges to operation and maintenance.

[0003] At present, the most common and best performing bus for real-time communication in distributed real-time control systems is the EtherCAT bus, which solves the problem of real-time communication of bus nodes in distributed control systems. However, the following problems still exist: when there are many communication nodes in the bus, since the EtherCAT communication data frame passes through each slave station, the slave station will analyze the instructions in it to extract data or insert the slave station's own data, and update the working counter, that is, the delay of a single node from the slave station receiving the previous node data frame to forwarding it is large. When there are hundreds of nodes on the bus, the delay from the master station to the end node of the bus is large. Usually, the network communication delay of 100 nodes is not less than 0.1ms, which cannot meet the control system's 50us or even smaller closed-loop control cycle requirements. Summary of the invention

[0004] Based on the above situation, the main purpose of the present invention is to provide a dual-ring network communication method and system, which forwards the host's call message through a fast forwarding mode, and forwards the slave's local message and the received local message from the previous slave through a slow forwarding mode, thereby minimizing the forwarding delay and ensuring the synchronization and real-time performance of the distributed real-time control system.

[0005] To achieve the above purpose, the technical solution adopted by the present invention is as follows: A dual ring network communication method, the dual ring network includes a host and N slaves, the N is at least 1, the host and the N slaves are connected in sequence to form a ring network, the method includes: When the first communication port of the host sends a call message, the first slave receives the call message and forwards the call message to the second slave through the fast forwarding mode, the first slave switches to the slow forwarding mode, and forwards the local message of the first slave to the second slave, when the second slave receives the call message, it forwards the call message to the third slave through the fast forwarding mode, the second slave switches to the slow forwarding mode, and forwards the local message of the second slave to the third slave, when the second slave completes the forwarding of the local message, the second slave forwards all the received local messages to the third slave, and the transmission is carried out in this way until the call message and the local messages of the N slaves are returned to the second communication port of the host; When the second communication port of the host sends a calling message, the Nth slave receives the calling message and forwards the calling message to the N-1th slave through the fast forwarding mode, the Nth slave switches to the slow forwarding mode, and forwards the local message of the N-1th slave to the N-1th slave. When the N-1th slave receives the calling message, it forwards the calling message to the N-2th slave through the fast forwarding mode, the N-1th slave switches to the slow forwarding mode, and forwards the local message of the N-1th slave to the N-2th slave. When the N-1th slave completes the forwarding of the local message, the N-1th slave forwards all the received local messages to the N-2th slave, and transmits in this way until the calling message and the local messages of the N slaves return to the first communication port of the host.

[0006] Preferably, when the slave receives the calling message, the slave starts to cache and encode a local message, where the local message is the message of the slave itself.

[0007] Preferably, after the slave quickly forwards the calling message, the slave first sends its own local message, and also decodes and caches the local messages received from all other slaves.

[0008] Preferably, when the slave is in the fast forwarding mode, the slave only performs clock recovery technology processing on the received data code stream and then directly forwards it to the next slave; when the slave is in the slow forwarding mode, if the slave forwards its own local message, the slave caches its own local message, encodes it, and sends it to the next slave; if the slave forwards all received local messages, the slave decodes and caches all local messages in turn, encodes them, and then forwards them to the next slave.

[0009] Preferably, when any slave is in an idle state, any slave is in a fast forwarding mode to wait for a call message sent by the master.

[0010] Preferably, after the slave completes forwarding the summon message in the fast forwarding mode and both receiving and sending are idle, the slave switches to the slow forwarding mode; when the forwarding buffer area of ​​the slave is empty in the slow forwarding mode and both receiving and sending of the slave are idle, the slave switches to the fast forwarding mode to wait for the start of the next communication cycle.

[0011] Preferably, there is an idle space between two frames after the slave completes forwarding the call message.

[0012] Preferably, the application layer data frame structure of the call message includes a sender ID field, a frame length field, a total number of slaves field, a current device sequence number field and a data load field. The sender ID field is used to mark the host and each slave; The frame length field is used to mark the number of bytes of the application layer data of the data frame, and the calculation range includes all application layer contents starting from the total number of ring network slaves; The total number of slaves field is the total number of slaves in the current ring network defined by the master; The current device serial number field is used for the ring network ID adaptation process; The data payload field includes actual application data of the application layer.

[0013] The application layer data frame structure of the call message also includes a heartbeat field, an ID adaptive command field and a communication cycle field. The heartbeat field is used for the detection of the message link, and the heartbeat value changes each time the message is sent; the ID adaptive command field is used for the ring network ID adaptive process; the communication cycle field is used to agree on the time interval between each ring network communication Preferably, the sender ID field includes a node ID bit and a path ID bit, the node ID bit is used to mark the ID of the host in the ring network, and the path ID bit is used to mark whether the data frame is sent from the first communication port or the second communication port of the host.

[0014] Preferably, when the path ID bit is 0, it indicates that the data frame is sent from the first communication port of the host; when the path ID bit is 1, it indicates that the data frame is sent from the second communication port of the host.

[0015] Preferably, the heartbeat field includes a data frame heartbeat bit, and the data frame heartbeat bit is accumulated by 1 each time a message is sent; the ID adaptive command field includes a dual-ring network ID adaptive process trigger bit, and the dual-ring network ID adaptive process trigger bit is used to trigger the dual-ring network ID adaptive process.

[0016] Preferably, the local message application layer data frame structure sent by the slave includes a sender ID field, a frame length field, a heartbeat field and a data load field. The sender ID field is used to mark each slave; The frame length field is used to mark the number of bytes of the application layer data of the data frame, and the calculation range is the heartbeat field and the data load field; The heartbeat field is used as a heartbeat, and the value of the field changes each time a message is sent; The data payload field contains the actual application data of the application layer.

[0017] Preferably, the sender ID field includes a node ID bit and a path ID bit, the node ID bit is used to mark the ID of the slave in the ring network, and the path ID bit is used to mark whether the data frame is sent from the first communication port or the second communication port of the slave.

[0018] Preferably, when the path ID bit is 0, it indicates that the data frame is sent from the first communication port of the slave machine; when the path ID bit is 1, it indicates that the data frame is sent from the second communication port of the slave machine.

[0019] Preferably, the method further includes an ID adaptation process, which includes: The host enables the ID adaptation command field in the application layer data frame of at least one communication cycle to initiate the ID adaptation process. During the ID adaptation, the current device sequence number field in the call message sent by the host is 0, and the total number of slaves field is equal to the total number of slaves in the ring network; When the slave parses and finds that the ID adaptive command field in the call message is enabled, the slave maintains the slow forwarding mode after ending the current ring network communication and sets the sender ID field of the slave; If a call message is sent by the first communication port of the host, the slave increases the value of the current device serial number field in the received call message by 1 and writes it into the sender ID field of the slave, and forwards it to the next slave until the sender ID fields of all slaves are updated; If a summon message is sent by the second communication port of the host, the slave will write the value obtained by subtracting the current device serial number field value from the total number of slaves field value in the received summon message into the sender ID field of the slave and forward it to the next slave until the sender ID fields of all slaves are updated.

[0020] Preferably, when the ID adaptation command field in the call message is reset, all slaves exit the ID adaptation process, exit the slow forwarding mode, and switch to the fast forwarding mode.

[0021] The present invention further discloses a computer storage medium, wherein the storage medium stores a program, wherein the program is used to be executed to implement any one of the dual-ring network communication methods of the present invention.

[0022] The present invention also discloses a dual-ring network communication system, the dual-ring network communication system comprises a host and N slaves, wherein N is at least 1, the host and the N slaves are sequentially connected to form a ring network, When the first communication port of the host sends a calling message, the first slave receives the calling message and forwards the calling message to the second slave through the fast forwarding mode, the first slave switches to the slow forwarding mode, and forwards the local message of the first slave to the second slave, when the second slave receives the calling message, it quickly forwards the calling message to the third slave through the fast forwarding mode, the second slave switches to the slow forwarding mode, and forwards the local message of the second slave to the third slave, when the second slave completes the forwarding of the local message, the second slave forwards all the received local messages to the third slave, and the transmission is carried out in this way until the calling message and the local messages of the N slaves are returned to the second communication port of the host; When the second communication port of the host sends a calling message, the Nth slave receives the calling message and forwards the calling message to the N-1th slave through the fast forwarding mode, the Nth slave switches to the slow forwarding mode, and forwards the local message of the N-1th slave to the N-1th slave. When the N-1th slave receives the calling message, it forwards the calling message to the N-2th slave through the fast forwarding mode, the N-1th slave switches to the slow forwarding mode, and forwards the local message of the N-1th slave to the N-2th slave. When the N-1th slave completes the forwarding of the local message, the N-1th slave forwards all the received local messages to the N-2th slave, and transmits in this way until the calling message and the local messages of the N slaves return to the first communication port of the host.

[0023] Preferably, when the slave receives the calling message, the slave starts to cache and encode a local message, where the local message is the message of the slave itself.

[0024] Preferably, after the slave quickly forwards the calling message, the slave first sends its own local message, and also decodes and caches all other received local messages of the slaves.

[0025] Preferably, when the slave is in the fast forwarding mode, the slave only performs clock recovery technology processing on the received data code stream and then directly forwards it to the next slave; when the slave is in the slow forwarding mode, if the slave forwards its own local message, the slave caches its own local message, encodes it, and sends it to the next slave; if the slave forwards all received local messages, the slave decodes and caches all local messages in turn, encodes them, and then forwards them to the next slave.

[0026] Preferably, when any slave is in an idle state, any slave is in a fast forwarding mode to wait for a call message sent by the master.

[0027] Preferably, after the slave completes forwarding the summon message in the fast forwarding mode and both receiving and sending are idle, the slave switches to the slow forwarding mode; when the forwarding buffer area of ​​the slave is empty in the slow forwarding mode and both receiving and sending of the slave are idle, the slave switches to the fast forwarding mode to wait for the start of the next communication cycle.

[0028] Preferably, there is an idle space between two frames after the slave completes forwarding the call message.

[0029] Preferably, the dual-ring network communication system can also execute an ID adaptive process, including: The host enables the ID adaptation command field in the application layer data frame of at least one communication cycle to initiate the ID adaptation process. During the ID adaptation, the current device sequence number field in the call message sent by the host is 0, and the total number of slaves field is equal to the total number of slaves in the ring network; When the slave parses and finds that the ID adaptive command field in the call message is enabled, the slave maintains the slow forwarding mode after ending the current ring network communication and sets the sender ID field of the slave; If a call message is sent by the first communication port of the host, the slave increases the value of the current device serial number field in the received call message by 1 and writes it into the sender ID field of the slave, and forwards it to the next slave until the sender ID fields of all slaves are updated; If a summon message is sent by the second communication port of the host, the slave will write the value obtained by subtracting the current device serial number field value from the total number of slaves field value in the received summon message into the sender ID field of the slave and forward it to the next slave until the sender ID fields of all slaves are updated.

[0030] In the technical solution of the present invention, in order to allow the host's call message to be transmitted to each slave faster to improve system synchronization, the slave needs to implement two forwarding modes: fast forwarding and slow forwarding. The host's call message is forwarded in fast forwarding mode, and the slave's local message and the received local message of the upstream slave of the communication link are forwarded in slow forwarding mode. This can minimize the forwarding delay while ensuring the quality of the signal after forwarding.

[0031] Other beneficial effects of the present invention will be explained in the specific implementation manner through the introduction of specific technical features and technical solutions. Through the introduction of these technical features and technical solutions, those skilled in the art should be able to understand the beneficial technical effects brought about by the technical features and technical solutions. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] The preferred implementation of the dual ring network communication method and device according to the present invention will be described below with reference to the accompanying drawings. Figure 1 A schematic diagram of the application environment of the dual-ring network communication method of the present invention; Figure 2 A flow chart of a dual ring network communication method according to a preferred embodiment of the present invention; Figure 3 The application layer data frame structure of the call message in the dual ring network communication method according to a preferred embodiment of the present invention; Figure 4 An example of the composition of a host node ring network application layer data frame according to a preferred embodiment of the present invention; Figure 5 The application layer data frame structure of the slave in the dual ring network communication method according to a preferred embodiment of the present invention; Figure 6 An example of the composition of a slave node ring network application layer data frame according to a preferred embodiment of the present invention; Figure 7 A schematic diagram of fast forwarding and slow forwarding in dual ring network communication according to a preferred embodiment of the present invention; Figure 8-10 A schematic diagram of sending data in different stages of a fast forwarding mode and a slow forwarding mode in a dual-ring network communication according to a preferred embodiment of the present invention; Fig.11 The figure is a schematic diagram of an ID adaptation process according to a preferred embodiment of the present invention. DETAILED DESCRIPTION

[0033] Figure 1 Schematic diagram of the application environment of the dual-ring network communication method of the present invention, Figure 2is a flow chart of a dual ring network communication method according to a preferred embodiment of the present invention. This method can be applied to Figure 1 In the dual ring network communication shown in FIG. 1 , the dual ring network includes a host and N slaves, wherein N is at least 1, and the host and the N slaves are sequentially connected to form a ring network. Figure 1 As shown, the method includes: When the first communication port of the host ( Figure 1 When the first slave ( Figure 1 The slave 1 in the example receives the call message and forwards the call message to the second slave ( Figure 1 Slave 2 in the host), the first slave switches to the slow forwarding mode, and forwards the local message of the first slave to the second slave, and when the second slave receives the calling message, it forwards the calling message to the third slave through the fast forwarding mode, and the second slave switches to the slow forwarding mode, and forwards the local message of the second slave to the third slave, when the second slave completes the forwarding of the local message, the second slave forwards all the received local messages to the third slave, and transmits in this way until the calling message and the local messages of the N slaves are returned to the second communication port of the host; When the second communication port of the host ( Figure 1 When the B port in the Nth slave ( Figure 1 The slave N in the host receives the calling message and forwards the calling message to the N-1th slave through the fast forwarding mode, the N-1th slave switches to the slow forwarding mode, and forwards the local message of the N-1th slave to the N-1th slave. When the N-1th slave receives the calling message, it forwards the calling message to the N-2th slave through the fast forwarding mode, the N-1th slave switches to the slow forwarding mode, and forwards the local message of the N-1th slave to the N-2th slave. When the N-1th slave completes the forwarding of the local message, the N-1th slave forwards all the received local messages to the N-2th slave, and the transmission is carried out in this way until the calling message and the local messages of the N slaves return to the first communication port of the host.

[0034] In the technical solution of the present invention, in order to allow the host's call message to be transmitted to each slave faster to improve system synchronization, the slave needs to implement two forwarding modes: fast forwarding and slow forwarding. The host's call message is forwarded in fast forwarding mode, and the slave's local message and the received local message of the upstream slave of the communication link are forwarded in slow forwarding mode. This can minimize the forwarding delay while ensuring the quality of the signal after forwarding.

[0035] In a preferred embodiment, when a slave receives a call message, the slave starts to cache and encode a local message, where the local message is the message of the slave itself. For example, when the second slave receives a call message, it will pack and prepare the local message of the second slave itself, that is, cache and encode the local message of the second slave itself, so as to prepare to send it to the next slave.

[0036] In a preferred embodiment, after the slave quickly forwards the call message, the slave first sends its own local message, and also decodes and caches the local messages received from all other slaves. For example, after the second slave forwards the received call message, the second slave first sends its own local message, and also decodes and caches the local message received from the first slave, in preparation for sending it to the next slave.

[0037] In a preferred embodiment, when the slave is in a fast forwarding mode, the slave only performs clock recovery technology (CDR) processing on the received data code stream and then directly forwards it to the next slave; when the slave is in a slow forwarding mode, if the slave forwards its own local message, the slave caches and encodes its own local message and sends it to the next slave; if the slave forwards all received local messages, the slave sequentially encodes all decoded and cached local messages and then forwards them to the next slave.

[0038] In a preferred embodiment, since a round of ring network communication always starts with the master sending a message, when any slave is in an idle state, any slave is in a fast forwarding mode to wait for the call message sent by the master. After the master sends the call message, the slave can quickly propagate the message to the next slave through the fast forwarding mode.

[0039] In a preferred embodiment, after the slave completes forwarding the call message in the fast forwarding mode, and when both receiving and sending are idle, the slave switches to the slow forwarding mode; when the forwarding buffer of the slave is empty in the slow forwarding mode, and both receiving and sending of the slave are idle, the slave switches to the fast forwarding mode to wait for the start of the next communication cycle. While the call message is output through fast forwarding, it is also received and decoded by the slave node. After the slave node recognizes the call message through decoding, it packs and prepares the local message of this node, and switches to the slow forwarding mode after the fast forwarding is idle, giving priority to sending the local message of this node, and caching all messages received by the corresponding receiving port and forwarding them later.

[0040] In a preferred embodiment, Figure 3As shown, the application layer data frame structure of the call message includes a sender ID field, a frame length field, a total number of slaves field, a current device sequence number field and a data load field. The sender ID field is used to mark the host and each slave; The frame length field is used to mark the number of bytes of the application layer data of the data frame, and the calculation range includes all application layer contents starting from the total number of ring network slaves; for example, when the data payload length is 20 bytes, the frame length field should be 0x18.

[0041] The total number of slaves field is the total number of slaves in the current ring network defined by the master; The current device serial number field is used for the ring network ID adaptation process; The data payload field includes actual application data of the application layer. In a specific implementation, when there are multiple bytes of data to be sent, the low byte is sent first, and then the high byte is sent.

[0042] In a preferred embodiment, the application layer data frame structure of the call message also includes a heartbeat field, an ID adaptive command field and a communication cycle field. The heartbeat field is used for detecting the message link, and the heartbeat value changes each time the message is sent, for example, it is accumulated by 1 each time; the ID adaptive command field is used for the ring network ID adaptive process; the communication cycle field is used to agree on the time interval between each ring network communication; the unit is usually 1us.

[0043] In a specific implementation manner, the field order in the above application layer data frame structure can be custom designed according to protocol rules.

[0044] In a preferred embodiment, the sender ID field includes a node ID bit and a path ID bit, wherein the node ID bit is used to mark the ID of the host in the ring network, and the path ID bit is used to mark whether the data frame is sent from the first communication port or the second communication port of the host. For example, the sender ID field can be 1 Byte, including a node ID and a path ID, wherein bit0-bit6 is the node ID, marking the ID of the host in the ring network, and bit7 is the path ID, marking whether the data frame is sent from the first communication port or the second communication port of the host.

[0045] In a preferred embodiment, when the path ID bit is 0, it indicates that the data frame is sent by the first communication port of the host, and at this time, the sender ID field can be 0x00; when the path ID bit is 1, it indicates that the data frame is sent by the second communication port of the host, and at this time, the sender ID field can be 0x80.

[0046] In a preferred embodiment, the heartbeat field includes a data frame heartbeat bit, and the data frame heartbeat bit is accumulated by 1 each time a message is sent; the ID adaptive command field includes a dual-ring network ID adaptive process trigger bit, and the dual-ring network ID adaptive process trigger bit is used to trigger the dual-ring network ID adaptive process.

[0047] In a specific implementation, the heartbeat and ID adaptive command field can also be designed as one field. For example, the heartbeat and ID adaptive command field can be 1 Byte, bit0~bit2 are reserved bits, bit3~bit6 are data frame heartbeats, each time accumulating 1, and bit7 is used to trigger the dual ring network ID adaptive process.

[0048] Figure 4 The following is an example of the composition of the application layer data frame of the host node ring network. This is an application layer data frame. After passing through the physical layer, the frame will have a frame header and a delimiter added to the beginning, and a CRC checksum and a frame tail added to the end.

[0049] In a preferred embodiment, Figure 5 As shown, the local message application layer data frame structure sent by the slave includes a sender ID field, a frame length field, a heartbeat field and a data load field. The sender ID field is used to mark each slave; for example, for a slave device with a node ID of 3, the sender ID in the data frame sent by its first communication port is 0x03, and the sender ID in the data frame sent by its second communication port is 0x83.

[0050] The frame length field is used to mark the number of bytes of the application layer data of the data frame, and the calculation range is the heartbeat field and the data payload field; for example, when the data payload is 20 bytes long, the frame length field value should be 0x15.

[0051] The heartbeat field is used as a heartbeat, and the value of the field changes each time a message is sent; for example, it is accumulated by 1, and usually, the value range is 0 to 255.

[0052] The data payload field contains the actual application data of the application layer. Usually, when there are multiple bytes of data to be sent, the low byte is sent first, and then the high byte is sent.

[0053] In a specific implementation manner, the field order in the above application layer data frame structure can be custom designed according to protocol rules.

[0054] In a preferred embodiment, the sender ID field includes a node ID bit and a path ID bit. AtMark the ID of the slave in the ring network, and the path ID bit is used to mark whether the data frame is sent from the first communication port or the second communication port of the slave. For example, the sender ID field can be 1 Byte, including the node ID and the path ID, where bit0-bit6 is the node ID, marking the ID of the slave in the ring network, and bit7 is the path ID, marking whether the data frame is sent from the first communication port or the second communication port of the slave.

[0055] In a preferred embodiment, for the sender ID field, when the path ID bit is 0, it indicates that the data frame is sent from the first communication port of the slave machine; when the path ID bit is 1, it indicates that the data frame is sent from the second communication port of the slave machine.

[0056] Figure 6 The following is an example of the composition of the application layer data frame of the slave node ring network. This is an application layer data frame. After passing through the physical layer, the frame will have a frame header and a delimiter added to the beginning, and a CRC checksum and a frame tail added to the end.

[0057] In a preferred embodiment, the method further includes an ID adaptation process, which includes: The host enables the ID adaptation command field in the application layer data frame of at least one communication cycle to initiate the ID adaptation process. During the ID adaptation, the current device sequence number field in the call message sent by the host is 0, and the total number of slaves field is equal to the total number of slaves in the ring network; When the slave parses and finds that the ID adaptive command field in the call message is enabled, the slave maintains the slow forwarding mode after ending the current ring network communication, and sets the sender ID field of the slave, for example, the field can be set to 0x7F; If a call message is sent by the first communication port of the host, the slave increases the value of the current device serial number field in the received call message by 1 and writes it into the sender ID field of the slave, and forwards it to the next slave until the sender ID fields of all slaves are updated; If a summon message is sent by the second communication port of the host, the slave will write the value obtained by subtracting the current device serial number field value from the total number of slaves field value in the received summon message into the sender ID field of the slave and forward it to the next slave until the sender ID fields of all slaves are updated.

[0058] In a preferred embodiment, when the ID adaptation command field in the call message is reset, all slaves exit the ID adaptation process, exit the slow forwarding mode, and switch to the fast forwarding mode.

[0059] Figure 7It is a schematic diagram of fast forwarding and slow forwarding in dual ring network communication implemented according to the technical solution of the present invention. Figure 8-10 This is a schematic diagram of the data sent by the ring network in different stages of fast forwarding mode and slow forwarding mode, where: Phase 1: The slave performs fast forwarding. The slave performs clock recovery technology (CDR) processing on the received data stream and directly outputs it without decoding, caching, or encoding. This can minimize forwarding delay while ensuring the quality of the signal after forwarding.

[0060] Phase 2: The call message is received and decoded by the slave while being output through fast forwarding. After the slave recognizes the call message through decoding, it packs and prepares the local message of this node, that is, caches and encodes the local message, and switches to slow forwarding mode after the fast forwarding is idle, giving priority to sending the local message of this slave node, and caching all messages received by the corresponding receiving port.

[0061] Phase 3: After the local message of the slave is sent, the slave node remains in slow forwarding mode and continues to read and send all local messages received by the slave from the forwarding buffer. Finally, when the forwarding buffer is empty and the receiving and sending are idle, the slave node returns to fast forwarding mode and waits for the next communication cycle to start.

[0062] The technical solution of the present invention only performs clock recovery on the received message before forwarding, while other communication networks perform decoding, message parsing and frame forwarding, so the forwarding delay of this solution is greatly shortened. This solution can be based on optical fiber network transmission. In a 100M network environment, the message transmission delay of each node can be 0.1us, and the delay of 100 nodes is 10us. The real-time performance of node transmission is close to 10 times that of Ethercat network at the same clock rate.

[0063] like Fig.11As shown, it is a schematic diagram of the ID self-adaptation process implemented according to the technical solution of the present invention. When there are 4 slaves in the ring network performing ID self-adaptation, the current device serial number field in the message with ID 0x00 received by slave A is 0, and the current device serial number field in the message with ID 0x80 is 3. Therefore, slave A can add 1 to the current device serial number 0 in the message with ID 0x00 to obtain its own sender ID 1, and subtract the current device serial number 3 from the total number of ring network slave nodes 4 in the message with ID 0x80 to obtain its own sender ID 1. If the node IDs obtained in the two directions are consistent, slave A obtains node ID 0x01. Similarly, slaves B, C, and D obtain node IDs 0x02, 0x03, and 0x04, respectively. If the node IDs obtained in the two directions are inconsistent, or the communication in one direction is abnormal, the node ID 0x7F is obtained. When the ID adaptive command in the call message is reset, this cycle ends, all slaves exit the ID adaptive process, and use the last sender ID as the ring network communication address of the local machine. After completing the ID value confirmation, the device slave exits the slow forwarding mode and switches to the fast forwarding mode.

[0064] The present invention further discloses a computer storage medium, wherein the storage medium stores a program, wherein the program is used to be executed to implement the dual-ring network communication method as described in the present invention.

[0065] The present invention also discloses a dual-ring network communication system, which includes a host and N slaves, wherein N is at least 1, and the host and the N slaves are connected in sequence to form a ring network. When the first communication port of the host sends a calling message, the first slave receives the calling message and forwards the calling message to the second slave through a fast forwarding mode. The first slave switches to a slow forwarding mode and forwards the local message of the first slave to the second slave. When the second slave receives the calling message, it quickly forwards the calling message to the third slave through the fast forwarding mode. The second slave switches to a slow forwarding mode and forwards the local message of the second slave to the third slave. When the second slave completes the forwarding of the local message, the second slave forwards all the received local messages to the third slave, and the transmission is carried out in this way until the calling message and the local messages are transmitted. The local messages of the N slaves are returned to the second communication port of the host; when the second communication port of the host sends a calling message, the Nth slave receives the calling message and forwards the calling message to the N-1th slave through the fast forwarding mode, the Nth slave switches to the slow forwarding mode, and forwards the local message of the Nth slave to the N-1th slave. When the N-1th slave receives the calling message, it forwards the calling message to the N-2th slave through the fast forwarding mode, the N-1th slave switches to the slow forwarding mode, and forwards the local message of the N-1th slave to the N-2th slave. When the N-1th slave completes the forwarding of the local message, the N-1th slave forwards all the received local messages to the N-2th slave, and transmits in this way until the calling message and the local messages of the N slaves are returned to the first communication port of the host.

[0066] In a preferred implementation, when the slave receives the calling message, the slave starts to cache and encode a local message, where the local message is the message of the slave itself.

[0067] In a preferred embodiment, after the slave quickly forwards the calling message, the slave first sends its own local message, and also decodes and caches the local messages received from all other slaves.

[0068] In a preferred embodiment, when the slave is in a fast forwarding mode, the slave only performs clock recovery technology processing on the received data code stream and then directly forwards it to the next slave; when the slave is in a slow forwarding mode, if the slave forwards its own local message, the slave caches its own local message, encodes it, and sends it to the next slave; if the slave forwards all received local messages, the slave decodes and caches all local messages in turn, encodes them, and then forwards them to the next slave.

[0069] In a preferred embodiment, when any slave is in an idle state, any slave is in a fast forwarding mode to wait for a call message sent by the master.

[0070] In a preferred embodiment, after the slave completes forwarding of the summoning message in the fast forwarding mode, and both receiving and sending are idle, the slave switches to the slow forwarding mode; when the forwarding buffer area of ​​the slave is empty in the slow forwarding mode, and both receiving and sending of the slave are idle, the slave switches to the fast forwarding mode to wait for the start of the next communication cycle.

[0071] In a preferred embodiment, the dual-ring network communication system can also execute an ID adaptive process, including: The host enables the ID adaptation command field in the application layer data frame of at least one communication cycle to initiate the ID adaptation process. During the ID adaptation, the current device sequence number field in the call message sent by the host is 0, and the total number of slaves field is equal to the total number of slaves in the ring network; When the slave parses and finds that the ID adaptive command field in the call message is enabled, the slave maintains the slow forwarding mode after ending the current ring network communication and sets the sender ID field of the slave; If a call message is sent by the first communication port of the host, the slave increases the value of the current device serial number field in the received call message by 1 and writes it into the sender ID field of the slave, and forwards it to the next slave until the sender ID fields of all slaves are updated; If a summon message is sent by the second communication port of the host, the slave will write the value obtained by subtracting the current device serial number field value from the total number of slaves field value in the received summon message into the sender ID field of the slave and forward it to the next slave until the sender ID fields of all slaves are updated.

[0072] It should be noted that the use of step numbers (letters or numbers) to refer to certain specific method steps in the present invention is only for the purpose of convenience and brevity of description, and is by no means intended to limit the order of these method steps. Those skilled in the art will understand that the order of the relevant method steps should be determined by the technology itself and should not be inappropriately limited by the existence of step numbers.

[0073] Those skilled in the art will appreciate that, without conflict, the above-mentioned preferred solutions can be freely combined and superimposed.

[0074] It should be understood that the above-mentioned embodiments are merely illustrative and not restrictive. Without departing from the basic principles of the present invention, various obvious or equivalent modifications or substitutions that can be made by those skilled in the art to the above-mentioned details will be included in the scope of the claims of the present invention.

Claims

1. A dual ring network communication method, the dual ring network comprising a host and N slaves, wherein N is at least 1, the host and the N slaves are sequentially connected to form a ring network, characterized in that: The method comprises: When the first communication port of the host sends a call message, the first slave receives the call message and forwards the call message to the second slave through the fast forwarding mode, the first slave switches to the slow forwarding mode, and forwards the local message of the first slave to the second slave, when the second slave receives the call message, it forwards the call message to the third slave through the fast forwarding mode, the second slave switches to the slow forwarding mode, and forwards the local message of the second slave to the third slave, when the second slave completes the forwarding of the local message, the second slave forwards all the received local messages to the third slave, and the transmission is carried out in this way until the call message and the local messages of the N slaves are returned to the second communication port of the host; When the second communication port of the host sends a calling message, the Nth slave receives the calling message and forwards the calling message to the N-1th slave through the fast forwarding mode, the Nth slave switches to the slow forwarding mode, and forwards the local message of the N-1th slave to the N-1th slave. When the N-1th slave receives the calling message, it forwards the calling message to the N-2th slave through the fast forwarding mode, the N-1th slave switches to the slow forwarding mode, and forwards the local message of the N-1th slave to the N-2th slave. When the N-1th slave completes the forwarding of the local message, the N-1th slave forwards all the received local messages to the N-2th slave, and transmits in this way until the calling message and the local messages of the N slaves return to the first communication port of the host.

2. The dual ring network communication method according to claim 1, characterized in that: When the slave receives the calling message, the slave starts to cache and encode the local message, which is the message of the slave itself.

3. The dual ring network communication method according to claim 1, characterized in that: After the slave quickly forwards the calling message, the slave first sends its own local message, and also decodes and caches the local messages received from all other slaves.

4. The dual ring network communication method according to claim 1, characterized in that: When the slave is in fast forwarding mode, the slave performs clock recovery technology processing on the received data code stream and then directly forwards it to the next slave; When the slave is in slow forwarding mode, if the slave forwards its own local message, the slave caches and encodes its own local message and sends it to the next slave; if the slave forwards all received local messages, the slave sequentially encodes all decoded and cached local messages and forwards them to the next slave.

5. The dual ring network communication method according to claim 1, characterized in that: When any slave is in an idle state, any slave is in a fast forwarding mode to wait for a call message sent by the master.

6. The dual ring network communication method according to claim 1, characterized in that: After the slave completes forwarding of the call message in the fast forwarding mode, and when both receiving and sending are idle, the slave switches to the slow forwarding mode; When the forwarding buffer of the slave is empty in the slow forwarding mode and both the receiving and sending of the slave are idle, the slave switches to the fast forwarding mode to wait for the start of the next communication cycle.

7. The dual ring network communication method according to claim 1, characterized in that: The application layer data frame structure of the call message includes a sender ID field, a frame length field, a total number of slaves field, a current device sequence number field and a data load field. The sender ID field is used to mark the host and each slave; The frame length field is used to mark the number of bytes of application layer data in the data frame; The total number of slaves field is the total number of slaves in the current ring network defined by the master; The current device serial number field is used for the ring network ID adaptation process; The data payload field includes actual application data of the application layer.

8. The dual ring network communication method according to claim 7, characterized in that: The application layer data frame structure of the call message also includes a heartbeat field, an ID adaptive command field and a communication cycle field. The heartbeat field is used for the detection of the message link, and the heartbeat value changes each time a message is sent; The ID adaptation command field is used for the ring network ID adaptation process; The communication cycle field is used to agree on the time interval between each ring network communication.

9. The dual ring network communication method according to claim 7, characterized in that: The sender ID field includes a node ID bit and a path ID bit. The node ID bit is used to mark the ID of the host in the ring network; The path ID bit is used to mark whether the data frame is sent from the first communication port or the second communication port of the host.

10. The dual ring network communication method according to claim 9, characterized in that: When the path ID bit is 0, it indicates that the data frame is sent by the first communication port of the host; When the path ID bit is 1, it indicates that the data frame is sent from the second communication port of the host.

11. The dual ring network communication method according to claim 8, characterized in that: The heartbeat field includes a data frame heartbeat bit, and the data frame heartbeat bit is accumulated by 1 each time a message is sent; The ID adaptation command field includes a dual-ring network ID adaptation process triggering bit, and the dual-ring network ID adaptation process triggering bit is used to trigger the dual-ring network ID adaptation process.

12. The dual ring network communication method according to claim 1, characterized in that: The local message application layer data frame structure sent by the slave includes a sender ID field, a frame length field, a heartbeat field and a data load field. The sender ID field is used to mark each slave; The frame length field is used to mark the number of bytes of the application layer data of the data frame, and the calculation range is the heartbeat field and the data load field; The heartbeat field is used as a heartbeat, and the value of the field changes each time a message is sent; The data payload field contains the actual application data of the application layer.

13. The dual ring network communication method according to claim 12, characterized in that: The sender ID field includes a node ID bit and a path ID bit. The node ID bit is used to mark the ID of the slave in the ring network; The path ID bit is used to mark whether the data frame is sent from the first communication port or the second communication port of the slave.

14. The dual ring network communication method according to claim 13, characterized in that: When the path ID bit is 0, it indicates that the data frame is sent from the first communication port of the slave; When the path ID bit is 1, it indicates that the data frame is sent from the second communication port of the slave machine.

15. The dual ring network communication method according to any one of claims 7 to 14, characterized in that: The method further includes an ID adaptation process, which includes: The host enables the ID adaptation command field in the application layer data frame of at least one communication cycle to initiate the ID adaptation process. During the ID adaptation, the current device sequence number field in the call message sent by the host is 0, and the total number of slaves field is equal to the total number of slaves in the ring network; When the slave parses and finds that the ID adaptive command field in the call message is enabled, the slave maintains the slow forwarding mode after ending the current ring network communication and sets the sender ID field of the slave; If a call message is sent by the first communication port of the host, the slave increases the value of the current device serial number field in the received call message by 1 and writes it into the sender ID field of the slave, and forwards it to the next slave until the sender ID fields of all slaves are updated; If a summon message is sent by the second communication port of the host, the slave will write the value obtained by subtracting the current device serial number field value from the total number of slaves field value in the received summon message into the sender ID field of the slave and forward it to the next slave until the sender ID fields of all slaves are updated.

16. The dual ring network communication method according to claim 15, characterized in that: When the ID adaptation command field in the call message is reset, all slaves exit the ID adaptation process, exit the slow forwarding mode, and switch to the fast forwarding mode.

17. A computer storage medium, characterized in that: The storage medium stores a program, wherein the program is used to be executed to implement the dual-ring network communication method according to any one of claims 1 to 16.

18. A dual ring network communication system, comprising a host and N slaves, wherein N is at least 1, and wherein the host and the N slaves are sequentially connected to form a ring network, wherein: When the first communication port of the host sends a calling message, the first slave receives the calling message and forwards the calling message to the second slave through the fast forwarding mode, the first slave switches to the slow forwarding mode, and forwards the local message of the first slave to the second slave, when the second slave receives the calling message, it quickly forwards the calling message to the third slave through the fast forwarding mode, the second slave switches to the slow forwarding mode, and forwards the local message of the second slave to the third slave, when the second slave completes the forwarding of the local message, the second slave forwards all the received local messages to the third slave, and the transmission is carried out in this way until the calling message and the local messages of the N slaves are returned to the second communication port of the host; When the second communication port of the host sends a calling message, the Nth slave receives the calling message and forwards the calling message to the N-1th slave through the fast forwarding mode, the Nth slave switches to the slow forwarding mode, and forwards the local message of the N-1th slave to the N-1th slave. When the N-1th slave receives the calling message, it forwards the calling message to the N-2th slave through the fast forwarding mode, the N-1th slave switches to the slow forwarding mode, and forwards the local message of the N-1th slave to the N-2th slave. When the N-1th slave completes the forwarding of the local message, the N-1th slave forwards all the received local messages to the N-2th slave, and transmits in this way until the calling message and the local messages of the N slaves return to the first communication port of the host.

19. The dual-ring network communication system according to claim 18, characterized in that: When the slave receives the calling message, the slave starts to cache and encode the local message, which is the message of the slave itself.

20. The dual ring network communication system according to claim 18, characterized in that: After the slave quickly forwards the calling message, the slave first sends its own local message, and also decodes and caches the local messages received from all other slaves.

21. The dual-ring network communication system according to claim 18, characterized in that: When the slave is in fast forwarding mode, the slave performs clock recovery technology processing on the received data code stream and then directly forwards it to the next slave; When the slave is in slow forwarding mode, if the slave forwards its own local message, the slave caches and encodes its own local message and sends it to the next slave; if the slave forwards all received local messages, the slave sequentially encodes all decoded and cached local messages and forwards them to the next slave.

22. The dual ring network communication system according to claim 18, characterized in that: When any slave is in an idle state, any slave is in a fast forwarding mode to wait for a call message sent by the master.

23. The dual-ring network communication system according to claim 18, characterized in that: After the slave completes forwarding of the call message in the fast forwarding mode, and when both receiving and sending are idle, the slave switches to the slow forwarding mode; When the forwarding buffer of the slave is empty in the slow forwarding mode and both the receiving and sending of the slave are idle, the slave switches to the fast forwarding mode to wait for the start of the next communication cycle.

24. The dual ring network communication system according to any one of claims 18 to 23, characterized in that: The dual-ring network communication system can also execute an ID adaptive process, including: The host enables the ID adaptation command field in the application layer data frame of at least one communication cycle to initiate the ID adaptation process. During the ID adaptation, the current device sequence number field in the call message sent by the host is 0, and the total number of slaves field is equal to the total number of slaves in the ring network; When the slave parses and finds that the ID adaptive command field in the call message is enabled, the slave maintains the slow forwarding mode after ending the current ring network communication and sets the sender ID field of the slave; If a call message is sent by the first communication port of the host, the slave increases the value of the current device serial number field in the received call message by 1 and writes it into the sender ID field of the slave, and forwards it to the next slave until the sender ID fields of all slaves are updated; If a summon message is sent by the second communication port of the host, the slave will write the value obtained by subtracting the current device serial number field value from the total number of slaves field value in the received summon message into the sender ID field of the slave and forward it to the next slave until the sender ID fields of all slaves are updated.

Citation Information

Patent Citations

  • Message processing method for tangent ring networks and Ethernet switch

    CN102215165A

  • Industrial Ethernet switch looped network rapid network unlocking method and system, and storage medium

    CN110300043A

  • Dual-unit server redundant network system

    CN110557296A

  • Serial port double-loop network redundant communication method

    CN112463705A

  • Multi-component master-slave automatic networking method and management system

    CN116208638A

Cited By

  • Power electronic equipment ring network communication topological structure and ring network communication synchronization method

    CN120110836A