X4 Help Center
7.5 7.4 German English
Auto Light Dark
Auto Light Dark
7.5 7.4 German English

OPC UA Publisher Adapter

This adapter connects to an OPC UA Server to read and write data from/to a machine in a Technical Process.

Properties

Operation

Operation executed by the adapter

Possible values:

  • GetServerConfiguration: Calls the server configuration

  • ListNodes: Lists the available nodes

  • ListNodesAttributtesId: Lists the attributes for each node

  • Read: Reads out values and the status

  • ReadHistory: Reads out historical values and status

  • Write: Writes the attributes of a node

Parameters

url

Server URL

Possible values: Any valid URL, e.g. opc.tcp://SP-WS-204.softproject.local:53530/OPCUA/SimulationServer

user

Username to connect to the server

Possible values: Any string with the user name, e.g. myUser

password

Password to connect to the server

Possible values: Any string with the password, e.g. myPassword

securityMode

Security Mode and Server Policies

Possible values:

  • NONE

  • BASIC256_SIGN

  • BASIC256_SIGN_ENCRYPT

  • BASIC128RSA15_SIGN

  • BASIC128RSA15_SIGN_ENCRYPT

  • BASIC256SHA256_SIGN

  • BASIC256SHA256_SIGN_ENCRYPT

autoReconnect

Specifies whether the client should automatically reconnect to the server or not.

nodeIndex

Node index

Possible values: Any integer with the node index, e.g. 1234

nodeIdentifier

Node identifier

Possible values: Any string with the node identifier, e.g. myNode

nodeIdentifierType

Type of the node identifier

Possible values:

  • String

  • Numeric

historyOption

Options to retrieve the history of a specific node

Possible values:

  • AT_TIMES

  • AVERAGE

  • COUNT

  • DELTA

  • END

  • MAXIMUM

  • MAXIMUM_ACTUAL_TIME

  • MINIMUM

  • MINIMUM_ACTUAL_TIME

  • RANGE

  • RAW_DATA

  • START

  • WORST_QUALITY

from

Start date with the format yyyy-MM-dd hh:mm:ss

Possible values: Any date with the appropriate format, e.g. 2018-01-01 00:00:00

to

End date with the format yyyy-MM-dd hh:mm:ss

Possible values: Any date with the appropriate format, e.g. 2018-12-31 00:00:00

interval

Interval value in seconds

Possible values: Any whole time with the interval in seconds, e.g. 3000

arrayDelimiter

Character to separate the values within an array

Possible values: Any character (default ,)

Status values

1

The adapter operation was executed successfully

-1

An error occurred while executing the adapter

Input

For the Read and Write operations, the adapter expects a specific XML document with the following elements:

  • nodeIndex (Integer)

  • nodeIdentifier (String)

  • nodeIdentifierType (String , Numeric)

  • attributeId (Integer) 

  • Use the ListNodesAttributtesId operation to call the node attribute ID.

  • You specify arrays by enclosing the values in square brackets, for example [997, 998, 999].

Example input for the READ operation
XML
<?xml version="1.0" encoding="UTF-8"
<RootElement>
    <NodeID nodeIndex="5" nodeIdentifier="Counter1" nodeIdentifierType="String" attributeId="13"></NodeID>
    <NodeID nodeIndex="5" nodeIdentifier="Square1" nodeIdentifierType="String" attributeId="13"></NodeID>
    <NodeID nodeIndex="5" nodeIdentifier="Triangle1" nodeIdentifierType="String" attributeId="13"></NodeID>
	<NodeID nodeIndex="0" nodeIdentifier="2256" nodeIdentifierType="Numeric" attributeId="5"></NodeID>
</RootElement>
Example input for the WRITE operation without arrays
XML
<?xml version="1.0" encoding="UTF-8"
<RootElement>
    <NodeID nodeIndex="5" nodeIdentifier="Counter1" nodeIdentifierType="String" attributeId="13">999</NodeID>
    <NodeID nodeIndex="5" nodeIdentifier="Square1" nodeIdentifierType="String" attributeId="13">9636</NodeID>
    <NodeID nodeIndex="5" nodeIdentifier="Triangle1" nodeIdentifierType="String" attributeId="13">TestData</NodeID>
	<NodeID nodeIndex="0" nodeIdentifier="2256" nodeIdentifierType="Numeric" attributeId="5">Testing</NodeID>
