Communication method and device, data transmission method and device, gateway device, device

By automatic recognition of the interface and device type of PLC device, the preset driver and type library are used to realize the automatic access and communication connection of the PLC device, which solves the problem of inconsistent PLC device access in the existing technologies, and improves. The universality and communication accuracy of the gateway equipment.

CN114900563BActive Publication Date: 2025-01-28SHENZHEN YUHANG INTELLIGENT INFORMATION TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210526233.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-16
Publication Date
2025-01-28
Estimated Expiration
2042-05-16

AI Technical Summary

Technical Problem

The prior art cannot integrate the access standards of all PLC equipment, resulting in poor connection between PLC equipment and industrial networks.

Method used

By obtaining the interface type and device type of the PLC device, the preset driver library and type library are used to automatically identify and initialize the hardware interface driver and embedded program drive to achieve automatic recognition and access of the PLC device.

Benefits of technology

The automatic recognition and access to different PLC devices is achieved, and the driver selection error caused by artificial settings is avoided, and the universality of the gateway equipment and the accuracy of the communication connection are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114900563B_ABST
    Figure CN114900563B_ABST
Patent Text Reader

Abstract

The present invention discloses a communication method and device, a data transmission method and device, a gateway device, and a device. Among them, the communication method is applied to a gateway device, and the gateway device is used to communicate with a PLC device. The method includes: obtaining the interface type of the PLC device, and obtaining a drive parameter value according to the interface type; obtaining a first target driver according to the interface type, the drive parameter value, and a preset drive library, and performing an interface driver initialization operation according to the first target driver; performing a communication channel connection operation on the PLC device; obtaining the device type of the PLC device, and obtaining a second target driver according to the device type and a preset type library, and performing a device driver initialization operation according to the second target driver to achieve a communication connection with the PLC device. The embodiment of the present invention can realize automatic identification and access to different PLC devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a communication method and device, a data transmission method and device, a gateway device, and a device. Background Art

[0002] At present, in order to improve the production efficiency of manufacturing equipment, it is necessary to carry out digital transformation of the manufacturing industry. That is, the equipment on the production line should be connected to the industrial network, and the equipment on the production line should be coordinated and deployed through the industrial network.

[0003] In the related art, data monitoring and control operations are performed on production equipment through programmable logic controllers (PLC). In order to enable PLC devices to access industrial networks, different types of gateways have been developed for different PLC device manufacturers and access protocols. However, the above method cannot integrate the access standards of all PLC devices, thus affecting the connection between PLC devices and industrial networks. Summary of the invention

[0004] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention proposes a communication method and device, a data transmission method and device, a gateway device, and a device, which can realize automatic identification and access to different PLC devices.

[0005] The communication method according to the first aspect of the present invention is applied to a gateway device, the gateway device being used for communication connection with a PLC device, and the method comprises:

[0006] Obtaining the interface type of the PLC device, and obtaining a driving parameter value according to the interface type;

[0007] Obtaining a first target driver according to the interface type, the driver parameter value, and a preset driver library, and performing an interface driver initialization operation according to the first target driver;

[0008] Performing a communication channel connection operation on the PLC device;

[0009] The device type of the PLC device is obtained, a second target driver is obtained according to the device type and a preset type library, and a device driver initialization operation is performed according to the second target driver to achieve communication connection with the PLC device.

[0010] The communication method provided in the embodiment of the present application obtains a first target driver capable of initializing the hardware interface driver through the PLC device hardware interface type and the preset driver library; on the basis of the PLC device communication channel being connected, the second target driver capable of establishing an embedded program driver with the PLC device is obtained through the PLC device type and the type library, thereby realizing formal communication with the PLC device. It can be seen that the communication method provided in the embodiment of the present application realizes automatic identification of the PLC device and establishment of communication, avoids the method of using different gateway devices for different PLC devices in the related art, and the phenomenon of incorrect driver selection caused by artificial settings, and improves the universality of the gateway device and the accuracy of the communication connection.

