A factory equipment data acquisition method and system based on OPC UA
The OPC UA system uniformly manages the communication protocols of factory equipment, establishes device collections and unique codes, solves the difficulty of IoT integration caused by the diversity of hardware devices, achieves efficient data transmission and protocol management, and improves IoT integration efficiency and Security.
Patent Information
- Application Number
- CN202211670303.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-23
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2042-12-23
AI Technical Summary
The diversity of communication protocols of hardware devices in factories makes it difficult to integrate the Internet of Things. It is difficult to effectively manage and unify communication protocols with existing technology, which reduces integration efficiency and degree of integration.
The OPC UA system is used to collect factory equipment data. By extracting and monitoring the communication protocol of the equipment, a unique code and equipment collection are established, and data conversion and segmentation processing is performed to ensure that the data complies with Internet transmission standards and reduces transmission bandwidth limitations.
It improves the efficiency and degree of integration of the Internet of Things, reduces the difficulty of communication protocol management, enhances data transmission security, effectively manages and categorizes protocol types of factory equipment, and improves data transmission efficiency.
Smart Images

Figure CN116847217B
Abstract
Description
Technical Field
[0001] The invention proposes a factory equipment data acquisition method and system based on OPC UA, belonging to the technical field of data acquisition. Background Art
[0002] As factories continue to develop automated workshops, there are a variety of hardware devices in the factory, and each hardware device has a variety of communication protocols. The communication protocols of hardware devices are different. If the hardware devices need to be integrated in the factory, it is difficult to connect them to the Internet of Things platform. Summary of the invention
[0003] The present invention provides a factory equipment data collection method and system based on OPC UA to solve the problem of difficulty in integrating the Internet of Things due to inconsistent communication protocols:
[0004] A method for collecting factory equipment data based on OPC UA, the method comprising:
[0005] When the factory equipment is connected to the OPC UA system for data transmission, a communication protocol for the factory equipment to be connected to the OPC UA system is extracted;
[0006] According to different types of communication protocols, a factory equipment set is established for factory equipment corresponding to the same type of communication protocol;
[0007] The OPC UA system is used to convert the data of each factory equipment in the factory equipment set into transmission data that is allowed to access the Internet, and the transmission data is connected to the Internet.
[0008] Furthermore, when the factory equipment accesses the OPC UA system for data transmission, the communication protocol for the factory equipment to access the OPC UA system is extracted, including:
[0009] The OPC UA system monitors data access requests issued by the factory equipment in real time;
[0010] After the OPC UA system detects the data access request sent by the factory equipment, it sends a protocol type information sending instruction to the factory equipment, and monitors and receives feedback information from the factory equipment in real time;
[0011] After receiving the protocol type information fed back by the factory equipment, the OPC UA system performs protocol type unique coding on the factory equipment corresponding to the same protocol type information, and performs protocol type unique coding identification on the factory equipment.
[0012] Furthermore, according to different types of communication protocols, a factory equipment set is established for factory equipment corresponding to the same type of communication protocol, including:
[0013] The OPC UA system extracts the factory equipment corresponding to the unique code of the protocol type;
[0014] The OPC UA system uniquely codes and identifies each factory equipment under the same unique code of the protocol type according to the time sequence in which the unique code of the protocol type is identified on the factory equipment;
[0015] The OPC UA system establishes an association calling relationship between each factory device and a unique device code corresponding to the factory device;
[0016] The OPC UA system uses the unique code of the protocol type as a unit and the unique code of the device as a set element to establish a set of factory devices corresponding to each different type of communication protocol.
[0017] Further, using the OPC UA system to convert data of each factory device in the factory device set into transmission data that complies with the permission to access the Internet, and connecting the transmission data to the Internet, including:
[0018] Connecting the real-time data generated by the factory equipment to the OPC UA system based on the factory equipment set;
[0019] The OPC UA system performs data conversion based on the TCP binary protocol on the real-time data to obtain transmission data in a data format that complies with the data format specified by the Internet firewall authority;
[0020] The transmission data is transmitted to the corresponding Internet through the Internet firewall. Since the data length of the real-time data will increase after the data conversion based on the TCP binary protocol is performed on the real-time data, there is a risk of data loss due to the limitation of the transmission bandwidth in the later transmission process. Therefore, when the data after the data conversion based on the TCP binary protocol is long, the data will be divided into multiple sub-data based on the TCP binary protocol and transmitted to the corresponding Internet through the Internet firewall. The specific steps include:
[0021] Step A1: Use formula (1) to convert the real-time data into data based on the TCP binary protocol to determine whether the data needs to be segmented.
[0022]
[0023] Wherein F represents the control value of whether the data needs to be segmented; D2 represents the binary form of the real-time data before the binary protocol conversion based on TCP; TCP(D2) represents the binary form of the real-time data after the data conversion based on the binary protocol of TCP; len[] represents the number of data bits in the brackets, that is, the number of bits of the data; T represents the unit time; G represents the transmission bandwidth between the Internet;
[0024] If F=1, it means that the data needs to be segmented;
[0025] If F=0, it means that the data does not need to be segmented;
[0026] Step A2: If the data needs to be segmented, the number of copies of the data that needs to be segmented is obtained using formula (2) according to the data length of the real-time data before the TCP-based binary protocol conversion.
[0027]
[0028] Where M represents the number of copies of the data to be divided; N2(TCP) represents the number of binary data bits (also the number of data bits) that will be added to the data after the TCP-based binary protocol conversion; % represents remainder; a represents an integer variable; A min {a|len(D2)%[T×G-N2(TCP)]-a=0} means that the value of is increased from 0 in sequence, and after each value is taken, it is determined whether the formula len(D2)%[T×G-N2(TCP)]-a=0 is established. If it is established, the calculation is stopped and the value of a at this time is recorded as the overall calculation result;
[0029] Step A3: Using formula (3) to control the segmentation of the real-time data before the binary protocol conversion based on TCP according to the number of copies of the data to be segmented
[0030]
[0031] Wherein d2(i) represents the binary form of the i-th sub-data that has not been converted into a binary protocol based on TCP; Indicates that the first Rank to The bit data is extracted to obtain new binary form data;
[0032] Each d2(i) is subjected to data conversion based on the TCP binary protocol, and then transmitted to the corresponding Internet in sequence through the Internet firewall.
[0033] A factory equipment data acquisition system based on OPC UA, the factory equipment data acquisition system comprising:
[0034] An extraction module, used for extracting the communication protocol of the factory equipment accessing the OPC UA system when the factory equipment accesses the OPC UA system for data transmission;
[0035] A set establishment module, used for establishing a factory equipment set for factory equipment corresponding to the same type of communication protocol according to different types of communication protocols;
[0036] The data forming module is used to use the OPC UA system to perform data conversion on each factory equipment in the factory equipment set to form transmission data that is allowed to access the Internet, and connect the transmission data to the Internet.
[0037] Furthermore, the extraction module comprises:
[0038] A request monitoring module, used for the OPC UA system to monitor in real time the data access requests issued by the factory equipment;
[0039] An information receiving monitoring module, which is used for sending a protocol type information sending instruction to the factory equipment after the OPC UA system detects a data access request sent by the factory equipment, and monitors and receives feedback information from the factory equipment in real time;
[0040] The coding and identification module is used for the OPC UA system to uniquely encode the factory equipment corresponding to the same protocol type information after receiving the protocol type information fed back by the factory equipment, and to uniquely code the factory equipment with the protocol type.
[0041] Furthermore, the set building module includes:
[0042] A device extraction module, used for the OPC UA system to extract factory devices corresponding to the unique code of the protocol type;
[0043] The device coding and identification module is used for the OPC UA system to uniquely code and identify each factory device under the same unique code of the protocol type according to the time sequence of the unique code of the protocol type being identified on the factory device;
[0044] An association calling module, used for the OPC UA system to establish an association calling relationship between each factory device and a unique device code corresponding to the factory device;
[0045] The device set establishment module is used for the OPC UA system to establish a factory device set corresponding to each different type of communication protocol using the protocol type unique code as a unit and the device unique code as a set element.
[0046] Furthermore, the data forming module includes:
[0047] An access system module, used for accessing the real-time data generated by the factory equipment into the OPC UA system based on the factory equipment set;
[0048] A data conversion module, used to perform data conversion based on the TCP binary protocol on the real-time data through the OPC UA system, and obtain transmission data in a data form that complies with the data format specified by the Internet firewall authority;
[0049] The data transmission module is used to transmit the transmission data to the corresponding Internet through the Internet firewall. Since the data length of the real-time data will increase after the data conversion based on the TCP binary protocol is performed on the real-time data, there may be a risk of data loss due to the limitation of the transmission bandwidth in the later transmission process. Therefore, when the data after the data conversion based on the TCP binary protocol is long, the data will be divided into multiple sub-data based on the TCP binary protocol and transmitted to the corresponding Internet through the Internet firewall. The specific steps include:
[0050] Step A1: Use formula (1) to convert the real-time data into data based on the TCP binary protocol to determine whether the data needs to be segmented.
[0051]
[0052] Wherein F represents the control value of whether the data needs to be segmented; D2 represents the binary form of the real-time data before the binary protocol conversion based on TCP; TCP(D2) represents the binary form of the real-time data after the data conversion based on the binary protocol of TCP; len[] represents the number of data bits in the brackets, that is, the number of bits of the data; T represents the unit time; G represents the transmission bandwidth between the Internet;
[0053] If F=1, it means that the data needs to be segmented;
[0054] If F=0, it means that the data does not need to be segmented;
[0055] Step A2: If the data needs to be segmented, the number of copies of the data that needs to be segmented is obtained using formula (2) according to the data length of the real-time data before the TCP-based binary protocol conversion.
[0056]
[0057]
[0058] Where M represents the number of copies of the data to be divided; N2(TCP) represents the number of binary data bits (also the number of data bits) that will be added to the data after the TCP-based binary protocol conversion; % represents remainder; a represents an integer variable; A min {a|len(D2)%[T×G-N2(TCP)]-a=0} means that the value of is increased from 0 in sequence, and after each value is taken, it is determined whether the formula len(D2)%[T×G-N2(TCP)]-a=0 is established. If it is established, the calculation is stopped and the value of a at this time is recorded as the overall calculation result;
[0059] Step A3: Using formula (3) to control the segmentation of the real-time data before the binary protocol conversion based on TCP according to the number of copies of the data to be segmented
[0060]
[0061] Wherein d2(i) represents the binary form of the i-th sub-data that has not been converted into a binary protocol based on TCP; Indicates that the first Rank to The bit data is extracted to obtain new binary form data;
[0062] Each d2(i) is subjected to data conversion based on the TCP binary protocol, and then transmitted to the corresponding Internet in sequence through the Internet firewall.
[0063] Beneficial effects of the present invention:
[0064] This paper proposes a factory equipment data collection method and system based on OPC UA. With OPC UA as the core technology, it takes advantage of its strong data transmission security and integrated address space to design and implement a data collection and monitoring system for factory hardware equipment. It effectively improves the integration efficiency and integration level of the Internet of Things, and at the same time, it can effectively reduce the difficulty of communication protocol management. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 is a flow chart of the method of the present invention;
[0066] Figure 2 The system block diagram of the system of the present invention. DETAILED DESCRIPTION
[0067] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0068] The embodiment of the present invention proposes a factory equipment data collection method based on OPC UA, such as Figure 1 As shown, the factory equipment data collection method includes:
[0069] S1. When the factory equipment is connected to the OPC UA system for data transmission, extract the communication protocol for the factory equipment to access the OPC UA system;
[0070] S2. Establishing a factory equipment set for factory equipment corresponding to the same type of communication protocol according to different types of communication protocols;
[0071] S3. Using the OPC UA system, convert the data of each factory equipment in the factory equipment set into transmission data that is allowed to access the Internet, and connect the transmission data to the Internet.
[0072] The working principle of the above technical solution is: first, when the factory equipment accesses the OPC UA system for data transmission, the communication protocol for the factory equipment to access the OPC UA system is extracted; then, according to the different types of communication protocols, a factory equipment set is established for the factory equipment corresponding to the same type of communication protocol; finally, the OPC UA system is used to convert the data of each factory equipment in the factory equipment set into transmission data that meets the requirements for access to the Internet, and the transmission data is connected to the Internet.
[0073] The effect of the above technical solution is as follows: This embodiment proposes a factory equipment data collection method based on OPC UA, which takes the unified architecture (OPC UA) as the core technology, and uses its advantages such as strong data transmission security and integrated address space to design and implement a data collection and monitoring system for factory hardware equipment. It effectively improves the integration efficiency and integration level of the Internet of Things, and at the same time, can effectively reduce the difficulty of communication protocol management.
[0074] In one embodiment of the present invention, when the factory equipment accesses the OPC UA system for data transmission, the communication protocol for the factory equipment to access the OPC UA system is extracted, including:
[0075] S101, the OPC UA system monitors the data access request issued by the factory equipment in real time;
[0076] S102, after the OPC UA system detects the data access request sent by the factory equipment, it sends a protocol type information sending instruction to the factory equipment, and monitors and receives feedback information from the factory equipment in real time;
[0077] S103. After receiving the protocol type information fed back by the factory equipment, the OPC UA system performs protocol type unique coding on the factory equipment corresponding to the same protocol type information, and performs protocol type unique coding identification on the factory equipment.
[0078] The working principle of the above technical solution is: first, the OPC UA system monitors the data access request issued by the factory equipment in real time; then, after the OPC UA system monitors the data access request issued by the factory equipment, it sends a protocol type information sending instruction to the factory equipment, and monitors and receives the feedback information of the factory equipment in real time; finally, after receiving the protocol type information fed back by the factory equipment, the OPC UA system uniquely encodes the factory equipment corresponding to the same protocol type information, and uniquely codes the factory equipment with the protocol type.
[0079] The effects of the above technical solution are: effectively improving the management efficiency and classification accuracy of factory equipment and its protocol types, and effectively improving the communication efficiency in the subsequent data transmission process.
[0080] In one embodiment of the present invention, a factory equipment set is established for factory equipment corresponding to the same type of communication protocol according to different types of communication protocols, including:
[0081] S201, the OPC UA system extracts the factory equipment corresponding to the unique code of the protocol type;
[0082] S202, the OPC UA system uniquely codes and identifies each factory equipment under the same unique code of the protocol type according to the time sequence of the unique code of the protocol type being identified on the factory equipment;
[0083] S203, the OPC UA system establishes an association calling relationship between each factory device and a unique device code corresponding to the factory device;
[0084] S204: The OPC UA system uses the protocol type unique code as a unit and the device unique code as a set element to establish a factory device set corresponding to each different type of communication protocol.
[0085] The working principle of the above technical solution is: first, the OPC UA system extracts the factory equipment corresponding to the protocol type unique code; then, the OPC UA system uniquely codes and identifies each factory equipment under the same protocol type unique code in the chronological order of the protocol type unique code identification on the factory equipment; thereafter, the OPC UA system establishes an associated calling relationship between each factory equipment and the device unique code corresponding to the factory equipment; finally, the OPC UA system establishes a factory equipment set corresponding to each different type of communication protocol with the protocol type unique code as a unit and the device unique code as a set element.
[0086] The effects of the above technical solution are: effectively improving the management efficiency and classification accuracy of factory equipment and its protocol types, and effectively improving the communication efficiency in the subsequent data transmission process.
[0087] In one embodiment of the present invention, the OPC UA system is used to convert data of each factory device in the factory device set into transmission data that is allowed to access the Internet, and the transmission data is connected to the Internet, including:
[0088] S301, connecting the real-time data generated by the factory equipment to the OPC UA system based on the factory equipment set;
[0089] S302, performing data conversion based on the TCP binary protocol on the real-time data through the OPC UA system to obtain transmission data in a data format that complies with the data format specified by the Internet firewall authority;
[0090] S303, transmitting the transmission data to the corresponding Internet through the Internet firewall. Since the data length of the real-time data will increase after the data conversion based on the TCP binary protocol is performed on the real-time data, there may be a risk of data loss due to the limitation of the transmission bandwidth in the later transmission process. Therefore, when the data after the data conversion based on the TCP binary protocol is long, the data will be divided into multiple sub-data based on the TCP binary protocol and transmitted to the corresponding Internet through the Internet firewall. The specific steps include:
[0091] Step A1: Use formula (1) to convert the real-time data into data based on the TCP binary protocol to determine whether the data needs to be segmented.
[0092]
[0093] Wherein F represents the control value of whether the data needs to be segmented; D2 represents the binary form of the real-time data before the binary protocol conversion based on TCP; TCP(D2) represents the binary form of the real-time data after the data conversion based on the binary protocol of TCP; len[] represents the number of data bits in the brackets, that is, the number of bits of the data; T represents the unit time; G represents the transmission bandwidth between the Internet;
[0094] If F=1, it means that the data needs to be segmented;
[0095] If F=0, it means that the data does not need to be segmented;
[0096] Step A2: If the data needs to be segmented, the number of copies of the data that needs to be segmented is obtained using formula (2) according to the data length of the real-time data before the TCP-based binary protocol conversion.
[0097]
[0098] Where M represents the number of copies of the data to be divided; N2(TCP) represents the number of binary data bits (also the number of data bits) that will be added to the data after the TCP-based binary protocol conversion; % represents remainder; a represents an integer variable; A min {a|len(D2)%[T×G-N2(TCP)]-a=0} means that the value of is increased from 0 in sequence, and after each value is taken, it is determined whether the formula len(D2)%[T×G-N2(TCP)]-a=0 is established. If it is established, the calculation is stopped and the value of a at this time is recorded as the overall calculation result;
[0099] Step A3: Using formula (3) to control the segmentation of the real-time data before the binary protocol conversion based on TCP according to the number of copies of the data to be segmented
[0100]
[0101] Wherein d2(i) represents the binary form of the i-th sub-data that has not been converted into a binary protocol based on TCP; Indicates that the first Rank to The bit data is extracted to obtain new binary form data;
[0102] Each d2(i) is subjected to data conversion based on the TCP binary protocol, and then transmitted to the corresponding Internet in sequence through the Internet firewall.
[0103] The working principle of the above technical solution is: first, the real-time data generated by the factory equipment is connected to the OPC UA system based on the factory equipment set; then, the real-time data is converted into data based on the TCP binary protocol through the OPC UA system to obtain transmission data in a data format that complies with the data format specified by the Internet firewall authority; finally, the transmission data is transmitted to the corresponding Internet through the Internet firewall.
[0104] The effect of the above technical solution is: effectively improve the management efficiency of factory equipment and its protocol types and the accuracy of classification management. At the same time, effectively improve the communication efficiency in the subsequent data transmission process. Effectively improve the management efficiency of factory equipment and its protocol types and the accuracy of classification management. At the same time, effectively improve the communication efficiency in the subsequent data transmission process. At the same time, the formula (1) of step A1 is used to determine whether the data needs to be segmented after the data conversion based on the TCP binary protocol of the real-time data, so as to know whether the current data is subject to bandwidth restrictions, which is convenient for subsequent control analysis; then the formula (2) of step A2 is used to obtain the number of copies of the data that need to be segmented according to the data length of the real-time data before the TCP-based binary protocol conversion, so as to divide the data into multiple sub-data, so as to facilitate the subsequent transmission without being affected by bandwidth restrictions; finally, the formula (3) of step A3 is used to control the segmentation of the real-time data before the TCP-based binary protocol conversion according to the number of copies of the data that need to be segmented, thereby reducing the risk of data loss due to factors limited by the transmission bandwidth.
[0105] The embodiment of the present invention proposes a factory equipment data acquisition system based on OPC UA, such as Figure 2 As shown, the factory equipment data acquisition system includes:
[0106] An extraction module, used for extracting the communication protocol of the factory equipment accessing the OPC UA system when the factory equipment accesses the OPC UA system for data transmission;
[0107] A set establishment module, used for establishing a factory equipment set for factory equipment corresponding to the same type of communication protocol according to different types of communication protocols;
[0108] The data forming module is used to use the OPC UA system to perform data conversion on each factory equipment in the factory equipment set to form transmission data that is allowed to access the Internet, and connect the transmission data to the Internet.
[0109] The working principle of the above technical solution is: first, when the factory equipment is connected to the OPC UA system for data transmission, the communication protocol of the factory equipment to access the OPC UA system is extracted by the extraction module; then, the set establishment module is used to establish a factory equipment set for factory equipment corresponding to the same type of communication protocol according to different types of communication protocols; finally, the data formation module is used to use the OPC UA system to convert the data of each factory equipment in the factory equipment set into transmission data that is allowed to access the Internet, and the transmission data is connected to the Internet.
[0110] The effect of the above technical solution is as follows: This embodiment proposes a factory equipment data acquisition system based on OPC UA, which takes the unified architecture (OPC UA) as the core technology, and uses its advantages such as strong data transmission security and integrated address space to design and implement a data acquisition and monitoring system for factory hardware equipment. It effectively improves the integration efficiency and integration level of the Internet of Things, and at the same time, can effectively reduce the difficulty of communication protocol management.
[0111] In one embodiment of the present invention, the extraction module comprises:
[0112] A request monitoring module, used for the OPC UA system to monitor in real time the data access requests issued by the factory equipment;
[0113] An information receiving monitoring module, which is used for sending a protocol type information sending instruction to the factory equipment after the OPC UA system detects a data access request sent by the factory equipment, and monitors and receives feedback information from the factory equipment in real time;
[0114] The coding and identification module is used for the OPC UA system to uniquely encode the factory equipment corresponding to the same protocol type information after receiving the protocol type information fed back by the factory equipment, and to uniquely code the factory equipment with the protocol type.
[0115] The working principle of the above technical solution is: first, the request monitoring module is used to control the OPC UA system to monitor the data access requests issued by the factory equipment in real time; then, the information receiving monitoring module is used to control the OPC UA system to monitor the data access requests issued by the factory equipment, send a protocol type information sending instruction to the factory equipment, and monitor and receive the feedback information of the factory equipment in real time; finally, the coding identification module is used to control the OPC UA system to uniquely encode the factory equipment corresponding to the same protocol type information after receiving the protocol type information fed back by the factory equipment, and uniquely encode the protocol type of the factory equipment, and identify the factory equipment with the protocol type.
[0116] The effects of the above technical solution are: effectively improving the management efficiency and classification accuracy of factory equipment and its protocol types, and effectively improving the communication efficiency in the subsequent data transmission process.
[0117] In one embodiment of the present invention, the set establishment module includes:
[0118] A device extraction module, used for the OPC UA system to extract factory devices corresponding to the unique code of the protocol type;
[0119] The device coding and identification module is used for the OPC UA system to uniquely code and identify each factory device under the same unique code of the protocol type according to the time sequence of the unique code of the protocol type being identified on the factory device;
[0120] An association calling module, used for the OPC UA system to establish an association calling relationship between each factory device and a unique device code corresponding to the factory device;
[0121] The device set establishment module is used for the OPC UA system to establish a factory device set corresponding to each different type of communication protocol using the protocol type unique code as a unit and the device unique code as a set element.
[0122] The working principle of the above technical solution is: first, the OPC UA system is controlled by the device extraction module to extract the factory equipment corresponding to the protocol type unique code; then, the device code identification module is used to control the OPC UA system to perform device unique coding and identification on each factory equipment under the same protocol type unique code in the chronological order of the protocol type unique code identification on the factory equipment; thereafter, the association call module is used to control the OPC UA system to establish an association call relationship between each factory equipment and the device unique code corresponding to the factory equipment; finally, the device set establishment module is used to control the OPC UA system to establish a factory equipment set corresponding to each different type of communication protocol with the protocol type unique code as the unit and the device unique code as the set element.
[0123] The effects of the above technical solution are: effectively improving the management efficiency and classification accuracy of factory equipment and its protocol types, and effectively improving the communication efficiency in the subsequent data transmission process.
[0124] In one embodiment of the present invention, the data forming module includes:
[0125] An access system module, used for accessing the real-time data generated by the factory equipment into the OPC UA system based on the factory equipment set;
[0126] A data conversion module, used to perform data conversion based on the TCP binary protocol on the real-time data through the OPC UA system, and obtain transmission data in a data form that complies with the data format specified by the Internet firewall authority;
[0127] The data transmission module is used to transmit the transmission data to the corresponding Internet through the Internet firewall. Since the data length of the real-time data will increase after the data conversion based on the TCP binary protocol is performed on the real-time data, there may be a risk of data loss due to the limitation of the transmission bandwidth in the later transmission process. Therefore, when the data after the data conversion based on the TCP binary protocol is long, the data will be divided into multiple sub-data based on the TCP binary protocol and transmitted to the corresponding Internet through the Internet firewall. The specific steps include:
[0128] Step A1: Use formula (1) to convert the real-time data into data based on the TCP binary protocol to determine whether the data needs to be segmented.
[0129]
[0130] Wherein F represents the control value of whether the data needs to be segmented; D2 represents the binary form of the real-time data before the binary protocol conversion based on TCP; TCP(D2) represents the binary form of the real-time data after the data conversion based on the binary protocol of TCP; len[] represents the number of data bits in the brackets, that is, the number of bits of the data; T represents the unit time; G represents the transmission bandwidth between the Internet;
[0131] If F=1, it means that the data needs to be segmented;
[0132] If F=0, it means that the data does not need to be segmented;
[0133] Step A2: If the data needs to be segmented, the number of copies of the data that needs to be segmented is obtained using formula (2) according to the data length of the real-time data before the TCP-based binary protocol conversion.
[0134]
[0135] Where M represents the number of copies of the data to be divided; N2(TCP) represents the number of binary data bits (also the number of data bits) that will be added to the data after the TCP-based binary protocol conversion; % represents remainder; a represents an integer variable; A min{a|len(D2)%[T×G-N2(TCP)]-a=0} means that the value of is increased from 0 in sequence, and after each value is taken, it is determined whether the formula len(D2)%[T×G-N2(TCP)]-a=0 is established. If it is established, the calculation is stopped and the value of a at this time is recorded as the overall calculation result;
[0136] Step A3: Using formula (3) to control the segmentation of the real-time data before the binary protocol conversion based on TCP according to the number of copies of the data to be segmented
[0137]
[0138] Wherein d2(i) represents the binary form of the i-th sub-data that has not been converted into a binary protocol based on TCP; Indicates that the first Rank to The bit data is extracted to obtain new binary form data;
[0139] Each d2(i) is subjected to data conversion based on the TCP binary protocol, and then transmitted to the corresponding Internet in sequence through the Internet firewall.
[0140] The working principle of the above technical solution is: first, the real-time data generated by the factory equipment is connected to the OPC UA system in units of the factory equipment set through the access system module; then, the real-time data is converted into data based on the TCP binary protocol through the OPC UA system using the data conversion module to obtain transmission data in a data form that complies with the data format specified by the Internet firewall authority; finally, the transmission data is transmitted to the corresponding Internet through the Internet firewall using the data transmission module.
[0141] The effect of the above technical solution is: effectively improving the management efficiency of factory equipment and its protocol types and the accuracy of classification management. At the same time, effectively improving the communication efficiency in the subsequent data transmission process. At the same time, the formula (1) of step A1 is used to determine whether the data needs to be segmented after the data conversion based on the TCP binary protocol of the real-time data, so as to know whether the current data is subject to bandwidth restrictions, which is convenient for subsequent control analysis; then the formula (2) of step A2 is used to obtain the number of copies of the data that need to be segmented according to the data length of the real-time data before the TCP binary protocol conversion, so as to divide the data into multiple sub-data, so as to facilitate the subsequent transmission without being affected by bandwidth restrictions; finally, the formula (3) of step A3 is used to control the segmentation of the real-time data before the TCP binary protocol conversion according to the number of copies of the data that need to be segmented, thereby reducing the risk of data loss due to factors limited by the transmission bandwidth.
[0142] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A factory equipment data collection method based on OPC UA, characterized in that: The factory equipment data collection method comprises: When the factory equipment is connected to the OPC UA system for data transmission, a communication protocol for the factory equipment to be connected to the OPC UA system is extracted; According to different types of communication protocols, a factory equipment set is established for factory equipment corresponding to the same type of communication protocol; Using the OPC UA system to convert data of each factory device in the factory device set into transmission data that is allowed to access the Internet, and connecting the transmission data to the Internet; The OPC UA system is used to convert data of each factory device in the factory device set into transmission data that is allowed to access the Internet, and the transmission data is connected to the Internet, including: Connecting the real-time data generated by the factory equipment to the OPC UA system based on the factory equipment set; The OPC UA system performs data conversion based on the TCP binary protocol on the real-time data to obtain transmission data in a data format that complies with the data format specified by the Internet firewall authority; The transmission data is transmitted to the corresponding Internet through the Internet firewall. Since the data length of the real-time data will increase after the data conversion based on the TCP binary protocol, there is a risk of data loss due to the limitation of the transmission bandwidth in the later transmission process. Therefore, when the data after the data conversion based on the TCP binary protocol is long, the data will be divided into multiple sub-data based on the TCP binary protocol and transmitted to the corresponding Internet through the Internet firewall. The specific steps include: Step A1: Use formula (1) to convert the real-time data into data based on the TCP binary protocol to determine whether the data needs to be segmented. Wherein F represents the control value of whether the data needs to be segmented; D2 represents the binary form of the real-time data before the binary protocol conversion based on TCP; TCP(D2) represents the binary form of the real-time data after the data conversion based on the binary protocol of TCP; len[] represents the number of data bits in the brackets, that is, the number of bits of the data; T represents the unit time; G represents the transmission bandwidth between the Internet; If F=1, it means that the data needs to be segmented; If F=0, it means that the data does not need to be segmented; Step A2: If the data needs to be segmented, the number of copies of the data that needs to be segmented is obtained using formula (2) according to the data length of the real-time data before the TCP-based binary protocol conversion. Where M represents the number of copies of the data to be divided; N2(TCP) represents the number of bits of binary data that will be added to the data after the TCP-based binary protocol conversion, which is also the number of data bits; % represents remainder; a represents an integer variable; A min {a|len(D2)%[T×G-N2(TCP)]-a=0} means that the value of is increased from 0 in sequence, and after each value is taken, it is determined whether the formula len(D2)%[T×G-N2(TCP)]-a=0 is established. If it is established, the calculation is stopped and the value of a at this time is recorded as the overall calculation result; Step A3: Using formula (3) to control the segmentation of the real-time data before the binary protocol conversion based on TCP according to the number of copies of the data to be segmented Wherein d2(i) represents the binary form of the i-th sub-data that has not been converted into a binary protocol based on TCP; Indicates that the first Rank to The bit data is extracted to obtain new binary form data; Each d2(i) is subjected to data conversion based on the TCP binary protocol, and then transmitted to the corresponding Internet in sequence through the Internet firewall.
2. The factory equipment data collection method according to claim 1, characterized in that: When the factory equipment is connected to the OPC UA system for data transmission, the communication protocol for the factory equipment to access the OPC UA system is extracted, including: The OPC UA system monitors data access requests issued by the factory equipment in real time; After the OPC UA system detects the data access request sent by the factory equipment, it sends a protocol type information sending instruction to the factory equipment, and monitors and receives feedback information from the factory equipment in real time; After receiving the protocol type information fed back by the factory equipment, the OPC UA system performs protocol type unique coding on the factory equipment corresponding to the same protocol type information, and performs protocol type unique coding identification on the factory equipment.
3. The factory equipment data collection method according to claim 1, characterized in that: According to different types of communication protocols, a factory equipment set is established for factory equipment corresponding to the same type of communication protocol, including: The OPC UA system extracts the factory equipment corresponding to the unique code of the protocol type; The OPC UA system uniquely codes and identifies each factory equipment under the same unique code of the protocol type according to the time sequence in which the unique code of the protocol type is identified on the factory equipment; The OPC UA system establishes an association calling relationship between each factory device and a unique device code corresponding to the factory device; The OPC UA system uses the unique code of the protocol type as a unit and the unique code of the device as a set element to establish a set of factory devices corresponding to each different type of communication protocol.
4. A factory equipment data acquisition system based on OPC UA, characterized in that: The factory equipment data acquisition system comprises: An extraction module, used for extracting the communication protocol of the factory equipment accessing the OPC UA system when the factory equipment accesses the OPC UA system for data transmission; A set establishment module, used for establishing a factory equipment set for factory equipment corresponding to the same type of communication protocol according to different types of communication protocols; A data forming module, used for using the OPC UA system to perform data conversion on each factory device in the factory device set to form transmission data that is allowed to access the Internet, and connect the transmission data to the Internet; Wherein, the data forming module comprises: An access system module, used for accessing the real-time data generated by the factory equipment into the OPC UA system based on the factory equipment set; A data conversion module, used to perform data conversion based on the TCP binary protocol on the real-time data through the OPC UA system, and obtain transmission data in a data form that complies with the data format specified by the Internet firewall authority; The data transmission module is used to transmit the transmission data to the corresponding Internet through the Internet firewall. Since the data length of the real-time data will increase after the data conversion based on the TCP binary protocol, there will be a risk of data loss due to the limitation of the transmission bandwidth in the later transmission process. Therefore, when the data after the data conversion based on the TCP binary protocol of the real-time data is long, the data will be divided into multiple sub-data based on the TCP binary protocol and transmitted to the corresponding Internet through the Internet firewall. The specific steps include: Step A1: Use formula (1) to convert the real-time data into data based on the TCP binary protocol to determine whether the data needs to be segmented. Wherein F represents the control value of whether the data needs to be segmented; D2 represents the binary form of the real-time data before the binary protocol conversion based on TCP; TCP(D2) represents the binary form of the real-time data after the data conversion based on the binary protocol of TCP; len[] represents the number of data bits in the brackets, that is, the number of bits of the data; T represents the unit time; G represents the transmission bandwidth between the Internet; If F=1, it means that the data needs to be segmented; If F=0, it means that the data does not need to be segmented; Step A2: If the data needs to be segmented, the number of copies of the data that needs to be segmented is obtained using formula (2) according to the data length of the real-time data before the TCP-based binary protocol conversion. Where M represents the number of copies of the data to be divided; N2(TCP) represents the number of bits of binary data that will be added to the data after the TCP-based binary protocol conversion, which is also the number of data bits; % represents remainder; a represents an integer variable; A min {a|len(D2)%[T×G-N2(TCP)]-a=0} means that the value of is increased from 0 in sequence, and after each value is taken, it is determined whether the formula len(D2)%[T×G-N2(TCP)]-a=0 is established. If it is established, the calculation is stopped and the value of a at this time is recorded as the overall calculation result; Step A3: Using formula (3) to control the segmentation of the real-time data before the binary protocol conversion based on TCP according to the number of copies of the data to be segmented Wherein d2(i) represents the binary form of the i-th sub-data that has not been converted into a binary protocol based on TCP; Indicates that the first Rank to The bit data is extracted to obtain new binary form data; Each d2(i) is subjected to data conversion based on the TCP binary protocol, and then transmitted to the corresponding Internet in sequence through the Internet firewall.
5. The factory equipment data acquisition system according to claim 4, characterized in that: The extraction module comprises: A request monitoring module, used for the OPC UA system to monitor in real time the data access requests issued by the factory equipment; An information receiving monitoring module, which is used for sending a protocol type information sending instruction to the factory equipment after the OPC UA system detects a data access request sent by the factory equipment, and monitors and receives feedback information from the factory equipment in real time; The coding and identification module is used for the OPC UA system to uniquely encode the factory equipment corresponding to the same protocol type information after receiving the protocol type information fed back by the factory equipment, and to uniquely code the factory equipment with the protocol type.
6. The factory equipment data acquisition system according to claim 4, characterized in that: The set building module comprises: A device extraction module, used for the OPC UA system to extract factory devices corresponding to the unique code of the protocol type; The device coding and identification module is used for the OPC UA system to uniquely code and identify each factory device under the same unique code of the protocol type according to the time sequence of the unique code of the protocol type being identified on the factory device; An association calling module, used for the OPC UA system to establish an association calling relationship between each factory device and a unique device code corresponding to the factory device; The device set establishment module is used for the OPC UA system to establish a factory device set corresponding to each different type of communication protocol using the protocol type unique code as a unit and the device unique code as a set element.
Citation Information
Patent Citations
Acquisition method and acquisition system for massive industrial data
CN111596628A
Deterministic communication system based on TSN network and OPC UA architecture
CN111970212A
Protocol conversion configuration system and method based on OPC UA
CN112583824A
Multi-protocol self-adaptive module design method based on OPC UA PubSub
CN112637198A
OPCUA protocol conversion method based on online configuration
CN114201088A
