A heartbeat processing method and computer device for data communication network
By using logical ring mode to propagate heartbeat signals in a multi-node data communication network and establishing a connection status table in the server, the problems of low communication efficiency and inaccurate judgment of fault nodes in the prior art are solved, and more efficient communication and More accurate fault judgment.
Patent Information
- Application Number
- CN202411541383.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2044-10-31
AI Technical Summary
The prior art transmitting and receiving signals in the center of a multi-node data communication network leads to a reduced communication efficiency and the judgment of a single fault node is not accurate enough.
By establishing a connection status table in the server and propagating the heartbeat signal using a logical ring, the server updates the connection status table based on the received binary string, thereby judging the working status of the network node.
Improves communication efficiency and significantly improves the accuracy of judgments on a single fault node.
Smart Images

Figure CN119052313B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of heartbeat processing in data communication, and in particular to a heartbeat processing method and a computer device of a data communication network. Background Art
[0002] At present, almost all distributed control systems adopt a multi-layer hierarchical network structure, which consists of field control network, system network and management network. Among them, the system network is a link between the control network and the management network, and must have an efficient and secure network structure. The system network usually supports multiple types of network topologies and data transmission directions to ensure the reliability of data communication. However, there are still many factors that affect data communication in network operation, such as too many nodes may affect the transmission speed, and a single node failure may cause the entire network to be paralyzed. Therefore, it is particularly important to grasp the communication status of the nodes in the ring network in a timely manner.
[0003] In most communication systems, heartbeat packets are usually used between communication endpoints to confirm the connection, which is used to detect whether both parties are still online and whether the data link is unobstructed. In addition, through the heartbeat signal, node or link failures can be discovered in time, and corresponding recovery measures can be taken in time. Heartbeat packets are usually very small or just empty packets with only a header but no actual content. After the sending node sends a heartbeat packet, it should receive a heartbeat response from the receiver within a specified time. If no heartbeat response is received, it can be determined that the current communication line has a link failure or the receiving application is already in an abnormal state.
[0004] Although the sending and receiving of a single heartbeat packet has almost no effect on the performance of the node, if there are a large number of network nodes, the server will send and receive heartbeat signals one-to-one between nodes and each node will complete it independently, which will inevitably affect the communication performance of the entire network, resulting in reduced communication efficiency. In addition, the current heartbeat processing method is not accurate enough to judge a single faulty node, and it is not clear which specific node has failed. Summary of the invention
[0005] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a heartbeat processing method and a computer device for a data communication network, which improves the communication efficiency and also greatly improves the accuracy of judging a single faulty node.
[0006] The present invention adopts the following technical solutions to achieve the above-mentioned purpose. In a first aspect, the present invention provides a heartbeat processing method for a data communication network, comprising:
[0007] The server establishes a connection status table according to the number of connected main control modules, wherein the connection status table contains binary strings of at least n length, where n is an integer greater than or equal to 1, corresponding to the n connected main control modules respectively. If the main control module is connected smoothly, the corresponding position in the binary string is set to 1, otherwise the corresponding position is set to 0;
[0008] Initially, the server assumes by default that all the main control modules are in a disconnected state, so the server organizes a heartbeat detection packet as an initial heartbeat signal, that is, a binary string 000...000 of all 0s and length n, and sends it to the first main control module;
[0009] If the first main control module receives the initial heartbeat signal normally, it adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 100...000, and then sends the updated binary string 100...000 to the second main control module. If the second main control module receives the heartbeat signal normally, it adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 110...000, and then sends the updated binary string 110...000 to the third main control module. If the third main control module receives the heartbeat signal normally, it adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 111...000, and updates in sequence. Finally, the nth main control module sends the updated binary string 111...111 to the server, and the server updates the binary string 111...111 to the connection status table.
[0010] In a second aspect, the present invention provides a heartbeat processing method for a data communication network, comprising:
[0011] The server establishes a connection status table according to the number of connected main control modules, wherein the connection status table contains binary strings of at least n length, where n is an integer greater than or equal to 1, corresponding to the n connected main control modules respectively. If the main control module is connected smoothly, the corresponding position in the binary string is set to 1, otherwise the corresponding position is set to 0;
[0012] Initially, the server assumes that all the main control modules are in a disconnected state by default, so the server organizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string 000...000 of all 0s and length n, which is sent to the first main control module in a counterclockwise direction. The set time for the nth main control module to wait for the detection packet in the counterclockwise direction is greater than the set time for the n-1th main control module to wait for the detection packet;
[0013] If the first main control module cannot receive the initial heartbeat signal normally, the second main control module will be in the waiting state for the detection packet until it times out. After the timeout, the second main control module starts the exception handling process:
[0014] The second main control module reorganizes the heartbeat detection packet, sets the position of the first main control module of its preceding node to 0, and adds its own position state 1 to form a detection packet of the binary string 010...000, and then sends the detection packet of the binary string 010...000 to the third main control module. If the third main control module receives the heartbeat signal normally, it adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 011...000, and then sends the binary string 011...000 to the fourth main control module, updates them in sequence, and finally the nth main control module sends the updated binary string 011...111 to the server;
[0015] After receiving the detection packet of the binary string 011...111, the server reorganizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string 000...000 of all 0s and length n, and sends it to the nth main control module in a clockwise direction. In the clockwise direction, the set time for the nth main control module to wait for the detection packet is less than the set time for the n-1th main control module to wait for the detection packet;
[0016] During the heartbeat signal transmission process, if the first main control module cannot receive the initial heartbeat signal normally, the server will be in a state of waiting for the detection packet until it times out. After the timeout, the server starts the exception handling process:
[0017] The server sets all the master control modules on the node to 0, forming a detection packet with a binary string of 000...000;
[0018] The server performs a logical OR operation on the binary string 011...111 and the binary string 000...000 to obtain the binary string 011...111, and updates the binary string 011...111 to the connection status table. 0 indicates that the main control module of the corresponding node is faulty, and 1 indicates that the main control module of the corresponding node is normal. The first main control module is determined to be faulty based on the binary string 011...111.
[0019] In a third aspect, the present invention provides a heartbeat processing method for a data communication network, comprising:
[0020] The server establishes a connection status table according to the number of connected main control modules, wherein the connection status table contains binary strings of at least n length, where n is an integer greater than or equal to 1, corresponding to the n connected main control modules respectively. If the main control module is connected smoothly, the corresponding position in the binary string is set to 1, otherwise the corresponding position is set to 0;
[0021] Initially, the server assumes that all the main control modules are in a disconnected state by default, so the server organizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string 000...000 of all 0s and length n, which is sent to the first main control module in a counterclockwise direction. The set time for the nth main control module to wait for the detection packet in the counterclockwise direction is greater than the set time for the n-1th main control module to wait for the detection packet;
[0022] If the first main control module receives the initial heartbeat signal normally, it adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 100...000, and then sends the updated binary string 100...000 to the second main control module. If the second main control module receives the heartbeat signal normally, it adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 110...000, and then sends the updated binary string 110...000 to the third main control module, and updates them in sequence. If the nth main control module cannot receive the initial heartbeat signal normally, the server will be in a waiting state for the detection packet until it times out. After the timeout, the server starts the exception handling process:
[0023] The server sets all the master control modules on the node to 0, forming a detection packet with a binary string of 000...000, and then reorganizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string of all 0s and length n, 000...000, and sends it to the nth master control module in a clockwise direction. In the clockwise direction, the set time for the nth master control module to wait for the detection packet is less than the set time for the n-1th master control module to wait for the detection packet;
[0024] If the nth master control module cannot receive the initial heartbeat signal normally, the n-1th master control module will be in the waiting state for the detection packet until it times out. After the timeout, the n-1th master control module starts the exception handling process:
[0025] The n-1th master control module reorganizes the heartbeat detection packet, sets the position of the nth master control module of its preceding node to 0, and adds its own position state 1 to form a detection packet of the binary string 000...010, and then sends the detection packet of the binary string 000...010 to the n-2th master control module. The n-2th master control module receives the heartbeat detection packet normally, then adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 000...110, and then sends the updated binary string 000...110 to the n-3th master control module, updates them in sequence, and finally the first master control module sends the updated binary string 111...110 to the server;
[0026] The server performs a logical OR operation on the binary string 111...110 and the binary string 000...000 to obtain the binary string 111...110, and updates the binary string 111...110 to the connection status table. 0 indicates that the main control module of the corresponding node is faulty, and 1 indicates that the main control module of the corresponding node is normal. The nth main control module is determined to be faulty based on the binary string 111...110.
[0027] In a fourth aspect, the present invention provides a heartbeat processing method for a data communication network, comprising:
[0028] The server establishes a connection status table according to the number of connected main control modules, wherein the connection status table contains binary strings of at least n length, where n is an integer greater than or equal to 1, corresponding to the n connected main control modules respectively. If the main control module is connected smoothly, the corresponding position in the binary string is set to 1, otherwise the corresponding position is set to 0;
[0029] Initially, the server assumes that all the main control modules are in a disconnected state by default, so the server organizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string 000...000 of all 0s and length n, which is sent to the first main control module in a counterclockwise direction. The set time for the nth main control module to wait for the detection packet in the counterclockwise direction is greater than the set time for the n-1th main control module to wait for the detection packet;
[0030] During the heartbeat signal transmission process, if the mth master control module cannot receive the heartbeat signal normally, 1<m<n, then the m+1th master control module will be in the waiting state for the detection packet until it times out. After the timeout, the m+1th master control module starts the exception handling process:
[0031] The m+1th master control module reorganizes the heartbeat detection packet, sets the positions of all the master control modules of its preceding node to 0, and adds its own position state 1 to form a detection packet of the binary string 0010...000, 00010...000, 000010...000, ..., 000...010 or 000...001, and then sends the detection packet of the binary string 0010...000, 00010...000, 000010...000, ..., 000...010 or 000...001 to the next master control module or server in the counterclockwise direction. If the next master control module in the counterclockwise direction receives the heartbeat detection packet normally, it adds 1 to the received heartbeat signal detection packet and updates the heartbeat signal detection packet to the binary string 00110...000, 000110...000, 0000110...000, ..., 000...0110 or 000...011 The detection packets are updated in sequence, and finally the nth module sends the updated detection packets of the binary strings 0011...111, 00011...111, 000011...111, ..., 000...0111 or 000...011 to the server;
[0032] After receiving the detection packet, the server reorganizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string 000...000 of all 0s and length n, and sends it to the nth main control module in a clockwise direction. In the clockwise direction, the set time for the nth main control module to wait for the detection packet is less than the set time for the n-1th main control module to wait for the detection packet;
[0033] During the heartbeat signal transmission process, if the mth master control module cannot receive the heartbeat signal normally, the m-1th master control module will be in the waiting state for the detection packet until it times out. After the timeout, the m-1th master control module starts the exception handling process:
[0034] The m-1th master control module reorganizes the heartbeat detection packet, sets the positions of all the master control modules of its predecessor nodes to 0, and adds its own position status 1 to form a detection packet with a binary string of 000...0100, 000...01000, 000...010000, ..., 010...000 or 100...000, and then sends the detection packet with a binary string of 000...0100, 000...01000, 000...010000, ..., 010...000 or 100...000 to the next master control module or server in the clockwise direction, and so on. The next main control module in the clockwise direction receives the heartbeat detection packet normally, then adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to a detection packet of a binary string 000...1100, 000...011000, 000...0110000, ..., 0110...000 or 110...000, updates them in sequence, and finally the first main control module sends the updated binary string 111...1100, 111...11000, 111...110000, ..., 1110...000 or 110...000 detection packet to the server;
[0035] The server performs a logical OR operation on the binary string 0011...111, 00011...111, 000011...111, ..., 000...011 or 000...001 and the binary string 100...000, 110...000, 1110...000, ..., 111...11000 or 111...1100 to obtain the binary string 1011...111, 1101...111, 11101...111, ..., 111.. .11011 or 111...11101, and update the binary string 1011...111, 1101...111, 11101...111, ..., 111...11011 or 111...11101 to the connection status table, 0 indicates that the main control module of the corresponding node is faulty, 1 indicates that the main control module of the corresponding node is normal, then the fault of the second main control module, the third main control module, the fourth main control module, ..., the n-2th main control module or the n-1th main control module is determined according to the binary string in the connection status table.
[0036] In a fifth aspect, the present invention provides a computer device, including a memory, wherein the memory stores program instructions, and when the program instructions are executed, the heartbeat processing method of the data communication network as described above is executed.
[0037] The beneficial effects of the present invention are:
[0038] The present invention aims at the operation mechanism of the heartbeat signal between the server and the field main control module in the distributed control system, and innovatively proposes to realize the propagation of the heartbeat signal among all nodes in the network through a logical ring mode rather than a point-to-point mode, thereby improving the communication efficiency.
[0039] The present invention is not limited to the current network topology, but establishes a bidirectional ring network communication system between a server and a main control module based on a logical ring. The specific heartbeat signal is relayed in the ring network, carrying the status information of each network node, which is finally summarized to the server and used to judge the working status of the network node, greatly improving the accuracy of judging a single faulty node. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 This is a normal processing flow of the heartbeat of a data communication network provided by an embodiment of the present invention;
[0041] Figure 2 This is a heartbeat abnormality processing flow of a data communication network provided by an embodiment of the present invention;
[0042] Figure 3 This is the heartbeat processing flow of the data communication network under two main control modules provided by an embodiment of the present invention;
[0043] Figure 4 This is a heartbeat abnormality processing flow of a data counterclockwise communication network under three main control modules provided by an embodiment of the present invention;
[0044] Figure 5 This is a heartbeat exception processing flow of a clockwise data communication network under three main control modules provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0045] To make the purpose, technical solution and advantages of the embodiments of the present invention more clear, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0046] The present invention aims at the operation mechanism of the heartbeat signal between the server and the field main control module in the distributed control system, and elaborates on the connection mode between the server and the client, the sending and receiving logic of the heartbeat signal, the fault judgment of the node or link, etc.
[0047] The system network of the distributed control system supports various types of network topologies and data transmission directions to ensure the reliability of data communication. Various types of servers (real-time servers, historical servers, synchronous servers, redundant servers, etc.) and various types of field master control modules are simultaneously connected to the system network. Whether the server and the field master control module are in a star, bus or ring topology, the present invention forms a logical ring network with the server and each master control module, supports two-way data communication, and facilitates the subsequent logical processing of the heartbeat signal. Logical ring Figure 1 shown.
[0048] After the system is started, the server actively sends heartbeat signals to each main control module at regular intervals. In traditional applications, the server sends heartbeat signals to main control modules 1 to n respectively, and waits for each module to reply. In this mode, it takes 2*n heartbeat data sending and receiving actions (one sending and one receiving counts as two times) to complete a connection monitoring of all network nodes; if a main control module fails and cannot reply to the server's heartbeat signal, the number will become 2*(n-1)+1 times.
[0049] Specifically, the scheme of the present invention is as follows:
[0050] In a first aspect, the present invention provides a heartbeat processing method for a data communication network, comprising:
[0051] The server establishes a connection status table according to the number of connected main control modules. The connection status table contains binary strings of at least n length, where n is an integer greater than or equal to 1, corresponding to the n main control modules connected to it. If the main control module is connected smoothly, the corresponding position in the binary string is set to 1, otherwise the corresponding position is set to 0;
[0052] Initially, the server assumes by default that all the main control modules are in a disconnected state, so the server organizes a heartbeat detection packet as an initial heartbeat signal, that is, a binary string 000...000 of all 0s and length n, and sends it to the first main control module;
[0053] If the first main control module receives the initial heartbeat signal normally, it adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 100...000, and then sends the updated binary string 100...000 to the second main control module. If the second main control module receives the heartbeat signal normally, it adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 110...000, and then sends the updated binary string 110...000 to the third main control module. If the third main control module receives the heartbeat signal normally, it adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 111...000, and updates in sequence. Finally, the nth main control module sends the updated binary string 111...111 to the server, and the server updates the binary string 111...111 to the connection status table.
[0054] In a second aspect, the present invention provides a heartbeat processing method for a data communication network, comprising:
[0055] The server establishes a connection status table according to the number of connected main control modules. The connection status table contains binary strings of at least n length, where n is an integer greater than or equal to 1, corresponding to the n main control modules connected to it. If the main control module is connected smoothly, the corresponding position in the binary string is set to 1, otherwise the corresponding position is set to 0;
[0056] Initially, the server assumes that all the main control modules are in a disconnected state by default, so the server organizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string 000...000 of all 0s and length n, which is sent to the first main control module in a counterclockwise direction. The set time for the nth main control module to wait for the detection packet in the counterclockwise direction is greater than the set time for the n-1th main control module to wait for the detection packet;
[0057] If the first main control module cannot receive the initial heartbeat signal normally, the second main control module will be in the waiting state for the detection packet until it times out. After the timeout, the second main control module starts the exception handling process:
[0058] The second main control module reorganizes the heartbeat detection packet, sets the position of the first main control module of its preceding node to 0, and adds its own position state 1 to form a detection packet of the binary string 010...000, and then sends the detection packet of the binary string 010...000 to the third main control module. If the third main control module receives the heartbeat signal normally, it adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 011...000, and then sends the binary string 011...000 to the fourth main control module, updates them in sequence, and finally the nth main control module sends the updated binary string 011...111 to the server;
[0059] After receiving the detection packet of the binary string 011...111, the server reorganizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string 000...000 of all 0s and length n, and sends it to the nth main control module in a clockwise direction. In the clockwise direction, the set time for the nth main control module to wait for the detection packet is less than the set time for the n-1th main control module to wait for the detection packet;
[0060] During the heartbeat signal transmission process, if the first main control module cannot receive the initial heartbeat signal normally, the server will be in a state of waiting for the detection packet until it times out. After the timeout, the server starts the exception handling process:
[0061] The server sets all the master control modules on the node to 0, forming a detection packet with a binary string of 000...000;
[0062] The server performs a logical OR operation on the binary string 011...111 and the binary string 000...000 to obtain the binary string 011...111, and updates the binary string 011...111 to the connection status table. 0 indicates that the main control module of the corresponding node is faulty, and 1 indicates that the main control module of the corresponding node is normal. The first main control module is determined to be faulty based on the binary string 011...111.
[0063] In a third aspect, the present invention provides a heartbeat processing method for a data communication network, comprising:
[0064] The server establishes a connection status table according to the number of connected main control modules. The connection status table contains binary strings of at least n length, where n is an integer greater than or equal to 1, corresponding to the n main control modules connected to it. If the main control module is connected smoothly, the corresponding position in the binary string is set to 1, otherwise the corresponding position is set to 0;
[0065] Initially, the server assumes that all the main control modules are in a disconnected state by default, so the server organizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string 000...000 of all 0s and length n, which is sent to the first main control module in a counterclockwise direction. The set time for the nth main control module to wait for the detection packet in the counterclockwise direction is greater than the set time for the n-1th main control module to wait for the detection packet;
[0066] If the first main control module receives the initial heartbeat signal normally, it adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 100...000, and then sends the updated binary string 100...000 to the second main control module. If the second main control module receives the heartbeat signal normally, it adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 110...000, and then sends the updated binary string 110...000 to the third main control module, and updates them in sequence. If the nth main control module cannot receive the initial heartbeat signal normally, the server will be in a waiting state for the detection packet until it times out. After the timeout, the server starts the exception handling process:
[0067] The server sets all the master control modules on the node to 0, forming a detection packet with a binary string of 000...000, and then reorganizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string of all 0s and length n, 000...000, and sends it to the nth master control module in a clockwise direction. In the clockwise direction, the set time for the nth master control module to wait for the detection packet is less than the set time for the n-1th master control module to wait for the detection packet;
[0068] If the nth master control module cannot receive the initial heartbeat signal normally, the n-1th master control module will be in the waiting state for the detection packet until it times out. After the timeout, the n-1th master control module starts the exception handling process:
[0069] The n-1th master control module reorganizes the heartbeat detection packet, sets the position of the nth master control module of its preceding node to 0, and adds its own position state 1 to form a detection packet of the binary string 000...010, and then sends the detection packet of the binary string 000...010 to the n-2th master control module. The n-2th master control module receives the heartbeat detection packet normally, then adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 000...110, and then sends the updated binary string 000...110 to the n-3th master control module, updates them in sequence, and finally the first master control module sends the updated binary string 111...110 to the server;
[0070] The server performs a logical OR operation on the binary string 111...110 and the binary string 000...000 to obtain the binary string 111...110, and updates the binary string 111...110 to the connection status table. 0 indicates that the main control module of the corresponding node is faulty, and 1 indicates that the main control module of the corresponding node is normal. The nth main control module is determined to be faulty based on the binary string 111...110.
[0071] In a fourth aspect, the present invention provides a heartbeat processing method for a data communication network, comprising:
[0072] The server establishes a connection status table according to the number of connected main control modules. The connection status table contains binary strings of at least n length, where n is an integer greater than or equal to 1, corresponding to the n main control modules connected to it. If the main control module is connected smoothly, the corresponding position in the binary string is set to 1, otherwise the corresponding position is set to 0;
[0073] Initially, the server assumes that all the main control modules are in a disconnected state by default, so the server organizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string 000...000 of all 0s and length n, which is sent to the first main control module in a counterclockwise direction. The set time for the nth main control module to wait for the detection packet in the counterclockwise direction is greater than the set time for the n-1th main control module to wait for the detection packet;
[0074] During the heartbeat signal transmission process, if the mth master control module cannot receive the heartbeat signal normally, 1<m<n, then the m+1th master control module will be in the waiting state for the detection packet until it times out. After the timeout, the m+1th master control module starts the exception handling process:
[0075] The m+1th master control module reorganizes the heartbeat detection packet, sets the positions of all the master control modules of its preceding node to 0, and adds its own position state 1 to form a detection packet of the binary string 0010...000, 00010...000, 000010...000, ..., 000...010 or 000...001, and then sends the detection packet of the binary string 0010...000, 00010...000, 000010...000, ..., 000...010 or 000...001 to the next master control module or server in the counterclockwise direction. If the next master control module in the counterclockwise direction receives the heartbeat detection packet normally, it adds 1 to the received heartbeat signal detection packet and updates the heartbeat signal detection packet to the binary string 00110...000, 000110...000, 0000110...000, ..., 000...0110 or 000...011 The detection packets are updated in sequence, and finally the nth module sends the updated detection packets of the binary strings 0011...111, 00011...111, 000011...111, ..., 000...0111 or 000...011 to the server;
[0076] After receiving the detection packet, the server reorganizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string 000...000 of all 0s and length n, and sends it to the nth main control module in a clockwise direction. In the clockwise direction, the set time for the nth main control module to wait for the detection packet is less than the set time for the n-1th main control module to wait for the detection packet;
[0077] During the heartbeat signal transmission process, if the mth master control module cannot receive the heartbeat signal normally, the m-1th master control module will be in the waiting state for the detection packet until it times out. After the timeout, the m-1th master control module starts the exception handling process:
[0078] The m-1th master control module reorganizes the heartbeat detection packet, sets the positions of all the master control modules of its predecessor nodes to 0, and adds its own position status 1 to form a detection packet with a binary string of 000...0100, 000...01000, 000...010000, ..., 010...000 or 100...000, and then sends the detection packet with a binary string of 000...0100, 000...01000, 000...010000, ..., 010...000 or 100...000 to the next master control module or server in the clockwise direction, and so on. The next main control module in the clockwise direction receives the heartbeat detection packet normally, then adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to a detection packet of a binary string 000...1100, 000...011000, 000...0110000, ..., 0110...000 or 110...000, updates them in sequence, and finally the first main control module sends the updated binary string 111...1100, 111...11000, 111...110000, ..., 1110...000 or 110...000 detection packet to the server;
[0079] The server performs a logical OR operation on the binary string 0011...111, 00011...111, 000011...111, ..., 000...011 or 000...001 and the binary string 100...000, 110...000, 1110...000, ..., 111...11000 or 111...1100 to obtain the binary string 1011...111, 1101...111, 11101...111, ..., 111.. .11011 or 111...11101, and update the binary string 1011...111, 1101...111, 11101...111, ..., 111...11011 or 111...11101 to the connection status table, 0 indicates that the main control module of the corresponding node is faulty, 1 indicates that the main control module of the corresponding node is normal, then the fault of the second main control module, the third main control module, the fourth main control module, ..., the n-2th main control module or the n-1th main control module is determined according to the binary string in the connection status table.
[0080] The present invention is described in detail below with reference to specific embodiments.
[0081] For the case of two main control modules, in this case, there may be a main control module connected to the server that fails. Therefore, the present invention provides a heartbeat processing method for a data communication network, such as Figure 3 As shown, Figure 3 The main control module 1 is the first main control module, and the main control module 2 is the second main control module.
[0082] Specifically, the method includes:
[0083] The server establishes a connection status table according to the number of connected main control modules. The connection status table contains binary strings with a length of at least 2, corresponding to the first main control module and the second main control module connected thereto, respectively. If the first or second main control module is connected smoothly, the corresponding position in the binary string is set to 1, otherwise the corresponding position is set to 0;
[0084] Initially, the server assumes that all the main control modules are in a disconnected state by default, so the server organizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string 00 of all 0s and a length of 2, which is sent counterclockwise to the first main control module;
[0085] If the first main control module receives the initial heartbeat signal normally, 1 is added to the received heartbeat signal detection packet, the heartbeat signal detection packet is updated to binary string 10, and then the updated binary string 10 is sent to the second main control module. If the second main control module receives the heartbeat signal normally, 1 is added to the received heartbeat signal detection packet, the heartbeat signal detection packet is updated to binary string 11, and then the updated binary string 11 is sent to the server, and the server updates the binary string 11 to the connection status table;
[0086] If the first main control module cannot receive the initial heartbeat signal normally, the second main control module will be in the waiting state for the detection packet until it times out. After the timeout, the second main control module starts the exception handling process:
[0087] The second main control module reorganizes the heartbeat detection packet, sets the position of the first main control module of its preceding node to 0, and adds its own position state 1 to form a detection packet of binary string 01, and then sends the detection packet of binary string 01 to the server;
[0088] After receiving the detection packet of the binary string 01, the server reorganizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string 00 of all 0s and a length of 2, and sends it to the second main control module in a clockwise direction;
[0089] During the heartbeat signal transmission process, if the first main control module cannot receive the initial heartbeat signal normally, the server will be in a state of waiting for the detection packet until it times out. After the timeout, the server starts the exception handling process:
[0090] The server sets all the master control modules on the node to 0, forming a detection packet with a binary string of 00;
[0091] The server performs a logical OR operation on binary string 01 and binary string 00 to obtain binary string 01, and updates binary string 01 to the connection status table. 0 indicates that the main control module of the corresponding node is faulty, and 1 indicates that the main control module of the corresponding node is normal. The first main control module is determined to be faulty based on binary string 01.
[0092] For three main control modules, in this case, the present invention provides a heartbeat processing method for a data communication network, such as Figure 4 , Figure 5 As shown, Figure 4 , Figure 5 In the embodiment, the main control module 1 is the first main control module, the main control module 2 is the second main control module, and the main control module 3 is the third main control module.
[0093] Specifically, the method includes:
[0094] The server establishes a connection status table according to the number of connected main control modules. The connection status table contains binary strings of at least 3 in length, corresponding to the first main control module, the second main control module and the third main control module connected thereto respectively. If the first main control module is connected smoothly, the corresponding position in the binary string is set to 1, otherwise the corresponding position is set to 0;
[0095] Initially, the server assumes that all the main control modules are in a disconnected state by default, so the server organizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string 000 of all 0s and a length of 3, which is sent counterclockwise to the first main control module;
[0096] If the first main control module receives the initial heartbeat signal normally, 1 is added to the received heartbeat signal detection packet, the heartbeat signal detection packet is updated to the binary string 100, and then the updated binary string 100 is sent to the second main control module; if the second main control module receives the heartbeat signal normally, 1 is added to the received heartbeat signal detection packet, the heartbeat signal detection packet is updated to the binary string 110, and then the updated binary string 110 is sent to the third main control module; if the third main control module receives the heartbeat signal normally, 1 is added to the received heartbeat signal detection packet, the heartbeat signal detection packet is updated to the binary string 111, and then the updated binary string 111 is sent to the server, and the server updates the binary string 111 to the connection status table;
[0097] If the second main control module cannot receive the heartbeat signal normally, the third main control module will be in the waiting state for the detection packet until it times out. After the timeout, the third main control module starts the exception handling process:
[0098] The third master control module reorganizes the heartbeat detection packet, sets the positions of all the master control modules of its preceding node to 0, and adds its own position state 1 to form a detection packet of binary string 001, and then sends the detection packet of binary string 001 to the server;
[0099] After receiving the detection packet of binary string 001, the server reorganizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string 000 of all 0s and length 3, and sends it to the third main control module in a clockwise direction;
[0100] During the heartbeat signal transmission process, if the second main control module cannot receive the heartbeat signal normally, the first main control module will be in the waiting state for the detection packet until it times out. After the timeout, the first main control module starts the exception handling process:
[0101] The first master control module reorganizes the heartbeat detection packet, sets the positions of all the master control modules of its preceding node to 0, and adds its own position state 1 to form a detection packet with a binary string of 100, and then sends the detection packet with a binary string of 100 to the server;
[0102] The server performs a logical OR operation on the received binary string 001 and the binary string 100 to obtain the binary string 101. The server updates the binary string 101 to the connection status table. 0 indicates that the main control module of the corresponding node is faulty, and 1 indicates that the main control module of the corresponding node is normal. The server determines that the second main control module is faulty based on the binary string 101.
[0103] In the case of n main control modules, the server completes the heartbeat signal interaction with the main control module according to the following process.
[0104] The server creates a connection status table according to the number of connected master control modules. The most important information in the table is a binary string of length n, corresponding to the n connected master control modules. If the master control module is connected smoothly, the corresponding position in the binary string is set to 1; otherwise, the corresponding position is set to 0.
[0105] By default, the server assumes that all the master control modules are in a disconnected state, and will organize a detection packet as the initial heartbeat signal, that is, a binary string of all 0s and length n 00000...0000, which is sent to the master control module 1 in a counterclockwise direction. The set time for the master control module n to wait for the detection packet in the counterclockwise direction is greater than the set time for the master control module n-1 to wait for the detection packet.
[0106] Whether the main control module 1 works normally determines whether it can receive the detection packet normally, so it is divided into the following situations:
[0107] like Figure 1As shown, if the main control module 1 can receive it normally, it does not directly reply to the server, but adds its own state 1 to the received heartbeat signal detection packet, that is, updates the heartbeat signal detection packet to 10000...0000, and randomly sends the detection packet to the subsequent node-main control module 2. Similarly, if the main control module 2 can receive it normally, it does not directly reply to the server, but adds its own state 1 to the received heartbeat signal detection packet, that is, updates the heartbeat signal detection packet to 11000...0000, and randomly sends the detection packet to the main control module 3. And so on, until the heartbeat signal packet traverses the entire network node. At the same time, it can be seen that if all the main control modules are working normally, the final detection packet received by the server will be a binary string of 11111...1111, because all bits are set to 1, indicating that all corresponding network nodes (main control modules) are working normally. The server updates its connection status table with this binary string.
[0108] At this point, according to the binary string in the connection status table, it can be concluded that after a counterclockwise heartbeat detection packet is sent, it can be determined that the working status of all nodes (main control modules) in the current network is normal. At the same time, it can be seen that to complete such a connection detection, the heartbeat data transmission and initiation required are n+1 times, which is much lower than the 2*n times in the traditional point-to-point mode.
[0109] like Figure 2 As shown, if the main control module 1 cannot receive it normally, the operation of updating the detection packet and forwarding it to the main control module 2 cannot be completed. The main control module 2 will be in the state of waiting for the detection packet until it times out. After the timeout, the main control module 2 will start the exception handling process. First, the main control module 2 reorganizes the heartbeat detection packet, sets the position of its predecessor node-the main control module 1 to 0, and adds its own state 1, that is, constructs a detection packet with a binary string of 01000...0000, and then sends it to the subsequent node-the main control module 3. If the main control module 3 works normally and the subsequent network nodes are not faulty, the data sent by the main control module n to the server will be a detection packet in the form of 01111...1111. It can be judged that the network nodes (main control modules) corresponding to all the bits set to 1 are working normally, and the network nodes (main control modules) corresponding to the bits set to 0 are not working properly. The server updates its connection status table with this binary string.
[0110] To complete such a connection test, the heartbeat data needs to be sent and received n times, which is also much lower than the 2*(n-1)+1 times after a single point failure occurs in the traditional point-to-point mode.
[0111] Consider a more general situation, that is, the faulty node is not the one directly connected to the server in the network. Assuming that the main control module 2 fails, the main control module 3 will be in a state of waiting for the detection packet until it times out, after which the main control module 3 will start the exception handling process.
[0112] Module 3 reorganizes the heartbeat detection packet, sets the positions of all its predecessor nodes, main control module 1 and main control module 2, to 0, and adds its own state 1, that is, constructs a detection packet of the form 00100...0000, and then sends it to the subsequent node, main control module 4. If main control module 4 works normally and there is no failure in the subsequent network nodes, the data sent by main control module n to the server will be a detection packet of the form 00111...1111. Based on the form of the final detection packet alone, it can be judged that the network nodes (main control modules) corresponding to all the bits set to 1 are working normally; but because main control module 3 assumes that all its predecessor nodes are in abnormal state when organizing a new detection packet, it is impossible to fully determine whether the state of main control module 1 is normal. The server will temporarily store this binary string and organize the sending of the detection packet again.
[0113] The server reorganizes the detection packet as the initial heartbeat signal, that is, a binary string of all 0s and length n, 00000…0000, which is sent to the main control module n in a clockwise direction. In the clockwise direction, the set time for the nth main control module to wait for the detection packet is less than the set time for the n-1th main control module to wait for the detection packet. Except for the different directions of data flow, the sending and receiving process of this heartbeat signal packet is as described above. Because the faulty node in the current network is in the main control module 2, it cannot receive the heartbeat signal packet normally, nor can it update the detection packet and forward it to the main control module 1. The main control module 1 will be in the state of waiting for the detection packet until the timeout, after which the main control module 1 will start the exception handling process. First, the main control module 1 reorganizes the heartbeat detection packet, sets all its predecessor nodes-main control module 2 to the location of the main control module n to 0, and adds its own state 1, that is, constructs a detection packet in the form of 10000…0000, and then sends it to the subsequent node (for the main control module 1, its subsequent node is the server). The data received by the server will be a detection packet in the form of 10000…0000.
[0114] The server performs a logical OR operation on the binary strings 00111…1111 and 10000…0000 received during the two detections: 00111…1111 OR 10000…0000, and the result is 10111…1111. Based on this, the server determines that the network nodes (main control modules) corresponding to all the bits set to 1 are working normally, and the network nodes (main control modules) corresponding to the bits set to 0 are not working properly. Then the server updates its connection status table with this binary string 10111…1111.
[0115] The above is only a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the form disclosed herein, and should not be regarded as excluding other embodiments, but can be used in various other combinations, modifications and environments, and can be modified within the scope of the concept described herein through the above teachings or the technology or knowledge of the relevant field. The changes and modifications made by those skilled in the art shall not deviate from the spirit and scope of the present invention, and shall be within the scope of protection of the claims attached to the present invention.
Claims
1. A heartbeat processing method for a data communication network, characterized in that: include: The server establishes a connection status table according to the number of connected main control modules, wherein the connection status table contains binary strings of at least n length, where n is an integer greater than or equal to 1, corresponding to the n connected main control modules respectively. If the main control module is connected smoothly, the corresponding position in the binary string is set to 1, otherwise the corresponding position is set to 0; Initially, the server assumes by default that all the main control modules are in a disconnected state, so the server organizes a heartbeat detection packet as an initial heartbeat signal, that is, a binary string 000...000 of all 0s and length n, and sends it to the first main control module; If the first main control module receives the initial heartbeat signal normally, it adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 100...000, and then sends the updated binary string 100...000 to the second main control module. If the second main control module receives the heartbeat signal normally, it adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 110...000, and then sends the updated binary string 110...000 to the third main control module. If the third main control module receives the heartbeat signal normally, it adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 111...000, and updates in sequence. Finally, the nth main control module sends the updated binary string 111...111 to the server, and the server updates the binary string 111...111 to the connection status table.
2. A heartbeat processing method for a data communication network, characterized in that: include: The server establishes a connection status table according to the number of connected main control modules, wherein the connection status table contains binary strings of at least n length, where n is an integer greater than or equal to 1, corresponding to the n connected main control modules respectively. If the main control module is connected smoothly, the corresponding position in the binary string is set to 1, otherwise the corresponding position is set to 0; Initially, the server assumes that all the main control modules are in a disconnected state by default, so the server organizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string 000...000 of all 0s and length n, which is sent to the first main control module in a counterclockwise direction. The set time for the nth main control module to wait for the detection packet in the counterclockwise direction is greater than the set time for the n-1th main control module to wait for the detection packet; If the first main control module cannot receive the initial heartbeat signal normally, the second main control module will be in the waiting state for the detection packet until it times out. After the timeout, the second main control module starts the exception handling process: The second main control module reorganizes the heartbeat detection packet, sets the position of the first main control module of its preceding node to 0, and adds its own position state 1 to form a detection packet of the binary string 010...000, and then sends the detection packet of the binary string 010...000 to the third main control module. If the third main control module receives the heartbeat signal normally, it adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 011...000, and then sends the binary string 011...000 to the fourth main control module, updates them in sequence, and finally the nth main control module sends the updated binary string 011...111 to the server; After receiving the detection packet of the binary string 011...111, the server reorganizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string 000...000 of all 0s and length n, and sends it to the nth main control module in a clockwise direction. In the clockwise direction, the set time for the nth main control module to wait for the detection packet is less than the set time for the n-1th main control module to wait for the detection packet; During the heartbeat signal transmission process, if the first main control module cannot receive the initial heartbeat signal normally, the server will be in a state of waiting for the detection packet until it times out. After the timeout, the server starts the exception handling process: The server sets all the master control modules on the node to 0, forming a detection packet with a binary string of 000...000; The server performs a logical OR operation on the binary string 011...111 and the binary string 000...000 to obtain the binary string 011...111, and updates the binary string 011...111 to the connection status table. 0 indicates that the main control module of the corresponding node is faulty, and 1 indicates that the main control module of the corresponding node is normal. The first main control module is determined to be faulty based on the binary string 011...
111.
3. A heartbeat processing method for a data communication network, characterized in that: include: The server establishes a connection status table according to the number of connected main control modules, wherein the connection status table contains binary strings of at least n length, where n is an integer greater than or equal to 1, corresponding to the n connected main control modules respectively. If the main control module is connected smoothly, the corresponding position in the binary string is set to 1, otherwise the corresponding position is set to 0; Initially, the server assumes that all the main control modules are in a disconnected state by default, so the server organizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string 000...000 of all 0s and length n, which is sent to the first main control module in a counterclockwise direction. The set time for the nth main control module to wait for the detection packet in the counterclockwise direction is greater than the set time for the n-1th main control module to wait for the detection packet; If the first main control module receives the initial heartbeat signal normally, it adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 100...000, and then sends the updated binary string 100...000 to the second main control module. If the second main control module receives the heartbeat signal normally, it adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 110...000, and then sends the updated binary string 110...000 to the third main control module, and updates them in sequence. If the nth main control module cannot receive the initial heartbeat signal normally, the server will be in a waiting state for the detection packet until it times out. After the timeout, the server starts the exception handling process: The server sets all the master control modules on the node to 0, forming a detection packet with a binary string of 000...000, and then reorganizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string of all 0s and length n, 000...000, and sends it to the nth master control module in a clockwise direction. In the clockwise direction, the set time for the nth master control module to wait for the detection packet is less than the set time for the n-1th master control module to wait for the detection packet; If the nth master control module cannot receive the initial heartbeat signal normally, the n-1th master control module will be in the waiting state for the detection packet until it times out. After the timeout, the n-1th master control module starts the exception handling process: The n-1th master control module reorganizes the heartbeat detection packet, sets the position of the nth master control module of its preceding node to 0, and adds its own position state 1 to form a detection packet of the binary string 000...010, and then sends the detection packet of the binary string 000...010 to the n-2th master control module. The n-2th master control module receives the heartbeat detection packet normally, then adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to the binary string 000...110, and then sends the updated binary string 000...110 to the n-3th master control module, updates them in sequence, and finally the first master control module sends the updated binary string 111...110 to the server; The server performs a logical OR operation on the binary string 111...110 and the binary string 000...000 to obtain the binary string 111...110, and updates the binary string 111...110 to the connection status table. 0 indicates that the main control module of the corresponding node is faulty, and 1 indicates that the main control module of the corresponding node is normal. The nth main control module is determined to be faulty based on the binary string 111...
110.
4. A heartbeat processing method for a data communication network, characterized in that: include: The server establishes a connection status table according to the number of connected main control modules, wherein the connection status table contains binary strings of at least n length, where n is an integer greater than or equal to 1, corresponding to the n connected main control modules respectively. If the main control module is connected smoothly, the corresponding position in the binary string is set to 1, otherwise the corresponding position is set to 0; Initially, the server assumes that all the main control modules are in a disconnected state by default, so the server organizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string 000...000 of all 0s and length n, which is sent to the first main control module in a counterclockwise direction. The set time for the nth main control module to wait for the detection packet in the counterclockwise direction is greater than the set time for the n-1th main control module to wait for the detection packet; During the heartbeat signal transmission process, if the mth master control module cannot receive the heartbeat signal normally, 1<m<n, then the m+1th master control module will be in the waiting state for the detection packet until it times out. After the timeout, the m+1th master control module starts the exception handling process: The m+1th master control module reorganizes the heartbeat detection packet, sets the positions of all the master control modules of its preceding node to 0, and adds its own position state 1 to form a detection packet of the binary string 0010...000, 00010...000, 000010...000, ..., 000...010 or 000...001, and then sends the detection packet of the binary string 0010...000, 00010...000, 000010...000, ..., 000...010 or 000...001 to the next master control module or server in the counterclockwise direction. If the next master control module in the counterclockwise direction receives the heartbeat detection packet normally, it adds 1 to the received heartbeat signal detection packet and updates the heartbeat signal detection packet to the binary string 00110...000, 000110...000, 0000110...000, ..., 000...0110 or 000...011 The detection packets are updated in sequence, and finally the nth module sends the updated detection packets of the binary strings 0011...111, 00011...111, 000011...111, ..., 000...0111 or 000...011 to the server; After receiving the detection packet, the server reorganizes a heartbeat detection packet as the initial heartbeat signal, that is, a binary string 000...000 of all 0s and length n, and sends it to the nth main control module in a clockwise direction. In the clockwise direction, the set time for the nth main control module to wait for the detection packet is less than the set time for the n-1th main control module to wait for the detection packet; During the heartbeat signal transmission process, if the mth master control module cannot receive the heartbeat signal normally, the m-1th master control module will be in the waiting state for the detection packet until it times out. After the timeout, the m-1th master control module starts the exception handling process: The m-1th master control module reorganizes the heartbeat detection packet, sets the positions of all the master control modules of its predecessor nodes to 0, and adds its own position status 1 to form a detection packet with a binary string of 000...0100, 000...01000, 000...010000, ..., 010...000 or 100...000, and then sends the detection packet with a binary string of 000...0100, 000...01000, 000...010000, ..., 010...000 or 100...000 to the next master control module or server in the clockwise direction, and so on. The next main control module in the clockwise direction receives the heartbeat detection packet normally, then adds 1 to the received heartbeat signal detection packet, updates the heartbeat signal detection packet to a detection packet of a binary string 000...1100, 000...011000, 000...0110000, ..., 0110...000 or 110...000, updates them in sequence, and finally the first main control module sends the updated binary string 111...1100, 111...11000, 111...110000, ..., 1110...000 or 110...000 detection packet to the server; The server performs a logical OR operation on the binary string 0011...111, 00011...111, 000011...111, ..., 000...011 or 000...001 and the binary string 100...000, 110...000, 1110...000, ..., 111...11000 or 111...1100 to obtain the binary string 1011...111, 1101...111, 11101...111, ..., 111.. .11011 or 111...11101, and update the binary string 1011...111, 1101...111, 11101...111, ..., 111...11011 or 111...11101 to the connection status table, 0 indicates that the main control module of the corresponding node is faulty, 1 indicates that the main control module of the corresponding node is normal, then the fault of the second main control module, the third main control module, the fourth main control module, ..., the n-2th main control module or the n-1th main control module is determined according to the binary string in the connection status table.
5. A computer device, comprising a memory, wherein the memory stores program instructions, characterized in that: When the program instructions are executed, the heartbeat processing method for the data communication network as claimed in claim 1, 2, 3 or 4 is executed.
Citation Information
Patent Citations
Fault detection and repair method for industrial ring network
CN108566326A
Method for implementig mechanism of variable speed heartbeat based on network and load in host
CN1661968A