[0011] According to some embodiments of the present invention, the interface type includes a network port, a serial port, and a USB;

[0012] The obtaining of the driving parameter value according to the interface type includes:

[0013] If the interface type is the serial port, the preset parameter value is used as the driving parameter value;

[0014] If the interface type is the network port or the USB, the communication port value of the PLC device is obtained, and the communication port value is used as the driving parameter value.

[0015] According to some embodiments of the present invention, the performing a communication channel connection operation on the PLC device includes:

[0016] Obtaining the response address of the PLC device;

[0017] The target address is set according to the response address; wherein the target address and the response address are in the same network segment, and the target address is used to establish a communication channel connection with the PLC device.

[0018] The data transmission method according to the second aspect of the present invention is applied to a gateway device, wherein the gateway device is used to establish a communication connection with the PLC device according to the communication method according to the first aspect, and the method includes:

[0019] Obtaining variable information of the variable storage area of ​​the PLC device, and setting a variable value associated with the variable information according to the variable information; wherein the variable information includes a variable address, a variable identifier, and a variable comment;

[0020] Performing classification operations on the variable values ​​to obtain classification groups;

[0021] The variable values ​​in the classification group are subjected to data encapsulation operations and sent to a business system.

[0022] According to some embodiments of the present invention, the method further comprises:

[0023] Performing data encapsulation operation on the variable value whose change frequency reaches a preset threshold value to form a data packet;

[0024] The data packet is sent to the service system.

[0025] The communication device according to the third aspect of the present invention is applied to a gateway device, the gateway device is used to communicate with the PLC device, and the communication device includes:

[0026] A hardware driver configuration module is used to obtain the interface type of the PLC device and obtain a driver parameter value according to the interface type; obtain a first target driver according to the interface type, the driver parameter value, and a preset driver library, and perform an interface driver initialization operation according to the first target driver;

[0027] A communication channel configuration module, used to perform a communication channel connection operation on the PLC device;

[0028] The PLC driver configuration module is used to obtain the device type of the PLC device, obtain a second target driver according to the device type and a preset type library, and perform a device driver initialization operation according to the second target driver to achieve a communication connection with the PLC device.

[0029] According to a data transmission device of an embodiment of a fourth aspect of the present invention, the data transmission device is applied to a gateway device, the gateway device is used to establish a communication connection with the PLC device according to the communication device of the third aspect, and the data transmission device includes:

[0030] A variable mapping module, used to obtain the variable information of the variable storage area of ​​the PLC device, and set the variable value associated with the variable information according to the variable information; wherein the variable information includes a variable address, a variable identifier, and a variable comment;

[0031] The data encapsulation module is used to perform classification operations on the variable values ​​to obtain classification groups; perform data encapsulation operations on the variable values ​​in the classification groups, and send the data to the business system.

[0032] A gateway device according to an embodiment of a fifth aspect of the present invention includes:

[0033] The communication device according to the third aspect;

[0034] A data transmission device as described in the fourth aspect.

[0035] An electronic device according to a sixth aspect of the present invention includes:

[0036] at least one memory;

[0037] at least one processor;

[0038] at least one computer program;

[0039] The computer program is stored in the memory, and the processor executes the at least one computer program to implement:

[0040] A method as described in any one of the first aspects; or

[0041] A method as described in the second aspect.

[0042] According to a computer-readable storage medium of a seventh aspect of the present invention, the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute:

[0043] A method as described in any one of the first aspects; or

[0044] A method as described in the second aspect.

[0045] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] The present invention will be further described below with reference to the accompanying drawings and embodiments, wherein:

[0047] Figure 1 A schematic diagram of a flow chart of a communication method according to an embodiment of the present invention;

[0048] Figure 2 Another schematic diagram of a communication method according to an embodiment of the present invention;

[0049] Figure 3 Another schematic diagram of a communication method according to an embodiment of the present invention;

[0050] Figure 4 A schematic diagram of a flow chart of a data transmission method according to an embodiment of the present invention;

