config.json file description

This documentation provides details on the configuration settings for OPC servers in the OPC_Connector.

Example of OPC Servers configuration:

The OPC Servers configuration settings for OPC_Connector:

{
    "opc_servers": {
        "PLC_OPC": {
            "server_url": "opc.tcp://192.168.105.200:4840",
            "timeout": 5,
            "keepalive": true
        },
        "PLC1": {
            "server_url": "opc.tcp://192.168.0.1:4840",
            "timeout": 5,
            "keepalive": true
        },
        "PLC2": {
            "server_url": "opc.tcp://192.168.5.1:4840",
            "timeout": 5,
            "keepalive": true
        },
        "PLCSIM": {
            "server_url": "opc.tcp://192.168.105.220:4840",
            "timeout": 5,
            "keepalive": true
        }
    }

All the three parameters (server_url, timeout, keepalive) are required for each PLC.

server_url - is the url of the opc server. It should be opc.tcp://<ip address>:<port>. For example: opc.tcp://192.168.105.220:4840

timeout - is the timeout parameter for opcua client (in seconds)

keepalive - if true, the connection will be established at the first write or read methods of OPCClient

Logger Configuration

The logger configuration settings for OPC_Connector:

{
    "version": 1,
    "enable": true,                           // enable or disable logging in general
    "disable_existing_loggers": false,
    "formatters": {
    "standard": {
      "format": "%(asctime)s.%(msecs)03d - %(levelname)s - %(message)s",
      "datefmt": "%Y-%m-%d %H:%M:%S"
    }
    },
    "handlers": {
    "fileHandler": {
      "class": "logging.FileHandler",       // log into file
      "level": "INFO",                      // level of logging more info
      "formatter": "standard",
      "filename": "OPC_Connector/opc.log",  // file to log into
      "mode": "a"
    },
    "consoleHandler": {                     // log into console
      "class": "logging.StreamHandler",
      "level": "INFO",                      // level of logging more info
      "formatter": "standard"
    }
    },
    "root": {
    "handlers": ["fileHandler"],            // select handlers to use for logging e.g., use ["fileHandler", "consoleHandler"] for both file and console logging
    "level": "INFO"                         // level of logging more info
    }
    }

Logger Library

The logging library in Python provides extensive documentation on various settings and configurations for logging.