Communication method based on controller and related equipment

By using a controller-based communication method in the modbus communication protocol to send broadcast frames and data frames to devices in the network configuration, the problem of the contradiction between the communication speed and network resources of the modbus communication protocol in one-to-many communication scenarios is solved, and efficient many-to-many communication is achieved.

CN119644870APending Publication Date: 2025-03-18CHINA LEADSHINE TECH CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411819591.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

In the one-to-many communication scenario, the existing modbus communication protocol has a contradiction between communication speed and network resource occupancy, which cannot meet the changing user network communication needs.

Method used

Using a controller-based communication method, the device broadcast frame is transmitted to all devices to be controlled in the network configuration, the device data frame of each device is accepted and analyzed, the device parameter information is modified, and the parameter adjustment and connection establishment are performed through the second device data frame and the reply broadcast frame.

Benefits of technology

It realizes that in one-to-many communication scenarios, it can not only improve the communication speed but also save network resources, solves the problem of cumbersome IP address configuration and modbus protocol that can only communicate one-to-many in multi-computer communication, and supports many-to-many communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119644870A_ABST
    Figure CN119644870A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a communication method based on a controller and related equipment, which are used for saving network resources as much as possible when one-to-many communication is realized. The method provided by the embodiment of the invention comprises the following steps: sending a device broadcast frame to all to-be-controlled devices in network configuration; receiving a first device data frame of each to-be-controlled device returned by all the to-be-controlled devices based on the device broadcast frame; modifying the to-be-modified device parameter information corresponding to each to-be-controlled device to obtain target device parameter information; sending the second equipment data frame to all the to-be-controlled equipment in the network configuration, so that all the to-be-controlled equipment identifies equipment identification information in the second equipment data frame, determining corresponding target control equipment, and adjusting equipment parameter information of the target control equipment according to the target equipment parameter information; and sending the response broadcast frame to all target control equipment in the network configuration, so that the target control equipment establishes communication connection with the target controller according to the response broadcast frame.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of data communication, and in particular to a controller-based communication method and related equipment. Background Art

[0002] At present, industrial controllers generally use the modbus communication protocol in the scenario of multi-machine communication. Serial communication uses modbus-rtu or modbus-ascii, and Ethernet communication uses modbus-tcp. The above serial communication and Ethernet communication are both communication methods that follow the modbus standard communication protocol specifications. As industrial application scenarios become more and more abundant, users' demands for network communication are becoming more and more variable, but the bottleneck of the modbus communication protocol itself cannot meet the needs of these scenarios, so it is necessary to propose a more suitable network communication method for multi-machine interconnection. Specifically, when modbus-tcp performs one-to-many communication, there is a contradiction between the communication speed and the network resources occupied; if the communication speed needs to be increased, a large amount of network resources will be occupied. If network resources need to be saved, the communication speed will be greatly restricted. Summary of the invention

[0003] The embodiments of the present application provide a controller-based communication method and related devices for saving network resources as much as possible when implementing one-to-many communication.

[0004] A first aspect of an embodiment of the present application provides a controller-based communication method, which is applied to a target controller. The method includes:

[0005] Send device broadcast frames to all devices to be controlled in the network configuration;

[0006] Accepting a first device data frame returned by all the devices to be controlled based on the device broadcast frame for each device to be controlled, wherein the first device data frame includes device identification information corresponding to each device to be controlled and device parameter information to be modified;

[0007] Modify the device parameter information to be modified corresponding to each device to be controlled to obtain target device parameter information;

[0008] Sending a second device data frame to all the devices to be controlled in the network configuration, so that all the devices to be controlled recognize the device identification information in the second device data frame, determine the corresponding target control device, and adjust the device parameter information of the target control device according to the target device parameter information; wherein the target control device is any device to be controlled corresponding to the device identification information among all the devices to be controlled;

[0009] A response broadcast frame is sent to all target control devices in the network configuration, so that the target control device establishes a communication connection with the target controller according to the response broadcast frame.

[0010] Optionally, sending a device broadcast frame to all devices to be controlled in the network configuration includes:

[0011] Building the network configuration based on the target controller and all the devices to be controlled;

[0012] Packing the device scanning instruction in the application of the target controller to obtain scanning instruction single package data;

[0013] The scanning instruction single packet data is inserted into the device broadcast frame, and the device broadcast frame is broadcast to all the devices to be controlled.

[0014] Optionally, after broadcasting to all the devices to be controlled, the method further includes:

[0015] Determine the device single package data in the first device data frame; wherein the device single package data is generated by packaging each device to be controlled according to the corresponding device identification information and the device parameter information to be modified;

[0016] Analyze all device single packet data, and execute the step of displaying a device information list corresponding to each device to be controlled according to the device identification information.

[0017] Optionally, the sending the second device data frame to all the devices to be controlled in the network configuration includes:

[0018] In the application program of the target controller, the target device parameter information and the device identification information of all the devices to be controlled are packaged to obtain device parameter multi-package data; wherein the device parameter multi-package data includes a plurality of device parameter single-package data, and the device parameter single-package data is the device identification information and the target device parameter information of each device to be controlled;

[0019] Insert the multi-packet data of the device parameters into the second device data frame, and broadcast the second device data frame to all the devices to be controlled respectively.

[0020] Optionally, sending a response broadcast frame to all target control devices in the network configuration includes:

[0021] Inserting the communication parameter information into a broadcast frame in the application of the target controller to obtain the response broadcast frame; wherein the communication parameter information includes the device quantity information of all target control devices and the preset number of retransmissions;

[0022] The response broadcast frame is broadcasted to all the target control devices, so that all the target control devices adjust communication parameters according to the response broadcast frame.

[0023] Optionally, after broadcasting the response broadcast frame to all target control devices, the method further includes:

[0024] Sending a query broadcast frame corresponding to the device quantity information to all the target control devices, and receiving device response broadcast frames returned by the corresponding target control devices one by one; wherein the device response broadcast frame includes the target device parameter information of the target control device;

[0025] Determining whether the corresponding current control device responds correctly according to the target device parameter information in the device response broadcast frame; wherein the current control device is the target control device corresponding to the target device parameter information;

[0026] If the current control device responds correctly, it is determined that the parameter information of the target device has been adjusted in the current control device, and a determination step of the next target control device is executed;

[0027] If the current control device responds with an error, and the number of retransmissions exceeds the number of retransmissions information, an error reporting process is performed on the current control device, and a step of determining the next target control device is executed;

[0028] If the current control device responds with an error, and the number of retransmissions does not exceed the number of retransmissions information, the step of determining the next target control device is executed.

[0029] Optionally, after the step of determining the next target control device is performed, the method further includes:

[0030] Determine whether the current control device is the last control device according to the device quantity information;

[0031] If the current control device is the last control device, executing the step of sending a device broadcast frame to all devices to be controlled in the network configuration to perform the next cycle;

[0032] If the current control device is not the last control device, the step of sending a query broadcast frame corresponding to the device quantity information to all target control devices is performed.

[0033] Optionally, before modifying the device parameter information to be modified corresponding to each device to be controlled and obtaining the target device parameter information, the method further includes:

[0034] A device information list corresponding to each device to be controlled is displayed according to the device identification information, and in the device information list, the step of modifying the device parameter information to be modified corresponding to each device to be controlled is performed.

[0035] A second aspect of an embodiment of the present application provides a controller-based communication system, which is applied to a target controller. The system includes:

[0036] A sending unit, used for sending a device broadcast frame to all devices to be controlled in the network configuration;

[0037] A receiving unit, configured to receive a first device data frame returned by all the devices to be controlled based on the device broadcast frame to each device to be controlled, wherein the first device data frame includes device identification information corresponding to each device to be controlled and device parameter information to be modified;

[0038] An acquiring unit, configured to modify the device parameter information to be modified corresponding to each device to be controlled, and obtain target device parameter information;

[0039] The sending unit is further used to send a second device data frame to all the devices to be controlled in the network configuration, so that all the devices to be controlled recognize the device identification information in the second device data frame, determine the corresponding target control device, and adjust the device parameter information of the target control device according to the target device parameter information; wherein the target control device is any device to be controlled corresponding to the device identification information among all the devices to be controlled;

[0040] The sending unit is further used to send a response broadcast frame to all target control devices in the network configuration, so that the target control device establishes a communication connection with the target controller according to the response broadcast frame.

[0041] The controller-based communication system provided in the second aspect of the embodiment of the present application is used to execute the controller-based communication method described in the first aspect.

[0042] A third aspect of an embodiment of the present application provides a controller-based communication device, including:

[0043] CPU, memory, input and output interfaces, wired or wireless network interfaces, and power supply;

[0044] The memory is a short-term storage memory or a persistent storage memory;

[0045] The central processing unit is configured to communicate with the memory and execute instruction operations in the memory to perform the controller-based communication method described in the first aspect.

[0046] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium includes instructions. When the instructions are executed on a computer, the computer executes the controller-based communication method described in the first aspect.

[0047] A fifth aspect of an embodiment of the present application provides a computer program product, which includes instructions. When the instructions are executed on a computer, the computer executes the controller-based communication method described in the first aspect.

[0048] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages: through a controller-based communication method disclosed in the embodiments of the present application, the unbalanced contradiction between the communication speed and the network occupied resources can be solved in the communication, and the communication speed can be fast and the network resources occupied are small. At the same time, it can also solve the problem that multi-machine communication relies on the TCP protocol, the IP address of each site needs to be defined, and large-scale multi-machine communication cannot be carried out. It can be done without configuring the IP address and uniformly configuring all communication equipment parameters in the network. It can also solve the problem that only one-to-many master-slave communication can be carried out in the modbus protocol, and many-to-many communication can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0050] Figure 1 A topological diagram of a network configuration disclosed in an embodiment of the present application;

[0051] Figure 2 A flow chart of a controller-based communication method disclosed in an embodiment of the present application;

[0052] Figure 3 A flow chart of another controller-based communication method disclosed in an embodiment of the present application;

[0053] Figure 4 A flow chart of another controller-based communication method disclosed in an embodiment of the present application;

[0054] Figure 5 A flowchart of a network communication cycle disclosed in an embodiment of the present application;

[0055] Figure 6 A network diagram of an RS485 connection disclosed in an embodiment of the present application;

[0056] Figure 7 A schematic diagram of a network through a switch disclosed in an embodiment of the present application;

[0057] Figure 8 A schematic diagram of the structure of a controller-based communication system disclosed in an embodiment of the present application;

