A Dual-Ring Network Communication Method and System

By adopting the dual-ring network communication method in the distributed real-time control system and using fast and slow forwarding modes, the problem of large EtherCAT communication delay is solved, and lower forwarding delay and higher system synchronization and real-time are achieved.

CN119211111BActive Publication Date: 2025-06-10NANJING HZ ELECTRIC CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In distributed real-time control systems, EtherCAT communication has a large delay due to the large number of nodes, which cannot meet the closed-loop control cycle requirements of 50us or even smaller.

Method used

The dual-ring network communication method is adopted to forward the host's summoning message through the fast forwarding mode, and forward the slave's local messages and received local messages from the front slave in the slow forwarding mode to reduce the forwarding delay.

Benefits of technology

It minimizes forwarding delay and ensures the synchronization and real-time nature of the distributed real-time control system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119211111B_ABST
    Figure CN119211111B_ABST
Patent Text Reader

Abstract

The present invention discloses a dual-ring network communication method. The host sends a call message through the first communication port. The first slave receives the call message and quickly forwards it to the second slave, then switches to the slow forwarding mode and forwards the local message to the second slave. The second slave quickly forwards the call message to the third slave, switches to the slow forwarding mode, forwards the local message to the third slave, and forwards the received local message to the third slave until the call message and the local message of the slave return to the second communication port of the host. The host sends a call message through the second communication port. The Nth slave receives the call message and quickly forwards it to the (N-1)th slave, then switches to the slow forwarding mode and forwards the local message to the (N-1)th slave. The (N-1)th slave quickly forwards the call message to the (N-2)th slave, switches to the slow forwarding mode, forwards the local message to the (N-2)th slave, and forwards the received local message to the (N-2)th slave until the call message and the local message of the slave return to the first communication port of the host.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] For power electronic equipment based on a modular multilevel topology architecture such as high-voltage direct-connected SVG (reactive power compensation device) and energy storage systems, the number of power modules on each phase bridge arm can reach hundreds, 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, and each valve control unit can manage hundreds of power modules. In the traditional method, the valve control units communicate with the power modules through point-to-point optical fibers. This results in a very spectacular optical fiber connection on the back of each valve control unit, and the failure rate caused by optical fibers remains high, posing a great challenge to operation and maintenance.

[0003] Currently, the most common and best-performing real-time communication in distributed real-time control systems is the EtherCAT bus, which well solves the problem of real-time communication of bus nodes in distributed control systems. However, there are still the following problems: 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 therein to extract or insert the data of the slave station itself and update the working counter, that is, from the time when the slave station receives the data frame from the previous node to the time when it forwards it, the delay of a single node is relatively large. When there are hundreds of nodes on the bus, for a single communication from the master station to the last node at the end of the bus, the delay is relatively large. Usually, the network communication delay of a network composed of 100 nodes is not less than 0.1 ms, which cannot meet the requirement of the closed-loop control period of 50 us or even smaller in the control system. Summary of the Invention

[0004] Based on the above situation, the main object of the present invention is to provide a dual-ring network communication method and system, which can forward the call message of the host through a fast forwarding mode and forward the local message of the slave and the local message of the previous slave received by the slave through a slow forwarding mode, so as to minimize the forwarding delay and ensure the synchronization and real-time performance of the distributed real-time control system.

[0005] To achieve the above object, the technical solution adopted by the present invention is as follows:

[0006] A dual-ring network communication method, the dual-ring network includes a host and N slave stations, where N is at least 1, the host is sequentially connected to the N slave stations to form a ring network, and the method includes:

[0007] When the first communication port of the host sends a call message, the first slave receives the call message, 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, the second slave 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 finishes forwarding the local message, the second slave forwards all the received local messages to the third slave. Such transmission continues until the call message and the local messages of the N slaves return to the second communication port of the host;

