Data processing method and device, electronic equipment and storage medium
By converting the OPCUA protocol to the OPCDA protocol, the problem that the old version of software only supports the OPC protocol is solved, and the interoperability between the OPCUA protocol and the OPCDA protocol is achieved, meeting the needs of specific software applications.
Patent Information
- Application Number
- CN202510238907.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-03
- Publication Date
- 2025-05-13
AI Technical Summary
In the prior art, the old version of the software of the OPC Foundation only supports the OPC protocol and does not support the OPCUA protocol, resulting in the old version of the software not working properly in scenarios where the OPCUA protocol is required.
By converting the OPCUA protocol to the OPCDA protocol, leveraging the capabilities of the OPCUA protocol and converting it into the OPCDA protocol supported by older versions of software, meeting the needs of specific software applications.
The data protocol unification between devices that support the OPCUA protocol and devices that support the OPCDA protocol is realized, ensuring the information interaction of device data collection and interconnection with the information system.
Smart Images

Figure CN119996527A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to a data processing method, device, electronic equipment and storage medium, and belongs to the field of industrial data collection. Background Art
[0002] At present, multiple industrial protocol standards coexist, which are not unified and incompatible with each other, resulting in difficulties in protocol parsing, data format conversion and data interconnection.
[0003] Protocol conversion technology converts different industrial communication protocols into a unified protocol through technical means such as protocol analysis, data conversion, and address space remapping, so as to achieve information interaction of device data collection and interconnection with information systems. Commonly used industrial protocols reduce the difficulty of device networking through protocol conversion and achieve unified access.
[0004] Under the strong promotion of the OPC Foundation, the OPC protocol was proposed to standardize the software interface between devices and applications from different suppliers and simplify the data exchange. However, the OPC technology based on COM / DCOM has an ineradicable disadvantage and can only run on the Windows platform. Therefore, with the advancement of technology and the increase in various requirements for data exchange, the OPC Foundation released a new specification in 2008: OPC UA. The old version of the host computer software that only supports the OPC protocol has not kept up with the times and does not support the OPC UA protocol. In this case, there is a lot of room for application in converting OPC UA to OPCDA (data access based on the OPC standard). Summary of the invention
[0005] In view of this, the present application provides a data processing method, device, electronic device and storage medium. The embodiment of the present application converts the OPC UA protocol into the OPC DA protocol to meet the needs of specific software applications.
[0006] The first aspect of an embodiment of the present application discloses a data processing method, which includes: in response to a successful OPCUA service connection, obtaining a preset configuration model based on the NodeID of the address space; publishing the OPCDA service based on the configuration model to create a label; reading a first value of the NodeID of the configuration model; and updating a second value of the label based on the first value.
[0007] Furthermore, in response to the OPC UA service connection being successful, before obtaining a preset configuration model based on the NodeID of the address space, the method further includes: connecting to the OPC UA service based on OPC UA connection authentication parameters.
[0008] Furthermore, the OPC UA connection authentication parameters include: connection URL; security mode; security policy; account number and password.
[0009] Further, connecting to the OPC UA service based on the OPC UA connection authentication parameters includes: connecting to the OPC UA service based on the OPC UA connection authentication parameters and a disconnection reconnection model.
[0010] Furthermore, the disconnection reconnection model is configured to be short at the beginning and long at the end.
[0011] Further, the publishing of OPCDA service based on the configuration model to create a label includes: publishing OPCDA service based on the configuration model and generating OPCDA node information; and creating a label based on the OPCDA node information.
[0012] Furthermore, the OPCDA service is an SDK registered OPCDA service provided by the OPC Foundation.
[0013] The second aspect of an embodiment of the present application discloses a data processing device, which includes: a generation module, configured to respond to a successful OPCUA service connection and obtain a preset configuration model based on the NodeID of the address space; a creation module, configured to publish the OPCDA service based on the configuration model to create a label; a reading module, configured to read a first value of the NodeID of the configuration model; and an update module, configured to update the second value of the label based on the first value.
[0014] A third aspect of an embodiment of the present application discloses a computer-readable storage medium, which includes a stored program, wherein when the program is executed, the data processing method of the above embodiment is executed in a processor of a device where the program is located.
[0015] The fourth aspect of the embodiments of the present application discloses an electronic device, which includes: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors execute the data processing method of the above embodiment.
[0016] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0017] The embodiments of the present application provide a data processing method, device, electronic device and storage medium. The data processing method includes: in response to a successful OPCUA service connection, obtaining a preset configuration model based on the NodeID of the address space; publishing an OPCDA service based on the configuration model to create a tag; reading a first value of the NodeID of the configuration model; and updating a second value of the tag based on the first value. This embodiment establishes an update relationship between the first value and the second value through the configuration model, thereby converting the OPCUA protocol into the OPCDA protocol to meet the needs of specific software applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying any creative work.
[0019] Figure 1 A flowchart of a data processing method provided in an embodiment of the present application.
[0020] Figure 2 A flowchart of a model generation method provided in an embodiment of the present application.
[0021] Figure 3 A flowchart of a protocol conversion method provided in an embodiment of the present application.
[0022] Figure 4 A schematic diagram of the structure of a data processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention 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 interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0025] The inventors found that some device versions are old and only support the OPCDA protocol, but not the OPCUA protocol. When devices supporting the OPCUA protocol and devices supporting the OPCDA protocol are in the same node cluster, it is necessary to unify their data protocols to achieve information interaction of device data collection and interconnection with the information system. To this end, a solution for converting the OPCUA protocol to the OPCDA protocol is proposed to meet the needs of specific software applications. The specific implementation plan is as follows:
[0026] Embodiment 1:
[0027] Figure 1 A flowchart of a data processing method provided in an embodiment of the present application is shown as follows: Figure 1 As shown, the method may include the following steps:
[0028] 101 responds to the OPC UA service connection successfully, and obtains the preset configuration model based on the NodeID of the address space.
[0029] Among them, OPCUA's NodeID contains the following parts:
[0030] 1) Namespace Index: Identifies the namespace to which the node belongs.
[0031] 2) Node Identifier: A string or numeric value that uniquely identifies a node.
[0032] 3) Node identifier type: Identifies the type of the node identifier, such as string, integer, GUID, etc.
[0033] It should be noted that NodeId is one of the key elements in building the OPCUA configuration model. In the configuration model, by reasonably defining and editing NodeId, the various nodes in the model and their relationships can be determined. For example, when creating an object-type node set with variables and methods, NodeId is used to clarify the position of each node in the entire configuration model, including object nodes, variable nodes, method nodes, etc. Take the creation of a configuration model for an industrial monitoring system that contains multiple sensor data collection points as an example. The node corresponding to each sensor has a unique NodeId. The definition of these NodeIds (such as encoding according to the physical location of the sensor, functional type, etc.) determines the structure and data flow of the entire monitoring system configuration model.
[0034] As an optional implementation, connect to the OPC UA service, and after successful connection, filter the NodeID of the address space, generate a configuration model, and save it in a specified format.
[0035] For example, developers can implement flexible editing of NodeId by using model design tools or writing scripts to automatically generate codes.
[0036] In some embodiments, the responding to the successful connection of the OPC UA service, before obtaining a preset configuration model based on the NodeID of the address space, further includes: connecting to the OPC UA service based on the OPC UA connection authentication parameters.
[0037] Specifically, Figure 2 As shown, in order to generate a configuration model, the OPC UA service is connected according to the OPC UA connection authentication parameters, including the connection URL, security mode, security policy, account number and password.
[0038] Among them, the security policy is configured to scan automatically.
[0039] In some embodiments, connecting to the OPC UA service based on the OPC UA connection authentication parameters includes: connecting to the OPC UA service based on the OPC UA connection authentication parameters and a disconnection reconnection model.
[0040] It should be noted that different reconnection models are used for different OPC UA services, which are not limited here.
[0041] In some embodiments, the disconnection reconnection model is configured to be short at the beginning and long at the end.
[0042] Specifically, the target device is accessed in a short connection mode within the first preset time, and the target device is accessed in a long connection mode within the second preset time. The target device can be a server or another client device. The disconnection reconnection model is set to short first and long later, which can avoid resource waste and improve software performance.
[0043] In one embodiment, the configuration model includes multiple different OPC UA services to achieve simultaneous conversion of multiple services.
[0044] 102 Publish the OPCDA service based on the configuration model to create a tag.
[0045] It should be noted that the basic condition for creating an OPCDA tag is to obtain the address of the target node. This is because the tag is associated with a specific node. The configuration model can provide unique information about the node address. Therefore, in some embodiments, Figure 3 As shown, the publishing of OPCDA service based on the configuration model to create a tag includes: publishing OPCDA service based on the configuration model and generating OPCDA node information; creating a tag based on the OPCDA node information. Generally speaking, an OPCDA tag includes information such as data value, data quality, and timestamp.
[0046] Exemplarily, the step of creating a tag may include:
[0047] Step 1. Connect to the OPCDA server: Use the client software to connect to the OPCDA server;
[0048] Step 2. Navigate to the desired tag: Once connected, start browsing tags on the server through API functions or tools;
[0049] Step 3. Create a new tag: After selecting or navigating to the target tag, perform the creation operation. This usually involves setting the tag's name, data type, and other related properties.
[0050] 103 reads the first value of the NodeID of the configuration model.
[0051] 104 updates the second value of the tag based on the first value.
[0052] In this embodiment, the value of the NodeID of the OPC UA configuration model is read, and the value of the corresponding OPC DA tag is continuously updated, thereby realizing the conversion of the protocol. The value may represent exchange data, and this embodiment does not limit the specific data type.
[0053] In some embodiments, the OPCDA service is an SDK-registered OPCDA service provided by the OPC Foundation.
[0054] It is worth noting that according to the configuration model, based on the SDK provided by the OPC Foundation, OPCDA services can be published without relying on other applications, and the application software reads the published tag information based on the service name.
[0055] In an actual application, the server responds to the successful connection of the OPCUA service, obtains a preset configuration model based on the NodeID of the address space, and the configuration model includes characteristic data of each node; the server publishes the OPCDA service based on the configuration model to create labels for each node; the server reads the first value of the NodeID of the configuration model; and the server updates the second value of the label based on the first value.
[0056] In another practical application, the cluster master control device responds to the successful connection of the OPCUA service, obtains a preset configuration model based on the NodeID of the address space, and the configuration model contains characteristic data of each node; the master control device publishes the OPCDA service based on the configuration model to create labels for each node; the master control device reads the first value of the NodeID of the configuration model; the master control device updates the second value of the label based on the first value.
[0057] Embodiment 2:
[0058] Figure 4 A schematic diagram of the structure of a data processing device provided in an embodiment of the present application is shown in FIG. Figure 4 As shown, the device may include the following modules:
[0059] The generation module 401 is configured to obtain a preset configuration model based on the NodeID of the address space in response to the OPC UA service connection success.
[0060] The creation module 402 is configured to publish an OPCDA service based on the configuration model to create a tag.
[0061] The reading module 403 is configured to read the first value of the NodeID of the configuration model.
[0062] The updating module 404 is configured to update the second value of the tag based on the first value.
[0063] In some embodiments, the responding to the successful connection of the OPC UA service, before obtaining a preset configuration model based on the NodeID of the address space, further includes: connecting to the OPC UA service based on the OPC UA connection authentication parameters.
[0064] In some embodiments, the OPC UA connection authentication parameters include: connection URL; security mode; security policy; account number and password.
[0065] In some embodiments, connecting to the OPC UA service based on the OPC UA connection authentication parameters includes: connecting to the OPC UA service based on the OPC UA connection authentication parameters and a disconnection reconnection model.
[0066] In some embodiments, the disconnection reconnection model is configured to be short at the beginning and long at the end.
[0067] In some embodiments, publishing the OPCDA service based on the configuration model to create a tag includes: publishing the OPCDA service based on the configuration model and generating OPCDA node information; and creating a tag based on the OPCDA node information.
[0068] In some embodiments, the OPCDA service is an SDK-registered OPCDA service provided by the OPC Foundation.
[0069] Embodiment 3:
[0070] An embodiment of the present application further provides an electronic device, comprising: a memory storing an executable program; and a processor for running the program, wherein the program executes the methods in various embodiments of the present invention when running.
[0071] The above-mentioned memory may refer to a device inside a computer for storing data and programs, and may include memory, hard disk, etc., wherein the memory may be used to temporarily store running programs and data, the hard disk may be used to store programs and data for a long time, and the memory may be used to enable the computer to read and write data, and execute programs; the above-mentioned processor may be responsible for executing instructions in computer programs and performing data processing, and may be responsible for controlling and executing various operations, including arithmetic operations, logical operations, data transmission, etc.
[0072] Embodiment 4:
[0073] An embodiment of the present application further provides a computer-readable storage medium, which includes a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute the methods in various embodiments of the present invention.
[0074] The above-mentioned computer storage medium may refer to a medium in a computer memory used to store certain discontinuous physical quantities. Computer storage media mainly include semiconductors, magnetic cores, magnetic drums, magnetic tapes, laser disks, etc.; the stored program included in the computer-readable storage medium may be a set of instructions that can be recognized and executed by a computer, running on an electronic computer, and is an information tool that meets certain needs of people.
[0075] Embodiment 5:
[0076] An embodiment of the present application further provides a computer program product, including a computer program, which implements the methods in various embodiments of the present invention when executed by a processor.
[0077] The above-mentioned computer program product may refer to a software program that has been written, tested and released and can be run on a computer or other device. The computer program product may include an application, an operating system, tool software, etc., which is used to implement specific functions or solve specific problems.
[0078] Embodiment 6:
[0079] An embodiment of the present application further provides a computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the method in each embodiment of the present invention is implemented.
[0080] The above-mentioned non-volatile computer-readable storage medium may refer to a medium for storing data. The non-volatile computer-readable storage medium can keep the data from being lost when the power is off, and can be used to store long-term data, such as operating systems, applications, and user files. The non-volatile storage medium may include hard disk drives, solid-state drives, optical disks, and flash memory storage devices, etc.
[0081] Embodiment 7:
[0082] The embodiments of the present application further provide a computer program, which implements the methods in the above-mentioned embodiments of the present invention when executed by a processor.
[0083] The above-mentioned computer program may refer to a collection of instructions used to tell a computer to perform a specific task or operation. A computer program may be written by a programmer using a specific programming language and may include algorithms, data structures, logic, and control flows. A computer program may be used for a variety of purposes, including application software, operating systems, and the like.
[0084] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0085] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, 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 units or modules, which can be electrical or other forms.
[0086] 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 units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0087] In addition, each functional unit in each embodiment of the present invention 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.
[0088] 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 invention, in essence, 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. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0089] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A data processing method, characterized in that: include: In response to the OPCUA service connection being successful, the preset configuration model is obtained based on the NodeID of the address space; Publishing an OPCDA service to create a tag based on the configuration model; Read a first value of the NodeID of the configuration model; A second value of the tag is updated based on the first value.
2. The data processing method according to claim 1, characterized in that: Before the OPC UA service connection is successfully received and the preset configuration model is obtained based on the NodeID of the address space, the method further includes: Connect to the OPCUA service based on the OPCUA connection authentication parameters.
3. The data processing method according to claim 2, characterized in that: The OPCUA connection authentication parameters include: Connection URL; Safe Mode; Security policy; Account number and password.
4. The data processing method according to claim 2, characterized in that: The connecting to the OPCUA service based on the OPCUA connection authentication parameters includes: Connect to the OPCUA service based on the OPCUA connection authentication parameters and the offline reconnection model.
5. The data processing method according to claim 4, characterized in that: The disconnection reconnection model is configured to be short at the beginning and long at the end.
6. The data processing method according to claim 1, characterized in that: The publishing of the OPCDA service based on the configuration model to create a tag includes: Publish OPCDA services and generate OPCDA node information based on the configuration model; Create a label based on the OPCDA node information.
7. The data processing method according to claim 1, characterized in that: The OPCDA service is an SDK-registered OPCDA service provided by the OPC Foundation.
8. A data processing device, characterized in that: include: A generation module is configured to respond to a successful OPCUA service connection and obtain a preset configuration model based on a NodeID of the address space; a creation module configured to publish an OPCDA service to create a tag based on the configuration model; A reading module, configured to read a first value of a NodeID of the configuration model; An updating module is configured to update a second value of the tag based on the first value.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is executed, the data processing method according to any one of claims 1 to 7 is executed in a processor of a device where the program is controlled.
10. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors execute the data processing method according to any one of claims 1 to 7.