[0058] Fig. 9 A schematic diagram of the structure of a controller-based communication device disclosed in an embodiment of the present application. DETAILED DESCRIPTION

[0059] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0060] It should be noted that the descriptions involving "first", "second", etc. in this application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0061] From the above background, we can see that the defects of the current modbus communication technology solution are:

[0062] (1) Only one-to-many master-slave communication can be carried out, and data cannot be exchanged between slaves; (2) Modbus-tcp relies on the Transmission Control Protocol (TCP) protocol, which requires the definition of the Internet Protocol (IP) address, which is relatively cumbersome; (3) Modbus-tcp has IP address restrictions within the local area network and cannot carry out large-scale multi-machine communication; (4) When Modbus-tcp carries out one-to-many communication, there is a contradiction between the communication speed and the network resources occupied; if the communication speed needs to be increased, a large amount of network resources will be required; if network resources need to be saved, the communication speed will be greatly restricted.

[0063] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0064] For easier understanding, please refer to Figure 1 , Figure 1 A topological diagram of a network configuration disclosed in an embodiment of the present application. The PC software is set on the PC end, which can be a laptop, a desktop computer, a PDA or a mobile Internet device (MID), i.e., the target controller described above, which can send broadcast frames or data frames through the modbus communication protocol. There is a graphical interface on the PC end, which includes input controls, and the device parameters of other control devices (or network devices) can be configured.

[0065] In the embodiment of the present application, the PC can send broadcast frames through the user datagram protocol (UDP) to achieve one-to-many (parallel) communication. Specifically, it should be noted that: Figure 1 Multiple network devices (such as Figure 1The network devices 1-15) are located in the network configuration, which is a NN network configuration, that is, N sites can exchange data with other N-1 sites. Furthermore, one of the sites can be used as the master site and the other sites can be used as slave sites to achieve communication interaction between the master and slave sites. In an embodiment of the present application, the network device may also be a laptop computer, desktop computer, PDA or mobile internet device (MID, mobile internet device) described above, etc., which is not limited here. Furthermore, the PC terminal and the network device can be connected through a switch or router (serial port or Ethernet, etc.), which is not limited here. Data exchange can also be carried out between network devices by broadcasting frames.

[0066] To solve the above technical problems, please refer to Figure 2 , Figure 2 This is a flow chart of a controller-based communication method disclosed in an embodiment of the present application, including steps 201 to 204.

[0067] 201. Send a device broadcast frame to all devices to be controlled in the network configuration.

[0068] The premise of implementing the parallel communication protocol between multiple sites is that each site device itself does not have a specific ID number (or master-slave station number) set, that is, parallel communication will not be performed. Therefore, it is necessary to set the station number for each network device in other ways. Therefore, it can be understood that when implementing parallel communication between various sites, the master station needs to set some communication parameters, that is, in this embodiment Figure 2 The embodiment shown. Specifically, the target controller (usually a PC) needs to send a device broadcast frame to all devices to be controlled in the network configuration. It should be noted that the device broadcast frame is based on UDP and includes a device scan instruction. The device scan instruction is used for all devices to be controlled to return the first device data frame corresponding to each device to be controlled. The first device data frame includes device identification information corresponding to each device to be controlled and device parameter information to be modified.