[0008] When the second communication port of the host sends a call message, the Nth slave receives the call message, forwards the call message to the (N - 1)th 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 - 1)th slave. When the (N - 1)th slave receives the call message, the (N - 1)th slave forwards the call message to the (N - 2)th slave through the fast forwarding mode, the (N - 1)th slave switches to the slow forwarding mode, and forwards the local message of the (N - 1)th slave to the (N - 2)th slave. When the (N - 1)th slave finishes forwarding the local message, the (N - 1)th slave forwards all the received local messages to the (N - 2)th slave. Such transmission continues until the call message and the local messages of the N slaves return to the first communication port of the host.

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

[0010] Preferably, after the slave forwards the call message quickly, the slave first sends its own local message, and at the same time decodes and caches all the local messages received from other slaves.

[0011] Preferably, when the slave is in the fast forwarding mode, the slave only performs clock recovery technology processing on the received data 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 and encodes its own local message and then sends it to the next slave; if the slave forwards all the received local messages, the slave sequentially encodes the decoded and cached all local messages and then forwards them to the next slave.

[0012] Preferably, when any slave is in the idle state, any slave is in the fast forwarding mode to wait for the call message sent by the host.

[0013] Preferably, after the slave device finishes forwarding the call message in the fast forwarding mode and both receiving and sending are idle, the slave device switches to the slow forwarding mode; when the buffer of the slave device is emptied during forwarding in the slow forwarding mode and both receiving and sending of the slave device are idle, the slave device switches to the fast forwarding mode to wait for the start of the next communication cycle.

[0014] Preferably, there is an idle period between two frames after the slave device finishes forwarding the call message.

[0015] Preferably, the application layer data frame structure of the call message includes a sender ID field, a frame length field, a total number of slave devices field, a current device serial number field, and a data payload field.

[0016] The sender ID field is used to mark the master device and each slave device.

[0017] 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 slave devices in the ring network.

[0018] The total number of slave devices field is the total number of slave devices in the current ring network defined by the master device.

[0019] The current device serial number field is used for the ring network ID self - adaptation process.

[0020] The data payload field includes the actual application data of the application layer.

[0021] The application layer data frame structure of the call message further includes a heartbeat field, an ID self - adaptation command field, and a communication cycle field. The heartbeat field is used for detecting the message link, and the heartbeat value changes each time a message is sent; the ID self - adaptation command field is used for the ring network ID self - adaptation process; the communication cycle field is used to agree on the time interval between each ring network communication.

[0022] 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 master device 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 master device.

[0023] Preferably, when the path ID bit is 0, it means the data frame is sent from the first communication port of the master device; when the path ID bit is 1, it means the data frame is sent from the second communication port of the master device.

[0024] Preferably, the heartbeat field includes a data frame heartbeat bit, and the data frame heartbeat bit is incremented 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.

[0025] Preferably, the application layer data frame structure of the local message sent by the slave includes a sender ID field, a frame length field, a heartbeat field, and a data payload field.

[0026] The sender ID field is used to mark each slave.

[0027] 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.

[0028] The heartbeat field is used as a heartbeat, and the value of this field changes each time a message is sent.

[0029] The data payload field contains the actual application data of the application layer.

[0030] 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.

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

[0032] Preferably, the method further includes an ID adaptive process, and the process includes:

[0033] The host enables the ID adaptive command field in the application layer data frame of at least one communication cycle to initiate the ID adaptive process. During the ID adaptation, the current device serial number field in the call message sent by the host is 0, and the slave total number field is equal to the total number of slaves in the ring network.

[0034] When the slave parses that the ID adaptive command field in the call message is enabled, after the slave finishes the current ring network communication, it maintains the slow forwarding mode and sets the sender ID field of this slave.

[0035] If the call message is sent from the first communication port of the host, the slave increments 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 then forwards it to the next slave until the sender ID fields of all slaves are updated.

[0036] If a call message is sent from the second communication port of the host, the slave device subtracts the value of the slave device total number field in the received call message from the value of the current device serial number field, writes the obtained value into the sender ID field of the slave device, and forwards it to the next slave device until the sender ID fields of all slave devices are updated.

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

