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 Adapter Script Overview-V2 for an overall look at the V2 adapter scripts.
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.
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.
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:
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
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.
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:
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:
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
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.
Reach out to firstname.lastname@example.org for additional help.