[0069] In one specific embodiment, the target controller generates a scan instruction, which is used to scan each device to be controlled in the network configuration ( Figure 1 There are multiple devices to be controlled in the network configuration. Therefore, in order to reduce the communication interaction process and time, the scanning instruction can be placed in the device broadcast frame, and then the scanning instruction is sent to all devices to be controlled in a one-to-many manner through UDP broadcast. Then, after the device to be controlled in the network configuration receives the scanning instruction, it can package its own device identification information and the device parameter information to be modified and reply, specifically, it can also be in the form of UDP broadcast.

[0070] Furthermore, the device identification information is a MAC identifier (device uniqueness, cannot be changed). The PC side can distinguish different devices through the MAC identifier. Specifically, the PC side can use the uniqueness of the MAC identifier to perform unified broadcast operations such as scanning, obtaining, displaying, modifying, and sending, and then the network device determines whether the data frame is sent to itself by verifying the MAC identifier in the data frame. Secondly, the packaged data replied by the device to be controlled can be replied in the form of a data frame (for example, the device to be controlled 1 replies with a data frame with its own MAC identifier and device parameters, or the device to be controlled n replies with a data frame with its own MAC identifier and device parameters), that is, the first device data frame described above.

[0071] 202. Accept the first device data frame of each device to be controlled returned by all devices to be controlled based on the device broadcast frame.

[0072] Then, after all the devices to be controlled in the network configuration receive the scan command, they will reply with the first device data frame. The first device data frame specifically refers to the data frame returned by each device to be controlled. Therefore, the number of returned device data frames should be related to the number of devices to be controlled in the network configuration. It should also be noted that the first device data frame includes device single package data, which is generated by packaging each device to be controlled according to the corresponding device identification information and the device parameter information to be modified.

[0073] Specifically, the device to be controlled that receives the scan command in the network configuration replies with its own MAC identifier and device parameters in a package, and each package is a single package of device data. Therefore, the target controller can receive multiple packages of data. This will be described in detail later.

[0074] 203. Modify the device parameter information to be modified corresponding to each device to be controlled to obtain the target device parameter information.

[0075] Furthermore, the device parameter information to be modified corresponding to each device to be controlled can be modified to obtain the target device parameter information.

[0076] In one of the specific embodiments, after modifying the device parameter information to be modified, the device information list corresponding to each device to be controlled can be displayed according to the device identification information, and the modification can be performed in the device information list. Specifically, the device information list is displayed on the graphical interface of the PC, wherein the device information list can be arranged according to the device identification information of each device to be controlled, and further, the device parameter information to be modified of each device to be controlled can also be displayed in the corresponding device information list. Then, in the device information list, the device parameter information to be modified corresponding to each device to be controlled is modified to obtain the target device parameter information.

[0077] In one specific embodiment, the PC can display the device parameters of all devices to be controlled in the network configuration in a list in a graphical interface, and then modify the device parameters. Specifically, the communication cycle, communication frequency or other PLC parameters of each device to be controlled can be adjusted, and the specifics are not limited here.

[0078] 204. Send a second device data frame to all devices to be controlled in the network configuration, so that all devices to be controlled recognize the device identification information in the second device data frame, determine the corresponding target control device, and adjust the device parameter information of the target control device according to the target device parameter information.

[0079] After modifying the device parameter information of all devices to be controlled, the second device data frame can be sent to all devices to be controlled in the network configuration, so that all devices to be controlled can recognize the device identification information in the second device data frame, determine the corresponding target control device, and adjust the device parameter information of the target control device according to the target device parameter information. It should be noted that the target control device is any device to be controlled corresponding to the device identification information among all devices to be controlled.

[0080] In one specific embodiment, there is a sending control on the graphical interface of the PC, so that the user can send the device parameters of the device number (i.e., the target device parameter information mentioned above) through the sending control. Specifically, it can be done in the form of multiple data frames (multiple second device data frames), that is, each data frame corresponds to each device to be controlled. In other words, each data frame includes the device identification information and target device parameter information of a certain device to be controlled, and is sent to the corresponding device to be controlled through the device identification information.

[0081] Furthermore, the target device parameter information of all devices to be controlled may also be sent in the same data frame (a second device data frame). Specifically, the data frame includes device identification information and target device parameter information of each device to be controlled in the network configuration.

[0082] Therefore, based on at least two of the above methods, the corresponding device to be controlled can determine the target device parameter information belonging to itself by scanning and analyzing the second device data frame, combining the device identification information therein, and filtering and judging the data packets in the second device data frame, thereby modifying or adjusting its own device parameter information. For example, device 1 to be controlled identifies the MAC identifier in the data frame, and then modifies its own device parameters. Or, device n to be controlled identifies the MAC identifier in the data frame, and then modifies its own device parameters. Correspondingly, when a certain device to be controlled determines that the MAC identifier in the second device data frame belongs to itself, the device to be controlled at this time is the target control device.

[0083] It should be noted that when the PC sends a broadcast data frame, it needs to include a MAC identifier in the data frame because the broadcast data frame will be received by all network devices. The network device needs to determine which frame of data is for itself based on whether the MAC identifier in the data frame is consistent with its own.

[0084] 205. Send a response broadcast frame to all target control devices in the network configuration, so that the target control device establishes a communication connection with the target controller according to the response broadcast frame.

[0085] After completing the debugging of all target control devices in the network configuration, a response broadcast frame can be sent to all target control devices in the network configuration, so that the target control device establishes a communication connection with the target controller according to the response broadcast frame. It should be noted that the response broadcast frame includes communication parameter information of the target controller.

[0086] In one specific embodiment, after all target control devices in the network configuration are debugged, each control device in the network configuration ( Figure 1 Specifically, the target controller can first send a response broadcast frame to the network devices in the network configuration, thereby adjusting the communication parameters of each network device through the communication parameter information in the response broadcast frame to achieve the same period or frequency interaction. Therefore, after obtaining the response frame returned by each network device, the parallel communication of each network device in the network configuration can be established.

[0087] Furthermore, any network device in the network configuration can be used as a master device, and the rest can be used as slave devices. Alternatively, the target controller can be used as a master device, and all network devices in the network configuration can be used as slave devices. This is not specifically limited here.

[0088] The controller-based communication method disclosed in this embodiment can solve the imbalance contradiction between communication speed and network occupied resources in communication, and can achieve fast communication speed and less occupied network resources. At the same time, it can also solve the problem that multi-machine communication relies on TCP protocol, needs to define the IP address of each site, and cannot carry out large-scale multi-machine communication, and can achieve unified configuration of all communication equipment parameters in the network without configuring IP addresses. It can also solve the problem that only one-to-many master-slave communication can be carried out in the modbus protocol, and can achieve many-to-many communication.

[0089] For the above Figure 2 Steps 201 to 203 in Figure 3 , Figure 3 This is a flow chart of another controller-based communication method disclosed in an embodiment of the present application, including steps 301 to 305.

[0090] 301. A network configuration is constructed based on the target controller and all devices to be controlled, and the device scanning instructions are packaged in the application program of the target controller to obtain scanning instruction single packet data.

[0091] By the above Figure 1 It can be obtained that a network configuration can be constructed through the target controller and all the devices to be controlled, and the device scanning instructions can be packaged in the application program of the target controller to obtain the scanning instruction single package data.

[0092] In one specific embodiment, all devices to be controlled (i.e. Figure 1 All network devices in the target controller (PC side) are constructed as a network configuration, and the target controller (PC side) is a separate device. Then, on the PC software of the target controller, a device scan instruction is generated and the device scan instruction is packaged to obtain a scan instruction single packet data. It should be noted that the scan instruction single packet data has only one scan command.

[0093] 302. Insert the scan instruction single packet data into the device broadcast frame, and broadcast the device broadcast frame to all devices to be controlled.

[0094] Based on step 301, a single packet of scan instruction data is inserted into a device broadcast frame, and the device broadcast frame is broadcast to all devices to be controlled.

[0095] In one specific embodiment, in order to allow all devices to be controlled in the network configuration to receive the scan command, a scan instruction single packet data can be inserted into a broadcast frame, thereby obtaining a device broadcast frame to be broadcasted. Then, the device broadcast frame is broadcasted to all devices to be controlled in the network configuration.

[0096] 303. Accept the first device data frame of each device to be controlled that is returned by all devices to be controlled based on the device broadcast frame.

[0097] Based on step 302, after all the devices to be controlled in the network configuration receive the scan command, they will reply with a first device data frame. Among them, the first device data frame specifically refers to the data frame returned by each device to be controlled. Therefore, the number of returned device data frames should be related to the number of devices to be controlled in the network configuration. It should also be noted that the first device data frame includes a single device packet data, and the single device packet data is generated after being packaged for each device to be controlled according to the corresponding device identification information and the device parameter information to be modified.

[0098] Specifically, the device to be controlled that receives the scan command in the network configuration replies with its own MAC identifier and device parameters in a package, and each package is a single package of device data. Therefore, the target controller can receive multiple packages of data.

[0099] 304 , determining the device single package data in the first device data frame, analyzing all the device single package data, and packaging the target device parameter information and device identification information of all the devices to be controlled in the application program of the target controller to obtain device parameter multi-package data.

[0100] After obtaining all the single-package data of all the devices to be controlled, it is necessary to analyze the single-package data of the device, and then package the target device parameter information and device identification information of all the devices to be controlled in the application of the target controller, so as to obtain the multi-package data of the device parameters. It should be noted that the multi-package data of the device parameters includes multiple single-package data of the device parameters, and the single-package data of the device parameters is the device identification information and the target device parameter information of each device to be controlled.

[0101] In one specific embodiment, after the target controller obtains all device single-packet data, since each device single-packet data corresponds to a device to be controlled, the device identification information and the device parameter information to be modified corresponding to each device to be controlled can be obtained, and then the target controller can obtain the device identification information and the device parameter information to be modified corresponding to each device to be controlled through the above Figure 2 After step 202, that is, after completing the parameter modification of the devices in the network configuration, the parameter information of all the devices to be controlled and all the target devices can be packaged one by one, that is, each parameter to be controlled is regarded as a data packet, thereby forming a multi-packet data of device parameters.

[0102] 305 . Insert the device parameter multi-packet data into the second device data frame, and broadcast the second device data frame to all devices to be controlled respectively.

[0103] Then, the device parameter multi-packet data is inserted into the second device data frame, and the second device data frame is broadcasted to all devices to be controlled respectively.

[0104] In one specific embodiment, the device parameter multi-packet data is placed in the second device data frame, and the second device data frame is sent to all devices to be controlled by UDP broadcast. In other words, each device to be controlled can receive the second device data frame, analyze the second device data frame corresponding to its own device identification information and target device parameter information, and complete the modification of internal device parameters according to the target device parameter information.

[0105] Through a controller-based communication method disclosed in this embodiment, the Ethernet interface supports UDP broadcast mode to set the parameters of the site, and there is no need to specify the IP address before connecting and setting the parameters; in the original technical solution, when setting the parameters and ID of the communication device, since the identification ID of each device is required to be different, each device needs to be set separately. In the early setting stage of the device and when the network configuration needs to be changed later, if there are many devices in the network, it will bring a lot of setting workload, which brings many inconveniences to the user; this solution provides a solution for configuring the parameters of multiple devices at one time in the network configuration, using UDP broadcast data frames to realize multiple devices in the network configuration to receive and send configuration parameters at the same time, generate a display interface for scanning multiple devices in the network configuration on the PC software (graphical interface), and then perform one-time parameter settings for different devices on the interface, and then use UDP broadcast data frames combined with the MAC address identifier of each device to send the parameters of all devices in the network configuration at one time, and finally all device parameters in the network configuration take effect at the same time.

[0106] For the above Figure 2 Step 204 in Figure 4 , Figure 4 This is a flow chart of another controller-based communication method disclosed in an embodiment of the present application, including steps 401 to 410.

[0107] 401. Insert communication parameter information into a broadcast frame in an application of a target controller to obtain a response broadcast frame.

[0108] It should be noted that, in this embodiment, steps 401 to 410 are executed after the target controller completes the debugging of all target control devices in the network configuration. Specifically, in order to implement the parallel communication protocol between multiple sites, it is necessary to first insert the communication parameter information into the broadcast frame in the application of the target controller to obtain a response broadcast frame. It should be noted that the communication parameter information includes the device quantity information and the preset number of retransmissions of all target control devices. Furthermore, it can also include the timeout determination time, etc., and the communication parameter information is not specifically limited here.

[0109] In one specific embodiment, the target controller needs to first set the communication parameter information for the subsequent parallel communication protocol, and then, in order to send the communication parameter information to each target control device via UDP broadcast, the communication parameter information can be inserted into the response broadcast frame.

[0110] 402. Broadcast a response broadcast frame to all target control devices, so that all target control devices adjust communication parameters according to the response broadcast frame.

[0111] Then, after the response broadcast frame is obtained, the response broadcast frame can be broadcast to all target control devices, so that all target control devices adjust communication parameters according to the response broadcast frame.

[0112] In one specific embodiment, the target control device sends the communication parameter information to each target control device by broadcasting a response broadcast frame, and then each target control device can adjust its own communication parameters according to the communication parameter information. It should be noted that the response broadcast frame at this time also instructs each target control device to respond to the broadcast frame, thereby generating a response frame corresponding to the target control device.

[0113] 403. Send a query broadcast frame corresponding to the device quantity information to all target control devices, and receive device response broadcast frames returned by the corresponding target control devices one by one.

[0114] After the target control device sends the response frame, it can send a query broadcast frame corresponding to the device quantity information to all target control devices, and receive the device response broadcast frames returned by the corresponding target control devices one by one. It should be noted that in one of the feasible technical solutions, the device response broadcast frame also includes the target device parameter information of the target control device.

[0115] In one of the specific embodiments, after the target controller sends the communication parameter information to the target control device in the network configuration, it will send a query frame, i.e., a query broadcast frame, to the target control device to query whether the target control device has completed the adjustment of the communication parameter information. Specifically, after receiving the communication parameter information sent by the target controller and receiving the query frame, the target control device will return a response frame, i.e., a device response broadcast frame, to the target controller.

[0116] Furthermore, in other feasible technical solutions, the target control device may also insert the target device parameter information into the device response broadcast frame, which is not specifically limited here.

[0117] It should also be added that the above target controller can be used as a master device, and the target control device can be used as a slave device. Furthermore, the master device or the slave device can be a network device in a network configuration, and there is no specific limitation here. In addition, the master device and the slave device can be connected to each other through Ethernet or a serial port.

[0118] For easier understanding, please refer to Figure 5 , Figure 5 The flowchart of a network communication cycle disclosed in the embodiment of the present application. In one of the communication cycles of the NN network, the master station (the master device, which can be the target controller or any control device in the network configuration) sends a device broadcast frame, that is, Figure 5 The master station broadcasts the frame in the master station. Then, the master station generates a response frame, that is, step 401. Then, the master station query frame 1 is initiated, and the corresponding slave station returns the response frame 1, that is, step 403. Then, the communication interaction between the next slave station and the master station is realized, that is, the master station query frame 2, the slave station response frame 2, ... until the cycle ends.

[0119] 404. Determine whether the corresponding current control device responds correctly according to the target device parameter information in the device response broadcast frame.

[0120] Based on step 403, it can be determined whether the corresponding current control device responds correctly according to the target device parameter information in the device response broadcast frame. It should be noted that the current control device is the target control device corresponding to the target device parameter information. For ease of understanding, any target control device in the target controller or network configuration is described as a master station, and the remaining target control devices are slave stations.

[0121] In one specific embodiment, the master station determines whether the adjustment of slave station n is completed or the response is correct by judging the target device parameter information in the device response broadcast frame of slave station n and the device parameter information sent by the master station to slave station n, and then executes step 405, step 406 or step 407 according to different judgment results.

[0122] 405. If the current control device responds correctly, it is determined that the parameter information of the target device has been adjusted in the current control device, and a determination step of the next target control device is executed.

[0123] Corresponding to step 404, when the current control device responds correctly, it is determined that the parameter information of the target device has been adjusted in the current control device, and the determination step of the next target control device is executed.

[0124] In one specific embodiment, if the target device parameter information of slave station n and the corresponding slave station n in the master station is the same, it is determined that slave station n has completed the adjustment, and the data domain returned by slave station n is received, that is, the communication cycle or communication frequency of slave station n, etc., and then the next slave station determination step is executed, that is, n=n+1.

[0125] 406. If the current control device responds with an error, and the number of retransmissions exceeds the retransmission number information, an error processing is performed on the current control device, and a step of determining the next target control device is executed.

[0126] Corresponding to step 404, when the current control device responds with an error and the number of retransmissions exceeds the retransmission number information, an error reporting process is performed on the current control device, and the next target control device determination step is executed.

[0127] In one of the specific embodiments, when slave station n responds with an error, it is determined whether the query frame sent by the master station at this time exceeds the number of retransmissions. If the number of retransmissions exceeds the preset number of retransmissions, an error is reported to slave station n, and then the determination step for the next slave station is executed, that is, n=n+1.

[0128] 407. If the current control device responds with an error, and the number of retransmissions does not exceed the number of retransmissions information, a step of determining the next target control device is executed.

[0129] Corresponding to step 404, when the current control device responds with an error and the number of retransmissions does not exceed the number of retransmissions information, the step of determining the next target control device is directly executed.

[0130] In one specific embodiment, when slave station n responds with an error, it is determined whether the query frame sent by the master station exceeds the retransmission number. If the retransmission number does not exceed the preset retransmission number information, the determination step for the next slave station is directly executed, that is, n=n+1.

[0131] 408. Determine whether the current control device is the last control device according to the device quantity information.

[0132] Based on any one of steps 405 to 407 , after completing n=n+1, it is necessary to determine whether the current control device is the last control device according to the device quantity information.

[0133] In one specific embodiment, it is necessary to determine whether the slave station n is the last station at this time according to the device quantity information in the network configuration (reflecting the number of slave stations in the network configuration). Then, according to different judgment results, step 409 or step 410 is performed respectively.

[0134] 409. If the current control device is the last control device, execute the step of sending a device broadcast frame to all devices to be controlled in the network configuration to perform the next cycle.

[0135] Based on step 408, when the current control device is the last control device, the step of sending a device broadcast frame to all devices to be controlled in the network configuration is executed to perform the next cycle.

[0136] In one specific embodiment, if the slave station n is the last slave station at this time, the next cycle can be performed, that is, the execution Figure 2 In other words, it can be understood that a NN communication cycle ends.

[0137] 410. If the current control device is not the last control device, execute the step of sending a query broadcast frame corresponding to device quantity information to all target control devices.

[0138] Based on step 408, when the current control device is not the last control device, a corresponding query frame is sent to the current control device.

[0139] In one specific embodiment, if the slave station n is not the last slave station at this time, the response frame returned by the slave station n is queried, that is, step 403 is executed.

[0140] A controller-based communication method disclosed in this embodiment uses a data frame interaction method of network broadcasting, through a frame of "query" and a frame of "response", so that all sites in the network can refresh the data of each site in the same communication cycle, and realize many-to-many data interaction. At the same time, because the Ethernet interface uses UDP multicast to communicate with multiple machines, it avoids the cumbersome IP address setting and connection operations in TCP communication, and each site only needs to use a set of network resources to complete many-to-many communication. The entire many-to-many network communication frame is divided into broadcast frames, query frames and response frames. In each cycle, the master station will send a broadcast frame once, and send (master station + number of slave stations) query frames according to the number of slave stations, and then the corresponding station number will reply to the response frame. The master station also needs to reply to the response frame, regardless of whether there is a connected slave station.

[0141] Furthermore, in combination with the above Figures 2 to 4, the embodiment of the present application improves the original bus communication mode based on the modbus communication protocol, which can only be one-to-many. This communication mode has the disadvantages of low efficiency and many-to-many, and cannot meet the requirements in some application scenarios. The communication mode proposed in the embodiment of the present application can realize the data interaction between the master and the slave by utilizing the data frame interaction mode of bus broadcast, and the efficiency is extremely high. The same data bandwidth can transmit more data than modbus. The data interaction mode under the Ethernet interface is changed. The modbus-tcp protocol is a point-to-point communication mode based on TCP. This mode has the disadvantages of requiring point-to-point connection before communication, and must be in the same subnet segment in the local area network to communicate, and the use cost is high; the communication mode proposed in this article is changed to the UDP communication mode, which can perform multicast and broadcast of data frames, and cooperate with the many-to-many protocol frame response mode, which can greatly improve the communication efficiency, and does not need to set IP addresses, match subnet segments, and then connect and communicate like TCP. The cumbersome steps greatly reduce the use cost of multi-host networking.

[0142] Furthermore, combined with Figures 2 to 4 , see Figure 6 and Figure 7 ,in, Figure 6 This is a network diagram of an RS485 connection disclosed in an embodiment of the present application. Figure 7 This is a schematic diagram of a network interface through a switch disclosed in an embodiment of the present application. It should be noted that: Figure 6 It is a network connection diagram, i.e., parallel communication based on serial port RS485 communication medium. Figure 6 and Figure 7 The parallel communication method of the embodiment of the present application is described respectively, in the serial port RS485 ( Figure 6 ) communication medium, and Ethernet ( Figure 7 ) Schematic diagram of the physical network topology under the communication medium. It can be understood that the various control devices communicate in parallel.

[0143] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0144] See also Figure 8 , Figure 8 A schematic diagram of the structure of a controller-based communication system disclosed in an embodiment of the present application.

[0145] The sending unit 801 is used to send a device broadcast frame to all devices to be controlled in the network configuration;

[0146] A receiving unit 802 is configured to receive a first device data frame returned by all devices to be controlled based on a device broadcast frame to each device to be controlled, wherein the first device data frame includes device identification information corresponding to each device to be controlled and device parameter information to be modified;

[0147] An acquiring unit 803 is used to modify the device parameter information to be modified corresponding to each device to be controlled to obtain the target device parameter information;

[0148] The sending unit 801 is further used to send a second device data frame to all devices to be controlled in the network configuration, so that all devices to be controlled can identify the device identification information in the second device data frame, determine the corresponding target control device, and adjust the device parameter information of the target control device according to the target device parameter information; wherein the target control device is any device to be controlled corresponding to the device identification information among all devices to be controlled;

[0149] The sending unit 801 is further configured to send a response broadcast frame to all target control devices in the network configuration, so that the target control device establishes a communication connection with the target controller according to the response broadcast frame.

[0150] See below Fig. 9 , a schematic diagram of a controller-based communication device disclosed in an embodiment of the present application includes:

[0151] CPU 901, memory 905, input / output interface 904, wired or wireless network interface 903 and power supply 902;

[0152] The memory 905 is a temporary storage memory or a permanent storage memory;

[0153] The CPU 901 is configured to communicate with the memory 905 and execute the instructions in the memory 905 to perform the aforementioned Figures 2 to 4 A controller-based communication method in any of the illustrated embodiments.

[0154] The embodiment of the present application also provides a chip system, the chip system includes at least one processor and a communication interface, the communication interface and the at least one processor are interconnected through a line, and the at least one processor is used to run a computer program or instruction to execute the aforementioned Figures 2 to 4 A controller-based communication method in any of the illustrated embodiments.

[0155] The embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium includes instructions, when the instructions are executed on a computer, the computer executes the aforementioned Figures 2 to 4 A controller-based communication method in any of the illustrated embodiments.

[0156] The present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the aforementioned Figures 2 to 4 A controller-based communication method in any of the illustrated embodiments.

[0157] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0158] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0159] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0160] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0161] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.

