Indi.An PLCcom.Opc.Ua.Sdk Class Library Reference

PLCcom.Opc.Ua.Sdk Class Library Documentation






Getting Started with PLCcom.Opc.Ua.Sdk

Important note

With the PLCcom.Opc.Ua.Sdk you or the user will be able to monitor and control systems, machines or similar at your own discretion. For this purpose the user has to have the needed knowledge or activity. Before the resulting work can be applied to the plant, machine or similar, the creator of a project must test all functions and check for function and interactions with the system, machine or similar. These tests are to be repeated after every software change and after every change to the system, machine or similar or the periphery (network, server, etc.). If malfunctions occur or are detected, the PLCcom.Opc.Ua.Sdk must not be operated at the plant, machine or similar.

What is OPC UA?

OPC UA (Open Platform Communications Unified Architecture) is a platform-independent communication standard for industrial automation, developed by the OPC Foundation. It provides a secure, reliable framework for transporting machine data and is widely adopted in Industry 4.0 and IoT applications.

What PLCcom.Opc.Ua.Sdk has to offer

The PLCcom.Opc.Ua.Sdk is a highly optimized .NET library for building OPC UA client and server applications. The SDK is delivered as a single assembly that can be referenced directly via NuGet — no API calls or COM registration necessary. It runs cross-platform on .NET Framework 4.7.2+, .NET Standard 2.1, .NET 8, .NET 9, and .NET 10.

Supported OPC UA specifications:
  • Data Access (read, write, browse, monitor)
  • Alarm and Conditions
  • Historical Data and Historical Events
  • Complex / Structured Data Types
  • Reverse Connect

Supported transport protocols:
  • opc.tcp — binary UA TCP transport
  • opc.https — secure HTTPS transport

Key advantages:
  • Easy to use — many functions can be called with a single line of code
  • Path-based node addressing — address nodes by browse path (e.g. Objects.Plant.Line1.Machine1.Temperature) in addition to classic NodeIds
  • Automatic Connect, Reconnect, and Disconnect — the connection state does not need to be monitored by the developer
  • Active keep-alive monitoring of the server state
  • Full Client SDK and Server SDK in a single assembly
  • Extensive tutorials for C# and Visual Basic included


OPC UA Client SDK

Discover endpoints

The communication between client and server is carried out via endpoints. Use the discovery function to query available endpoints:

C#
EndpointDescriptionCollection endpoints = UaClient.GetEndpoints(
    new Uri("opc.tcp://localhost:48410"));

Create a client instance

Create a session configuration from the selected endpoint, then create the client instance:

C#
SessionConfiguration sessionConfig = SessionConfiguration.Build(
    "MyApplication", endpoints[0]);

UaClient client = new UaClient("[Enter your UserName here]", 
    "[Enter your Serial here]", 
    sessionConfig);

//register events
client.ServerConnected      += Client_ServerConnected;
client.ServerConnectionLost += Client_ServerConnectionLost;
client.CertificateValidation += (sender, e) => { e.Accept = true; };

The client connects and disconnects automatically by default. The connection state is monitored via keep-alive.

Read and write by path

PLCcom supports addressing nodes by browse path — no need to look up numeric NodeIds:

C#
//resolve a node by path
NodeId nodeId = client.GetNodeIdByPath("Objects.Plant.Line1.Machine1.Temperature");

//read a value
DataValue value = client.ReadValue(nodeId);

//write a value
client.WriteValue(nodeId, 23.5);

Of course, classic NodeId-based access is fully supported too:

C#
NodeId nodeId = new NodeId("ns=2;i=10001");
DataValue value = client.ReadValue(nodeId);

Read and write multiple values

For batch operations, use ReadValueIdCollection and WriteValueCollection:

C#
ReadValueIdCollection nodesToRead = new ReadValueIdCollection();

ReadValueId nodeToRead = new ReadValueId();
nodeToRead.NodeId = client.GetNodeIdByPath("Objects.Plant.Line1.Machine1.Temperature");
nodeToRead.AttributeId = Attributes.Value;
nodesToRead.Add(nodeToRead);

