In this article, we'll explain the basics of the OPC-UA V2 adapter script and what makes it different from other integration protocols.
Note: Please keep in mind OPC-UA adapter scripts are case-sensitive.
Note: See the Custom Adapter Script Overview for an overall look at adapter scripts.
Specify Version
The first line within your OPC-UA Adapter Script should be indicating which version of Adapter Script you're using. To use a V2 adapter script, enter the following.
version: 2
Note: If there is no version set, version 1 will be assumed.
Server Connection Information
Next, you'll need to specify the OPC-UA server's connection criteria. This will include the server's endpoint URL address, and if applicable, the username and password to access the server.
version:2
endpoint: opc.tcp://192.168.1.1
username: MachineMetrics
password: OpcUa1234
Certificates
Some OPC-UA servers require that connections be signed with a certificate. If you are not familiar with certificates, chances are you do not need them, as these are not always required. If your server does require them, there are two properties you can use to manage the connection, as shown below in the example:
security-mode: Sign
security-policy: Basic256Sha256
It is likely that there will be information on your server or on your control that will specify which value to use. Below we outline the potential values for these two properties:
Valid values for security-mode are:
None, Sign, SignAndEncrypt
Valid values for security-policy are:
None, Basic128, Basic192, Basic192Rsa15, Basic256Rsa15, Basic256Sha256, Aes128_Sha256_RsaOaep, PubSub_Aes128_CTR, PubSub_Aes256_CTR, Basic128Rsa15, Basic256
Tags
The next section of the OPC-UA adapter script is the Tags section. In this block you'll be defining the nodeID locations for the adapter script to pull from. These nodeID's (also referred to as tags) are the inputs from which our adapter script will pull data from.
version:2
endpoint: opc.tcp://192.168.1.1
username: MachineMetrics
password: OpcUa1234
tags:
The tags are defined by a path
property, which should point to a node ID of a variable in the OPC-UA tree.
Here we'll add an execution tag with its path to the nodeID on the server:
version:2
endpoint: opc.tcp://192.168.1.1
username: MachineMetrics
password: OpcUa1234
tags:
execution:
path: ns=2;s=MachineStates.ProcessActive
Suppose there was a complex data type called PlanInfo
, found at the node ns=2;s=Laser.CurrentPlan
. We could reference properties on the CurrentPlan node in our tags like so:
version:2
endpoint: opc.tcp://192.168.1.1
username: MachineMetrics
password: OpcUa1234
tags:
execution:
path: ns=2;s=MachineStates.ProcessActive
part-quantity:
path: ns=2;s=Laser.CurrentPlan
property: partQuantity
This would give us the partQuantity
property on the CurrentPlan node. This assumes the PlanInfo
type has a partQuantity
property defined which we’ll address in a later section. The value of this property can be referenced later in the data-items section via the part-quantity
label.
Next Steps
After the tags section is complete, the standard variables and/or data-items section can be filled in like any other adapter script. For more information visit these articles on data-items and conditions and variables.
Have Questions?
Reach out to support@machinemetrics.com for additional help.
Comments
0 comments
Please sign in to leave a comment.