[0051] Figure 5 Another schematic diagram of a data transmission method according to an embodiment of the present invention;

[0052] Figure 6 is a module block diagram of a communication device according to an embodiment of the present invention;

[0053] Figure 7 A block diagram of a data transmission device according to an embodiment of the present invention;

[0054] Figure 8A module block diagram of a gateway device according to an embodiment of the present invention;

[0055] Fig. 9 The figure is a schematic diagram of the hardware structure of the electronic device according to the embodiment of the present invention. DETAILED DESCRIPTION

[0056] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0057] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0059] First, some nouns involved in this application are analyzed:

[0060] Gateway: Also known as network connector or protocol converter. Gateway realizes network interconnection above the network layer. It is a complex network interconnection device and is only used for interconnection between two networks with different high-level protocols. Gateway can be used for wide area network interconnection as well as local area network interconnection. Gateway is a computer system or device that performs the important task of conversion. It is used between two systems with different communication protocols, data formats or languages, and completely different architectures to act as a "translator". Unlike a bridge that simply transmits information, a gateway repackages the received information to meet the needs of the destination system.

[0061] Programmable Logic Controller (PLC): A programmable logic controller is a digital operation electronic system designed specifically for use in an industrial environment. It uses an editable memory to execute instructions for operations such as logic operations, sequential control, timing, calculations, and arithmetic operations, and controls various types of mechanical equipment or production processes through digital or analog input and output. It should be noted that in the embodiments of the present application, PLC equipment is used as the abbreviation for programmable logic controller.

[0062] Communication port value: In network technology, ports include physical ports and logical ports, where physical ports refer to interfaces such as RJ-45 ports, SC ports, etc., used to connect other network devices such as ADSL Modem, hub, switch, router, etc.; logical ports refer to ports in the TCP / IP protocol, and the port number ranges from 0 to 65535. In the embodiment of the present application, the communication port refers to the logical port described above, and correspondingly, the communication port value refers to the port number of the corresponding port, that is, the communication port value ranges from 0 to 65535.

[0063] OPC (Open Platform Communications): refers to a group of software technologies that provide a single, unified interface for controlling various devices and exchanging data. The goal of creating the OPC specification is to provide users with a common interface to control various devices. OPC technology is used to exchange data between controllers and SCADA systems, but it can also organize complex systems at different levels of process control systems. OPC consists of two parts: OPC client and OPC server. The OPC server software polls various devices through the fieldbus control device driver; OPC client software is usually built into the SCADA system and is designed to receive data from the OPC server. OPC includes current standards such as OPC DA (data access), OPC HDA (historical data access), OPC AE (alarms and events), OPC Batch, OPC DX, and OPC UA (unified architecture).

[0064] Among them, the OPC DA server provides data exchange services. The data in OPC is a tag variable with certain attributes. The variable can be various integer and real number types, Boolean values, strings, dates, arrays, etc. The attributes include the current value of the variable, variable type, access rights, OPC server polling frequency, variable description, etc.

[0065] OPC UA is the current standard for data transmission in industrial networks. It provides secure and reliable communication between devices and is hardware and platform independent, allowing devices with different operating systems to communicate.

[0066] Supervisory Control Data Acquisition (SCADA): SCADA system is a computer-based DCS and power automation monitoring system. It can be applied to data acquisition and monitoring control in the fields of power, metallurgy, petroleum, chemical industry, gas, railway, etc., as well as process control.

[0067] Serialization: refers to the process of converting the state information of an object into a form that can be stored or transmitted. During serialization, the object writes its current state to a temporary or persistent storage, and then the state of the object can be read or deserialized from the storage and the object can be recreated. The serialization operation includes the following three purposes: first, to make custom objects persistent in a certain storage form; second, to transfer objects from one place to another; third, to make the program more maintainable.

