Documentation search search close
CONTENTS
https://www.speedgoat.com/help/slrt/page/icon_documentation.jpg
v10.0.1.x for R2026a
View other versions

OPC UA - Client Connection

OPC UA - Client Connection — Connects the local OPC UA client with one remote OPC UA server

Library

Simulink Real-Time - Speedgoat

Description

The Connection block connects the local OPC UA client with one remote OPC UA server. Each server connection requires a Connection block in the model. The connection start point is given by the local IP address, entered in the Setup block mask, and a random TCP port. The connection endpoint is given by the IP address and TCP port of the remote server. Enter both remote parameters in the Connection block mask.

Ports

Outputs
Connection Status

This port outputs the state of the client-server connection as an array of data type UINT32 and length 3. The first index is the OPC UA session state. The available values are:

CodeDescription
0UA_SESSIONSTATE_CLOSED
1UA_SESSIONSTATE_CREATE_REQUESTED
2UA_SESSIONSTATE_CREATED
3UA_SESSIONSTATE_ACTIVATE_REQUESTED
4UA_SESSIONSTATE_ACTIVATED
5UA_SESSIONSTATE_CLOSING

The second index is the OPC UA secure channel state. The available values are:

CodeDescription (before v9.9.1)Description
0UA_SECURECHANNELSTATE_FRESHUA_SECURECHANNELSTATE_CLOSED
1UA_SECURECHANNELSTATE_HEL_SENTUA_SECURECHANNELSTATE_REVERSE_LISTENING
2UA_SECURECHANNELSTATE_HEL_RECEIVEDUA_SECURECHANNELSTATE_CONNECTING
3UA_SECURECHANNELSTATE_ACK_SENTUA_SECURECHANNELSTATE_CONNECTED
4UA_SECURECHANNELSTATE_ACK_RECEIVEDUA_SECURECHANNELSTATE_REVERSE_CONNECTED
5UA_SECURECHANNELSTATE_OPN_SENTUA_SECURECHANNELSTATE_RHE_SENT
6UA_SECURECHANNELSTATE_OPENUA_SECURECHANNELSTATE_HEL_SENT
7UA_SECURECHANNELSTATE_CLOSINGUA_SECURECHANNELSTATE_HEL_RECEIVED
8UA_SECURECHANNELSTATE_CLOSEDUA_SECURECHANNELSTATE_ACK_SENT
9 UA_SECURECHANNELSTATE_ACK_RECEIVED
10 UA_SECURECHANNELSTATE_OPN_SENT
11 UA_SECURECHANNELSTATE_OPEN
12 UA_SECURECHANNELSTATE_CLOSING

The third index is an error code. A valid connection is indicated by

  • OPC UA session state = ACTIVATED and

  • OPC UA secure channel = UA_SECURECHANNELSTATE_OPEN and

  • Error = 0

Inputs

This block does not have any input ports.

Parameters

General
Station ID

Apply the Station ID of the corresponding Setup block. Must range between 0 and 65535.

Connection ID

The Connection ID is used to assign Read and Write blocks to a particular client-server connection. Connection IDs range between 0 to 65535 and must be unique along all Connections blocks of the client (these blocks have the same Station ID).

Remote Address

Enter the IP address or URL of the remote OPC UA server. If the Remote TCP Port parameter is 0, the remote address must be a URL. In all other cases, the remote address must be an IP address. Examples:

Remote TCP Port 4840 and Remote Address '192.168.1.50' prompts the client to connect to port 4840 at 192.168.1.50

Remote TCP Port 0 and Remote Address 'opc.tcp://192.168.1.51:4841' prompts the client to connect to port 4841 at 192.168.1.51

Remote TCP Port

Enter the TCP port the remote OPC UA server is listening on for connection requests.

Sample Time

Defines the base sample time at which this driver block gets its sample hit. This parameter can also be set to -1 for inherited sample time. The units are in seconds.

Security
Security Policy

Select the security policy of the server endpoint to which the client should connect.

Security Mode

Select the security mode of the server endpoint to which the client should connect. If the security policy is None, the security mode must also be None.

User Token Policy

Select the user token policy for user authentication. If Username is selected, enter the user credentials in the Username and Password parameters. Furthermore, you must provide a certificate and a private key as the remote server's policy may require username and password encryption.

Certificate

Define the location of the public application instance certificate on the host PC. The file must be an X509 DER file with extension *.cer. During the build process, the file will be packed into the real-time application and transferred to the target machine. The certificate is required for security policies other than None. The X509v3 Subject Alternative Name property of the certificate file must match the character array entered in the Application URI parameter. You can use the certificates included in the OPC UA product examples.

Data type: Character array

Default value: ''

Private Key

Define the location of the private key file on the host PC. The file must be a PEM file with extension *.pem and must relate to the certificate. During the build process, the file will be packed into the real-time application and transferred to the target machine. The private key is required for security policies other than None. You can use the private keys included in the OPC UA product examples.

Data type: Character array

Default value: ''

Username

Specify the user name with which the client should log in to the server.

Data type: Character array

Default value: ''

Password

Enter the password associated with the username.

Data type: Character array

Default value: ''

Identity
Application URI

The Application URI is a common identity property of all OPC UA devices. When using certificates, the Application URI must match the X509v3 Subject Alternative Name property of the certificate.