[0038] The present invention also discloses a computer storage medium storing a program, wherein the program is used to be executed to implement the dual-ring network communication method according to any one of the present invention.

[0039] The present invention also discloses a dual-ring network communication system, which includes a host and N slave devices, where N is at least 1, and the host and the N slave devices are sequentially connected to form a ring network.

[0040] When the host sends a call message from its first communication port, the first slave device receives the call message, forwards the call message to the second slave device through the fast forwarding mode, the first slave device switches to the slow forwarding mode, and forwards the local message of the first slave device to the second slave device. When the second slave device receives the call message, it quickly forwards the call message to the third slave device through the fast forwarding mode, the second slave device switches to the slow forwarding mode, and forwards the local message of the second slave device to the third slave device. When the second slave device finishes forwarding the local message, the second slave device forwards all the received local messages to the third slave device. In this way, the transmission continues until the call message and the local messages of the N slave devices return to the second communication port of the host.

[0041] When the host sends a call message from its second communication port, the Nth slave device receives the call message, forwards the call message to the (N - 1)th slave device through the fast forwarding mode, the Nth slave device switches to the slow forwarding mode, and forwards the local message of the Nth slave device to the (N - 1)th slave device. When the (N - 1)th slave device receives the call message, it forwards the call message to the (N - 2)th slave device through the fast forwarding mode, the (N - 1)th slave device switches to the slow forwarding mode, and forwards the local message of the (N - 1)th slave device to the (N - 2)th slave device. When the (N - 1)th slave device finishes forwarding the local message, the (N - 1)th slave device forwards all the received local messages to the (N - 2)th slave device. In this way, the transmission continues until the call message and the local messages of the N slave devices return to the first communication port of the host.

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

[0043] Preferably, after the slave quickly forwards the call message, the slave first sends its own local message, and at the same time also decodes and caches all other local messages received from other slaves.

[0044] Preferably, when the slave is in the fast forwarding mode, the slave only performs clock recovery technology processing on the received data stream and 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 and encodes its own local message and then sends it to the next slave; if the slave forwards all the local messages received, the slave sequentially decodes and caches all the local messages, encodes them, and then forwards them to the next slave.

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

[0046] Preferably, after the slave completes forwarding the call message in the fast forwarding mode and both reception and transmission are idle, the slave switches to the slow forwarding mode; when the buffer of the slave is emptied during forwarding in the slow forwarding mode and both reception and transmission of the slave are idle, the slave switches to the fast forwarding mode to wait for the start of the next communication cycle.

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

[0048] Preferably, the dual-ring network communication system can also execute the ID self-adaptation process, including:

[0049] The master enables the ID self-adaptation command field in the application layer data frame of at least one communication cycle to initiate the ID self-adaptation process. During the ID self-adaptation, the current device serial number field in the call message sent by the master is 0, and the total number of slaves field is equal to the total number of slaves in the ring network;

[0050] When the slave parses that the ID self-adaptation command field in the call message is enabled, after the slave ends the current ring network communication, it maintains the slow forwarding mode and sets the sender ID field of this slave;

[0051] If the call message is sent from the first communication port of the master, the slave adds 1 to the value of the current device serial number field in the received call message and writes it into the sender ID field of the slave, and then forwards it to the next slave until the sender ID fields of all slaves are updated;

[0052] If a call message is sent from the second communication port of the host, the slave device subtracts the value of the slave device total number field in the received call message from the value of the current device serial number field, writes the obtained value into the sender ID field of the slave device, and forwards it to the next slave device until the update of the sender ID fields of all slave devices is completed.

[0053] In the technical solution of the present invention, in order to enable the call message of the host to be transmitted to each slave device faster to improve system synchronization, the slave device needs to implement two forwarding modes, namely fast forwarding and slow forwarding, when forwarding messages. The call message of the host is forwarded through the fast forwarding mode, and the local message of the slave device and the local message of the slave device on the upstream of the communication link received are forwarded through the slow forwarding mode, which can minimize the forwarding delay and ensure the quality after signal forwarding.