[0068] In the related art, many gateway device manufacturers at home and abroad have developed various types of gateway devices for communication access between gateway devices and PLC devices, targeting the manufacturer types and communication access protocols of PLC devices, so as to meet the access requirements of existing diversified PLC devices. However, in the above method, it is impossible to integrate the access of all PLC devices, that is, the gateway device manufactured by the above method is not universal and can only perform communication access operations with specific PLC devices.

[0069] Based on this, the embodiments of the present application provide a communication method and device, a data transmission method and device, a gateway device, and a device, which can realize communication access with different PLC devices, thereby improving the universality of the gateway device. In addition, the gateway device can classify and archive the variable data of the PLC device, establish a mapping mechanism, split and reorganize, and convert it into the reporting data required by the business system, thereby realizing data transmission based on communication access with the PLC device, and achieving the rapid conversion effect of the PLC device communication protocol.

[0070] Reference Figure 1 The embodiment of the present application provides a communication method, which is applied to a gateway device, and the gateway device is used to communicate with a PLC device. The communication method includes but is not limited to steps S110 to S140.

[0071] S110, obtaining the interface type of the PLC device, and obtaining the driving parameter value according to the interface type;

[0072] Specifically, the gateway device automatically identifies the type of hardware interface to which the PLC device is connected, and obtains the drive parameter value corresponding to the type of the hardware interface according to the type of the hardware interface and the preset rules. For example, the types of hardware interfaces include network port, serial port, and USB. The gateway device sets different status signals for the three hardware interfaces, such as setting the status signal I=100 of the network port, the status signal I=010 of the serial port, and the status signal I=001 of the USB. When the PLC device is connected to the gateway device, the gateway device automatically identifies the type of hardware interface to which the PLC device is connected according to the status signal I. Among them, the drive parameter value refers to the hardware drive parameter value initialized when the PLC device is connected to the gateway device. It can be understood that the preset rule can be a corresponding mapping rule, that is, a mapping relationship between a type of hardware interface and a drive parameter value is preset, and the corresponding drive parameter value can be found according to the identified hardware interface type and the mapping relationship, or other preset rules can be set, and this embodiment of the present application is not specifically limited.

[0073] It is understandable that when the gateway device recognizes two different status signals I, such as when the gateway device recognizes both status signal I=100 and status signal I=010, it will query the driver parameter values ​​of both the network port and the serial port, that is, initialize the interface driver for both interfaces. In subsequent operations, the usability of the two interfaces is distinguished by repeatedly judging the validity.

[0074] It is understandable that in order to distinguish different serial port types, different status signals I may be set for different serial port types. For example, for an RS232 serial port, the status signal I=011 may be set.

[0075] S120, obtaining a first target driver according to the interface type, the driver parameter value, and a preset driver library, and performing an interface driver initialization operation according to the first target driver;

[0076] Specifically, the gateway device has a built-in interface standard driver library, and searches the interface standard driver library according to the interface type and driver parameter value obtained by the above method to obtain the corresponding first target driver. The driver parameter value is loaded into the first target driver to implement the driver initialization operation of the hardware interface.

[0077] S130, performing a communication channel connection operation on the PLC device;

[0078] It is understandable that the driver initialization operation performed in step S120 is the initialization of the hardware driver, that is, the embedded program channel between the gateway device and the PLC device is not really connected. Therefore, after starting the hardware interface driver, it is necessary to establish an asynchronous communication mechanism with the PLC device and implement the communication channel connection operation through operations such as broadcast address setting.

[0079] S140, obtaining a device type of the PLC device, obtaining a second target driver according to the device type and a preset type library, and performing a device driver initialization operation according to the second target driver to achieve communication connection with the PLC device.

[0080] It is understandable that step S130 realizes TCP / IP communication based on the underlying broadcast address, but it is still necessary to realize the program software driver on the basis of opening the communication channel. Specifically, on the basis of the communication channel connection, the type identification is performed through the PLC device embedded program to determine the device type of the PLC device. According to the device type, the preset type library is searched to obtain the corresponding second target driver, and the formal communication with the PLC device can be realized according to the second target driver.