nodeToRead = new ReadValueId();
nodeToRead.NodeId = client.GetNodeIdByPath("Objects.Plant.Line1.Machine1.RPM");
nodeToRead.AttributeId = Attributes.Value;
nodesToRead.Add(nodeToRead);

DataValueCollection results = client.Read(nodesToRead);

Monitor value changes

Subscribe to value changes using subscriptions and monitored items:

C#
Subscription subscription = new Subscription();
subscription.PublishingInterval = 1000;
client.AddSubscription(subscription);

NodeId nodeId = client.GetNodeIdByPath("Objects.Plant.Line1.Machine1.Temperature");
MonitoredItem monitoredItem = new MonitoredItem(subscription.DefaultItem)
{
    StartNodeId      = nodeId,
    SamplingInterval = 500,
    QueueSize        = uint.MaxValue,
    DisplayName      = "Temperature"
};

monitoredItem.Notification += (item, e) =>
{
    var notification = e.NotificationValue as MonitoredItemNotification;
    Console.WriteLine($"{item.DisplayName} = {notification.Value.Value}  " +
        $"Status: {notification.Value.StatusCode}");
};

subscription.AddItem(monitoredItem);
subscription.ApplyChanges();
subscription.SetPublishingMode(true);
subscription.Modify();


OPC UA Server SDK

The PLCcom.Opc.Ua.Sdk includes a full Server SDK for building OPC UA servers with a simple, high-level API.

Configure and start a server

C#
var config = new UaServerConfiguration
{
    ApplicationName = "My OPC UA Server",
    ApplicationUri  = "urn:mycompany:myserver",
    BaseAddresses   = new List<string>
    {
        "opc.tcp://localhost:48410",
        "opc.https://localhost:48411"
    }
};

var server = new UaServer();
await server.StartAsync(config);

Build the address space

C#
UaFolder plant = server.CreateFolder("Plant");
UaFolder machine = server.CreateFolder(plant, "Machine1");

UaVariable<double> temperature = server.CreateVariable<double>(
    machine, "Temperature", initialValue: 20.0);
UaVariable<int> rpm = server.CreateVariable<int>(
    machine, "RPM", initialValue: 0);
UaVariable<bool> running = server.CreateVariable<bool>(
    machine, "IsRunning", initialValue: false);

//update values at runtime
temperature.Value = 23.5;
rpm.Value = 1500;

Add methods

C#
server.CreateMethod(machine, "Reset",
    handler: (session, context, input, output) =>
    {
        temperature.Value = 0.0;
        rpm.Value = 0;
        return ServiceResult.Good;
    });

User authentication

C#
server.AddUser("operator", "secret123", Role.Operator);
server.AddUser("admin",    "admin456",  Role.Engineer);

Server SDK features

  • Folders, Variables (scalar + array), Objects, Methods
  • Custom ObjectTypes and VariableTypes
  • NodeSet2 XML import
  • Alarm & Conditions
  • Historical Data Access and Historical Events
  • Simple Events
  • Reverse Connect
  • User authentication with roles
  • Multiple namespaces
  • Configurable security policies
  • opc.tcp and opc.https transport
  • Integrated logging via LogMessage event

System requirements

Supported platforms:
  • Microsoft .NET Framework 4.7.2 or higher (up to 4.8.1)
  • Microsoft .NET 5.0 to 7.0 via .NET Standard 2.1
  • Microsoft .NET 8.0
  • Microsoft .NET 9.0
  • Microsoft .NET 10.0

To build and run the included examples:
  • Visual Studio 2022 or higher (VS2026 recommended)

Licensing

The PLCcom.Opc.Ua.Sdk must be enabled by entering license information. This license information has been sent to you either after purchase or by requesting a 30-day trial key.

The licensing information is passed during the creation of a client or server instance:

C#
//client
UaClient client = new UaClient("[Enter your UserName here]", 
    "[Enter your Serial here]", 
    sessionConfiguration);

//server
UaServer server = new UaServer("[Enter your UserName here]", 
    "[Enter your Serial here]");