[0054] Other beneficial effects of the present invention will be described in the specific implementation manner through the introduction of specific technical features and technical solutions. Those skilled in the art should be able to understand the beneficial technical effects brought by the technical features and technical solutions through these introductions. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] The preferred embodiments of the dual-ring network communication method and device according to the present invention will be described below with reference to the accompanying drawings. In the drawings:

[0056] Figure 1 is a schematic diagram of the application environment of the dual-ring network communication method of the present invention;

[0057] Figure 2 is a flowchart of the dual-ring network communication method according to a preferred embodiment of the present invention;

[0058] Figure 3 is 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;

[0059] Figure 4 is an example of the composition of the host node ring network application layer data frame according to a preferred embodiment of the present invention;

[0060] Figure 5 is the application layer data frame structure of the slave device in the dual-ring network communication method according to a preferred embodiment of the present invention;

[0061] Figure 6 is an example of the composition of the slave node ring network application layer data frame according to a preferred embodiment of the present invention;

[0062] Figure 7 is a schematic diagram of fast forwarding and slow forwarding in the dual-ring network communication according to a preferred embodiment of the present invention;

[0063] Figures 8 - 10 Schematic diagram of sending data in different stages of the fast forwarding mode and the slow forwarding mode in dual-ring network communication according to a preferred embodiment of the present invention;

[0064] Figure 11 Schematic diagram of the ID self-adaptation process according to a preferred embodiment of the present invention. Detailed implementation manners

[0065] Figure 1 Schematic diagram of the application environment of the dual-ring network communication method of the present invention, Figure 2 Schematic flowchart of the dual-ring network communication method according to a preferred embodiment of the present invention. This method can be applied to Figure 1 the dual-ring network communication shown in the figure. The dual-ring network includes a host and N slave devices, where N is at least 1. The host is sequentially connected to the N slave devices to form a ring network, as Figure 1 shown in the figure. The method includes:

[0066] When the first communication port ( Figure 1 port A in the figure) of the host sends a call message, the first slave device ( Figure 1 slave device 1 in the figure) receives the call message and forwards the call message to the second slave device ( Figure 1 slave device 2 in the figure) through the fast forwarding mode. The first slave device switches to the slow forwarding mode and forwards the local message of the first slave device to the second slave device. When the second slave device receives the call message, it forwards the call message to the third slave device through the fast forwarding mode. The second slave device switches to the slow forwarding mode and forwards the local message of the second slave device to the third slave device. When the second slave device finishes forwarding the local message, the second slave device forwards all the received local messages to the third slave device. Such transmission continues until the call message and the local messages of the N slave devices return to the second communication port of the host;

[0067] When the second communication port ( Figure 1 port B in the figure) of the host sends a call message, the Nth slave device ( Figure 1The slave N) receives the call message and forwards the call message to the (N - 1)th 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 - 1)th slave. When the (N - 1)th slave receives the call message, it forwards the call message to the (N - 2)th slave through the fast forwarding mode, the (N - 1)th slave switches to the slow forwarding mode, and forwards the local message of the (N - 1)th slave to the (N - 2)th slave. When the (N - 1)th slave finishes forwarding the local message, the (N - 1)th slave forwards all the received local messages to the (N - 2)th slave. This transmission continues until the call message and the local messages of the N slaves return to the first communication port of the host.

[0068] In the technical solution of the present invention, in order to make the call message of the host be transmitted to each slave faster to improve the system synchronization, the slave needs to implement two forwarding modes, namely fast forwarding and slow forwarding, when forwarding the message. The call message of the host is forwarded through the fast forwarding mode, and the local message of the slave and the local messages of the slaves upstream in the communication link received are forwarded through the slow forwarding mode, which can minimize the forwarding delay and ensure the quality after signal forwarding at the same time.