[0081] For example, if the device type of the PLC device is identified as Siemens S7-1200, the PLC device driver (i.e., the second driver) corresponding to the Siemens S7-1200 model is searched in the preset type library. The PLC device is loaded according to the second driver, thereby realizing communication with the underlying embedded program of the PLC device, that is, realizing formal communication with the PLC device.

[0082] The communication method provided in the embodiment of the present application obtains a first target driver capable of initializing the hardware interface driver through the PLC device hardware interface type and the preset driver library; on the basis of the PLC device communication channel being connected, the second target driver capable of establishing an embedded program driver with the PLC device is obtained through the PLC device type and the type library, thereby realizing formal communication with the PLC device. It can be seen that the communication method provided in the embodiment of the present application realizes automatic identification of the PLC device and establishment of communication, avoids the method of using different gateway devices for different PLC devices in the related art, and the phenomenon of incorrect driver selection caused by artificial settings, and improves the universality of the gateway device and the accuracy of the communication connection.

[0083] Reference Figure 2 In some embodiments, the step S110 of "obtaining a driving parameter value according to the interface type" includes but is not limited to sub-steps S210 to S220.

[0084] S210, if the interface type is a serial port, taking the preset parameter value as the driving parameter value;

[0085] S220: If the interface type is a network port or a USB, obtain the communication port value of the PLC device, and use the communication port value as a drive parameter value.

[0086] Specifically, different preset rules are set according to the type of hardware interface connected to the PLC device to obtain the corresponding drive parameter value. For example, for the serial port, fixed parameter values ​​are preset, such as setting the baud rate to 8400bps, the data bit to 8 bits, and the parity check to 0 for the hardware interface of the serial port model. For the network port and USB, the gateway device automatically searches for the connected PLC device, and the first value in the communication port value list after the search is used as the drive parameter value by default.

[0087] It is understandable that, for the network port and USB, after determining the driver parameter value according to the above method, it is necessary to further identify whether the driver parameter value (i.e., the communication port value) is used or occupied. If the driver parameter value is used or occupied, the second value in the list is used as the driver parameter value, and the above identification process is repeated until it is confirmed that the current driver parameter value is not used and occupied. If the last value in the list is traversed and the driver parameter value is still identified as being used or occupied, the first value in the list is used as the driver parameter value again, and the interface docking is attempted.

[0088] Reference Figure 3 In some embodiments, step S130 includes but is not limited to sub-steps S310 to S320.

[0089] S310, obtaining the response address of the PLC device;

[0090] S320. Set a target address according to the response address; wherein the target address and the response address are in the same network segment, and the target address is used to establish a communication channel connection with the PLC device.

[0091] Specifically, in order to achieve a true connection between the embedded program channel of the gateway device and the PLC device, the gateway device needs to set the broadcast address for its own address when starting the hardware interface driver. Taking the hardware interface type as an Ethernet port as an example, according to the OPC DA mechanism that matches the Ethernet port driver startup, the IP address of the local OPC driver of the gateway device needs to be set, for example, it can be set to 127.0.0.1, to initialize communication with the PLC device. On the basis of initializing communication, check the message and analyze the response address of the PLC device. The gateway device sets the target address that belongs to the same network segment as the response address based on the response address, and re-establishes an asynchronous communication mechanism with the PLC device.

[0092] For example, the response address of the PLC device is 192.168.3.110. According to the response address, the address network segment of the PLC device is 192.168.3, which is the Class C IP address 3 network segment, where 110 is the IP address of the PLC device. According to the IP address type and network segment, the gateway device can set an IP address that is also the Class C 3 network segment, such as 192.168.3.111, to establish a communication channel connection with the PLC device.

[0093] Reference Figure 4 In some embodiments, the present application also provides a data transmission method, which is applied to a gateway device, wherein the gateway device has established a communication connection with a PLC device through a communication method as described in any of the above embodiments. The data transmission method includes but is not limited to steps S410 to S430.

[0094] S410, obtaining variable information of a variable storage area of ​​a PLC device, and setting a variable value associated with the variable information according to the variable information; wherein the variable information includes a variable address, a variable identifier, and a variable comment;