Namespaces

PLCcom.Opc.Ua.Bindings The PLCcom.Opc.Ua.Bindings namespace provides transport protocol implementations for OPC UA communication. It includes the opc.tcp binary transport (UA TCP) and the opc.https transport for secure communication over HTTPS.

The PLCCom.Opc.Ua.Bindings namespace contains classes that implement the WCF bindings for the mappings described in Part 6 of the UA specification. It also includes an implementation for the UA TCP protocol.

PLCcom.Opc.Ua.Client The PLCcom.Opc.Ua.Client namespace provides the OPC UA client session and subscription infrastructure. It includes the Session class for managing server connections, the Subscription and MonitoredItem classes for data change and event notifications, and supporting types for browse operations, certificate validation, and connection management.

The PLCCom.Opc.Ua.Client namespace defines classes which can be used to implement a UA client. These classes manage client side state information, provide higher level abstractions for UA tasks such as managing sessions/subscriptions and saving/restoring connection information for later use.

PLCcom.Opc.Ua.Client.ComplexTypes
PLCcom.Opc.Ua.Client.SdkThe PLCcom.Opc.Ua.Client.Sdk namespace provides a high-level API for building OPC UA client applications. It includes the UaClient class for automatic connection management (connect, reconnect, disconnect), path-based node addressing, reading and writing values, subscriptions with monitored items, method calls, historical data access, alarm monitoring, and reverse connect support.
PLCcom.Opc.Ua.Configuration The PLCcom.Opc.Ua.Configuration namespace contains classes for managing OPC UA application configuration, including ApplicationConfiguration for endpoint, security, and certificate settings, and certificate store management for trusted/rejected certificate handling.

The PLCCom.Opc.Ua.Configuration namespace contains classes that used to manage the configuration and security information for a UA application.

PLCcom.Opc.Ua.PubSub.Encoding.Security
PLCcom.Opc.Ua.PubSub.SdkThe PLCcom.Opc.Ua.PubSub.Sdk namespace provides a high-level API for building OPC UA PubSub publisher and subscriber applications. It includes UaPublisher and UaSubscriber for brokerless UDP/UADP unicast, multicast, and broadcast and broker-based MQTT/UADP and MQTT/JSON transport, fluent configuration builders, and MQTT TLS certificate management.
PLCcom.Opc.Ua.Schema The PLCcom.Opc.Ua.Schema namespace provides classes for working with data type schemas used to describe structured data types exposed by OPC UA servers.

The PLCCom.Opc.Ua.Schema namespace provides classes which facilitate manipulation of the schemas used to describe data types exposed by a UA server.

PLCcom.Opc.Ua.Schema.Binary The PLCcom.Opc.Ua.Schema.Binary namespace implements the OPC Binary Type Description schema defined in Part 3 of the OPC UA specification, used for binary encoding of custom structured data types.

The PLCCom.Opc.Ua.Schema.Binary namespace provides classes which implement the OPC Binary Type Description schema which is defined in Part 3 of the UA specification.

PLCcom.Opc.Ua.Schema.Xml The PLCcom.Opc.Ua.Schema.Xml namespace provides access to XML schemas used to describe data types provided by OPC UA servers.

The PLCCom.Opc.Ua.Schema.Xml namespace provides classes which provide access to XML schemas used to describe the data types provided by a UA Server.

PLCcom.Opc.Ua.Sdk
PLCcom.Opc.Ua.SecurityThe PLCCom.Opc.Ua.Security namespace implements the OPC Security classes.
PLCcom.Opc.Ua.Security.Certificates The PLCcom.Opc.Ua.Security.Certificates namespace provides X.509 certificate management for OPC UA applications, including certificate creation, validation, storage, and PEM/PFX import/export.
PLCcom.Opc.Ua.Server.SdkThe PLCcom.Opc.Ua.Server.Sdk namespace provides a high-level API for building OPC UA servers. It includes the UaServer class for server lifecycle management, UaServerConfiguration for endpoint and security setup, UaNodeManager for address space management, and UaUserManager for user authentication and role management.