Table of content
- Table of content
- Description
- Constitution des devices
- Events
- Description of subscriptions in JSON format
- Description of subscriptions using properties only
- Deployment
Description
Objectives
The objective of the OPCUAProxy device server is to provide attributes on the Tango bus that are accessible via the OPC-UA protocol. It allows writing to these attributes and subscribing to them to be notified of their changes.
It also provides services to explore the hierarchy of an OPC-UA server.
Structure
The device server consists of two devices:
- OpcUaConnector
- It manages the connection to the OPC-UA server via a single session. It communicates with the OpcUaSubscriber devices.
- It must be unique within the device server.
- OpcUaSubscriber
- It manages a set of subscriptions to the OPC-UA server using the connection provided by the OpcUaConnector device.
- There is no limitation on the number of instances of this device within the server.
Constitution des devices
OpcUaConnector
Attributes
The device has only one fixed attribute: asyncReplyResult
, which displays responses from asynchronous commands. It's a read-only SPECTRUM String. All other attributes are dynamic and created based on session information. (session node id).
Commands
Name | Parameter | Description | Example |
---|---|---|---|
BrowseNode | Root node identifier to explore It is possible to specify the namespace index if the default one is not correct. In this case, it must be added at the beginning with the separator ',' It is possible to specify the type of node identifier by adding it at the beginning with a ',' separator. In this case, the Namespace index must also be specified. |
Displays the complete tree of child nodes of the one provided as a parameter. |
1;"DBOPCUA"."StructureBoolEntierReel" "DBOPCUA"."StructureBoolEntierReel" 1, numeric, 1000
|
ReadNode | Name of the node to read It is possible to specify the namespace index if the default one is not correct. In this case, it must be added at the beginning with the ',' separator. It is possible to specify the type of node identifier by adding it at the beginning with a ',' separator. In this case, the Namespace index must also be specified. |
Returns the value of the node. |
"DBOPCUA"."Reel" 1;"DBOPCUA"."Reel" See the dedicated paragraph. |
Properties
Name | Description | Example | Default value |
---|---|---|---|
OpcuaURL | OPC-UA server addresses. They must all have the same capabilities. If one doesn't respond, and this happens during initialization or if reconnection is selected, the next one is attempted, looping to the end. |
opc.tcp://172.16.3.38:4840 opc.tcp://172.16.3.39:4840
|
|
ConnectionMaximumAttempts | Maximum number of connection attempts (including all URLs). Infinite if <= 0. | 15 | -1 |
IntervalBetweenConnectionAttempts | Delay in seconds between connection attempts. | 30 | 5 |
ReconnectIfConnectionLost | If true, a reconnection will be attempted if disconnected. | true |
true |
RequestTimeout | Timeout duration for requests (subscription, querying, etc.). Specific to the session. | 5000 | 5000 |
CreateDiagnosticAttributes | Determines whether diagnostic attributes of the session should be created. This involves subscribing to the OPC-UA server for these attributes. |
false or true
|
false |
SamplingIntervalForSubscriptionForDiagnostic | Sampling interval for elements of diagnostic attributes. | 1000.0 | 1000.0 |
RequestedPublishingIntervalForDiagnostic | Publishing interval for subscription of diagnostic attributes. | 1000.0 | 1000.0 |
DefaultOpcUaNamespace | Default namespace to use. | 1 | 1 |
DefaultOpcUaType | Default type for identifiers. It will be used with the ReadNode command if the type is not explicitly specified. Possible values are: String, Numeric, and Guid. | Numeric | String |
ApplicationUri | URI of the client application. Note that the application URI must match the one in the certificate for secure certificate-based connections. In the case of a self-signed certificate generated by the device, the value of this property will be used as the application URI in the certificate. | urn:eclipse:milo:tango:client |
urn:sun:tango:opcua:client |
SecurityPolicy | Defines the security policy used. If the value is "None," the connection will not use a secure communication channel. If an algorithm is specified, the connection will be made with server authentication and encrypted communication. Recommended values by the Panorama server are: Basic256Sha256, Aes128_Sha256_RsaOaep, or Aes256_Sha256_RsaPss. Possible values are defined in the Milo SecurityPolicy enumeration: Milo SecurityPolicy Enumeration. Supported algorithms are defined by the OPC Foundation: OPC Foundation Security Policy. | Basic256Sha256 |
None |
SecurityDir | Directory location of the keystore file and the "pki" directory, the Public Key Infrastructure (PKI) infrastructure. The "pki" directory contains the CA and the OPC-UA server certificate. By default, the server certificate is rejected, resulting in a "the trustAnchors parameter must be non-empty" message. In practice, it is common to require manual action to validate the self-signed certificate by moving it from the "rejected" directory to the "trusted/certs" directory. | /usr/Local/etc/opcua/security |
Windows: %TEMP%/client/security Linux: /tmp/client/security
|
SecurityKeystoreFilename | Name of the keystore file containing the client certificate. If SecurityPolicy is set (other than None), the client certificate will be loaded from this keystore. If it doesn't exist, a keystore will be generated automatically with a self-signed certificate. | tango-opcua.pfx |
tango-opcua-client.pfx |
SecurityKeystorePassword | Keystore password | password |
Empty |
SecurityKeystoreAlias | Alias of the client certificate in the keystore | dev-el6-1 |
client-ai |
OpcUaSubscriber
Attributes
All attributes are created dynamically based on properties.
Commands
The device has no commands other than the usual Tango commands.
Properties
Name | Description | Example | Default value |
---|---|---|---|
SubscriptionsJson | The device configuration in JSON format. It describes all subscriptions and attributes along with their settings. | See dedicated section. | Empty |
PolledIdentifiers | Description of non-subscription attributes. They will be queried synchronously with the OPC-UA server. The property format is as follows: TangoName;TangoLabel;toBrowse;toWriteLeafs;OpcUANodeRead[;OpcUANodeWrite] |
MyVariable;My variable;false;false;2,numeric,13;2,numeric,13 | Empty |
DefaultOpcUaSamplingInterval | Sampling interval for elements of diagnostic attributes. | 1000.0 | 1000.0 |
DefaultOpcUaPublishingInterval | Publishing interval for subscription of diagnostic attributes. | 1000.0 | 1000.0 |
DefaultOpcUaNamespace | Default namespace to use. | 1 | 1 |
DefaultOpcUaType | Default type for identifiers. It will be used with the ReadNode command if the type is not explicitly specified. Possible values are: String, Numeric, and Guid. | Numeric | String |
A set of dynamically named properties can be used to describe subscriptions using properties only. See dedicated section.
Events
The OpcUaProxy device receives events for each change in value of an OPCUA attribute. Using the device's properties, it is possible to generate equivalent Tango events.
Description of subscriptions in JSON format
Definition
Subscriptions are described in an object composed of the following elements:
- root
- subscriptions: an array representing an OPC-UA subscription.
- subscription: an object representing a subscription
- attributes: an array representing Tango attributes to create from OPC-UA elements.
- attribute: an object representing an attribute.
- name: the attribute's name in Tango. It must be unique for the entire device.
- label: the label to be used. If not specified, it will be the same as the name.
- read: describes the OPC-UA node to subscribe to for reading the attribute.
- write: an array of OPC-UA nodes to write to for writing the attribute. Optional. If absent, the attribute will be read-only.
- readWrite: describes the OPC-UA node to subscribe to for both reading and writing the attribute. If present, the "read" and "write" attributes must be absent.
- events: an array of events to produce in case of notification of node change. Possible events are: change, archive, user_event, and data_ready.
- samplingInterval: Interval for sampling the read node.
- toBrowse: Boolean indicating if the node is a root to explore and needs to be subscribed to read all final nodes.
- toWriteLeafs: Boolean indicating, in the case where the node is a root to explore, if the final nodes should also be written.
- attribute: an object representing an attribute.
- requestedPublishingInterval: The publishing interval requested to the OPC-UA server for this subscription.
- attributes: an array representing Tango attributes to create from OPC-UA elements.
- subscription: an object representing a subscription
- defaultRequestedPublishingInterval: The publishing interval to use when not specified in subscription definitions.
- defaultSamplingInterval: The sampling interval to use when not specified in attribute definitions.
- defaultNamespaceIndex: The OPC-UA namespace index to use when not specified in node definitions.
- defaultType: The OPC-UA identifier type to use when not specified in node definitions. Possible values are: String, Numeric, and Guid.
- subscriptions: an array representing an OPC-UA subscription.
OPC-UA Nodes for JSON
OPC-UA nodes must be described with the following attributes:
- Id: OPC-UA Identifier. As a string, enclosed in
"
, even if it is numeric. For example:"1138"
. - Type: OPC-UA identifier type. Possible values are: String, Numeric, and Guid.
- NamespaceIndex: Index of the node's namespace.
Only the Id is mandatory. The other parameters can be replaced with default values.
Example
In the following example, the OPC-UA identifier contains the character "
which is normally reserved for JSON. To interpret it correctly, you need to use the escape character \
before it.
A subscription with two Tango attributes, reel
, and struct
, is described below. The struct
node is an OPC-UA structure. Only one parameter will be subscribed, but there will be as many Tango attributes as there are members in the structure.
{
"subscriptions": [
{
"attributes": [
{
"name": "reel",
"read": {
"id": "\"DBOPCUA\".\"Reel\""
},
"write": [ {
"id": "\"DBOPCUA\".\"Reel\""
}
]
},
{
"name": "struct",
"read": {
"id": "\"DBOPCUA\".\"Structure\""
},
"write": [{
"id": "\"DBOPCUA\".\"Structure\""
}]
}
],
"requestedPublishingInterval": 1000.0
}
],
"defaultNamespaceIndex": 3,
"defaultRequestedPublishingInterval": 1000.0,
"defaultSamplingInterval": 1000.0,
"defaultType": "String"
}
Description of subscriptions using properties only
Definition
To define subscriptions using properties only, you need to define several sets of properties:
- IdentifiersSubscription
- A list of different OPC-UA nodes to subscribe to. This property is mandatory if you want to subscribe using this method. Identifiers must be described according to the format defined in the dedicated section.
- SubscriptionDefaultSamplingInterval
- The sampling interval to use when not specified in attribute definitions. Optional.
- SubscriptionRequestedPublishingInterval
- The publishing interval to use for this subscription. Optional.
- SubscriptionDefaultOpcUaNamespace
- The OPC-UA namespace index to use when not specified in node definitions. Optional.
- SubscriptionDefaultOpcUaType
- The OPC-UA identifier type to use when not specified in node definitions. Possible values are: String, Numeric, and Guid.
All of these properties must be suffixed with a subscription name. For example:
- IdentifiersSubscriptionAlpha
- SubscriptionDefaultSamplingIntervalAlpha
- SubscriptionRequestedPublishingIntervalAlpha
- SubscriptionDefaultOpcUaNamespaceAlpha
- SubscriptionDefaultOpcUaTypeAlpha
Definition of elements to subscribe
In the IdentifiersSubscription
properties, attributes must be defined with at least 7 fields, separated by the ;
character:
- The Tango name,
- The Tango label,
- The list of Tango events to be generated, separated by the
,
character.- Possible values are: change, archive, user_event, and data_ready.
- It can be empty.
- The OPC-UA node to subscribe to for reading.
- Mandatory
- The sampling interval.
- It can be empty; the device's default value will be used.
- A boolean indicating whether to browse the node. It must have sub-elements that can be subscribed to.
- It can be empty; it defaults to false.
- If the node is browsed, a boolean indicates whether elements can be written. If false, the elements will be read-only. If true, the values will be written to the same node as for reading.
- It can be empty; it defaults to false. It is not considered if the previous field is false.
- The nodes to write to, separated by the
;
character.
OPC-UA Nodes
OPC-UA nodes must be described with the following attributes:
- Id: OPC-UA Identifier. As a string, enclosed in
"
, even if it is numeric. For example:"1138"
. - Type: OPC-UA identifier type. Possible values are: String, Numeric, and Guid.
- NamespaceIndex: Index of the node's namespace.
A default namespaceIndex and identifier type are defined by properties. You can define a node in three ways:
- Identifier alone: the default namespaceIndex and identifier type are used.
"DBOPCUA"."Reel"
- NamespaceIndex, Identifier: the default identifier type is used.
2,"DBOPCUA"."Reel"
- NamespaceIndex, Identifier Type, Identifier: The description is complete.
2,String,"DBOPCUA"."Reel"
Exemple
Property | Value |
---|---|
IdentifiersSubscriptionAlpha |
reel;;;"DBOPCUA"."Reel";;; Att_Bool_Elec_1;;archive;/Application/SOLEIL/Batiment_T7/RDC/Elec/T7ELEC1.Value_Bool;1000.0;false;false;/Application/SOLEIL/Batiment_T7/RDC/Elec/T7ELEC1.Value_Bool;
|
SubscriptionDefaultSamplingIntervalAlpha |
200.0 |
SubscriptionRequestedPublishingIntervalAlpha |
1500 |
SubscriptionDefaultOpcUaNamespaceAlpha |
1 |
SubscriptionDefaultOpcUaTypeAlpha |
String |
In the example above, a subscription is defined:
- The publishing interval will be 1500ms.
- It has 2 Tango attributes:
-
reel
- No Tango label
- The OPCUA node for the reading part of the Tango attribute will be:
- Namespace=1: default subscription value
- Node Identifier:
"DBOPCUA"."Reel"
- ID Type=String: default subscription value
- No events generated
- Sampling Interval=200.0ms: default subscription value
- The Tango attribute will be read-only
- The OPC-UA node will not be browsed and will generate only one Tango attribute.
-
Att_Bool_Elec_1
- The OPCUA node for the reading part of the Tango attribute will be:
- Namespace=1: default subscription value
- Node Identifier:
/Application/SOLEIL/Batiment_T7/RDC/Elec/T7ELEC1.Value_Bool
- ID Type=String: default subscription value
- Events of type
archive
will be generated - Sampling Interval=1000.0ms
- The Tango attribute will be read and write. It will write to the same node as for reading.
- The OPC-UA node will not be browsed and will generate only one Tango attribute.
- The OPCUA node for the reading part of the Tango attribute will be:
-
Deployment
Execution Script and Libraries
The device uses the eclipse Milo and Jackson libraries. Currently, these dependencies are not present in the deployments. They need to be added along with related dependencies.
Device server
DeviceServer: OPCUAProxy
Class: OpcUaConnector et OpcUaSubscriber