[0095] It can be understood that when the gateway device establishes a communication connection with the PLC device through the method described in any of the above embodiments, the corresponding data transmission operation can be performed, that is, the PLC device can transmit the data of the monitored industrial equipment to the gateway device through the established communication channel, and the gateway device sends the data to the business system, so that the business system can obtain the corresponding data of the industrial equipment in real time, and control or adjust the operation of the industrial equipment according to the data.

[0096] Specifically, the gateway device obtains the variable storage area of ​​the embedded program of the PLC device according to the type of the PLC device, performs a global variable search on the variable storage area to obtain the variable information in the variable storage area, and creates a variable value corresponding to the variable information in the target storage area to achieve a mapping association between the variable value and the variable information in the target storage area.

[0097] For example, a point table library is preset in the gateway device, and the point table library includes variable addresses, variable identifiers, and variable annotations obtained by performing global variable retrieval on the PLC device. For example, the variable addresses include 0X002 and 0D0001, wherein the variable identifier corresponding to the variable address 0X002 is temperature, and the variable annotation corresponding to the variable address 0X002 is the pressure surface temperature of the press machine; the variable identifier corresponding to the variable address 0D0001 is speed, and the scalar annotation corresponding to the variable address 0D0001 is the real-time speed of the press transmission. Variable values ​​Temper002 and Speed001 are established in the target memory area, and a mapping association is established between the variable value Temper002 and the variable address 0X002, and a mapping association is established between the variable value Speed001 and the variable address 0D0001, so that when the variable address 0X002 collects a specific value such as "80", the variable value Temper002 can correspond to the value "80".

[0098] It is understandable that the variable identification can be obtained by extracting keywords from the corresponding variable annotations and searching the extracted keywords in a preset identification library.

[0099] S420, performing classification operation on the variable value to obtain a classification group;

[0100] S430: perform data encapsulation operation on the variable values ​​in the classification group and send the data to the business system.

[0101] It is understandable that the variable values ​​are classified according to the variable information associated with the variable values, for example, the variable information can be classified into equipment status information, equipment process parameter information, equipment quality information, equipment alarm parameter information, equipment process parameter information, equipment result parameter information, etc. According to the business function of the business system, multiple variable values ​​belonging to the same category are archived and combined to form a classification group, and the classification group is uploaded to the business system through a unified interface, thereby realizing the data transmission function, that is, realizing the rapid conversion of the PLC device communication protocol.

[0102] Reference Figure 5 In some embodiments, the data transmission method further includes but is not limited to steps S510 to S520.

[0103] S510, performing a data encapsulation operation on the variable value whose change frequency reaches a preset threshold to form a data packet;

[0104] S520: Send the data packet to the service system.

[0105] Specifically, a data change frequency threshold (i.e., a preset threshold) is preset, and variable values ​​that meet the preset conditions are split from the classification group, and reorganized and data encapsulated with other variable values ​​that meet the preset conditions to form a data packet. That is, multiple change values ​​that meet the preset conditions are archived and serialized to form a standard protocol for docking with the business system, and the business system is subscribed and pushed through the standard protocol. Among them, the preset condition is that the change frequency of the variable value reaches the preset threshold.

[0106] For example, for the classification group of device status information, when the PLC device monitors the industrial equipment from device start to device stop, the corresponding first sub-variable value changes; for the classification group of device alarm parameter information, when the PLC device monitors the industrial equipment and an alarm event occurs, the corresponding second sub-variable value changes. When both the first sub-variable value and the second sub-variable value meet the preset conditions, the gateway device splits the first sub-variable value and the second sub-variable value from the corresponding classification group, and reorganizes the first sub-variable value and the second sub-variable value to form a data packet, thereby realizing a rapid data conversion mechanism. According to the OPC UA subscription mechanism, the data packet is pushed to the business system in real time. It can be understood that the preset threshold can be set to 0 or other values, and the embodiment of the present application is not specifically limited to this. When the preset threshold is set to 0, it indicates that as long as there is a change in the variable value, the above-mentioned splitting and reorganization operation is performed to realize a rapid data conversion mechanism.