[0069] In a preferred embodiment, when the slave receives the call message, the slave starts to cache and encode the local message, and the local message is the message of the slave itself. For example, when the second slave receives the call message, it will package and prepare the local message of the second slave itself, that is, cache and encode the local message of the second slave itself to prepare for sending to the next slave.

[0070] In a preferred embodiment, after the slave fast forwards the call message, the slave first sends its own local message, and at the same time decodes and caches all the local messages received from other slaves. For example, after the second slave forwards the received call message, the second slave will first send its own local message, and at the same time decode and cache the local message of the first slave received to prepare for sending to the next slave.

[0071] In a preferred embodiment, when the slave is in the fast forwarding mode, the slave only performs clock data recovery (CDR) processing on the received data 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 and encodes its own local message and then sends it to the next slave; if the slave forwards all the local messages received, the slave encodes all the decoded and cached local messages in sequence and then forwards them to the next slave.

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

[0073] In a preferred embodiment, after the slave completes the forwarding of the call message in the fast forwarding mode and both reception and transmission are idle, the slave switches to the slow forwarding mode; when the buffer of the slave is emptied during the forwarding in the slow forwarding mode and both reception and transmission 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 the local message of the node and, after the fast forwarding is idle, switches to the slow forwarding mode, preferentially sending the local message of the node, and at the same time caching all the messages received on the corresponding receiving port and forwarding them subsequently.

[0074] In a preferred embodiment, as Figure 3 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 serial number field, and a data payload field.

[0075] The sender ID field is used to mark the host and each slave.

[0076] 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 the 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.

[0077] The total number of slaves field is the total number of slaves in the current ring network defined by the host.

[0078] The current device serial number field is used for the ring network ID self - adaptation process.

[0079] The data payload field includes the actual application data of the application layer. In a specific embodiment, when multi - byte data needs to be sent, the low byte is sent first, and then the high byte is sent.

[0080] In a preferred embodiment, the application layer data frame structure of the call message further includes a heartbeat field, an ID self - adaptation 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, for example, it is incremented by 1 each time; the ID self - adaptation command field is used for the ring network ID self - adaptation process; the communication cycle field is used to agree on the time interval between each ring network communication; usually, the unit is 1 us.

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

[0082] In a preferred embodiment, 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. For example, the sender ID field can be 1Byte, including the node ID and the path ID. Among them, 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.

[0083] In a preferred embodiment, when the path ID bit is 0, it indicates that the data frame is sent from the first communication port of the host. 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 from the second communication port of the host. At this time, the sender ID field can be 0x80.

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

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

[0086] Figure 4 This is an example of the composition of the application layer data frame of the host node ring network. This is the application layer data frame. After passing through the physical layer, a frame header and a separator will be added at the beginning, and a CRC checksum and a frame tail will be added at the end.

[0087] In a preferred embodiment, as Figure 5 shown, the application layer data frame structure of the local message sent by the slave includes a sender ID field, a frame length field, a heartbeat field, and a data payload field.

[0088] The sender ID field is used to mark each slave device; 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.

[0089] 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 value of the frame length field should be 0x15.

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

[0091] The data payload field contains the actual application data of the application layer. Usually, when there is multi-byte data to be sent, the low byte is sent first, and then the high byte.

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

[0093] In a preferred implementation manner, the sender ID field includes a node ID bit and a path ID bit, and the node ID bit is used to at mark the ID of the slave device 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 device. For example, the sender ID field can be 1Byte, including the node ID and the path ID, where bit0-bit6 is the node ID, marking the ID of the slave device 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 device.

[0094] In a preferred implementation manner, for the sender ID field, when the path ID bit is 0, it means that the data frame is sent from the first communication port of the slave device; when the path ID bit is 1, it means that the data frame is sent from the second communication port of the slave device.

[0095] Figure 6 This is an example of the composition of the application layer data frame for the slave node ring network. This is the application layer data frame. After passing through the physical layer, a frame header and a separator will be added at the beginning, and a CRC checksum and a frame tail will be added at the end.

