Opc.UaFx.Client 2.7.4

OPC UA .NET SDK for Clients

Features:
• DA: Data Access
• HDA: Historical Data Access
• AE: Alarm & Events + Conditions
• IO: FileAccess
• API: Methods and Enumerations
• Others: Units of Measurements

Characteristics:
• Simple and fast Client Development
• Minimum number of lines of code
• Uses OPC Foundation Stack V1.03.351.0
• Significantly reduced lines of code compared to OPC Foundation Stack

Framework Features:
• Linq to Objects support to browse nodes
• Simplified automatic certificate management
• Advanced node identifier formats like compound, URI or Foundation
• Database Cursor like historical data access
• Event driven programming model for certificates and subscriptions

Tested with:
• SIMATIC S7-1500, SIMOTION, SINUMERIC, ...
• and many more other vendors

Works on:
• Windows / Ubuntu / Debian / macOS
• Android / iOS

Install-Package Opc.UaFx.Client -Version 2.7.4
dotnet add package Opc.UaFx.Client --version 2.7.4
<PackageReference Include="Opc.UaFx.Client" Version="2.7.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Opc.UaFx.Client --version 2.7.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Getting Started

The whole client development guides can be found here:

The most essential snippet to dig in:

using Opc.UaFx.Client;
...
using (var client = new OpcClient("opc.tcp://localhost:4840/")) {
    client.Connect();
    // Your code to interact with the server.
}

Let's Read a Node

OpcValue isRunning = client.ReadNode("ns=2;s=Machine/IsRunning");

More: Read Values of Node(s)

Let's Write a Node

OpcStatus result = client.WriteNode("ns=2;s=Machine/Job/Cancel", true);

More: Write Values of Node(s)

Let's Read a File Node

// All at once
string reportText = OpcFile.ReadAllText(client, "ns=2;s=Machine/Report");

// All via a stream
using (var stream = OpcFile.OpenRead(client, "ns=2;s=Machine/Report")) {
    var reader = new StreamReader(stream);

    while (!reader.EndOfStream)
        Console.WriteLine(reader.ReadLine());
}

More: Working with File Nodes

Browse the Node Tree

// One node
OpcNodeInfo machineNode = client.BrowseNode("ns=2;s=Machine");

// A child node
OpcNodeInfo jobNode = machineNode.Child("Job");

// Some child nodes
foreach (var childNode in machineNode.Children()) {
    // Your code to operate on each child node.
}

// Some node attributes
OpcAttributeInfo displayName = machineNode.Attribute(OpcAttribute.DisplayName);

foreach (var attribute in machineNode.Attributes()) {
    // Your code to operate on each attribute.
}

More: Browsing Nodes

Observe some Alarm's and Event's

client.SubscribeEvent(OpcObjectTypes.Server, HandleGlobalEvents);

...

private static void HandleGlobalEvents(object sender, OpcEventReceivedEventArgs e)
{
    Console.WriteLine(e.Event.Message);
}

More: Working with Events

Observe only Alarm's and Event's from interest

var severity = new OpcSimpleAttributeOperand(OpcEventTypes.Event, "Severity");
var conditionName = new OpcSimpleAttributeOperand(OpcEventTypes.Condition, "ConditionName");

var filter = OpcFilter.Using(client)
        .FromEvents(OpcEventTypes.AlarmCondition)
        .Where(severity > OpcEventSeverity.Medium & conditionName.Like("Temperature"))
        .Select();

client.SubscribeEvent(OpcObjectTypes.Server, filter, HandleGlobalEvents);

More: Working with Events

Getting Started

The whole client development guides can be found here:

The most essential snippet to dig in:

using Opc.UaFx.Client;
...
using (var client = new OpcClient("opc.tcp://localhost:4840/")) {
    client.Connect();
    // Your code to interact with the server.
}

Let's Read a Node

OpcValue isRunning = client.ReadNode("ns=2;s=Machine/IsRunning");

More: Read Values of Node(s)

Let's Write a Node

OpcStatus result = client.WriteNode("ns=2;s=Machine/Job/Cancel", true);

More: Write Values of Node(s)

Let's Read a File Node

// All at once
string reportText = OpcFile.ReadAllText(client, "ns=2;s=Machine/Report");

// All via a stream
using (var stream = OpcFile.OpenRead(client, "ns=2;s=Machine/Report")) {
    var reader = new StreamReader(stream);

    while (!reader.EndOfStream)
        Console.WriteLine(reader.ReadLine());
}

More: Working with File Nodes

Browse the Node Tree

// One node
OpcNodeInfo machineNode = client.BrowseNode("ns=2;s=Machine");

// A child node
OpcNodeInfo jobNode = machineNode.Child("Job");

// Some child nodes
foreach (var childNode in machineNode.Children()) {
    // Your code to operate on each child node.
}

// Some node attributes
OpcAttributeInfo displayName = machineNode.Attribute(OpcAttribute.DisplayName);

foreach (var attribute in machineNode.Attributes()) {
    // Your code to operate on each attribute.
}

More: Browsing Nodes

Observe some Alarm's and Event's

client.SubscribeEvent(OpcObjectTypes.Server, HandleGlobalEvents);

...

private static void HandleGlobalEvents(object sender, OpcEventReceivedEventArgs e)
{
    Console.WriteLine(e.Event.Message);
}

More: Working with Events

Observe only Alarm's and Event's from interest

var severity = new OpcSimpleAttributeOperand(OpcEventTypes.Event, "Severity");
var conditionName = new OpcSimpleAttributeOperand(OpcEventTypes.Condition, "ConditionName");

var filter = OpcFilter.Using(client)
        .FromEvents(OpcEventTypes.AlarmCondition)
        .Where(severity > OpcEventSeverity.Medium & conditionName.Like("Temperature"))
        .Select();

client.SubscribeEvent(OpcObjectTypes.Server, filter, HandleGlobalEvents);

More: Working with Events

Release Notes

https://wiki.traeger.de/en/software/sdk/opc-ua/opc-ua.framework.advanced/version.history

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
2.7.4 203 6/7/2019
2.7.3.1 104 5/23/2019
2.7.3 98 5/17/2019
2.7.2 93 5/10/2019
2.7.1.1 110 4/29/2019
2.7.1 287 3/25/2019
2.7.0 114 3/14/2019
2.6.0 272 2/20/2019
2.5.7 120 2/6/2019
2.5.6 928 10/19/2018
2.5.5 174 10/11/2018