Communication method of TCP gateway, TCP gateway and system
By establishing a TCP connection path between the TCP gateway and third-party devices, and utilizing the storage space of multiple logical slave devices, the problem of large data transmission between the TCP gateway and third-party devices is solved, and the storage resources for transmission are expanded.
Patent Information
- Application Number
- CN202410718279.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-09-06
AI Technical Summary
In the existing technology, TCP gateways are difficult to meet the demand for large amounts of data transmission with third-party devices, and are limited by the limited storage space of third-party devices in the DCS system.
By establishing a TCP connection path between the TCP gateway and the third-party device, and performing data transmission in the spaces corresponding to the multiple logical slave devices managed by the target storage space, the storage space of the multiple logical slave devices is fully utilized and the data transmission is expanded. cache resources.
It realizes the transmission of large amounts of data between TCP gateways and third-party devices, meets the demand for transmission of large amounts of data, and increases storage space resources.
Smart Images

Figure CN118612271A
Abstract
Description
Technical Field
[0001] The present application belongs to the field of industrial automation technology, and specifically relates to a TCP gateway communication method, a TCP gateway and a system. Background Art
[0002] In the field of industrial automation technology, DCS systems (Distributed Control System) are widely used. DCS systems not only need to use the data of the I / O (Input / Output) modules within the system, but also need to use the data from third-party devices. It is very important to effectively introduce the data of third-party devices into the DCS system.
[0003] In the related art, a TCP (Transmission Control Protocol) gateway is generally set in the DCS system to obtain data from a third-party device through the TCP gateway. Specifically, in the DCS system, the DCS controller can establish a TCP connection with the third-party device through the TCP gateway and perform data transmission.
[0004] However, there is a problem in the related art that it is difficult to meet the demand for large data volume transmission between the TCP gateway and the third-party device. For example, the storage space occupied by a third-party device in the input data area and the output data area in the DCS system is limited. Limited by the limited storage space occupied by the third-party device in the DCS system, when the amount of data to be transmitted by a real third-party device is large and exceeds the amount of data that can be cached in the input data area and the output data area of the third-party device in the DCS system, it is difficult to meet the demand for transmitting a large amount of data between the TCP gateway and the third-party device. Summary of the invention
[0005] The embodiments of the present application provide a communication method, gateway and system for a TCP gateway, which can solve the problem in the related art that it is difficult to meet the demand for transmitting large amounts of data between the TCP gateway and a third-party device.
[0006] In a first aspect, an embodiment of the present application provides a communication method of a TCP gateway, including:
[0007] Establish a TCP connection path between the TCP gateway and the third-party device;
[0008] Target data transmission is carried out between the TCP gateway and the third-party device through the TCP connection path;
[0009] The target data includes data obtained from the target storage space, or the target data includes data stored in the target storage space; the target storage space is the space occupied by multiple logical slave devices managed by the TCP gateway, and the multiple logical slave devices correspond to third-party devices.
[0010] In a second aspect, an embodiment of the present application provides a TCP gateway, including a processor and a memory, wherein the memory stores a program or instruction that can be executed on the processor, and when the program or instruction is executed by the processor, the method described in the first aspect is implemented.
[0011] In a third aspect, an embodiment of the present application provides a distributed control system, including: a controller, an input / output module connected to the controller, and a TCP gateway connected to the controller; the TCP gateway is used to implement the method described in the first aspect.
[0012] In an embodiment of the present application, a TCP connection path is established between a TCP gateway and a third-party device; target data is transmitted between the TCP gateway and the third-party device through the TCP connection path; wherein the target data includes data obtained from a target storage space, or the target data includes data stored in a target storage space; the target storage space is the space occupied by multiple logical slave devices managed by the TCP gateway, and the multiple logical slave devices correspond to third-party devices. In this way, compared with the related art which is limited by the limited storage space occupied by third-party devices in the DCS system, since the multiple logical slave devices managed by the TCP gateway in the present application correspond to the third-party devices, the space occupied by the multiple logical slave devices corresponding to the third-party devices can be fully utilized to transmit data between the TCP gateway and the third-party devices, thereby increasing the storage space resources required for data transmission between the TCP gateway and the third-party devices, thereby meeting the demand for large-scale data transmission between the TCP gateway and the third-party devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0014] Figure 1 A schematic flow chart of a communication method of a TCP gateway provided in an embodiment of the present application;
[0015] Figure 2 A schematic flow chart of another TCP gateway communication method provided in an embodiment of the present application;
[0016] Figure 3 A schematic flow chart of another communication method of a TCP gateway provided in an embodiment of the present application;
[0017] Figure 4 A schematic flow chart of another TCP gateway communication method provided in an embodiment of the present application;
[0018] Figure 5 A schematic structural diagram of a TCP gateway provided in an embodiment of the present application;
[0019] Figure 6 A schematic structural diagram of a distributed control system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0021] The terms "first", "second", "third", "fourth", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not 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 of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", "third", "fourth", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated before and after are in an "or" relationship.
[0022] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0023] As described in the background technology, the storage space of the input data area and the output data area occupied by the third-party device in the DCS system is limited. For example, the storage space of the input data area and the output data area occupied by the third-party device in the host computer, controller and TCP gateway of the DCS system is limited. Limited by the limited storage space occupied by the third-party device in the DCS system, when the amount of data to be transmitted by a real third-party device is large and exceeds the amount of data that can be cached in the input data area and the output data area occupied by the third-party device in the DCS system, it is difficult to transmit a large amount of data between the TCP gateway and the third-party device, and it is difficult to meet the demand for large data transmission between the TCP gateway and the third-party device.
[0024] Based on this, in order to meet the needs of TCP gateway and third-party devices for transmitting large amounts of data, the communication method of the TCP gateway provided in the embodiment of the present application can configure multiple logical slave devices to correspond to a real third-party device through the TCP gateway configuration. The TCP gateway can make full use of the target storage space occupied by multiple logical slave devices corresponding to the third-party device for data transmission, and then can exponentially expand the cache space required for the third-party device to transmit data, thereby providing more storage resources for the TCP gateway and third-party devices to transmit data, thereby meeting the needs of the TCP gateway and third-party devices for transmitting large amounts of data.
[0025] In practical applications, the communication method of the TCP gateway provided in the embodiment of the present application can be applied to the Modbus (an industrial Ethernet communication protocol) TCP gateway of the DCS system, or the TCP gateway of other application scenarios, and the present application does not impose any restrictions on this.
[0026] The test system provided in the embodiment of the present application is described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0027] Figure 1 A schematic flowchart of a communication method for a TCP gateway provided in an embodiment of the present application.
[0028] like Figure 1 As shown, a communication method of a TCP gateway provided in an embodiment of the present application may include:
[0029] Step 110: Establish a TCP connection path between the TCP gateway and the third-party device;
[0030] Step 120: Transmit target data between the TCP gateway and the third-party device via the TCP connection path; wherein the target data includes data obtained from the target storage space, or the target data includes data stored in the target storage space; the target storage space is the space occupied by multiple logical slave devices managed by the TCP gateway, and the multiple logical slave devices correspond to the third-party devices.
[0031] In the embodiment of the present application, the TCP gateway may be a Modbus TCP gateway in a DCS system.
[0032] In the embodiment of the present application, the third-party device refers to the controller and the input / output module in the DCS system. The present application does not limit the type and quantity of the third-party device. For example, the third-party device may include various third-party TCP slave devices.
[0033] In an embodiment of the present application, the target data may be data read / written by a TCP gateway from a target storage space in the memory of a controller of a DCS system. In practical applications, the target storage space may include multiple input / output data areas corresponding to multiple logical slave devices on a DCS system. For example, a DCS system may include, but is not limited to, a host computer, a controller, and a TCP gateway. The target storage space may include multiple input / output data areas corresponding to multiple logical slave devices on the memory of a host computer of a DCS system. The target storage space may also include multiple input / output data areas corresponding to multiple logical slave devices on the memory of a controller of a DCS system. The target storage space may also include multiple input / output data areas corresponding to multiple logical slave devices on the memory of a TCP gateway of a DCS system.
[0034] It should be pointed out that the storage space of a single input / output data area corresponding to a single logical slave device may be limited, but since the third-party device is corresponded to multiple logical slave devices in the embodiment of the present application, the number of corresponding logical slave devices can be expanded according to actual needs, thereby expanding the target storage space exponentially. Furthermore, the TCP gateway can make full use of the multiple input / output data areas corresponding to the multiple logical slave devices in the memory to transmit data with the third-party device, thereby increasing the cache resources required for the TCP gateway to transmit data with the third-party device, thereby meeting the demand for the TCP gateway to transmit a large amount of data with the third-party device.
[0035] According to the communication method of the TCP gateway provided in the embodiment of the present application, a TCP connection path is established between the TCP gateway and the third-party device; target data is transmitted between the TCP gateway and the third-party device through the TCP connection path; wherein the target data includes data obtained from the target storage space, or the target data includes data stored in the target storage space; the target storage space is the space occupied by multiple logical slave devices managed by the TCP gateway, and the multiple logical slave devices all correspond to the third-party devices. In this way, compared with the related art which is limited by the limited storage space occupied by the third-party devices in the DCS system, since the multiple logical slave devices managed by the TCP gateway in the present application all correspond to the third-party devices, the space occupied by the multiple logical slave devices corresponding to the third-party devices can be fully utilized to transmit data between the TCP gateway and the third-party devices, thereby increasing the storage space resources required for the TCP gateway to transmit data with the third-party devices, thereby meeting the demand for large-scale data transmission between the TCP gateway and the third-party devices.
[0036] In order to establish at least one TCP connection path between the TCP gateway and the third-party device, in a specific embodiment, as Figure 2 As shown, the communication method of the TCP gateway provided in the embodiment of the present application may include:
[0037] Step 210: Acquire network parameters of the TCP gateway and network parameters of the third-party device, where the network parameters of the third-party device include network parameters of a plurality of logical slave devices corresponding to the third-party device;
[0038] Step 220: establishing a TCP connection path between the TCP gateway and the third-party device based on the network parameters of the TCP gateway and the network parameters of the plurality of logical slave devices corresponding to the third-party device;
[0039] Step 230: Transmit target data between the TCP gateway and the third-party device via the TCP connection path.
[0040] Among them, step 210 and step 220 can be sub-steps of step 110.
[0041] Among them, step 230 may refer to the specific content of step 120.
[0042] Before step 210, since multiple logical slave devices correspond to one third-party device, obtaining the network parameters of the third-party device may include: obtaining the network parameters of the multiple logical slave devices corresponding to the third-party device based on the mapping relationship between the third-party device and the multiple logical slave devices; and using the network parameters of the multiple logical slave devices corresponding to the third-party device as the network parameters of the third-party device.
[0043] In step 220, the embodiment of the present application can determine a connection establishment request based on multiple logical slave device network parameters and the TCP gateway's own network parameters, and then the TCP gateway sends a connection establishment request to the third-party device to establish a TCP connection path between the TCP gateway and the third-party device.
[0044] It can be understood that the request to establish a connection can be a request sent by the TCP gateway to the third-party device, or a request received by the TCP gateway from the third-party device, and this application does not impose any restrictions on this.
[0045] For example, in other embodiments, after the third-party device sends a connection establishment request to the TCP gateway, the TCP gateway may receive a connection establishment request sent by the third-party device to establish a TCP connection path between the TCP gateway and the third-party device.
[0046] In step 230, the TCP gateway can perform target data transmission with multiple logical slave devices corresponding to the third-party device through the TCP connection path. For example, the TCP gateway can fully utilize multiple input / output data areas of multiple logical slave devices on the memory of the DCS controller to perform data transmission with the third-party device, thereby increasing the storage space resources required for the TCP gateway to transmit data with the third-party device, thereby meeting the demand for the TCP gateway to transmit a large amount of data with the third-party device.
[0047] In order to expand the storage space resources required for data transmission between the TCP gateway and the third-party device, before obtaining the network parameters of the third-party device, the TCP gateway can also configure multiple logical slave devices corresponding to the third-party device, and configure the network parameters and communication parameters of the multiple logical slave devices. Afterwards, the network parameters and communication parameters of the multiple logical slave devices managed by the TCP gateway can be used for communication.
[0048] For example, Figure 2 As shown, in a specific embodiment, before obtaining the network parameters of the third-party device in step 210, the communication method of the TCP gateway provided in the embodiment of the present application may include:
[0049] Step 204: Obtain configuration data;
[0050] Step 206: Establishing a mapping relationship between the third-party device and the plurality of logical slave devices based on the configuration data;
[0051] Step 208: Based on the configuration data, multiple logical slave devices corresponding to the third-party device are configured to generate network parameters of the multiple logical slave devices;
[0052] In the embodiment of the present application, steps 204 to 208 may be performed before step 210 .
[0053] In step 204, the configuration data may be configuration data from a DCS controller, or may be pre-stored configuration data, which is not specifically limited in the present application.
[0054] In step 206, the embodiment of the present application may associate the third-party device with the multiple logical slave devices based on the configuration data, so as to establish a mapping relationship between the third-party device and the multiple logical slave devices.
[0055] The specific number of logical slave devices corresponding to a third-party device can be determined by the amount of target data and the storage space occupied by a single logical slave device, and this application does not impose any specific restrictions on this.
[0056] In step 208, the embodiment of the present application can configure multiple logical slave devices based on the configuration data to generate network parameters of the multiple logical slave devices. The network parameters may include but are not limited to IP (Internet Protocol) addresses and port numbers.
[0057] The network parameters of the multiple logical slave devices may include network parameters of each logical slave device, and the network parameters of each logical slave device are different. Alternatively, the network parameters of the multiple logical slave devices include network parameters shared by multiple logical slave devices, in other words, the network parameters of each logical slave device are the same.
[0058] In addition, in addition to generating network parameters of multiple logical slave devices, the embodiment of the present application can also configure multiple logical slave devices based on configuration data to generate communication parameters of multiple logical slave devices. The communication parameters may include but are not limited to: communication cycle, command interval and timeout, etc.
[0059] In addition, the embodiment of the present application can also generate network parameters of the TCP gateway based on the configuration data. The network parameters may include but are not limited to the IP address and port number.
[0060] In this way, the embodiment of the present application configures multiple logical slave devices to correspond to a third-party device based on configuration data, configures network parameters and communication parameters of multiple logical slave devices, and thereby expands the cache space resources required for TCP gateway and third-party devices to transmit data.
[0061] It should be pointed out that in actual applications, the configuration methods of network parameters of multiple logical slave devices may be different according to the number of TCP connection paths supported by the actual third-party device. The following example illustrates:
[0062] In a specific example, when the third-party device supports multiple TCP connection paths, in the above step 208, configuring multiple logical slave devices and generating network parameters of multiple logical slave devices may include:
[0063] Each of the plurality of logic slave devices is configured respectively to generate network parameters of each logic slave device; wherein the network parameters of each logic slave device are different.
[0064] The network parameters may include but are not limited to IP addresses and port numbers. The different network parameters of each logical slave device may include: different IP addresses of each logical slave device, or different port numbers of each logical slave device, or different IP addresses and port numbers of each logical slave device.
[0065] In this way, the present application can configure different network parameters for each logical slave device respectively, so that the subsequent TCP gateway can independently communicate in parallel with each logical slave device corresponding to the third-party device, thereby improving the flexibility and speed of communication.
[0066] In another specific example, when the third-party device supports a single TCP connection path, in the above step 208, configuring multiple logical slave devices and generating network parameters of the multiple logical slave devices may include:
[0067] Multiple logical slave devices are configured into a logical slave device group, the logical slave device group is configured, and network parameters of the logical slave device group are generated; wherein the network parameters of the logical slave device group are network parameters shared by multiple logical slave devices.
[0068] Since the network parameters of the logic slave device group are network parameters shared by multiple logic slave devices, the network parameters of each logic slave device are the same.
[0069] In this way, the present application can configure a set of common network parameters for each logical slave device, so that the subsequent TCP gateway can communicate serially with each logical slave device corresponding to the third-party device in sequence according to the sequence of each logical slave device in the configured logical slave device group, thereby ensuring the reliability of communication.
[0070] The above describes that among the network parameters of multiple logical slave devices corresponding to the third-party device, the network parameters of each logical slave device can be different or the same. In the case where the network parameters of each logical slave device are different, multiple TCP connection paths can be established between the TCP gateway and the third-party device based on the different network parameters of each logical slave device; in the case where the network parameters of each logical slave device are the same, a TCP connection path can be established between the TCP gateway and the third-party device based on the network parameters shared by each logical slave device. The following examples illustrate the specific communication process of the TCP gateway in these two cases.
[0071] In a specific embodiment, in order to enable the TCP gateway to independently communicate in parallel with each logical slave device corresponding to the third-party device, thereby improving the flexibility and speed of communication, the TCP connection paths established between the TCP gateway and the third-party device may include multiple TCP connection paths, and the multiple TCP connection paths correspond one-to-one to the multiple logical slave devices.
[0072] For example, Figure 3 As shown, the communication method of the TCP gateway provided in the embodiment of the present application may include:
[0073] Step 310: Acquire network parameters of the TCP gateway and network parameters of the third-party device, where the network parameters of the third-party device include network parameters of each logical slave device; and the network parameters of each logical slave device are different;
[0074] Step 320: Send multiple connection establishment requests to the third-party device based on the network parameters of the TCP gateway and the network parameters of each logical slave device;
[0075] Step 330: Establish multiple TCP connection paths between the TCP gateway and the third-party device based on multiple connection establishment requests;
[0076] Step 340: The TCP gateway simultaneously transmits target data with multiple logical slave devices corresponding to the third-party device through multiple TCP connection paths; wherein the multiple TCP connection paths correspond one-to-one to the multiple logical slave devices.
[0077] Among them, step 310 may be a sub-step of step 210 , steps 320 and 330 may be sub-steps of step 220 , and step 340 may be a sub-step of step 230 .
[0078] In step 310, for multiple logical slave devices corresponding to the third-party device, the network parameters of each logical slave device are different, for example, the IP address of each logical slave device is different, or the port number of each logical slave device is different, or the IP address and port number of each logical slave device are different.
[0079] In step 320, multiple connection establishment requests are sent to the third-party device based on the network parameters of each logical slave device. Each connection establishment request carries the network parameters of a logical slave device, and each connection establishment request carries the network parameters of different logical slave devices.
[0080] Wherein, one connection establishment request corresponds to one logical slave device corresponding to the third-party device.
[0081] In step 330, based on the multiple connection establishment requests, multiple TCP connection paths are established between the TCP gateway and the multiple logical slave devices, and the multiple TCP connection paths correspond one-to-one to the multiple logical slave devices.
[0082] In step 340, each TCP connection path communicates in parallel, does not affect each other, and performs read / write operations with each logical slave device separately. For example, each TCP connection path communicates in parallel and performs operations of reading / writing target data with each logical slave device at the same time.
[0083] For example, for a target TCP connection path among multiple TCP connection paths, the TCP gateway can perform read / write operations on target data through the target TCP connection path and the logical slave device corresponding to the target TCP connection path based on the mapping relationship between the multiple TCP connection paths and the multiple logical slave devices.
[0084] In addition, in addition to the TCP gateway sending a connection establishment request to establish a TCP connection path, other embodiments of the present application may also allow a third-party device to send a connection establishment request to establish a TCP connection path. For example, the communication method of the TCP gateway provided in other embodiments of the present application also includes: receiving multiple connection establishment requests sent by a third-party device, the multiple connection establishment requests are obtained based on the network parameters of the TCP gateway and the different network parameters of each logical slave device; based on the multiple connection establishment requests, establishing multiple TCP connection paths between the TCP gateway and the multiple logical slave devices, the multiple TCP connection paths correspond to the multiple logical slave devices one by one; the TCP gateway simultaneously transmits target data with the multiple logical slave devices corresponding to the third-party device through the multiple TCP connection paths.
[0085] In this way, the TCP gateway can independently and in parallel communicate with each logical slave device corresponding to the third-party device through multiple TCP connection paths, thereby improving the flexibility and speed of communication.
[0086] In order to improve the flexibility of communication, network diagnosis can also be performed independently on each logical slave device. In a specific example, the TCP connection path includes multiple TCP connection paths, and the multiple TCP connection paths correspond to multiple logical slave devices one by one. Figure 3As shown, the communication method of the TCP gateway provided in the embodiment of the present application may also include:
[0087] Step 350: after the target TCP connection path between the TCP gateway and the third-party device is disconnected, determine a first connection establishment request based on the network parameters of the TCP gateway and the network parameters of the target logical slave device;
[0088] Step 360: Send a first connection establishment request to the third-party device to re-establish a target TCP connection path between the TCP gateway and the third-party device;
[0089] The target logical slave device is any one of the multiple logical slave devices corresponding to the third-party device, and the target TCP connection path is a TCP connection path corresponding to the target logical slave device among the multiple TCP connection paths.
[0090] In step 350, a first connection establishment request is obtained based on the network parameters of the TCP gateway and the network parameters of the target logical slave device.
[0091] The first connection establishment request may be a request sent by a TCP gateway to a third-party device. In addition, in other embodiments, the first connection establishment request may also be a request received by a TCP gateway from a third-party device, which is not limited in the present application.
[0092] In step 360, after the target TCP connection path between the TCP gateway and the third-party device is disconnected, it can be determined that the target logical slave device enters a reconnection state, and then based on the network parameters of the target logical slave device, a connection establishment request is sent to the third-party device to re-establish the target TCP connection path between the TCP gateway and the third-party device.
[0093] It should be noted that, in the case where the third-party device supports multiple TCP connection paths, each logical slave device performs network diagnosis separately. For example, if a logical slave device successfully establishes a connection, the logical slave device does not need to wait for other logical slave devices to successfully establish a connection, but can directly transmit data. If a logical slave device is disconnected, the logical slave device can directly enter the reconnection state and request to establish a connection without waiting for other logical slave devices to request to establish a connection.
[0094] In this way, since multiple TCP connection paths correspond one-to-one to multiple logical slave devices, each logical slave device can independently perform network diagnosis, thereby improving the flexibility of communication.
[0095] In another specific embodiment, in order to enable the TCP gateway to communicate serially with multiple logical slave devices corresponding to the third-party device and improve the reliability of communication, the TCP connection path established between the TCP gateway and the third-party device may include a single TCP connection path corresponding to multiple logical slave devices.
[0096] For example, Figure 4 As shown, the communication method of the TCP gateway provided in the embodiment of the present application may include:
[0097] Step 410: Acquire network parameters of the TCP gateway and network parameters of the third-party device, where the network parameters of the third-party device include network parameters shared by multiple logical slave devices;
[0098] Step 420: Send a single connection establishment request to the third-party device based on the network parameters of the TCP gateway and the network parameters shared by the multiple logical slave devices;
[0099] Step 430: Establishing a single TCP connection path between the TCP gateway and the third-party device based on the single connection establishment request;
[0100] Step 440: The TCP gateway transmits target data with multiple logical slave devices corresponding to the third-party device in a preset order through a single TCP connection path.
[0101] Among them, step 410 may be a sub-step of step 210 , steps 420 and 430 may be sub-steps of step 220 , and step 440 may be a sub-step of step 230 .
[0102] In step 410, for multiple logical slave devices corresponding to the third-party device, the network parameters of each logical slave device are the same. In other words, the multiple logical slave devices share the same set of network parameters.
[0103] In step 420, a single connection establishment request is sent to the third-party device based on the network parameters shared by the multiple logical slave devices. The connection establishment request carries the network parameters shared by the multiple logical slave devices, and one connection establishment request corresponds to all logical slave devices corresponding to the third-party device.
[0104] In step 430, based on the single connection establishment request, a single TCP connection path is established between the TCP gateway and the multiple logical slave devices, and the single TCP connection path corresponds to the multiple logical slave devices. The multiple logical slave devices can be configured as a whole as a logical slave device group.
[0105] For example, when a real third-party device supports a single TCP connection path, the TCP gateway can configure multiple logical slave devices to correspond to one real third-party device through configuration, and these logical slave devices are configured into a logical slave device group. All logical slave devices in the group share a set of slave device network parameters, that is, the network parameters of each logical slave device are the same, so that the TCP gateway establishes a TCP connection path with the real third-party device.
[0106] In step 440, the communication relationship between all logical slave devices in the group is a serial relationship, and communication is performed in the order of the logical slave devices in the configuration. After all read and write commands of a logical slave device are communicated, the communication is switched to the read and write commands of the next logical slave device.
[0107] In addition, in actual applications, a gateway can configure multiple logical slave device groups to correspond to multiple third-party devices through configuration. This application does not limit the number of third-party devices connected to the TCP gateway communication.
[0108] In this way, the TCP gateway can perform serial communication with all logical slave devices corresponding to the third-party device through a single TCP connection path, thereby improving the reliability of communication.
[0109] In a specific example, in order to perform network diagnosis on multiple logical slave devices synchronously, such as Figure 4 As shown, the communication method of the TCP gateway provided in the embodiment of the present application may also include:
[0110] Step 450: after the single TCP connection path between the TCP gateway and the third-party device is disconnected, determining a second connection establishment request based on the network parameters of the TCP gateway and the network parameters shared by the plurality of logical slave devices;
[0111] Step 460: Send a second connection establishment request to the third-party device to re-establish a TCP connection path between the TCP gateway and the third-party device.
[0112] The re-established TCP connection path may be understood as the only TCP connection path between the TCP gateway and the third-party device.
[0113] In step 450, the second connection establishment request is obtained based on the network parameters of the TCP gateway and the network parameters shared by the plurality of logical slave devices.
[0114] The second connection establishment request may be a request sent by the TCP gateway to the third-party device. In addition, in other embodiments, the second connection establishment request may also be a request received by the TCP gateway from the third-party device, which is not limited in the present application.
[0115] In step 460, after the TCP connection path between the TCP gateway and any logical slave device is disconnected, it can be determined that each of the multiple logical slave devices has entered a reconnection state; then, based on the network parameters shared by the multiple logical slave devices, a connection establishment request can be resent to the third-party device to re-establish the TCP connection path between the TCP gateway and the multiple logical slave devices.
[0116] In this case, the network diagnosis of each logical slave device in the logical slave device group is synchronized with each other. In other words, if a logical slave device successfully establishes a connection, the entire logical slave device group successfully establishes a connection, and the remaining logical slave devices no longer send connection establishment data. If a logical slave device in the logical slave device group is disconnected, the network connection of the entire logical slave device group is disconnected, and all logical slave devices in the group enter the reconnection state and request to establish a connection.
[0117] In this way, since a single TCP connection path corresponds to multiple logical slave devices in the logical slave device group, network diagnosis can be performed synchronously on each logical slave device, thereby improving the reliability of communication.
[0118] In addition, based on the same concept as the communication method of the TCP gateway provided in the above method embodiment, the embodiment of the present application also provides a TCP gateway.
[0119] like Figure 5 As shown, the TCP gateway 500 provided in the embodiment of the present application may include a processor 510 and a memory 520, wherein the memory 520 stores programs or instructions that can be run on the processor 510, and when the programs or instructions are executed by the processor 510, the steps of the communication method provided in the above method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they will not be repeated here.
[0120] In addition, in practical applications, based on the same concept as the TCP gateway provided in the above embodiment, the embodiment of the present application can also provide a distributed control system.
[0121] like Figure 6 As shown, the distributed control system provided in the embodiment of the present application may include: a controller, an input / output module (ie, I / O module) connected to the controller, and a TCP gateway connected to the controller.
[0122] The present application does not limit the number of input / output modules (ie, I / O modules).
[0123] Among them, in a distributed control system (ie, a DCS system), the controller can directly transmit data with the input / output module through the control bus. In addition, the controller can also communicate with third-party devices through a TCP gateway.
[0124] The third-party device refers to the controller and the input / output module in the DCS system, and the present application does not limit the type of the third-party device. For example, the third-party device may include various third-party TCP slave devices.
[0125] In the TCP gateway of the DCS system, the third-party device can exist in the form of a logical slave device, and the network parameters and communication parameters of each logical slave device can be configured. Among them, the network parameters may include but are not limited to the IP address and port number, and the communication parameters may include but are not limited to the communication cycle, command interval and timeout.
[0126] Among them, each logical slave device has a corresponding input data area and output data area in the DCS system (such as the host computer, controller and TCP gateway in the DCS system), which respectively correspond to the data of the controller's read commands and write commands to the third-party device through the TCP gateway, thereby connecting the third-party device to the DCS system through the TCP gateway.
[0127] It should be pointed out that the storage space occupied by the input data area and the output data area of a logical slave device in the DCS system is limited. For example, the input data area of a logical slave device in the controller's memory is 252 bytes, and the output data area is 124 bytes. When the amount of data to be transmitted by a real third-party device exceeds the amount of data that can be cached by a single logical slave device, the embodiment of the present application can configure multiple logical slave devices in the TCP gateway to correspond to a real third-party device, and make full use of the multiple input data areas and multiple output data areas occupied by multiple logical slave devices in the controller's memory to transmit target data, thereby increasing the cache resources required for the TCP gateway to transmit data with the third-party device, thereby meeting the demand for the TCP gateway to transmit a large amount of data with the third-party device.
[0128] In actual applications, according to the number of TCP connection paths supported by the actual third-party device, the communication process between the TCP gateway and the third-party device may include the following multiple implementations.
[0129] In a specific example, when the real third-party device supports multiple TCP connection paths, the TCP gateway can configure multiple logical slave devices to correspond to one real third-party device through configuration. The network parameters of each logical slave device are inconsistent (that is, the IP address and / or port number are inconsistent). The TCP gateway initiates multiple connection establishment requests to the real third-party device based on the network parameters of each logical slave device. The network parameters of each logical slave device are inconsistent (the IP address and / or port number are inconsistent). As a result, the TCP gateway successfully establishes multiple TCP connection paths with the real third-party device. Each TCP connection path communicates in parallel without affecting each other, and performs read / write operations with each logical slave device independently.
[0130] In this case, each logical slave device performs network diagnosis on its own. For example, if a logical slave device successfully establishes a connection, the logical slave device does not need to wait for other logical slave devices to successfully establish a connection, but can directly transmit data. If a logical slave device is disconnected, the logical slave device can directly enter the reconnection state and request to establish a connection without waiting for other logical slave devices to request to establish a connection.
[0131] In another specific example, when the real third-party device supports a single TCP connection path, the TCP gateway can configure multiple logical slave devices to correspond to a real third-party device through configuration, and these logical slave devices are configured into a logical slave device group. All logical slave devices in the group share a set of slave device network parameters, that is, the network parameters of each logical slave device are the same, so that the TCP gateway establishes a TCP connection path with the real third-party device. The communication relationship between the logical slave devices in the group is a serial relationship, and communication is carried out in the order of the logical slave devices in the configuration. After all read and write commands of a logical slave device are communicated, it switches to the read and write commands of the next logical slave device for communication.
[0132] In this case, the network diagnosis of each logical slave device in the group is synchronized with each other. For example, if a logical slave device successfully establishes a connection, the entire logical slave device group successfully establishes a connection, and the remaining logical slave devices no longer send request data to establish a connection; if a logical slave device in the group is disconnected, the network connection of the entire logical slave device group is disconnected, and all logical slave devices in the group enter a reconnection state and request to establish a connection.
[0133] In addition, in actual applications, a gateway can configure multiple logical slave device groups to correspond to multiple third-party devices through configuration. This application does not limit the number of third-party devices connected to the TCP gateway communication.
[0134] It should be pointed out that the TCP gateway can implement the steps of the communication method provided in the above method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0135] An embodiment of the present application further provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0136] The readable storage medium includes a computer-readable storage medium, such as a computer read-only memory, a random access memory, a magnetic disk or an optical disk.
[0137] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0138] An embodiment of the present application further provides a computer program product, which includes a computer program. The computer program is executed by at least one processor to implement the various processes of the above-mentioned method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0139] It should be noted that, in this article, the term "comprises", "includes" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the method and device in the embodiment of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0140] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus necessary general hardware platforms, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.
[0141] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A communication method for a transmission control protocol TCP gateway, characterized in that: include: Establish a TCP connection path between the TCP gateway and the third-party device; Performing target data transmission between the TCP gateway and the third-party device through the TCP connection path; Among them, the target data includes data obtained from the target storage space, or the target data includes data stored in the target storage space; the target storage space is the space occupied by multiple logical slave devices managed by the TCP gateway, and the multiple logical slave devices all correspond to the third-party devices.
2. The method according to claim 1, characterized in that: The step of establishing a TCP connection path between the TCP gateway and the third-party device includes: Acquire network parameters of the TCP gateway and network parameters of the third-party device, wherein the network parameters of the third-party device include network parameters of a plurality of logical slave devices corresponding to the third-party device; Based on the network parameters of the TCP gateway and the network parameters of a plurality of logical slave devices corresponding to the third-party device, a TCP connection path is established between the TCP gateway and the third-party device.
3. The method according to claim 2, characterized in that The network parameters of the plurality of logic slave devices corresponding to the third-party device include: network parameters of each of the logic slave devices, wherein the network parameters of each of the logic slave devices are different; The establishing of a TCP connection path between the TCP gateway and the third-party device based on the network parameters of the TCP gateway and the network parameters of the plurality of logical slave devices corresponding to the third-party device comprises: Based on the network parameters of the TCP gateway and the network parameters of each of the logical slave devices, sending multiple connection establishment requests to the third-party device; Based on the multiple connection establishment requests, multiple TCP connection paths are established between the TCP gateway and the third-party device.
4. The method according to claim 1 or 3, characterized in that: In the case where the TCP connection path includes multiple paths, the multiple TCP connection paths correspond one-to-one to the multiple logical slave devices; The transmitting of target data between the TCP gateway and the third-party device through the TCP connection path includes: The TCP gateway simultaneously transmits target data with multiple logical slave devices corresponding to the third-party device through multiple TCP connection paths.
5. The method according to claim 1 or 3, characterized in that: In the case where the TCP connection path includes multiple paths, the multiple TCP connection paths correspond one-to-one to the multiple logical slave devices; The method further comprises: After the target TCP connection path between the TCP gateway and the third-party device is disconnected, determining a first connection establishment request based on network parameters of the TCP gateway and network parameters of the target logical slave device; Sending a first connection establishment request to the third-party device to re-establish a target TCP connection path between the TCP gateway and the third-party device; The target logical slave device is any one of the multiple logical slave devices corresponding to the third-party device, and the target TCP connection path is a TCP connection path corresponding to the target logical slave device among the multiple TCP connection paths.
6. The method according to claim 2, characterized in that The network parameters of the plurality of logical slave devices corresponding to the third-party device include network parameters shared by the plurality of logical slave devices; The establishing of a TCP connection path between the TCP gateway and the third-party device based on the network parameters of the TCP gateway and the network parameters of the plurality of logical slave devices corresponding to the third-party device comprises: Based on the network parameters of the TCP gateway and the network parameters shared by the plurality of the logical slave devices, sending a single connection establishment request to the third-party device; Based on the single connection establishment request, a single TCP connection path is established between the TCP gateway and the third-party device.
7. The method according to claim 1 or 6, characterized in that: In the case where the TCP connection path includes a single one, the TCP connection path corresponds to each of the plurality of logical slave devices; The data transmission with the plurality of logical slave devices through the TCP connection path comprises: The TCP gateway transmits target data with multiple logical slave devices corresponding to the third-party device in a preset order through a single TCP connection path.
8. The method according to claim 1 or 6, characterized in that: In the case where the TCP connection path includes a single one, the TCP connection path corresponds to each of the plurality of logical slave devices; The method further comprises: After the TCP connection path between the TCP gateway and the third-party device is disconnected, determining a second connection establishment request based on network parameters of the TCP gateway and network parameters shared by a plurality of logical slave devices; A second connection establishment request is sent to the third-party device to re-establish the TCP connection path between the TCP gateway and the third-party device.
9. A Transmission Control Protocol TCP gateway, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the method according to any one of claims 1 to 8 is implemented.
10. A distributed control system, characterized in that: include: A controller, an input / output module connected to the controller, and a transmission control protocol TCP gateway connected to the controller; the TCP gateway is used to implement the method as claimed in any one of claims 1 to 8.
Citation Information
Cited By
Industrial gateway intelligent communication control system and equipment for edge computing
CN121547510A
