"opcuaclient" smartCORE module
Description
The OpcUaClient Module fetches the values of predefined nodes and writes the data and to a correnspending channel. The connection to an OPC UA server can be used without any encrytpion support or with opennssl supportted securitypolicies. Optionally a user and a password can be specified for connecting to the opc ua server. When the client successfully connected to an OPC UA server, it resolves the defined browsepath/s to nodeid/s or in case of a boolean flag every child node which is a variable. The values of these nodes is read cyclical and enqued to a nodevalue channelbuffer. The channelbuffer will be cyclical dequeued into the corresponding channel.
Open62541
installation
The OPC UA client module is based on open62541 1.3 Open62541 can be installed on Ubuntu as shared library with:
git clone https://github.com/open62541/open62541.git
cd open62541
git checkout 1.3
mkdir build && cd build
cmake -DBUILD_SHARED_LIBS=ON -DUA_FORCE_WERROR=OFF -DUA_NAMESPACE_ZERO=FULL -DUA_ENABLE_ENCRYPTION=OPENSSL ..
make -j8
sudo make install
configuration
JSON configuration
In the following section the whole JSON configuration of the opc ua client is shown. The channel names of the opc ua client module are composed of the browsepath names when no name is given. Without a specified datatype the channel can only be initialized when the OPC UA client successfully connects and is able to resolve the browsepath.
Minimum configuration
{
"module" : "OpcUaClient",
"factory" : "opcuaclient",
"config" : {
"serverURL" : "opc.tcp://opcua.umati.app:4840",
"channels" : [
{
"browsepath" : [ { "namespaceIndex" : 4, "name" : "Machines" }, { "namespaceIndex" : 22, "name" : "BasicGMS" }, { "namespaceIndex" : 9, "name" : "ResultManagement" }, { "namespaceIndex" : 9, "name" : "CorrectionsFolder" }, { "namespaceIndex" : 22, "name" : "Corr3" }, { "namespaceIndex" : 9, "name" : "CorrectionValueAbsolute" }]
}
]
}
}
Example The following channel name will result from the configuration specified above, when the OPC UA client has succesfully connected and resolved the browsepath:
- Machines.BasicGMS.ResultManagement.CorrectionsFolder.Corr3.CorrectionValueAbsolute
In case of the OPC UA client wasn't able to resolve the browsepaths, there will be no value updates produced and no channel created
Configuration with all parameters
{
"module":"OpcUaClient",
"factory":"opcuaclient",
"config":{
"serverURL" : "opc.tcp://opcua.umati.app:4840",
"userName" : "User",
"password" : "1234",
"securityMode" : "Sign",
"securityPolicyUri" : "http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256",
"pkiFolderPath" : "/home/Optimeas/clientPki",
"clientCertificateFile" : "/home/Optimeas/clientPki/own/certs/client_cert.der",
"privateKeyFile" : "/home/Optimeas/clientPki/own/private/client_key.der",
"produceInterval" : 100,
"pollInterval" : 100,
"bufferSize" : 1024,
"channels" :[
{
"browsepath" : [ { "namespaceIndex" : 4, "name" : "Machines" }, { "namespaceIndex" : 22, "name" : "BasicGMS" }, { "namespaceIndex" : 9, "name" : "ResultManagement" }, { "namespaceIndex" : 9, "name" : "CorrectionsFolder" }, { "name" : "Corr2", "namespaceIndex" : 22}],
"includeChildNodes": true
},
{
"browsepath" : [ { "namespaceIndex" : 4, "name" : "Machines" }, { "namespaceIndex" : 22, "name" : "BasicGMS" }, { "namespaceIndex" : 9, "name" : "ResultManagement" }, { "namespaceIndex" : 9, "name" : "CorrectionsFolder" }, { "name" : "Corr3", "namespaceIndex" : 22}, {"name" : "CorrectionValueAbsolute", "namespaceIndex": 9} ],
"name" : "CorrectionValueAbsolute3",
"dataType" : "double",
"physicalUnit" : "μm"
}
]
}
}
**Example The following channel names will result from the configuration specified above, when the OPC UA client has succesfully connected and resolved the browsepaths:
- "Machines.BasicGMS.ResultManagement.CorrectionsFolder.Corr2.CharacteristicIdentfier"
- "Machines.BasicGMS.ResultManagement.CorrectionsFolder.Corr2.Identifier"
- "Machines.BasicGMS.ResultManagement.CorrectionsFolder.Corr2.CorrectionValueAbsolute"
- "Machines.BasicGMS.ResultManagement.CorrectionsFolder.Corr2.LowerControlLimit"
- "Machines.BasicGMS.ResultManagement.CorrectionsFolder.Corr2.UpperControlLimit"
- "CorrectionValueAbsolute3"
The following channel names will result from the configuration specified above, when the OPC UA client wasn't able to connect:
- "CorrectionValueAbsolute3"
In case of the OPC UA client wasn't able to resolve the browsepaths, there will be no value updates produced
Parameter list configuration
parameter name | must-have | data type | default value | description |
---|---|---|---|---|
serverURL | Yes | string | URL of the OPC UA server | |
username | No | String | Username for login on the OPC UA server, default is anonymus | |
password | No | String | Password for login on the OPC UA server | |
securityMode | No | string | None | Security mode of the connection: None, Sign, SignAndEncrypt |
securityPolicyUri | No | string | Security policy uri of the selected Endpoint of the OPC UA server | |
pkiFolderPath | No | string | The filepath for loading the trust-, revocation- and issuerlist. Certificates needs to be storen in following subfolder issuer/certs, issuer/crl, trusted/certs | |
acceptAllCertificates | No | boolean | false | This flag decides if the client will accept all server certificates |
clientCertificateFile | No | string | The client certificate path include the file | |
privateKeyFile | No | string | The client private key path include the file | |
produceInterval | No | integer | 100 | The produceintervall for channels in ms |
pollInterval | No | integer | 100 | The pollingintervall for OPC UA node values in ms |
bufferSize | No | integer | 1024 | The buffersize of an OPC UA node value |
channels | Yes | array | Array containing an OPC UA node description for channels | |
browsepath | Yes | array | Array containing the browsepath of an OPC UA node. Startnode is Objects node (ns=0;i=85) | |
browsepath/namespaceIndex | Yes | integer | Namespace index of the browsename of an OPC UA node | |
browsepath/name | Yes | string | Name of the browsename of an OPC UA node | |
includeChildNodes | No | boolean | false | Boolean for polling and producing all childnodes of a node |
name | No | string | config specified name for the channel | |
dataType | No | string | Datatype for the channel, can be predefined or fetched by the OPC UA client | |
physicalUnit | No | string | Physical unit for the channel, can be predefined or fetched by the OPC UA client, is this information is available |
Module information/profile
Information | Value |
---|---|
Author | optiMEAS Measurement and Automation Systems GmbH |
Consumes signals | No |
Produces signals | Yes |
smartCORE Version | >= 1.0 |
Dependencies | Open62541 1.3, openssl |