Claims

1. A controller-based communication method, characterized in that: Applied to a target controller, the method comprises: Send device broadcast frames to all devices to be controlled in the network configuration; Accepting a first device data frame returned by all the devices to be controlled based on the device broadcast frame for each device to be controlled, wherein the first device data frame includes device identification information corresponding to each device to be controlled and device parameter information to be modified; Modify the device parameter information to be modified corresponding to each device to be controlled to obtain target device parameter information; Sending a second device data frame to all the devices to be controlled in the network configuration, so that all the devices to be controlled recognize the device identification information in the second device data frame, determine the corresponding target control device, and adjust the device parameter information of the target control device according to the target device parameter information; wherein the target control device is any device to be controlled corresponding to the device identification information among all the devices to be controlled; A response broadcast frame is sent to all target control devices in the network configuration, so that the target control device establishes a communication connection with the target controller according to the response broadcast frame.

2. The controller-based communication method according to claim 1, characterized in that: The sending of a device broadcast frame to all devices to be controlled in the network configuration includes: Building the network configuration based on the target controller and all the devices to be controlled; Packing the device scanning instruction in the application of the target controller to obtain scanning instruction single package data; The scanning instruction single packet data is inserted into the device broadcast frame, and the device broadcast frame is broadcast to all the devices to be controlled.