[0107] Reference Figure 6 The embodiment of the present application further provides a communication device, which is applied to a gateway device, and the gateway device is used to communicate with a PLC device. The communication device includes:

[0108] The hardware driver configuration module 601 is used to obtain the interface type of the PLC device and obtain the driver parameter value according to the interface type; obtain the first target driver according to the interface type, the driver parameter value, and the preset driver library, and perform the interface driver initialization operation according to the first target driver;

[0109] The communication channel configuration module 602 is used to perform a communication channel connection operation on the PLC device;

[0110] The PLC driver configuration module 603 is used to obtain the device type of the PLC device, obtain the second target driver according to the device type and a preset type library, and perform a device driver initialization operation according to the second target driver to achieve communication connection with the PLC device.

[0111] It can be seen that the contents of the above communication method embodiments are all applicable to the embodiments of the present communication device, the functions specifically implemented by the present communication device embodiments are the same as those of the above communication method embodiments, and the beneficial effects achieved are also the same as those achieved by the above communication method embodiments.

[0112] Reference Figure 7 The embodiment of the present application further provides a data transmission device, which is applied to a gateway device. The gateway device is used to establish a communication connection with a PLC device according to the communication device described in the above embodiment. The data transmission device includes:

[0113] The variable mapping module 701 is used to obtain the variable information of the variable storage area of ​​the PLC device, and set the variable value associated with the variable information according to the variable information; wherein the variable information includes the variable address, variable identification, and variable annotation;

[0114] The data encapsulation module 702 is used to perform classification operations on the variable values ​​to obtain classification groups; perform data encapsulation operations on the variable values ​​in the classification groups, and send them to the business system.

[0115] It can be seen that the contents of the above-mentioned data transmission method embodiment are all applicable to the embodiment of the present data transmission device, the functions specifically implemented by the present data transmission device embodiment are the same as those of the above-mentioned data transmission method embodiment, and the beneficial effects achieved are also the same as those achieved by the above-mentioned data transmission method example.

[0116] Reference Figure 8 , an embodiment of the present application also provides a gateway device, which includes the communication device described in the above embodiment and the data transmission device described in the above embodiment.

[0117] The present application also provides an electronic device, including:

[0118] at least one memory;

[0119] at least one processor;

[0120] at least one program;

[0121] The programs are stored in the memory, and the processor executes at least one program to implement the communication method or data transmission method described above in the present disclosure.

[0122] Combine the following Fig. 9 The electronic device according to the embodiment of the present application is introduced in detail.

[0123] Reference Fig. 9 , Fig. 9 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:

[0124] The processor 901 may be implemented by a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present disclosure;

[0125] The memory 902 may be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 902, and the processor 901 calls and executes the communication method or data transmission method of the embodiments of this disclosure.

[0126] Input / output interface 903, used to implement information input and output;

[0127] Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);

[0128] A bus 905 that transmits information between the various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904);

[0129] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .

[0130] The embodiment of the present disclosure further provides a storage medium, which is a computer-readable storage medium. The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the above communication method or data transmission method.

[0131] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0132] The embodiments described in the embodiments of the present disclosure are intended to more clearly illustrate the technical solutions of the embodiments of the present disclosure and do not constitute a limitation on the technical solutions provided by the embodiments of the present disclosure. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of the present disclosure are also applicable to similar technical problems.

[0133] Those skilled in the art will appreciate that the technical solutions shown in the figures do not limit the embodiments of the present disclosure and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.

[0134] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0135] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0136] The terms "first", "second", "third", "fourth", etc. (if any) in the specification 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 of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0137] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0138] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of 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 through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0139] 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.

[0140] 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.

[0141] 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 multiple instructions to enable an electronic device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store programs.

