The function block UA_Connect is used to create a transport connection and an OPC UA session.
Before executing the function block UA_Connect, enable the OPC UA stack on your controller:
For Modicon M262 Logic/Motion Controllers, activate the option OPC UA Server enabled in the OPC UA Server Configuration tab of the device editor.
For PacDrive controllers, call the function SystemInterface.FC_OpcUaStart once in the initialization of your application.
The function block UA_Connect must be executed once for each connection. The connection is terminated by calling the UA_Disconnect function block.
Input |
Data type |
Description |
---|---|---|
Execute |
BOOL |
Upon a rising edge, the function block is being executed. Also refer to Behavior of Function Blocks with the Input Execute. |
Timeout |
TIME |
Maximum time to respond. Value range: 2 s...60 s If the value is out of range the upper or lower limit is applied. Default value: GPL.Timeout |
ServerEndpointUrl |
STRING [255] |
URL of the server to connect to. For example, opc.tcp://10.128.154.220:4840. This string must not be a null string. |
SessionConnectInfo |
Structure to specify the connection information required to create an OPC UA session. |
Output |
Data type |
Description |
---|---|---|
Done |
BOOL |
Indicates that the execution of the function block was completed successfully. |
Busy |
BOOL |
Indicates that the execution of the function block is in progress. |
Error |
BOOL |
Indicates that an error was detected during execution.
NOTE: Even if Error indicates FALSE, verify the corresponding ErrorIDs before processing the namespace indexes.
|
ErrorID |
Provides additional diagnostic information as a numeric value. For each specified namespace URI, a separate result is provided. |
|
ConnectionHdl |
DWORD |
Connection handle valid until UA_Disconnect is called. |