Real-time ethernet bus self-configuration method applied to multi-rack PLC
Patent Information
- Application Number
- CN202311325574.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-13
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2043-10-13
AI Technical Summary
[0003]随着应用的深入,在实际应用中,不同的场合中,对所使用实时以太网可用性、易用性、兼容性提出了不同的要求,目前,其他网络的组态方式还是采用独立组态,或是无法适应星型网络下的自组态,需要人工干预,不能适应用户现场多样的网络拓扑和远距离配置带来的不便
[0042] 1) Availability: Enables real-time self-configuration of different racks under different Ethernet network topologies based on network topology and device status;
Smart Images

Figure CN117424807B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial communication technology, and in particular to a real-time Ethernet bus self-configuration method for multi-rack PLCs. Background Technology
[0002] Ethernet, with its advantages of openness, wide application and low cost, is increasingly being used in industrial settings. Data scheduling technology, as the core technology of industrial real-time Ethernet, is receiving more and more attention.
[0003] As applications become more widespread, different scenarios in practical applications present varying requirements for the availability, ease of use, and compatibility of the real-time Ethernet used. Currently, other network configuration methods still rely on independent configuration or are unable to adapt to self-configuration in star network topologies, requiring manual intervention and failing to address the inconvenience caused by diverse network topologies and long-distance configurations at user sites. Therefore, it is evident that existing industrial Ethernet configuration methods have limitations and shortcomings, failing to meet the network's requirements for availability and ease of use. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of existing technologies and provide a real-time Ethernet bus self-configuration method for multi-rack PLCs, comprising the following steps:
[0005] S1: Determine the network topology and device status of the PLC main rack and the PLC expansion rack by the status of the network topology query message Net_req sent and received between the CM module of the PLC main rack and the CP module of the PLC expansion rack;
[0006] S2: After confirming that the network topology and the device status are normal, determine the CM module address through the address management module of the CM module, and then configure the CP module address through the CM module;
[0007] S3: Determine the number of PLC expansion racks based on the configured CP module address, and configure Ethernet in real time based on the number of PLC expansion racks and the CM module address.
[0008] Further, in step S1, determining the network topology of the PLC main rack and the PLC expansion rack further includes:
[0009] The network topology is determined by the CM module. When the PLC host rack sends a message Net_req, if the two Ethernet ports of the PLC host rack each receive the message Net_req sent by the other port, the network topology is determined to be a ring network.
[0010] If each of the two Ethernet ports of the PLC host rack receives a Net_req message sent by its own port, the network topology is determined to be a linear network.
[0011] If each of the two Ethernet ports of the PLC host rack receives one or more Net_req messages sent by its own port, the network topology is determined to be a star network.
[0012] Preferably, in step S1, the state of the network topology query message Net_req sent and received further includes:
[0013] After the CM module is powered on, it includes two Ethernet ports: an ACM port and a BCM port. The CP module also includes two Ethernet ports: an ACP port and a BCP port. One of the ACM and BCM ports sends the Net_req message. Upon receiving the Net_req message, one of the ACP and BCP ports restarts the timer and forwards the Net_req message. If the other port is not connected to an Ethernet device, it sends the Net_req message back. If the other port is connected to an Ethernet device and does not receive the Net_req message within a specified time, it sends the Net_req message back. Finally, it is determined that the device is powered on and running, and that Ethernet transmission and reception are normal.
[0014] Preferably, in step S2, determining the CM module address through the CM module address management module further includes:
[0015] S211: The CM module begins to periodically send an address scan request message Addr_req from one of the ACM port and the BCM port. The message Addr_req includes field D, address value and address confirmation value. The CP module internally maintains a self-identification field D, which includes three fields: local rack address field A, time field B for receiving the message Addr_req, and local functional module type field C.
[0016] S212: When the CP module receives the message Addr_req from one of the ACP port and the BCP port, it updates the data of field B, fills the data into the address scan response message Addr_rsp and sends it to the CM module, and then sends the message Addr_req from the other port;
[0017] S213: The CM module receives and parses the self-identification first field D in the Addr_rsp message from the CP module. The address management module first performs statistics on the first fields A, B, and C in the first field D, respectively, and calculates the first minimum value of the first field A, the number of times the first minimum value occurs and the corresponding first field D; the second minimum value of the first field B, the number of times the second minimum value occurs and the corresponding first field D; and the third minimum value of the first field B and the first field C, the number of times the third minimum value occurs and the corresponding first field D.
[0018] Preferably, in step S211, the CM module begins to periodically send the message Addr_req from one of the ACM port and the BCM port, further including:
[0019] When the ACM port and BCM port of the CM module receive the Net_req message sent by the other port, the BCM port shall be used first to send the Addr_req message.
[0020] When one of the two Ethernet ports, the ACM port and the BCM port, receives the Net_req message, that port shall send the Addr_req message first.
[0021] When the ACM port and BCM port of the CM module receive the Net_req message, the Addr_req message is sent using the ACM port and BCM port.
[0022] Preferably, in step S211, the self-identification field D further includes:
[0023] The local rack address field A is stored in flash memory and is set to 0 at the factory. After the local rack address field A is configured for the first time, the CP module reads the corresponding value from the flash memory after power-on.
[0024] The time field B of receiving the Addr_req message is updated by the real-time Ethernet communication module of the CP module after each time it receives the Addr_req message.
[0025] When the CP module is powered on, the Ethernet communication module first scans the function module type and puts the scan result into the local function module type field C. The field is cleared to 0 when the device is powered off.
[0026] Preferably, in step S213, the address management module further includes:
[0027] S2131: First, determine whether there exists a first field A that is 1 greater than the CM module setting address, and the first field A appears only once. Then, add 1 to the first field D and the first address value corresponding to the first field A, fill in the address value confirmation message Addr_set, and send it to the real-time Ethernet.
[0028] S2132: If there is no first field A that is 1 greater than the address set by the CM module, or if there is a first field A that is 1 greater than the address set by the CM module and the first field A appears more than once, take the smallest first field B, and the first field D and the first address value corresponding to the second minimum value of the first field B appearing 1 times are the address set by the CM module plus 1, fill them into the message Addr_set and send them to the real-time Ethernet;
[0029] S2133: If there is no first field A that is 1 greater than the address of the CM module, or if there is a first field A that is 1 greater than the address of the CM module and the first field A appears more than once, and the occurrence count of the smallest first field B is not 1, then take the smallest first field C, and the first field D corresponding to the third minimum value occurring 1, and the first address value is the CM module setting address plus 1, fill it into the message Addr_set and send it to the real-time Ethernet;
[0030] S2134: If there is no field A that is 1 greater than the address of the CM module, or if there is a first field A that is 1 greater than the address of the CM module and the first field A appears more than once, and the minimum first field B appears more than once, and the minimum first field C appears more than once, then set the value of the first field D to 0, set the value of the first address to 0, resend the message Addr_req and send it to the real-time Ethernet, and keep the address of the CM module unchanged.
[0031] Preferably, in step S2, configuring the CP module address through the CM module further includes:
[0032] S221: After receiving the message Addr_set sent by the CM module, the CP module parses the value of the second field D in the message Addr_set and compares it with the value of field D in the CP module. If they are the same, the CP module sets the second address value in the message Addr_set to the CP module's address value and sends the message Addr_chk to the CM module. After receiving the message Addr_chk, the CM module sets the first address acknowledgment value in the message Addr_set and sends it to the real-time Ethernet. The CM module sets the address to increment by 1; after receiving the Addr_set message sent by the CM module, the CP module confirms that the CP module address has been set and stops sending the Addr_rsp message. If it does not receive the Addr_set message sent by the CM module, it continues to send. After the CM module sets the address of the first CP module in one of the CP modules, it continues to send the Addr_req message to set the address of the second CP module. In the second round of address setting, the CM module starts judging again from the first field A sent by the CP module.
[0033] S222: The second CP module receives a new second message Addr_set sent by the CM module, parses the value of the third field D of the second message Addr_set, and compares it with the value of field D of the second CP module. If the values are different, no processing is performed. The unconfigured third CP module updates the value of the second field B after receiving the second message Addr_req sent by the CM module, and waits again for the PLC host rack to send the third message Addr_req.
[0034] Preferably, in step S3, the real-time configuration Ethernet further includes:
[0035] S31: When the CM module sends the Addr_req message more than once consecutively and receives no response, the CM module confirms that all CP module addresses have been set, determines the number of expansion racks based on the maximum address of the CP module, writes the number of expansion racks into the rack setting message Frame_Num_set, and sends it to the real-time Ethernet through one of the ACM port and the BCM port. Based on the number of expansion racks, the periodic time, aperiodic time, and transmission offset time required for the real-time Ethernet to run are calculated, and the clock synchronization and scheduling process is started. The CP module processes the Frame_Num_set message in the same way as it processes the Net_req message.
[0036] S32: After the ACM port and the other port of the BCM port receive the message they sent, the number of racks is set. After the CP module receives the message Frame_Num_set, it parses the number of racks from it, and calculates the periodic time, non-periodic time and transmission offset time required for real-time Ethernet operation in combination with the CP module address. Then, it starts the clock synchronization and scheduling process and stores the second field A of the message Frame_Num_set into flash.
[0037] S33: After the real-time Ethernet configuration is completed, the CM module will still send the fourth message Addr_req at intervals. When the PLC expansion rack is connected to the new first PLC expansion rack, the fourth CP module of the first PLC expansion rack receives the fourth message Addr_req and sends the value of the fourth CP module field D to the CM module through the second message Addr_rsp. After receiving the second message Addr_rsp, the CM module extracts the second message Addr_rsp field D and the second message Addr_rsp address value after incrementing by 1, fills it into the third message Addr_set, and sends it to the real-time Ethernet. The fourth CP module confirms the address configuration is successful through the second message Addr_chk. Then, the CM module sends the fourth message Addr_set with the address confirmation value to confirm that the fourth CP module address setting is valid. At the same time, the CM module updates the number of internal racks and sends the second message Frame_Num_set again to inform the CP module in the real-time Ethernet to change the periodic time, non-periodic time, and transmission offset time.
[0038] Preferably, the network topology query message, the rack configuration message, and the address scan request message further include:
[0039] The network topology query message is a broadcast message and carries the port number that sent the message;
[0040] The Addr_req message, the second Addr_req message, the third Addr_req message, and the fourth Addr_req message are multicast messages, and carry the port number, extended rack field D, extended rack address, and extended rack address acknowledgment value of the port number used to send the Addr_req message, the second Addr_req message, the third Addr_req message, and the fourth Addr_req message. Initially, the extended rack field D, the extended rack address value, and the extended rack address acknowledgment value are all 0.
[0041] Compared with the prior art, the beneficial effects of the present invention are:
[0042] 1) Availability: Enables real-time self-configuration of different racks under different Ethernet network topologies based on network topology and device status;
[0043] 2) Ease of use: By configuring the CP module address through the CM module, real-time Ethernet can be self-configured under different topologies, eliminating the original cumbersome independent configuration process;
[0044] 2) Compatibility: Real-time Ethernet configuration avoids the repeated confirmation of configuration information caused by mixing different racks during the debugging process, meeting users' needs for plug-and-play functionality and arbitrary combinations under different network topologies. Attached Figure Description
[0045] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention.
[0046] Figure 1 This is a flowchart of a real-time Ethernet bus self-configuration method applied to a multi-rack PLC according to the present invention;
[0047] Figure 2 This is a schematic diagram of a real-time Ethernet bus self-configuration method for multi-rack PLCs according to the present invention.
[0048] Figure 3 This is a schematic diagram of the overall scheduling of the self-configuration method of real-time Ethernet bus applied to multi-rack PLC according to the present invention;
[0049] Figure 4 This is a schematic diagram of the internal address management module of the CM module in the real-time Ethernet bus self-configuration method for multi-rack PLCs according to the present invention. Detailed Implementation
[0050] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. Obviously, the described embodiments are only some, not all, of the embodiments described in this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without creative effort are within the scope of protection of this application.
[0051] Those skilled in the art will understand that, unless otherwise stated, the singular forms “a” and “an” used herein, and “the”, may also include the plural forms. It should be further understood that the term “comprising” as used in this specification means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0052] Example
[0053] Please see Figure 1 , Figure 3 As shown, this embodiment provides a real-time Ethernet bus self-configuration method for multi-rack PLCs, including the following steps:
[0054] S1: By using the network topology query message Net_req status sent and received between the CM module of the PLC main rack and the CP module of the PLC expansion rack, the network topology and device status of the PLC main rack and the PLC expansion rack are determined. Specifically, in this embodiment, the network consists of one PLC main rack and four PLC expansion racks, and the CP modules of the PLC expansion racks are labeled as CP module 1, CP module 2, CP module 3 and CP module 4.
[0055] S2: After confirming that the network topology and device status are working properly, determine the CM module address through the address management module of the CM module, and then configure the CP module address through the CM module;
[0056] S3: Determine the number of PLC expansion racks based on the configured CP module address, and configure Ethernet in real time based on the number of PLC expansion racks and CM module addresses.
[0057] refer to Figure 2 As shown, in step S1, determining the network topology of the PLC main rack and the PLC expansion rack further includes:
[0058] The network topology is determined by the CM module. When the PLC host rack sends a message Net_req, if the two Ethernet ports of the PLC host rack each receive the message Net_req sent by the other port, the network topology is determined to be a ring network. Specifically, in this embodiment, in the ring network, the A / B ports of the CM module receive the message Net_req sent by their own peer and determine that the PLC real-time Ethernet topology is a ring network.
[0059] If each of the two Ethernet ports of the PLC mainframe receives a Net_req message sent by its own port, the network topology is determined to be a linear network. Specifically, in this embodiment, in linear network 1, the B port of the CM module receives a Net_req message sent by itself, and the PLC real-time Ethernet topology is determined to be linear network 1. In linear network 2, the A / B ports of the CM module receive a Net_req message sent by itself, and the PLC real-time Ethernet topology is determined to be linear network 2.
[0060] If each of the two Ethernet ports of the PLC host rack receives more than one Net_req message sent by its own port, the network topology is determined to be a star network. Specifically, in this embodiment, in star network 1, the B port of the CM module receives multiple Net_req messages sent by itself, thus determining that the PLC real-time Ethernet topology is a star network.
[0061] Preferably, in step S1, the network topology query message status Net_req sent and received further includes:
[0062] After the CM module is powered on, it includes two Ethernet ports: an ACM port and a BCM port. The CP module includes two Ethernet ports: an ACP port and a BCP port. One of the ACM and BCM ports sends a Net_req message. After receiving the Net_req message, one of the ACP and BCP ports restarts the timer and forwards the Net_req message. If the other port is not connected to an Ethernet device, it sends the Net_req message back. If the other port is connected to an Ethernet device and does not receive the Net_req message within a specified time, it sends the Net_req message back. Finally, it is determined that the device is powered on and running, and the Ethernet transmission and reception are normal. Specifically, in this embodiment, when the CM and CP modules are not configured at the factory and are powered on after forming a network, the Ethernet devices are linear network 1, linear network 2, and star network.
[0063] More preferably, the port on which the CM module sends the address scan request message will differ depending on the network topology. In ring networks, linear network 1, and star networks, the CM module defaults to sending the Addr_req message from the BCM port. For linear network 1 and star networks, if the CM module finds that the BCM port is not connected to the CP module, it sends the Addr_req message from the A port. In linear network 2, the CM module sends the Addr_req message from both the ACM and BCM ports simultaneously. The CM module begins periodically sending the Addr_req message, which includes the D field value, the address value, and the address acknowledgment value; at this time, all of these values are 0.
[0064] Preferably, in step S2, determining the CM module address through the CM module address management module further includes:
[0065] S211: The CM module begins to periodically send an address scan request message Addr_req from one of the ACM port and the BCM port. The Addr_req message includes field D, address value, and address acknowledgment value. The CP module internally maintains a self-identification field D, which includes three fields: local rack address field A, time field B for receiving the Addr_req message, and local functional module type field C. Specifically, in this embodiment, the CP module is not configured at the factory. After being connected to the network and powered on, fields A, B, and C are all 0.
[0066] S212: When the CP module receives the message Addr_req from one of the ACP and BCP ports, it updates the data in field B and fills the data into the address scan response message Addr_rsp, which is then sent to the CM module. The Addr_req message is then sent from the other port. Specifically, in this embodiment, in the ring network and linear network 1, when CP module 1 receives the message Addr_req from port ACP, it updates the received timestamp data in field B and fills the updated data into the address scan response message Addr_rsp, sending it from the ACP port to the CM module. After sending, the Addr_req message is then sent from the BCP port to CP module 2. CP modules 2, 3, and 4 send the Addr_rsp message and forward it sequentially according to the method used by CP module 1. In a linear network 2, when CP module 4 receives the message Addr_req from port BCP, it updates the received timestamp data in field B and fills the updated data into the address scan response message Addr_rsp, sending it from port BCP to the CM module. After sending, it sends the message Addr_req from port ACP to CP module 3. CP module 3 sends the message Addr_rsp and forwards the message Addr_req in the same way as CP module 4. In a star network, when CP modules 1, 2, 3, and 4 receive the message Addr_req from port ACP, they update the received timestamp data in field B and fill the updated data into the address scan response message Addr_rsp, sending it from port ACP to the CM module.
[0067] S213: The CM module receives and parses the self-identifier first field D in the Addr_rsp message from the CP module. The address management module first performs statistics on the first field A, first field B, and first field C in the first field D, respectively, and counts the first minimum value of the first field A, the number of times the first minimum value occurs and the corresponding first field D; the second minimum value of the first field B, the number of times the second minimum value occurs and the corresponding first field D; and the third minimum value of the first field B and the first field C, the number of times the third minimum value occurs and the corresponding first field D.
[0068] The CM module receives and parses field D in the Addr_rsp message from each CP module. The address management module first performs statistics on fields A, B, and C in field D, respectively, to count the minimum value of field A, the number of times the minimum value occurs, and the corresponding field D; the minimum value of field B, the number of times the minimum value occurs, and the corresponding field D; and the minimum values of both field B and field C, the number of times the minimum values occur, and the corresponding field D.
[0069] Preferably, in step S211, the CM module begins to periodically send the message Addr_req from one of the ACM port and the BCM port, further including:
[0070] When the ACM port and BCM port of the CM module receive the Net_req message sent by the other port, the BCM port is used first to send the Addr_req message.
[0071] When one of the two Ethernet ports, ACM port and BCM port, receives the message Net_req, the port with priority sends the message Addr_req.
[0072] When the ACM port and BCM port of the CM module receive the Net_req message, they use the ACM port and BCM port to send the Addr_req message.
[0073] Preferably, in step S211, the self-identification field D further includes:
[0074] The local rack address field A is stored in flash memory. It is set to 0 at the factory. After the local rack address field A is configured for the first time, the CP module reads the corresponding value from flash memory after power-on.
[0075] The time field B of the received Addr_req message is updated by the real-time Ethernet communication module of the CP module after each reception of the Addr_req message.
[0076] The local function module type field C is used by the Ethernet communication module to scan the function module type after the CP module is powered on and put the scan results into the local function module type field C. The field is cleared to 0 after the device is powered off.
[0077] Preferably, in step S213, the address management module further includes:
[0078] S2131: First, determine whether there is a first field A that is 1 greater than the CM module setting address, and the first field A appears only once. Then, add 1 to the first field D and the first address value corresponding to the first field A, fill in the address value to confirm the address confirmation message Addr_set, and send it to the real-time Ethernet.
[0079] S2132: If there is no first field A that is 1 greater than the CM module setting address, or if there is a first field A that is 1 greater than the CM module setting address and the first field A appears more than once, take the smallest first field B, and the first field D and the first address value corresponding to the second minimum value of the first field B appearing 1 times are the CM module setting address plus 1, fill them into the message Addr_set and send them to the real-time Ethernet;
[0080] S2133: If there is no first field A that is 1 greater than the CM module address, or if there is a first field A that is 1 greater than the CM module address and the first field A appears more than once, and the occurrence count of the smallest first field B is not 1, then take the smallest first field C, and the first field D corresponding to the third minimum value appearing 1, and the first address value is the CM module setting address plus 1, fill it into the message Addr_set and send it to the real-time Ethernet;
[0081] S2134: If there is no field A that is 1 greater than the CM module address, or if there is a first field A that is 1 greater than the CM module address and the first field A appears more than once, and the smallest first field B appears more than once, and the smallest first field C appears more than once, then set the value of the first field D to 0, the value of the first address to 0, resend the message Addr_req and send it to the real-time Ethernet, and keep the CM module address unchanged.
[0082] refer to Figure 4 As shown, in step S2, configuring the CP module address through the CM module further includes:
[0083] S221: After receiving the Addr_set message sent by the CM module, the CP module parses the value of the second field D in the Addr_set message and compares it with the value of the CP module's field D. If they are the same, the second address value in the Addr_set message is set as the CP module's address value, and the CP module sends the Addr_chk message to the CM module. After receiving the Addr_chk message, the CM module sets the first address confirmation value in the Addr_set message and sends it to the real-time Ethernet. The CM module increments the address by 1. After receiving the Addr_set message sent by the CM module, the CP module confirms that the CP module address setting is complete and stops sending the Addr_rsp message. If it does not receive the Addr_set message sent by the CM module, it continues to send messages. After the CM module sets the address of the first CP module in one of the CP modules, it continues to send the Addr_req message to set the address of the second CP module. In the second round of address setting, the CM module starts judging again from the first field A sent by the CP module. Specifically, in this embodiment, in the ring network and the linear network 1, CP module 1 In the Addr_rsp message returned by CP modules 1, 2, 3, and 4, field A is all 0s and appears 4 times. The value of field B increases sequentially due to the sequential forwarding. Therefore, the CM module takes field D from CP module 1 (the smallest field B, with an occurrence test value of 1) and its address value as the set address plus 1, which equals 2. This value is then added to the Addr_set message and sent to the real-time Ethernet. After receiving the Addr_set message from the CM module, CP module 1 parses field D and compares it with its own field D. If the value is the same, then... The address in the message is set to its own address, and the CM module sends the message Addr_chk. After receiving the Addr_chk message from CP module 1, the CM module sets the address acknowledgment field in the Addr_set message and sends it to the real-time Ethernet, incrementing the address by 1. After receiving the Addr_set message, CP module 1 confirms that its own address has been set and does not send the Addr_rsp message again. CP modules 2, 3, and 4 do not process the Addr_set message. The CM module then sends the Addr_req message. Following the above method, in the second round of address setting, the CM module sets the address of CP module 2, and CP modules 3 and 4 in the same way.
[0084] Preferably, in the online network 2, if field A in the Addr_rsp message returned by CP modules 1, 2, 3, and 4 is all 0 and appears 4 times, then the CM module compares field B of CP modules 1 and 3. If there is a difference in the size of field B, the CM module takes the field D corresponding to the smallest field B and the address value as the set address plus 1, which equals 2, fills it into the Addr_set message, and sends it to the real-time Ethernet. After receiving the Addr_set message sent by the CM module, the target CP module parses the field D value and compares it with its own field D value. If the field D value is the same, the CM module sets the address in the message to its own address and sends the Addr_chk message to the CM module. After receiving the Addr_chk message sent by the target CP module, the CM module sets the address confirmation field in the Addr_set message, sends it to the real-time Ethernet, and sets the address to increment by 1. After receiving the Addr_set message, the target CP module confirms that its own address has been set and does not send the Addr_r message again. If field B is the same for both, field C is compared. If there is a difference in the size of field C, the field D corresponding to the smaller field C and the address value are set to the address plus 1, which equals 2. This is filled into the message Addr_set and sent to the real-time Ethernet. After receiving the message Addr_set sent by the CM module, the target CP module parses the field D value and compares it with its own field D value. If they are the same, the address in the message is set to its own address, and the message Addr_chk is sent to the CM module. After receiving the message Addr_chk sent by the target CP module, the CM module sets the address confirmation field in the message Addr_set and sends it to the real-time Ethernet, setting the address to increment by 1. After receiving the message Addr_set, the target CP module confirms that its own address has been set and does not send the message Addr_rsp again. If both fields B and C are the same, the field D value is set to 0, the address is set to 0, the message Addr_req is resent and sent to the real-time Ethernet, and the address remains unchanged. Finally, the address settings for CP module 1 and CP module 4 are completed first, followed by the address settings for CP module 2 and CP module 3.
[0085] Preferably, in a star network, if field A in the Addr_rsp message returned by CP modules 1, 2, 3, and 4 is all 0 and appears 4 times, then the CM module compares field B of CP modules 1, 2, 3, and 4. If field B differs in size, the CM module takes the field D corresponding to the smallest field B and its address value as the set address plus 1, which equals 2, fills it into the Addr_set message, and sends it to the real-time Ethernet. Upon receiving the Addr_set message from the CM module, the target CP module parses the D value and compares it with its own D value. If they are the same, it sets the address in the message to its own address and sends the Addr_chk message to the CM module. Upon receiving the Addr_chk message from the target CP module, the CM module sets the address confirmation field in the Addr_set message, sends it to the real-time Ethernet, and increments the address by 1. Upon receiving this message, the target CP module confirms that its address has been set and no longer sends message A. ddr_rsp; If field B is the same, compare field C. If field C differs in size, take the smallest field C, corresponding to field D and address value, and set the address to 2 plus 1. Fill this into the Addr_set message and send it to the real-time Ethernet. After receiving the Addr_set message from the CM module, the target CP module parses the field D value and compares it with its own field D value. If they are the same, set the address in the message to its own address and send the Addr_chk message to the CM module. After receiving the Addr_chk message from the target CP module, the CM module sets the address confirmation field in the Addr_set message, sends it to the real-time Ethernet, and increments the address by 1. After receiving this message, the target CP module confirms that its address has been set and does not send the Addr_rsp message again. If fields B and C are the same, set field D to 0 and the address to 0, resend the Addr_req message to the real-time Ethernet, and keep the address unchanged.
[0086] S222: The second CP module receives a new second message Addr_set from the CM module, parses the value of the third field D of the second message Addr_set, and compares it with the value of field D of the second CP module. If they are different, no processing is performed. The unconfigured third CP module updates the value of the second field B after receiving the second message Addr_req from the CM module, and waits again for the PLC host rack to send the third message Addr_req.
[0087] Preferably, in step S3, configuring Ethernet in real time further includes:
[0088] S31: When the CM module sends Addr_req message more than once consecutively and receives no response, the CM module confirms that all CP module addresses are configured and determines the number of expansion racks based on the maximum address of the CP module. It then writes the number of expansion racks into the rack configuration message Frame_Num_set and sends it to the real-time Ethernet through one of the ACM or BCM ports. Based on the number of expansion racks, it calculates the periodic time, aperiodic time, and transmission offset time required for the real-time Ethernet to run and initiates the clock synchronization and scheduling process. The CP module processes the message Frame_Num_set in the same way as it processes the message Net_req.
[0089] S32: After the other port among the ACM port and BCM port receives the message it sent, the number of racks is set. After the CP module receives the message Frame_Num_set, it parses the number of racks from it, and calculates the periodic time, non-periodic time and transmission offset time required for real-time Ethernet operation by combining the CP module address. Then, it starts the clock synchronization and scheduling process and stores the second field A of the message Frame_Num_set into flash.
[0090] S33: After the real-time Ethernet configuration is complete, the CM module will still send the fourth message Addr_req at intervals. When a new first PLC expansion rack is connected to the PLC expansion rack, the fourth CP module of the first PLC expansion rack receives the fourth message Addr_req and sends the value of the fourth CP module field D to the CM module through the second message Addr_rsp. After receiving the second message Addr_rsp, the CM module extracts the second message Addr_rsp field D and the address value of the second message Addr_rsp after incrementing by 1, fills it into the third message Addr_set, and sends it to the real-time Ethernet. The fourth CP module confirms the address configuration is successful through the second message Addr_chk. Then, the CM module sends the fourth message Addr_set with the address confirmation value to confirm that the address setting of the fourth CP module is valid. At the same time, the CM module updates the number of internal racks and sends the second message Frame_Num_set again to inform the CP module in the real-time Ethernet to change the periodic time, non-periodic time, and transmission offset time.
[0091] Preferably, the network topology query message, rack configuration message, and address scan request message further include:
[0092] Network topology query messages are broadcast messages and carry the port number from which the message was sent;
[0093] The Addr_req, Addr_req, Addr_req, Addr_req and Addr_req are multicast messages, and they carry the port number, extended rack field D, extended rack address and extended rack address acknowledgment value of the sending message Addr_req, ...
Claims
1. A real-time Ethernet bus self-configuration method applied to multi-rack PLCs, characterized in that, Includes the following steps: S1: Determine the network topology and device status of the PLC main rack and the PLC expansion rack by the status of the network topology query message Net_req sent and received between the CM module of the PLC main rack and the CP module of the PLC expansion rack; S2: After confirming that the network topology and the device status are normal, determine the CM module address through the address management module of the CM module, and then configure the CP module address through the CM module; S3: Determine the number of PLC expansion racks based on the CP module address, and configure Ethernet in real time based on the number of PLC expansion racks and the CM module address.
2. The real-time Ethernet bus self-configuration method for multi-rack PLCs according to claim 1, characterized in that, In step S1, determining the network topology of the PLC main rack and the PLC expansion rack further includes: The network topology is determined by the CM module. When the PLC host rack sends a Net_req message, if the two Ethernet ports of the PLC host rack each receive the Net_req message sent by their respective peer ports, the network topology is determined to be a ring network. If each of the two Ethernet ports of the PLC host rack receives a Net_req message sent by its own port, the network topology is determined to be a linear network. If each of the two Ethernet ports of the PLC host rack receives one or more Net_req messages sent by its own port, the network topology is determined to be a star network.
3. The real-time Ethernet bus self-configuration method for multi-rack PLCs according to claim 2, characterized in that, In step S1, the status of the sent and received network topology query messages Net_req further includes: After the CM module is powered on, it includes two Ethernet ports: an ACM port and a BCM port. The CP module also includes two Ethernet ports: an ACP port and a BCP port. One of the ACM and BCM ports sends the Net_req message. Upon receiving the Net_req message, one of the ACP and BCP ports restarts the timer and forwards the Net_req message. If the other port is not connected to an Ethernet device, it sends the Net_req message back. If the other port is connected to an Ethernet device and does not receive the Net_req message within a specified time, it sends the Net_req message back. Finally, it is determined that the CM and CP modules are powered on and running, and that Ethernet transmission and reception are normal.
4. The real-time Ethernet bus self-configuration method for multi-rack PLCs according to claim 3, characterized in that, In step S2, determining the CM module address through the CM module address management module further includes: S211: The CM module begins to periodically send an address scan request message Addr_req from one of the ACM port and the BCM port. The message Addr_req includes field D, address value and address confirmation value. The CP module internally maintains a self-identification field D, which includes three fields: local rack address field A, time field B for receiving the message Addr_req, and local functional module type field C. S212: When the CP module receives the message Addr_req from one of the ACP port and the BCP port, it updates the data of field B, fills the data into the address scan response message Addr_rsp and sends it to the CM module, and then sends the message Addr_req from the other port; S213: The CM module receives and parses the first field D in the message Addr_rsp from the CP module. The address management module first performs statistics on the first fields A, B, and C in the first field D, respectively, and calculates the first minimum value of the first field A, the number of times the first minimum value occurs, and the corresponding first field D; the second minimum value of the first field B, the number of times the second minimum value occurs, and the corresponding first field D; and the third minimum value of the first field B and the first field C, the number of times the third minimum value occurs, and the corresponding first field D.
5. The real-time Ethernet bus self-configuration method for multi-rack PLCs according to claim 4, characterized in that, In step S211, the local rack address field A is stored in flash memory and is set to 0 at the factory. After the local rack address field A is configured for the first time, the CP module reads the corresponding value from the flash memory after power-on. When the CP module is powered on, the Ethernet communication module first scans the function module type in the local function module type field C and puts the scan result into the local function module type field C. The field is cleared to 0 when the CP module is powered off.
6. The real-time Ethernet bus self-configuration method for multi-rack PLCs according to claim 5, characterized in that, Step S213 further includes: S2131: First, determine whether there is a first field A that is 1 greater than the CM module setting address, and the first field A appears only once. If it exists, set the first field D and the first address value corresponding to the first field A to the CM module setting address plus 1, fill in the address value confirmation message Addr_set and send it to the real-time Ethernet. S2132: If there is no first field A that is 1 greater than the address set by the CM module, or if there is a first field A that is 1 greater than the address set by the CM module and the first field A appears more than once, take the smallest first field B, and when the second minimum value of the first field B appears 1 time, the corresponding first field D and the first address value are the address set by the CM module plus 1, fill in the message Addr_set and send it to the real-time Ethernet; S2133: If there is no first field A that is 1 greater than the CM module setting address, or if there is a first field A that is 1 greater than the CM module setting address and the first field A appears more than once, and the occurrence count of the smallest first field B is not 1, then take the smallest first field C, and the first field D corresponding to the third minimum value occurring 1, and the first address value is the CM module setting address plus 1, fill it into the message Addr_set and send it to the real-time Ethernet; S2134: If there is no first field A that is 1 greater than the address set by the CM module, or if there is a first field A that is 1 greater than the address set by the CM module, and the first field A appears more than once, and the smallest first field B appears more than once, and the smallest first field C appears more than once, then set the first field D to 0, set the first address value to 0, resend the message Addr_req and send it to the real-time Ethernet, and keep the CM module address unchanged.
7. The real-time Ethernet bus self-configuration method for multi-rack PLCs according to claim 6, characterized in that, In step S2, configuring the CP module address through the CM module further includes: S221: After receiving the message Addr_set sent by the CM module, the CP module parses the value of the second field D in the message Addr_set and compares it with the value of field D in the CP module. If they are the same, the second address value in the message Addr_set is set as the address value of the CP module, and the CP module sends the message Addr_chk to the CM module. After receiving the message Addr_chk, the CM module sets the first address confirmation value in the message Addr_set and sends it to the real-time Ethernet. The CM module sets the address to increment by 1. After receiving the message Addr_set sent by the CM module, the CP module confirms that the CP module address setting is complete and stops sending the message Addr_rsp. If it does not receive the message Addr_set sent by the CM module, it continues to send the message. After the CM module sets the address of the first CP module in one of the CP modules, it continues to send the message Addr_req to set the address of the second CP module. In the second round of address setting, the CM module starts judging again from the first field A sent by the CP module. S222: The second CP module receives a new second message Addr_set sent by the CM module, parses the value of the third field D of the second message Addr_set, and compares it with the value of field D of the second CP module. If the values are different, no processing is performed. The unconfigured third CP module updates the value of the second field B after receiving the second message Addr_req sent by the CM module, and waits again for the PLC host rack to send the third message Addr_req.
8. The real-time Ethernet bus self-configuration method for multi-rack PLCs according to claim 7, characterized in that, In step S3, the real-time configuration of Ethernet further includes: S31: When the CM module sends the Addr_req message more than once consecutively and receives no response, the CM module confirms that all CP module addresses have been set, determines the number of expansion racks based on the maximum address of the CP module, writes the number of expansion racks into the rack setting message Frame_Num_set, and sends it to the real-time Ethernet through one of the ACM port and the BCM port. Based on the number of expansion racks, the periodic time, aperiodic time, and transmission offset time required for the real-time Ethernet to run are calculated, and the clock synchronization and scheduling process is started. The CP module processes the Frame_Num_set message in the same way as it processes the Net_req message. S32: After the ACM port and the other port of the BCM port receive the message sent by their own port, the number of racks is set. After the CP module receives the message Frame_Num_set, it parses the number of racks from it, and calculates the periodic time, non-periodic time and transmission offset time required for real-time Ethernet operation in combination with the CP module address. Then, it starts the clock synchronization and scheduling process and stores the second field A of the message Frame_Num_set into flash. S33: After the real-time Ethernet configuration is completed, the CM module will still send the fourth message Addr_req at intervals. When the PLC expansion rack is connected to the new first PLC expansion rack, the fourth CP module of the first PLC expansion rack receives the fourth message Addr_req and sends the value of the fourth CP module field D to the CM module through the second message Addr_rsp. After receiving the second message Addr_rsp, the CM module extracts the second message Addr_rsp field D and the second message Addr_rsp address value after incrementing by 1, fills it into the third message Addr_set, and sends it to the real-time Ethernet. The fourth CP module confirms the address configuration is successful through the second message Addr_chk. Then, the CM module sends the fourth message Addr_set with the address confirmation value to confirm that the address setting of the fourth CP module is valid. At the same time, the CM module updates the number of internal racks and sends the second message Frame_Num_set again to inform the CP module in the real-time Ethernet to change the periodic time, non-periodic time, and transmission offset time.
9. A real-time Ethernet bus self-configuration method for multi-rack PLCs according to claim 8, characterized in that, The network topology query message, the rack configuration message, and the address scan request message further include: The network topology query message is a broadcast message and carries the port number that sent the message; The Addr_req, the second Addr_req, the third Addr_req, and the fourth Addr_req are multicast messages, and carry the port number for sending the Addr_req, the second Addr_req, the third Addr_req, and the fourth Addr_req, the extended rack field D, the extended rack address value, and the extended rack address acknowledgment value. Initially, the extended rack field D, the extended rack address value, and the extended rack address acknowledgment value are all 0.
Citation Information
Patent Citations
PLC-based system and networking and communication method thereof
CN114002994A
Wired ad hoc network complete machine type PLC controller and control method thereof
CN115343938A