3. The controller-based communication method according to claim 2, characterized in that: After broadcasting to all the devices to be controlled, the method further includes: Determine the device single package data in the first device data frame; wherein the device single package data is generated by packaging each device to be controlled according to the corresponding device identification information and the device parameter information to be modified; Analyze all device single packet data, and execute the step of displaying a device information list corresponding to each device to be controlled according to the device identification information.

4. The controller-based communication method according to claim 1, characterized in that: The sending of the second device data frame to all the devices to be controlled in the network configuration includes: In the application program of the target controller, the target device parameter information and the device identification information of all the devices to be controlled are packaged to obtain device parameter multi-package data; wherein the device parameter multi-package data includes a plurality of device parameter single-package data, and the device parameter single-package data is the device identification information and the target device parameter information of each device to be controlled; Insert the multi-packet data of the device parameters into the second device data frame, and broadcast the second device data frame to all the devices to be controlled respectively.

5. The controller-based communication method according to claim 1, characterized in that: The sending of a response broadcast frame to all target control devices in the network configuration includes: Inserting the communication parameter information into a broadcast frame in the application of the target controller to obtain the response broadcast frame; wherein the communication parameter information includes the device quantity information of all target control devices and the preset number of retransmissions; The response broadcast frame is broadcasted to all the target control devices, so that all the target control devices adjust communication parameters according to the response broadcast frame.

