A CAN network optical fiber communication method supporting ring network redundancy
By building a ring fiber communication network in CAN network fiber communication and dividing control nodes and ordinary nodes, the problem of infinite loop forwarding of data in traditional redundant fiber ring network is solved, and the reliability and stability of the network are improved.
Patent Information
- Application Number
- CN202510009440.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2045-01-03
AI Technical Summary
After a traditional CAN network-to-fiber repeater using cascading networking to form a redundant fiber ring network, CAN data will be forwarded infinitely within the fiber ring network, resulting in network storm and network paralysis.
By building a ring fiber communication network based on several CAN network fiber repeaters, including two redundant transmission lines, and in the ring network mode, all repeaters are divided into one control node and several ordinary nodes, and data transmission is carried out on the normal line by one-way transmission method, and when abnormal, switch to another transmission line.
It effectively avoids the problem of infinite loop forwarding of data, improves the reliability of CAN network communication, and prevents network paralysis.
Smart Images

Figure CN119402092B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of CAN network optical fiber communication, and in particular to a CAN network optical fiber communication method supporting ring network redundancy. Background Art
[0002] In the prior art, a certain mainline diesel locomotive microcomputer network system uses a bus-based CAN network, and the communication medium is a twisted pair. Due to the internal space limitation of the locomotive, the power line and the communication line in the car are arranged close to each other, and there is a cross wiring situation. Therefore, the communication quality of the twisted pair CAN network is susceptible to electromagnetic interference, resulting in poor communication quality. Optical fiber transmission has the characteristics of no radiation energy, no conductivity, and no inductance, and there is no influence of mutual interference between signals. It has excellent anti-EMI and EMC characteristics. Therefore, it is proposed to use optical fiber as a network communication medium to solve the problem of signal electromagnetic interference. However, in practice, with the continuous improvement of rail transit operation safety requirements, locomotive network communication requires zero failure. When the conventional cascade networking method is used for communication, when the current transmission line fails, it is impossible to effectively switch the line for data transmission. Therefore, building a redundant optical fiber ring network is a means to improve the reliability of CAN network communication. However, after using a traditional CAN network to optical fiber repeater suitable for cascade networking to form a redundant optical fiber ring network, CAN data will be infinitely circulated and forwarded in the optical fiber ring network, generating a network storm and causing network paralysis. Summary of the invention
[0003] The present invention provides a CAN network optical fiber communication method supporting ring network redundancy, so as to overcome the technical problem that after a traditional CAN network is converted into an optical fiber repeater through cascade networking to form a redundant optical fiber ring network, CAN data will be infinitely circulated and forwarded in the optical fiber ring network, generating a network storm and causing network paralysis.
[0004] In order to achieve the above object, the technical solution of the present invention is:
[0005] A CAN network optical fiber communication method supporting ring network redundancy, the specific steps comprising:
[0006] S1: constructing a ring optical fiber communication network based on a plurality of CAN network optical fiber repeaters, wherein the ring optical fiber communication network includes two redundant transmission lines;
[0007] S2: Connect the power supply of the ring optical fiber communication network, so that each CAN network optical fiber repeater enters the ring network mode for data transmission, thereby realizing optical fiber communication;
[0008] In the ring network mode, all CAN network optical fiber repeaters are divided into a control node and several common nodes. The control node works according to the set control node working rules, and the common nodes work according to the set common node working rules, ensuring that when the current transmission line is working normally, a one-way transmission mode is used to transmit data on the current transmission line. When the current transmission line is abnormal, it is switched to another transmission line for data transmission.
[0009] Furthermore, the set control node working rules include:
[0010] 1) When transmitting data for the first time, select any direction as the transmission direction, send ACK, and execute 2);
[0011] 2) Determine whether the ACK sent by itself is received. If it is received, it means that the current transmission direction is normal. At this time, execute 3); otherwise, it means that the current transmission direction is abnormal. At this time, execute 5);
[0012] 3) Determine whether the number of times the packet CAN data is forwarded is equal to the number of CAN network optical fiber repeaters in the ring optical fiber communication network. If they are equal, discard the packet CAN data and execute 6). Otherwise, execute 4);
[0013] 4) After adding 1 to the forwarding count, forward the packetized CAN data and execute 6);
[0014] 5) Switch to another transmission direction and send ACK, and re-execute 2);
[0015] 6) Determine whether the control node has received the ID of the new CAN network fiber optic repeater. If so, it means that the topology of the ring fiber optic communication network has changed. At this time, the control node and the ordinary node are divided again; otherwise, execute 7);
[0016] 7) Send ACK to the current transmission direction and execute 2).
[0017] Furthermore, each CAN network optical fiber repeater is paired and communicated in sequence to form the annular optical fiber communication network with two redundant transmission lines;
[0018] Each CAN network optical fiber repeater includes a first optical fiber port and a second optical fiber port;
[0019] The first optical fiber port is used to convert the electrical signal received from the CAN port into an optical signal, and send the converted optical signal and the optical signal received from the second optical fiber port to an adjacent CAN network optical fiber repeater;
[0020] The second optical fiber port is used to forward the received optical signal sent by the adjacent CAN network optical fiber repeater to the first optical fiber port, and convert it into an electrical signal and send it to the CAN port.
[0021] Furthermore, in the ring network mode, all CAN network optical fiber repeaters are divided into a control node and a plurality of common nodes, wherein the division process is as follows:
[0022] The first optical fiber port and the second optical fiber port of each CAN network optical fiber repeater are set to a data mutual forwarding mode, and the CAN network optical fiber repeater is controlled to send its own ID to the first optical fiber port and the second optical fiber port respectively;
[0023] Each CAN network fiber optic repeater receives all CAN network fiber optic repeater IDs in the ring fiber optic communication network, and determines whether its own factory serial ID value is the smallest. If it is the smallest, it acts as a control node in the ring fiber optic communication network, otherwise it acts as an ordinary node in the ring fiber optic communication network.
[0024] Furthermore, the set common node working rules include:
[0025] a) Determine whether an ACK forwarded by the control node or other common nodes is received. If so, execute b). Otherwise, continue to wait until an ACK is received and execute b).
[0026] b) Take the transmission direction of ACK as the current transmission direction, forward ACK to the next common node or control node in the current transmission direction, and execute c);
[0027] c) Determine whether the number of forwarding times of the received packet CAN data is equal to the number of CAN network optical fiber repeaters in the ring optical fiber communication network. If they are equal, it means that the forwarding cycle of the packet CAN data has been completed in the ring optical fiber communication network. At this time, the packet CAN data is discarded and e) is executed. Otherwise, d) is executed);
[0028] d) After adding 1 to the forwarding times, forward the packaged CAN data and execute e);
[0029] e) Determine whether the ACK forwarded by the control node or other common nodes is received. If so, execute b), otherwise, execute f);
[0030] f) Determine whether the common node has received the ID of the new CAN network fiber optic repeater. If so, it indicates that the topology of the ring fiber optic communication network has changed. At this time, the control node and the common node are divided again; otherwise, execute c).
[0031] Beneficial effect: The present invention constructs a ring optical fiber communication network based on a plurality of CAN network optical fiber repeaters, and the ring optical fiber communication network includes two redundant transmission lines. In the ring network mode, all CAN network optical fiber repeaters are divided into a control node and a plurality of ordinary nodes, and the control node works according to the set control node working rules, and the ordinary nodes work according to the set ordinary node working rules, to ensure that when the current transmission line is working normally, a unidirectional transmission mode is used to transmit data on the current transmission line, and when the current transmission line is abnormal, it switches to another transmission line for data transmission. The present invention improves the reliability of CAN network communication by constructing a redundant optical fiber ring network, and at the same time avoids the problem that after the traditional CAN network is converted to an optical fiber repeater to form a redundant optical fiber ring network, CAN data will be infinitely forwarded in the optical fiber ring network, resulting in a network storm and causing network paralysis. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0033] Figure 1 It is a flow chart of a CAN network optical fiber communication method supporting ring network redundancy in the present invention;
[0034] Figure 2 A structural diagram of a ring network mode in an embodiment of the present invention;
[0035] Figure 3 A structural diagram of a cascade mode in an embodiment of the present invention;
[0036] Figure 4 The figure is a working flow diagram of the CAN fiber optic repeater in the ring network mode in the embodiment of the present invention. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0038] This embodiment provides a CAN network optical fiber communication method supporting ring network redundancy, such as Figure 1 As shown, the specific steps include:
[0039] S1: constructing a ring optical fiber communication network based on a plurality of CAN network optical fiber repeaters, wherein the ring optical fiber communication network includes two redundant transmission lines;
[0040] S2: Connect the power supply of the ring optical fiber communication network, so that each CAN network optical fiber repeater enters the ring network mode for data transmission, thereby realizing optical fiber communication;
[0041] In the ring network mode, all CAN network fiber repeaters are divided into a control node and several common nodes, such as Figure 4 As shown, the control node works according to the set control node working rules, and the ordinary node works according to the set ordinary node working rules, ensuring that when the current transmission line is working normally, a unidirectional transmission method is used to transmit data on the current transmission line. When the current transmission line is abnormal, it switches to another transmission line for data transmission.
[0042] Specifically, the configuration in this embodiment can ensure that if a CAN link fails, the system can switch to the backup link to continue working, thereby ensuring the reliability of communication.
[0043] In a specific embodiment, Figure 2 As shown, each CAN network optical fiber repeater is paired and communicated in sequence to form the ring optical fiber communication network with two redundant transmission lines;
[0044] Each CAN network fiber optic repeater includes a first fiber optic port, a second fiber optic port, a first twisted pair CAN port, and a second twisted pair CAN port;
[0045] The first optical fiber port is used to convert the electrical signal received from the CAN port into an optical signal, and send the converted optical signal and the optical signal received from the second optical fiber port to an adjacent CAN network optical fiber repeater;
[0046] The second optical fiber port is used to forward the received optical signal sent by the adjacent CAN network optical fiber repeater to the first optical fiber port, and convert it into an electrical signal and send it to the CAN port.
[0047] In addition, the first optical fiber port and the second optical fiber port can be used interchangeably according to setting requirements.
[0048] The first twisted pair CAN port and the second twisted pair CAN port are used to connect to the CAN network device, and the local CAN network device is connected through the twisted pair CAN port, so that the optical fiber repeater can be directly connected to the local CAN network device for data transmission. At the same time, in this embodiment, the CAN network optical fiber repeater is installed near the CAN network device, and the optical fiber is used to transmit network data over a long distance between different CAN network devices, which can reduce the electromagnetic interference of the CAN network signal.
[0049] Specifically, in this embodiment, a total of four CAN network optical fiber repeaters are set. In addition to forming the CAN network optical fiber repeaters into a ring network mode for operation, when the repeaters are required to operate in a cascade mode, the four CAN network optical fiber repeaters can also be formed into a ring network mode. Figure 3 In the cascade network shown in the figure, the optical fiber network is disconnected at the end node, and all repeaters on the optical fiber network work in transparent transmission mode. The data received by the repeater can be forwarded to the adjacent device through the optical fiber port. The data in the optical fiber network is terminated at the end node repeater, and each repeater will receive the data transmitted by other repeaters, that is, any twisted pair CAN port or optical fiber port can forward the received CAN data to the other three ports without loss.
[0050] Specifically, in this embodiment, in the ring network mode, all CAN network optical fiber repeaters are divided into a control node and a plurality of common nodes, wherein the division process is:
[0051] The first optical fiber port and the second optical fiber port of each CAN network optical fiber repeater are set to a data mutual forwarding mode, and the CAN network optical fiber repeater is controlled to send its own ID to the first optical fiber port and the second optical fiber port respectively;
[0052] Each CAN network fiber optic repeater receives all CAN network fiber optic repeater IDs in the ring fiber optic communication network, and determines whether its own factory serial ID value is the smallest. If it is the smallest, it acts as a control node in the ring fiber optic communication network, otherwise it acts as an ordinary node in the ring fiber optic communication network.
[0053] Specifically, in this embodiment, each CAN network fiber optic repeater has a unique factory serial ID value, so according to the ID data of each CAN network fiber optic repeater, the number of repeaters in the network can be obtained and the size of the ID value can be determined.
[0054] In a specific embodiment, the set control node working rules include:
[0055] The set control node working rules include:
[0056] 1) When transmitting data for the first time, select any direction as the transmission direction, send ACK, and execute 2);
[0057] 2) Determine whether the ACK sent by itself is received. If it is received, it means that the current transmission direction is normal. At this time, execute 3); otherwise, it means that the current transmission direction is abnormal. At this time, execute 5);
[0058] 3) Determine whether the number of times the packet CAN data is forwarded is equal to the number of CAN network optical fiber repeaters in the ring optical fiber communication network. If they are equal, discard the packet CAN data and execute 6). Otherwise, execute 4);
[0059] 4) After adding 1 to the forwarding count, forward the packetized CAN data and execute 6);
[0060] 5) Switch to another transmission direction and send ACK, and re-execute 2);
[0061] 6) Determine whether the control node has received the ID of the new CAN network fiber optic repeater. If so, it means that the topology of the ring fiber optic communication network has changed. At this time, the control node and the ordinary node are divided again; otherwise, execute 7);
[0062] 7) Send ACK to the current transmission direction and execute 2).
[0063] Specifically, in this embodiment, the control node repeater sends the ACK, that is, the control node sends an ACK to any of its own optical fiber ports, and the ACK is only forwarded in the optical fiber network. If the current data transmission direction is normal, the common node repeater connected to the control node receives the ACK from one optical fiber port and forwards it to another optical fiber port. The ACK is forwarded by each repeater in the optical fiber ring network and finally reaches another optical fiber port of the control node repeater. At this time, the packet CAN data is forwarded; if the ACK is not received, it means that the current data transmission direction is abnormal, then the direction is switched and the ACK is resent. At this time, after the common repeater in the ring network receives the ACK in the opposite direction, it will switch the data transmission direction of the optical fiber port. When all the common node repeaters switch the transmission direction, the transmission direction of the optical fiber ring network is switched.
[0064] Specifically, in this embodiment, during the process of forwarding the packet CAN data, it is determined in real time whether a new repeater has been added to the network, that is, whether the ID of a new CAN network optical fiber repeater has been received. If it has been received, it means that the topology of the network has changed. At this time, all repeaters are re-divided into control nodes and ordinary nodes, and enter the corresponding working mode according to the division results. In addition, in this embodiment, the control node is also set to periodically send ACK in the current transmission direction to determine whether the current data transmission direction is normal, thereby ensuring the smooth transmission of data.
[0065] Specifically, in this embodiment, the packetized CAN data refers to the normal CAN data being packetized after the forwarding times are added to the normal CAN data, and the packetized CAN data is only transmitted in the optical fiber ring network, and only the normal CAN data is forwarded between the two twisted pair CAN ports of the repeater. The CAN data received by the repeater from the twisted pair port is added with the forwarding times 0 (packetization) when forwarded to the optical fiber port, and the packetized CAN data received by the repeater optical fiber port is deleted when forwarded to the twisted pair port (unpacketization), and only the normal CAN data is forwarded to the twisted pair CAN port, and the packetized CAN data is only forwarded between the two optical fiber ports of the repeater.
[0066] In a specific embodiment, the set common node working rules include:
[0067] a) Determine whether an ACK forwarded by the control node or other common nodes is received. If so, execute b). Otherwise, continue to wait until an ACK is received and execute b).
[0068] b) Take the transmission direction of ACK as the current transmission direction, forward ACK to the next common node or control node in the current transmission direction, and execute c);
[0069] c) Determine whether the number of forwarding times of the received packet CAN data is equal to the number of CAN network optical fiber repeaters in the ring optical fiber communication network. If they are equal, it means that the forwarding cycle of the packet CAN data has been completed in the ring optical fiber communication network. At this time, the packet CAN data is discarded and e) is executed. Otherwise, d) is executed);
[0070] d) After adding 1 to the forwarding times, forward the packaged CAN data and execute e);
[0071] e) Determine whether the ACK forwarded by the control node or other common nodes is received. If so, execute b), otherwise, execute f);
[0072] f) Determine whether the common node has received the ID of the new CAN network fiber optic repeater. If so, it indicates that the topology of the ring fiber optic communication network has changed. At this time, the control node and the common node are divided again; otherwise, execute c).
[0073] Specifically, since each repeater can identify the number of repeaters in the ring network based on the number of different IDs received, and the repeater adds 1 to the forwarding times when sending packet CAN data, when the optical fiber port of the repeater receives the packet CAN data, it determines whether the forwarding times of the packet data are equal to the number of repeaters in the network, thereby determining whether the forwarding cycle of the packet CAN data has been completed in the optical fiber ring network. If they are equal, it means that all repeaters have received and forwarded the data. At this time, the repeater executes the operation of discarding the packet CAN data to prevent the packet CAN data from being forwarded in an infinite loop in the optical fiber ring network.
[0074] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A CAN network optical fiber communication method supporting ring network redundancy, characterized in that: The specific steps include: S1: constructing a ring optical fiber communication network based on a plurality of CAN network optical fiber repeaters, wherein the ring optical fiber communication network includes two redundant transmission lines; S2: Connect the power supply of the ring optical fiber communication network, so that each CAN network optical fiber repeater enters the ring network mode for data transmission, thereby realizing optical fiber communication; In the ring network mode, all CAN network optical fiber repeaters are divided into a control node and several common nodes. The control node works according to the set control node working rules, and the common nodes work according to the set common node working rules, ensuring that when the current transmission line is working normally, a one-way transmission mode is used to transmit data on the current transmission line. When the current transmission line is abnormal, it is switched to another transmission line for data transmission. The set control node working rules include: 1) When transmitting data for the first time, select any direction as the transmission direction, send ACK, and execute 2); 2) Determine whether the ACK sent by itself is received. If it is received, it means that the current transmission direction is normal. At this time, execute 3); otherwise, it means that the current transmission direction is abnormal. At this time, execute 5); 3) Determine whether the number of times the packet CAN data is forwarded is equal to the number of CAN network optical fiber repeaters in the ring optical fiber communication network. If they are equal, discard the packet CAN data and execute 6), otherwise, execute 4); 4) After adding 1 to the forwarding times, forward the packaged CAN data and execute 6); 5) Switch to another transmission direction and send ACK, and re-execute 2); 6) Determine whether the control node has received the ID of the new CAN network optical fiber repeater. If so, it indicates that the topology of the ring optical fiber communication network has changed. At this time, the control node and the ordinary node are divided again; otherwise, execute 7); 7) Send ACK to the current transmission direction and execute 2).
2. The CAN network optical fiber communication method supporting ring network redundancy according to claim 1, characterized in that: The CAN network optical fiber repeaters are paired and communicated in sequence to form the ring optical fiber communication network with two redundant transmission lines; Each CAN network optical fiber repeater includes a first optical fiber port and a second optical fiber port; The first optical fiber port is used to convert the electrical signal received from the CAN port into an optical signal, and send the converted optical signal and the optical signal received from the second optical fiber port to an adjacent CAN network optical fiber repeater; The second optical fiber port is used to forward the received optical signal sent by the adjacent CAN network optical fiber repeater to the first optical fiber port, and convert it into an electrical signal and send it to the CAN port.
3. The CAN network optical fiber communication method supporting ring network redundancy according to claim 2, characterized in that: In the ring network mode, all CAN network fiber optic repeaters are divided into a control node and several common nodes, wherein the division process is as follows: The first optical fiber port and the second optical fiber port of each CAN network optical fiber repeater are set to a data mutual forwarding mode, and the CAN network optical fiber repeater is controlled to send its own ID to the first optical fiber port and the second optical fiber port respectively; Each CAN network fiber optic repeater receives all CAN network fiber optic repeater IDs in the ring fiber optic communication network, and determines whether its own factory serial ID value is the smallest. If it is the smallest, it acts as a control node in the ring fiber optic communication network, otherwise it acts as an ordinary node in the ring fiber optic communication network.
4. The CAN network optical fiber communication method supporting ring network redundancy according to claim 1, characterized in that: The set common node working rules include: a) Determine whether an ACK forwarded by the control node or other common nodes is received. If so, execute b); otherwise, continue to wait until an ACK is received and execute b); b) taking the transmission direction of the ACK as the current transmission direction, forwarding the ACK to the next common node or control node in the current transmission direction, and executing c); c) determining whether the number of forwarding times of the received packet CAN data is equal to the number of CAN network optical fiber repeaters in the ring optical fiber communication network. If they are equal, it means that the packet CAN data has completed the forwarding cycle in the ring optical fiber communication network. At this time, the packet CAN data is discarded and e) is executed. Otherwise, d) is executed. d) After adding 1 to the forwarding times, forward the packaged CAN data and execute e); e) Determine whether an ACK forwarded by the control node or other common nodes is received. If so, execute b), otherwise, execute f); f) Determine whether the common node has received the ID of the new CAN network fiber optic repeater. If so, it indicates that the topology of the ring fiber optic communication network has changed. At this time, the control node and the common node are divided again; otherwise, execute c).
Citation Information
Patent Citations
Redundant network system and method for realizing redundancy
CN102111299A
Diesel generating set CAN-to-fiber ring network control system
CN220399827U