[0096] In a preferred implementation manner, the method further includes an ID adaptation process, and the process includes:

[0097] The host enables the ID adaptation command field in the application layer data frame for at least one communication cycle to initiate the ID adaptation process. During the ID adaptation, the current device serial number field in the call message sent by the host is 0, and the slave total number field is equal to the total number of slaves in the ring network;

[0098] When the slave parses that the ID adaptation command field in the call message is enabled, after the slave finishes the current ring network communication, it maintains the slow forwarding mode and sets the sender ID field of this slave. For example, this field can be set to 0x7F;

[0099] If the call message is sent from 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 then forwards it to the next slave until the sender ID fields of all slaves are updated;

[0100] If the call message is sent from the second communication port of the host, the slave writes the value obtained by subtracting the value of the current device serial number field from the value of the slave total number field in the received call message into the sender ID field of the slave, and then forwards it to the next slave until the sender ID fields of all slaves are updated.

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

[0102] Figure 7 It is a schematic diagram of fast forwarding and slow forwarding in the dual-ring network communication implemented according to the technical solution of the present invention, Figures 8 - 10 It is a schematic diagram of sending data in different stages of the ring network in the fast forwarding mode and the slow forwarding mode. Among them,

[0103] Stage 1: The slave performs fast forwarding. The slave only performs clock data recovery (CDR) processing on the received data stream and then directly outputs it without performing decoding, caching, and encoding operations, which can minimize the forwarding delay and ensure the quality of the signal after forwarding at the same time.

[0104] Stage 2: While the call message is output through fast forwarding, it is also received and decoded by the slave. After the slave recognizes the call message through decoding, it packages and prepares the local message of this node, that is, caches and encodes the local message, and switches to the slow forwarding mode after the fast forwarding is idle, and preferentially sends the local message of this slave node, and at the same time caches all the messages received by the corresponding receiving port.

[0105] Phase 3: After the local message transmission of the slave is completed, the slave node remains in the slow forwarding mode and continues to read and transmit all local messages received by the slave from the forwarding cache. Eventually, when the forwarding cache is emptied and both reception and transmission are idle, the slave node returns to the fast forwarding mode and waits for the start of the next communication cycle.

[0106] In the technical solution of the present invention, fast forwarding only performs clock recovery on the received message and then forwards it, while the forwarding of other communication networks decodes, parses the message, and then re-frames and forwards it. Therefore, the forwarding delay of this solution is greatly shortened. This solution can be based on fiber optic network transmission. In a 100Mbps network environment, the message transmission delay of each node can reach 0.1us. For 100 nodes, the delay is 10us. At the same clock rate, the node transmission real-time performance is nearly 10 times that of the Ethercat network.

[0107] As Figure 11 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 slave devices in the ring network for ID self-adaptation, for the call message received by slave A, in the message with ID 0x00, the current device serial number field is 0, and in the message with ID 0x80, the current device serial number field is 3. Therefore, slave A can increment the current device serial number 0 in the message with ID 0x00 by 1 to obtain its own sender ID as 1, and subtract the current device serial number 3 from the total number of slave nodes in the ring network 4 in the message with ID 0x80 to obtain its own sender ID as 1. Since the node IDs obtained in both directions are the same, slave A obtains the node ID 0x01. Similarly, slave B, C, and D obtain the node IDs 0x02, 0x03, and 0x04 respectively. If the node IDs obtained in both directions are inconsistent, or the communication in a certain direction is abnormal, then the node ID 0x7F is obtained. When the ID self-adaptation command in the call message is reset, this cycle ends, and all slave devices exit the ID self-adaptation process, use the finally obtained sender ID as the ring network communication address of the local device. After completing the ID value confirmation, the slave device exits the slow forwarding mode and switches to the fast forwarding mode.

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