6. The controller-based communication method according to claim 5, characterized in that: After broadcasting the response broadcast frame to all target control devices, the method further includes: Sending a query broadcast frame corresponding to the device quantity information to all the target control devices, and receiving device response broadcast frames returned by the corresponding target control devices one by one; wherein the device response broadcast frame includes the target device parameter information of the target control device; Determining whether the corresponding current control device responds correctly according to the target device parameter information in the device response broadcast frame; wherein the current control device is the target control device corresponding to the target device parameter information; If the current control device responds correctly, it is determined that the parameter information of the target device has been adjusted in the current control device, and a determination step of the next target control device is executed; If the current control device responds with an error, and the number of retransmissions exceeds the number of retransmissions information, an error reporting process is performed on the current control device, and a step of determining the next target control device is executed; If the current control device responds with an error, and the number of retransmissions does not exceed the number of retransmissions information, the step of determining the next target control device is executed.

7. The controller-based communication method according to claim 6, characterized in that: After the step of determining the next target control device is performed, the method further includes: Determine whether the current control device is the last control device according to the device quantity information; If the current control device is the last control device, executing the step of sending a device broadcast frame to all devices to be controlled in the network configuration to perform the next cycle; If the current control device is not the last control device, the step of sending a query broadcast frame corresponding to the device quantity information to all target control devices is performed.

8. The controller-based communication method according to claim 1, characterized in that: Before modifying the device parameter information to be modified corresponding to each device to be controlled and obtaining the target device parameter information, the method further includes: A device information list corresponding to each device to be controlled is displayed according to the device identification information, and in the device information list, the step of modifying the device parameter information to be modified corresponding to each device to be controlled is performed.

9. A communication device based on a controller, characterized in that: The device comprises: CPU, memory, input and output interfaces, wired or wireless network interfaces, and power supply; The memory is a transient storage memory or a persistent storage memory; The central processing unit is configured to communicate with the memory and execute instructions in the memory to perform the controller-based communication method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes instructions, and when the instructions are executed on a computer, the computer is caused to perform the controller-based communication method according to any one of claims 1 to 7.