[0142] The preferred embodiments of the present disclosure are described above with reference to the accompanying drawings, but the scope of the rights of the present disclosure is not limited thereto. Any modification, equivalent substitution and improvement made by those skilled in the art without departing from the scope and essence of the present disclosure should be within the scope of the rights of the present disclosure.

Claims

1. A communication method, applied to a gateway device, wherein the gateway device is used to communicate with a PLC device, characterized in that: The method comprises: Obtain the hardware interface type of the PLC device, and obtain the driving parameter value according to the hardware interface type; wherein the hardware interface type includes an Ethernet port, a serial port, and a USB; According to the hardware interface type and the driver parameter value, a driver library built into the gateway device is searched to obtain a first target driver, and a hardware interface driver initialization operation is performed according to the first target driver; Performing a communication channel connection operation on the PLC device; Acquire the device type of the PLC device, obtain a second target driver according to the device type and a preset type library, and perform a device driver initialization operation according to the second target driver to achieve communication connection with the PLC device; The obtaining of the driving parameter value according to the hardware interface type includes: If the hardware interface type is the serial port, the preset parameter value is used as the driving parameter value; If the hardware interface type is the network port or the USB, the communication port value of the PLC device is obtained, and the communication port value is used as the drive parameter value; wherein the first value in the communication port value list is used as the drive parameter value; If the hardware interface type is the network port or the USB, after determining the drive parameter value, identify whether the drive parameter value is used or occupied. If the drive parameter value is used or occupied, use the second value in the list as the drive parameter value, and repeat the identification process until it is confirmed that the drive parameter value is not used and occupied. If the last value in the list is traversed and the drive parameter value is still identified as being used or occupied, use the first value in the list as the drive parameter value again.

2. The communication method according to claim 1, characterized in that: The performing of a communication channel connection operation on the PLC device includes: Obtaining the response address of the PLC device; The target address is set according to the response address; wherein the target address and the response address are in the same network segment, and the target address is used to establish a communication channel connection with the PLC device.

3. A communication device, applied to a gateway device, wherein the gateway device is used to communicate with a PLC device, characterized in that: The communication device comprises: A hardware driver configuration module is used to obtain the hardware interface type of the PLC device, and obtain a driver parameter value according to the hardware interface type; according to the hardware interface type and the driver parameter value, a preset driver library is searched to obtain a first target driver, and a hardware interface driver initialization operation is performed according to the first target driver; wherein the hardware interface type includes a network port, a serial port, and a USB; A communication channel configuration module, used to perform a communication channel connection operation on the PLC device; A PLC driver configuration module, used to obtain a device type of the PLC device, obtain a second target driver according to the device type and a preset type library, and perform a device driver initialization operation according to the second target driver to achieve communication connection with the PLC device; The obtaining of the driving parameter value according to the hardware interface type includes: If the hardware interface type is the serial port, the preset parameter value is used as the driving parameter value; If the hardware interface type is the network port or the USB, the communication port value of the PLC device is obtained, and the communication port value is used as the drive parameter value; wherein the first value in the communication port value list is used as the drive parameter value; If the hardware interface type is the network port or the USB, after determining the drive parameter value, identify whether the drive parameter value is used or occupied. If the drive parameter value is used or occupied, use the second value in the list as the drive parameter value, and repeat the identification process until it is confirmed that the drive parameter value is not used and occupied. If the last value in the list is traversed and the drive parameter value is still identified as being used or occupied, use the first value in the list as the drive parameter value again.

4. A gateway device, characterized in that: include: The communication device as claimed in claim 3.

5. An electronic device, characterized in that include: at least one memory; at least one processor; at least one computer program; The computer program is stored in the memory, and the processor executes the at least one computer program to implement: The method according to any one of claims 1 to 2.

6. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to cause a computer to execute: The method according to any one of claims 1 to 2.

Citation Information

Patent Citations

  • Equipment management method and device

    CN107613020A

  • Internet of Things universal gateway based on OPC UA

    CN110708240A

  • Cloud digital platform and use method thereof

    CN113347172A