</RootElement>
Example input for the WRITE operation with arrays
XML
<?xml version="1.0" encoding="UTF-8"?>
<RootElement>
    <NodeID nodeIndex="6" nodeIdentifier="BooleanArray" nodeIdentifierType="String" attributeId="13">[true, true, true, true, true]</NodeID>
    <NodeID nodeIndex="6" nodeIdentifier="ByteArray" nodeIdentifierType="String" attributeId="13">[1, 2, 3, 4, 5]</NodeID>
    <NodeID nodeIndex="6" nodeIdentifier="ByteStringArray" nodeIdentifierType="String" attributeId="13">[[3] 0x010203, [3] 0x040506, [3] 0x070809, [3] 0x010101]</NodeID>
    <NodeID nodeIndex="6" nodeIdentifier="DateTimeArray" nodeIdentifierType="String" attributeId="13">[2021-01-23 09:33:08.0031200 GMT, 2021-02-23 09:33:08.0031200 GMT]</NodeID>
    <NodeID nodeIndex="6" nodeIdentifier="DoubleArray" nodeIdentifierType="String" attributeId="13">[1.0, 2.0, 3.0, 4.0, 5.0]</NodeID>
    <NodeID nodeIndex="6" nodeIdentifier="FloatArray" nodeIdentifierType="String" attributeId="13">[1.0, 2.0, 3.0, 4.0, 5.0]</NodeID>
    <NodeID nodeIndex="6" nodeIdentifier="GUIDArrayArray" nodeIdentifierType="String" attributeId="13">[66c6a6fa-79a8-4a47-b0d4-6416f3836bf5, abdb9e68-dd91-4a85-84a1-54a1620209fd]</NodeID>
    <NodeID nodeIndex="6" nodeIdentifier="Int16Array" nodeIdentifierType="String" attributeId="13">[1, 2, 3, 4, 5]</NodeID>
    <NodeID nodeIndex="6" nodeIdentifier="Int32Array" nodeIdentifierType="String" attributeId="13">[1, 2, 3, 4, 5]</NodeID>
    <NodeID nodeIndex="6" nodeIdentifier="Int64Array" nodeIdentifierType="String" attributeId="13">[1, 2, 3, 4, 5]</NodeID>
    <NodeID nodeIndex="6" nodeIdentifier="LocalizedTextArray" nodeIdentifierType="String" attributeId="13">[(de) Text1, (de) Text2, (de) Text3, (de) Text4, (de) Text5, (de) Text0]</NodeID>
    <NodeID nodeIndex="6" nodeIdentifier="QualifiedNameArray" nodeIdentifierType="String" attributeId="13">[Default Binary, Default XML, Default Binary, Default XML, Default Binary]</NodeID>
    <NodeID nodeIndex="6" nodeIdentifier="SByteArray" nodeIdentifierType="String" attributeId="13">[1, 2, 3, 4, 5]</NodeID>
    <NodeID nodeIndex="6" nodeIdentifier="StringArray" nodeIdentifierType="String" attributeId="13">[testString1, testString2, testString3, testString4, testString5]</NodeID>
    <NodeID nodeIndex="6" nodeIdentifier="UInt16Array" nodeIdentifierType="String" attributeId="13">[1, 2, 3, 4, 5]</NodeID>
    <NodeID nodeIndex="6" nodeIdentifier="UInt32Array" nodeIdentifierType="String" attributeId="13">[1, 2, 3, 4, 5]</NodeID>
    <NodeID nodeIndex="6" nodeIdentifier="UInt64Array" nodeIdentifierType="String" attributeId="13">[1, 2, 3, 4, 5]</NodeID>
    <NodeID nodeIndex="6" nodeIdentifier="VariantArray" nodeIdentifierType="String" attributeId="13">[true, true, true, true, true, true]</NodeID>
    <NodeID nodeIndex="6" nodeIdentifier="XmlElementArray" nodeIdentifierType="String" attributeId="13"><![CDATA[[<?xml version="1.0" encoding="utf-8" standalone="no"?>
<testElement1/>
, <?xml version="1.0" encoding="utf-8" standalone="no"?>
<testElement2/>
, <?xml version="1.0" encoding="utf-8" standalone="no"?>
<testElement3/>
, <?xml version="1.0" encoding="utf-8" standalone="no"?>
<testElement4/>
, <?xml version="1.0" encoding="utf-8" standalone="no"?>
<testElement5/>
]]]></NodeID>
</RootElement>

Output

The adapter outputs a specific XML document with the result:

Sample output for the READ operation
XML
<?xml version="1.0" encoding="UTF-8"
<Result>
    <NodeID statusCode="GOOD" nodeIndex="5" nodeIdentifier="Counter1" nodeIdentifierType="String">999</NodeID>
    <NodeID statusCode="GOOD" nodeIndex="5" nodeIdentifier="Square1" nodeIdentifierType="String">9636.0</NodeID>
    <NodeID statusCode="GOOD" nodeIndex="5" nodeIdentifier="Triangle1" nodeIdentifierType="String">1.5999999955515</NodeID>
	<NodeID statusCode="GOOD" nodeIndex="0" nodeIdentifier="2256" nodeIdentifierType="Numeric">The current status of the server</NodeID>
</Result>
Example output for the WRITE operation
XML
<?xml version="1.0" encoding="UTF-8"
<RootElement>
    <NodeID nodeIndex="5" nodeIdentifier="Counter1" nodeIdentifierType="String">SUCCESS</NodeID>
    <NodeID nodeIndex="5" nodeIdentifier="Square1" nodeIdentifierType="String">SUCCESS</NodeID>
    <NodeID nodeIndex="5" nodeIdentifier="Triangle1">XML malformed - Invalid value format to write into the Node attribute</NodeID>
	<NodeID nodeIndex="0" nodeIdentifier="2256">Bad_NotWritable (0x803B0000) "The access level does not allow writing to the Node</NodeID>
</RootElement>