C# OPC UA Client Libraries for Siemens TP1200 Comfort HMI

David Krause14 min read
OPC / OPC UASiemensTechnical Reference
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Overview: OPC UA Client Development for the TP1200 Comfort

The SIMATIC TP1200 Comfort (article number 6AV2 124-1MC01-0AX0 / -0AX1, 12.1" widescreen 1280×800) is part of the SIMATIC HMI Comfort family and exposes a built-in OPC UA server starting with WinCC Comfort/Professional V15.1. Every modern .NET OPC UA client library can connect to that server, but the choice between stacks has direct consequences for licensing, support, footprint, and long-term maintenance.

OPC UA is specified in the IEC 62541 series (OPC Foundation OPC UA technology page) and is a platform-independent, service-oriented successor to OPC Classic. The TP1200 implements the DataAccess profile, exposing HMI tags as Variable nodes under a Siemens-specific namespace (typically ns=1;s=Tags.<TagName>).

This reference compares the four most common C# stacks — the OPC Foundation reference library, the Siemens SIMATIC NET COM wrappers, the Traeger SDK, and OPC Labs QuickOPC — and shows a working UA-.NETStandard client for the TP1200. Additional examples referenced in Siemens' support entries (IDs 109737901, 109748892, and 77376110) are also placed in context.

Scope: This article covers the C# client side only. TIA Portal project configuration of the TP1200 OPC UA server is summarized for completeness; refer to the WinCC Comfort manual for full step-by-step commissioning.

TP1200 Comfort OPC UA Server: Capabilities and Configuration

The TP1200 Comfort OPC UA server is enabled per device in the TIA Portal project. Once enabled, the panel accepts OPC UA client connections on the default endpoint:

  • URL: opc.tcp://<IP-or-hostname>:4840
  • Application URI: urn:Siemens.Automation.HMI.<project>.<device>
  • Authentication: Anonymous, Username/Password (no certificate-based client auth by default)
  • Security policies: None, Basic128Rsa15, Basic256, Basic256Sha256 (selectable per project)
  • Transport: uaTcp (binary UA TCP); SOAP/HTTPS is firmware-dependent
  • Profiles: DataAccess (read/write/subscribe on Variables); Methods are exposed only for selected system functions

Server configuration is performed in TIA Portal under HMI device > Properties > OPC UA:

  1. Enable the OPC UA server and assign the runtime port (default 4840).
  2. Select the security policy and authentication mode.
  3. Whitelist the tags (or expose all HMI tags) — only HMI tags reachable from the project are browsable by default; pure PLC-side tags are not directly accessible unless mirrored as HMI tags.
  4. Compile and download to the panel.
  5. Approve the panel's self-signed server certificate if the client enforces trust.

The panel generates a self-signed server certificate on first activation. On the client side, this certificate must be placed in the trusted peers store or explicitly accepted at runtime, depending on the security policy you select. Per the OPC Foundation's overview of connecting PLCs to various software packages with OPC UA, this is the typical server-bootstrap flow for OPC UA-enabled HMI panels.

Library Options at a Glance

The following table summarizes the .NET options you can target. Details and trade-offs follow in the next sections.

Library Vendor License NuGet / Assembly .NET Target Protocol Footprint Documentation Cost
UA-.NETStandard OPC Foundation GPL 2.0 + commercial dual OPCFoundation.NetStandard.Opc.Ua .NET Standard 2.0 / .NET 6+ / .NET Framework 4.6+ OPC UA (full stack) Large Reference, sparse Free under GPL or paid commercial
SIMATIC NET OPC RCW Siemens Siemens EULA opcrcw.comn.dll, opcrcw.da.dll .NET Framework (COM interop) OPC Classic DA (not UA) Small (COM wrappers) Siemens manual Bundled with SIMATIC NET license
SIMATIC NET OPC UA assemblies Siemens Siemens EULA Installed by SIMATIC NET PC software .NET Framework / .NET 6+ OPC UA Medium Siemens manual Bundled with SIMATIC NET license
Traeger SDK Traeger Commercial opcua.traeger.de SDK .NET 6+ (managed) OPC UA Medium Excellent, vendor-backed Per-developer / site license
QuickOPC OPC Labs Commercial OpcLabs.EasyOpcUA NuGet .NET Framework / .NET 6+ / COM OPC UA + Classic Medium Excellent, vendor-backed Per-developer / site license
converter-systems/opc-ua-client converter-systems (community) MIT github.com/convertersystems/opc-ua-client .NET Standard 2.0 OPC UA (DA subset) Small Sample-driven Free
Critical clarification: The two DLLs opcrcw.comn.dll and opcrcw.da.dll referenced in the SIMATIC NET programming manual (Siemens Support entry 77376110) are OPC Classic Data Access COM wrappers (Runtime Callable Wrappers for OLE for Process Control). They are not OPC UA. If your TP1200 is configured as an OPC UA server, you must use a UA client stack (UA-.NETStandard, Traeger, QuickOPC, or the SIMATIC NET UA assemblies). Do not attempt to use the OPC RCW files against an opc.tcp:// endpoint — the wire protocol is fundamentally different (binary SOAP-less UA TCP vs. COM/IOPCServer DA).

OPC Foundation UA-.NETStandard: The Reference Stack

The OPC Foundation maintains the canonical .NET reference stack at github.com/OPCFoundation/UA-.NETStandard. It is the same wire-protocol library that ships inside SIMATIC NET's OPC UA client assemblies and inside most third-party SDKs (Traeger and OPC Labs provide higher-level wrappers on the same protocol). The earlier Siemens example "Creating of OPC UA clients with .NET and helper class" (entry ID 109737901) uses an early build of this stack under the legacy Opc.UA.Core.dll / Opc.UA.Client.dll names; current builds ship as a single NuGet package with a unified Opc.Ua namespace.

Licensing — the library is dual-licensed:

  • GNU GPL v2 with classpath exception — free, but your client application must be GPL-compatible or open source.
  • Commercial — paid license from the OPC Foundation that lets you distribute closed-source commercial products without GPL downstream obligations.

The license terms are documented in the UA-.NETStandard LICENSE file and the OPC Foundation's OPC UA technology page.

Package install:

dotnet add package OPCFoundation.NetStandard.Opc.Ua

Current builds (1.4.x and 1.5.x lines) target .NET Standard 2.0, .NET 6/7/8, and .NET Framework 4.6.1+; this lets the same code run on Windows, Linux, and inside WinCC Runtime add-ons. The companion UA-.NETStandard-Samples repository provides the canonical reference examples.

Strengths:

  • Standards-compliant; same wire protocol every commercial SDK uses.
  • Active maintenance by the OPC Foundation; aligned with the latest IEC 62541 errata.
  • Free for open-source and internal tools.
  • Cross-platform.

Trade-offs:

  • API surface is large; sessions, channels, subscriptions, monitored items, and certificate stores are all explicit. The reference example is dense.
  • Documentation is essentially the source XML doc comments and the public samples repository.
  • Commercial closed-source distribution requires a paid Foundation license.

Siemens SIMATIC NET OPC: Two Distinct Stacks

SIMATIC NET (the product, not the UA standard) ships two separate OPC APIs that engineers frequently confuse:

  1. OPC Classic DA via COM RCW — opcrcw.comn.dll (common OPC interfaces) and opcrcw.da.dll (Data Access 2.0/3.0 interfaces). These are .NET runtime callable wrappers around the OLE/COM OPC Foundation 1.0/2.0 specifications. They implement IOPCServer, IOPCItemMgt, and the DA subscription interfaces. They are referenced in the SIMATIC NET programming manual, entry ID 77376110.
  2. OPC UA .NET — Siemens also ships OPC UA client assemblies that wrap the OPC Foundation stack. These are part of the SIMATIC NET "PC software" install and are documented in the same manual. If you install SIMATIC NET, you can reference these assemblies instead of pulling the OPC Foundation NuGet package.

Use-case split:

  • TP1200 OPC UA server (recommended, modern): use any UA stack — OPC Foundation, Traeger, or OPC Labs. The TP1200 does not expose a Classic DA server.
  • S7-300/400 OPC Classic DA server on a SIMATIC NET PC station: use the RCW files (opcrcw.comn.dll / opcrcw.da.dll) against the ProgID registered by the SIMATIC NET OPC server.

The OPC Foundation's "Connecting PLCs to Various Software Packages with OPC UA" article is a useful companion for understanding where SIMATIC NET fits in a multi-vendor landscape. The Siemens example referenced under entry ID 109748892 also illustrates the C# OPC UA client pattern against a SIMATIC NET server.

Commercial SDKs: Traeger and OPC Labs

Commercial SDKs provide thin, high-level APIs on top of the OPC Foundation stack. They trade license cost for shorter development time, more samples, and direct vendor support.

Traeger OPC UA SDK

  • Vendor site: opcua.traeger.de
  • Documentation: docs.traeger.de
  • Language: C# (and native C++/JavaScript variants)
  • License: commercial per-developer, with floating and site options.

Typical usage is a one-liner session + read:

var client = new OpcUaClient(new OpcUaClientOptions {
    ApplicationName = "MyClient",
    EndpointUrl     = "opc.tcp://192.168.0.10:4840"
});
await client.ConnectAsync();
var value = await client.ReadAsync<double>("ns=1;s=Tags\\Process\\Temperature");
await client.DisconnectAsync();

Strengths: well-documented, mature, vendor-backed. The default logger and certificate store management work out of the box. Trade-off: license cost per developer / per site.

OPC Labs QuickOPC

  • Vendor site: opclabs.com
  • Library: OpcLabs.EasyOpcUA (.NET), COM variant for legacy clients.
  • License: commercial per-developer.

QuickOPC exposes EasyUAClient with a fluent API. The library is widely used for both OPC UA and OPC Classic in tooling and SCADA-adjacent products; useful if you also need to bridge to older DA servers.

Lightweight Open-Source Wrappers

Several GitHub projects wrap the OPC Foundation stack with a simpler API surface. The most cited is github.com/convertersystems/opc-ua-client (MIT license). It provides a UaClient class that hides session, channel, and subscription plumbing for simple read/write/subscribe scenarios. It is appropriate for internal tooling where you want MIT-licensed code and do not need full stack access.

Other wrappers appear in the NuGet gallery under names such as "OPC UA Client .NET"; verify the underlying protocol support, last commit date, and license before adopting any of them in production.

Selection Criteria and Trade-Offs

Use this matrix when picking a stack:

Constraint Recommended stack Why
Internal tool, source closed, budget zero UA-.NETStandard under GPL — only if the tool stays strictly internal and you accept the GPL. No cost, full UA coverage.
Internal tool, source closed, no GPL contamination converter-systems wrapper on top of UA-.NETStandard, or Traeger/OPC Labs trial. MIT or commercial keeps your code clean.
Commercial distributed product Traeger or OPC Labs (paid), or commercial UA-.NETStandard license from OPC Foundation. Avoids GPL downstream obligations.
OPC Classic DA needed alongside UA OPC Labs QuickOPC (covers both), or SIMATIC NET RCW for Classic + UA-.NETStandard for UA. Single vendor for mixed fleet.
SCADA / HMI add-in inside WinCC Runtime UA-.NETStandard or Traeger .NET 6+ build. Cross-platform .NET, no COM dependency.
Maximum support and documentation Traeger or OPC Labs. Vendor-backed; sample code and KB.

Minimal C# Client with UA-.NETStandard

Working code that connects to a TP1200 Comfort OPC UA server, browses the root, and reads a value:

using Opc.Ua;
using Opc.Ua.Client;
using System;
using System.Threading.Tasks;

public static class Tp1200Client
{
    public static async Task<double> ReadTemperatureAsync(string endpointUrl, string tag)
    {
        var config = new ApplicationConfiguration {
            ApplicationName = "Tp1200Client",
            ApplicationType = ApplicationType.Client,
            SecurityConfiguration = new SecurityConfiguration {
                ApplicationCertificate = new CertificateIdentifier {
                    StoreType   = "Directory",
                    StorePath   = "pki/own",
                    SubjectName = "CN=Tp1200Client"
                },
                TrustedPeerCertificates = new CertificateTrustList {
                    StoreType = "Directory",
                    StorePath = "pki/trusted"
                },
                RejectSHA1SignedCertificates  = false,
                AutoAcceptUntrustedCertificates = true  // commissioning only
            },
            TransportQuotas    = new TransportQuotas { OperationTimeout = 15000 },
            ClientConfiguration = new ClientConfiguration()
        };
        await config.ValidateAsync(ApplicationType.Client);

        var endpoint = CoreClientUtils.SelectEndpoint(endpointUrl, useSecurity: false);
        var session  = await Session.Create(
            config,
            new ConfiguredEndpoint(null, endpoint),
            /*renew:**/ false,
            "Tp1200Client",
            /*timeout:**/ 60000,
            /*identity:**/ null,
            /*preferredLocales:**/ null);

        try
        {
            var nodeId    = new NodeId(tag, 1); // ns=1;s=<tag>
            var readValue = session.ReadValue(nodeId);
            Console.WriteLine($"{tag} = {readValue.Value} ({readValue.StatusCode})");
            return Convert.ToDouble(readValue.Value);
        }
        finally
        {
            session.Close();
        }
    }
}

// Call site:
await ReadTemperatureAsync("opc.tcp://192.168.0.10:4840", "Tags\\Process\\Temperature");

Key points:

  • AutoAcceptUntrustedCertificates = true is for commissioning only. Replace with proper trust-store management for production.
  • The TP1200's tag namespace URI is urn:Siemens.Automation.HMI.<project>.<device> by default, so NodeId("Tags\\Process\\Temperature", 1) resolves to the correct ns=1;s=… identifier.
  • useSecurity: false disables encryption. Switch to true once you have deployed trusted certificates.
  • For WSTRING or non-ASCII tag names, the tag path may contain percent-encoded or non-ASCII characters; use new NodeId("…", 1) with the literal string from the address-space browse result.

Adding a Subscription

var subscription = new Subscription(session.DefaultSubscription) {
    PublishingInterval = 1000   // TP1200 supports >= 100 ms; start at 1000 ms
};

var item = new MonitoredItem(subscription.DefaultItem) {
    StartNodeId       = new NodeId("Tags\\Process\\Temperature", 1),
    AttributeId       = Attributes.Value,
    SamplingInterval  = 500
};
item.Notification += (s, e) => {
    foreach (var v in e.NotificationValue.Value as MonitoredItemNotification[])
        Console.WriteLine($"Update: {v.Value}");
};

subscription.AddItem(item);
session.AddSubscription(subscription);
subscription.Create();

Address Space and Data Type Handling

When you browse the TP1200 OPC UA server, the structure typically looks like:

  • ns=0;Server — UA built-in nodes (ServerStatus, NamespaceArray, etc.).
  • ns=1;Tags — root of the HMI tag folder.
  • ns=1;Tags.<Folder>.<TagName> — individual variables.
  • ns=1;System — runtime status and diagnostics nodes.

Default data type mappings for HMI tags of common S7 types:

TIA Portal / S7 type HMI tag type OPC UA built-in type Notes
BOOL Bool Boolean Direct mapping
INT / DINT Int / DInt Int16 / Int32 Unsigned variants map to UInt16 / UInt32
REAL / LREAL Real / LReal Float / Double IEEE 754
STRING / WSTRING String / WString String TP1200 returns UA String; length prefix per OPC UA Part 6
DTL / DATE_AND_TIME DateTime DateTime S7-1500: encoded as 8-byte structure; clients that read DateTime directly work; legacy clients may receive an ExtensionObject
STRUCT / UDT UDT (S7-1500) or non-typed struct on HMI ExtensionObject Generic clients read the structure as an ExtensionObject with the structure's binary body; the client must decode against the S7 type dictionary. S7-1500 STRUCTs and PLC UDTs typically work in clients that support Structure decoding; otherwise the field is exposed as a generic Variant that the client must decode manually.
ARRAY of BOOL/INT/REAL Array One-dimensional or multi-dimensional array Dimension mapping is preserved
Field tip: If your client only sees the Tags root and cannot drill into individual tags, the OPC UA server on the TP1200 may not have the HMI tag list regenerated. Re-compile the TIA Portal project and download to the panel; tag list changes in the project are not always pushed without a full recompile. Also verify the project has been downloaded to the panel and not just to the PC station.

Security, Certificates, and Authentication

The TP1200 accepts the following authentication modes (configurable in TIA Portal):

  • Anonymous — default; simplest for commissioning on isolated networks.
  • Username/Password — accounts are configured in the panel's user administration; the client must supply UserNameIdentityToken.

For secure channels, the panel generates a self-signed server certificate on first use. The client must trust it:

  1. Set SecurityConfiguration.AutoAcceptUntrustedCertificates = false in production.
  2. Export the panel's certificate from the TP1200 web-based management (https://<ip>/) or extract it via UA Expert's certificate dialog.
  3. Place the certificate (DER .der or PEM) in the client's pki/trusted/certs folder; sign it with your own CA if you want chain validation.
  4. Set the panel's security policy to Basic256Sha256 in TIA Portal; the client must match.

Siemens documents certificate handling in the WinCC Comfort manual's "OPC UA Security" section; the OPC Foundation security overview covers the protocol side (asymmetric signing, symmetric channel keys, certificate trust list and revocation list semantics defined in IEC 62541-2 and Part 4).

Verification, Diagnostics, and Common Errors

Before writing C# code, validate the connection with UA Expert (Unified Automation) or any third-party OPC UA browser. This isolates whether the problem is the server, the network, or your code.

Common errors you may see in your client logs, with root causes and fixes:

Error Service / Status code Typical cause Fix
ServiceResultException: BadCommunicationError 0x80050000 Network unreachable, wrong port, firewall Confirm TCP 4840 is open between client and TP1200; check opc.tcp://<ip>:4840 resolves.
ServiceResultException: BadSecurityChecksFailed 0x80130000 Server certificate not trusted, or security policy mismatch Install server certificate in trusted peers; align security policies on both sides.
ServiceResultException: BadIdentityTokenRejected 0x80050200 Username/password wrong, or panel expects Anonymous and you sent UserName Match the panel's authentication mode.
StatusCode BadNodeIdUnknown 0x80340000 Tag not exposed on the TP1200 server Browse the server first; confirm tag name and namespace.
StatusCode BadAttributeIdInvalid 0x80350000 Reading an attribute the TP1200 does not expose Use Attributes.Value (13) for normal reads.
Subscription never publishes — Publishing interval too low, or sampling interval unsupported TP1200 supports ≥ 100 ms; start at 1000 ms.
ServiceResultException: BadRequestTimeout 0x80040000 Panel CPU saturated or connection throttled Reduce subscription count; raise OperationTimeout.

Verification steps in order:

  1. ping the panel IP — confirms Layer 3 reachability.
  2. Test-NetConnection -Port 4840 (PowerShell) or nc -vz <ip> 4840 — confirms the OPC UA port is open.
  3. Browse with UA Expert — confirms server, authentication, and certificate trust.
  4. Run the C# code with AutoAcceptUntrustedCertificates = true and useSecurity: false — confirms the API and address space.
  5. Re-enable security policy and certificate trust one at a time.

Frequently Asked Questions

Is OPC UA encrypted by default on the TP1200 Comfort?

No. The default security policy in WinCC Comfort/Professional is "None" with Anonymous authentication, which is plaintext over TCP 4840. Enable Basic256Sha256 in the TIA Portal OPC UA settings and deploy trusted certificates to use encryption.

Can I use the OPC Foundation UA-.NETStandard library in a commercial product?

Yes, but you must either (a) distribute your client under the GPL v2 with classpath exception, which forces your source open, or (b) purchase a commercial license from the OPC Foundation. The dual-license terms are documented in the UA-.NETStandard repository LICENSE file.

What is the difference between opcrcw.comn.dll, opcrcw.da.dll, and the OPC UA .NET assemblies?

The opcrcw.*.dll files are COM Runtime Callable Wrappers for OPC Classic Data Access 2.0/3.0. They are not OPC UA. OPC UA uses different transports (binary or SOAP over TCP/HTTPS) and a different security model. The TP1200 only exposes an OPC UA server, so you need a UA client stack (UA-.NETStandard, Traeger, or OPC Labs) to talk to it.

What is the default TCP port for the TP1200 OPC UA server?

4840. The port is configurable in the TIA Portal project under HMI device properties; the discovery URL on the client side must match exactly, including the opc.tcp:// scheme.

Why can't my client see all HMI tags on the TP1200?

Only tags configured in the WinCC project and downloaded to the panel are exposed. Internal-only or unused tags may be excluded. Re-compile and re-download the project after any tag-list change; verify with UA Expert that the tags appear in the address space before debugging the client code.

Back to blog