[0109] The present invention also discloses a dual-ring network communication system. The dual-ring network communication system includes a host and N slave devices, where N is at least 1. The host and the N slave devices are sequentially connected to form a ring network. When the first communication port of the host sends a call message, the first slave device receives the call message and forwards the call message to the second slave device through the fast forwarding mode. The first slave device switches to the slow forwarding mode and forwards the local message of the first slave device to the second slave device. When the second slave device receives the call message, it quickly forwards the call message to the third slave device through the fast forwarding mode. The second slave device switches to the slow forwarding mode and forwards the local message of the second slave device to the third slave device. When the second slave device finishes forwarding its local message, the second slave device forwards all the received local messages to the third slave device. Such transmission continues until the call message and the local messages of the N slave devices return to the second communication port of the host. When the second communication port of the host sends a call message, the Nth slave device receives the call message and forwards the call message to the (N - 1)th slave device through the fast forwarding mode. The Nth slave device switches to the slow forwarding mode and forwards the local message of the Nth slave device to the (N - 1)th slave device. When the (N - 1)th slave device receives the call message, it forwards the call message to the (N - 2)th slave device through the fast forwarding mode. The (N - 1)th slave device switches to the slow forwarding mode and forwards the local message of the (N - 1)th slave device to the (N - 2)th slave device. When the (N - 1)th slave device finishes forwarding its local message, the (N - 1)th slave device forwards all the received local messages to the (N - 2)th slave device. Such transmission continues until the call message and the local messages of the N slave devices return to the first communication port of the host.

[0110] In a preferred embodiment, when a slave device receives a call message, the slave device starts to cache and encode its local message, where the local message is the message of the slave device itself.

[0111] In a preferred embodiment, after a slave device quickly forwards the call message, the slave device first sends its own local message and simultaneously decodes and caches all the local messages received from other slave devices.

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

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

[0114] In a preferred embodiment, after the slave completes the forwarding of the call message in the fast forwarding mode and both reception and transmission are idle, the slave switches to the slow forwarding mode; when the buffer of the slave is emptied during the forwarding in the slow forwarding mode and both reception and transmission of the slave are idle, the slave switches to the fast forwarding mode to wait for the start of the next communication cycle.

[0115] In a preferred embodiment, the dual-ring network communication system can also execute the ID self-adaptation process, including:

[0116] The master enables the ID self-adaptation command field in the application layer data frame of at least one communication cycle to initiate the ID self-adaptation process. During the ID self-adaptation, the current device serial number field in the call message sent by the master is 0, and the total number of slaves field is equal to the total number of slaves in the ring network;

[0117] When the slave parses that the ID self-adaptation command field in the call message is enabled, after the slave ends the current ring network communication, it maintains the slow forwarding mode and sets the sender ID field of this slave;

[0118] If the call message is sent from the first communication port of the master, the slave adds 1 to the value of the current device serial number field in the received call message and writes it into the sender ID field of the slave, and then forwards it to the next slave until the sender ID fields of all slaves are updated;

[0119] If the call message is sent from the second communication port of the master, the slave writes the value obtained by subtracting the value of the current device serial number field from the value of the total number of slaves field in the received call message into the sender ID field of the slave, and then forwards it to the next slave until the sender ID fields of all slaves are updated.

[0120] It should be noted that in the present invention, step numbers (letter or number numbers) are used to refer to certain specific method steps, only for the purpose of convenient and concise description, and by no means to limit the order of these method steps by letters or numbers. Those skilled in the art can understand that the order of the relevant method steps should be determined by the technology itself and should not be unduly restricted by the existence of step numbers.

[0121] Those skilled in the art can understand that on the premise of no conflict, the above preferred solutions can be freely combined and superimposed.

[0122] It should be understood that the above-described embodiments are merely exemplary and not restrictive. Without departing from the basic principles of the present invention, various obvious or equivalent modifications or substitutions that those skilled in the art can make to the above details will all be included within 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, where the local message 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 data in the application layer 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 data in the local message application layer 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, where the local message 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

  • Dual-unit server redundant network system

    CN110557296A

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

    CN116208638A