Zum Hauptinhalt springen

"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 namemust-havedata typedefault valuedescription
serverURLYesstringURL of the OPC UA server
usernameNoStringUsername for login on the OPC UA server, default is anonymus
passwordNoStringPassword for login on the OPC UA server
securityModeNostringNoneSecurity mode of the connection: None, Sign, SignAndEncrypt
securityPolicyUriNostringSecurity policy uri of the selected Endpoint of the OPC UA server
pkiFolderPathNostringThe filepath for loading the trust-, revocation- and issuerlist. Certificates needs to be storen in following subfolder issuer/certs, issuer/crl, trusted/certs
acceptAllCertificatesNobooleanfalseThis flag decides if the client will accept all server certificates
clientCertificateFileNostringThe client certificate path include the file
privateKeyFileNostringThe client private key path include the file
produceIntervalNointeger100The produceintervall for channels in ms
pollIntervalNointeger100The pollingintervall for OPC UA node values in ms
bufferSizeNointeger1024The buffersize of an OPC UA node value
channelsYesarrayArray containing an OPC UA node description for channels
browsepathYesarrayArray containing the browsepath of an OPC UA node. Startnode is Objects node (ns=0;i=85)
browsepath/namespaceIndexYesintegerNamespace index of the browsename of an OPC UA node
browsepath/nameYesstringName of the browsename of an OPC UA node
includeChildNodesNobooleanfalseBoolean for polling and producing all childnodes of a node
nameNostringconfig specified name for the channel
dataTypeNostringDatatype for the channel, can be predefined or fetched by the OPC UA client
physicalUnitNostringPhysical unit for the channel, can be predefined or fetched by the OPC UA client, is this information is available

Module information/profile

InformationValue
AuthoroptiMEAS Measurement and Automation Systems GmbH
Consumes signalsNo
Produces signalsYes
smartCORE Version>= 1.0
DependenciesOpen62541 1.3, openssl