Skip to content

OPCUA driver

This driver allows the communication between Simumatik and any plaftform using an OPCUA server.

Parameters

Aside from the common parameters described in the communication_driver docs, this driver includes:

  • url: URL address of the OPCUA server. Default = 'opc.tcp://localhost:4840'

Definition example

The following json examples represent the data exchanged with the driver.

Setup data

The setup data will give values to the parameters required and will specify the I/O variables info.

{
    "parameters": {
        "url": "opc.tcp://localhost:4840", 
    },
    "variables": {
        "sensors": {
            "datatype": "byte", 
            "size": 1,
            "operation": "write"
        },
        "motors": {
            "datatype": "byte", 
            "size": 1, 
            "operation": "read"
        }
    }
}

Note

The setup_params in the generic PLC components for opcua_client will need the following format:

{"url": "opc.tcp://localhost:4840"}

Variable name formats

Variable names can be defined in three different ways: with just the name, with the path, or with the Node Id.

Tip

In case you have many variables in the project and want to speed up the driver connection, the variable names can be defined by their NodeId. The NodeId format changes depending the PLC manufacturer (OPCUA Server), here are some examples (assuming the variable is named inputs):

  • CODESYS: ns=4;s=|var|CODESYS Control Win V3 x64.Application.GVL.inputs (Note that there are no quotes)
  • TIA Portal: ns=3;s="inputs" (Note that we need the quotes)

Update input

As defined in the setup data, we will write the data in the "sensors" var, therefore the driver will send this information:

{
    "sensors": 2,
}

Update output

As defined in the setup data, we will read the data in the "motors" var, therefore the driver will receive this information:

{
    "motors": 2,
}

Component example

If you want to review a component using a full implementation of the OPCUA client, take a look to one below:

alt text