
OPC UA Client / Server in C#/VB.NET
schnell und einfach.
Mit dem OPC UA SDK .NET schnell und einfach zur eigenen OPC UA Client- oder Server-Anwendung.
Der an den Richtlinien für das Framework Design von Microsoft angelehnte Aufbau erlaubt es selbst OPC Neulingen einen Einstieg von null auf hundert in die Entwicklung. Die üblicherweise aufwändige Konfiguration entfällt nahezu vollständig.
Hierbei erweitert das Framework den Foundation Stack um diverse Features. So werden serverseitig ACLs (Access Control List) für die Benutzer und Zertifikat basierte Authentifizierung bereitgestellt. Über deren ACEs (Access Control Entry) lassen sich dann die Zugriffsrechte individuell festlegen. Ebenso einfach ist das Node Management, sodass komplexe gar dutzende Zeilen an Konfigurationscode entfallen.
Auch clientseitig wird einiges geboten. Das Lesen mittels ReadNode und Schreiben mittels WriteNode ist ebenso einfach wie das Browsen der Nodes.
Das SKD ist für .NET Framework, .NET Standard und .NET Core verwendbar. Es unterstützt jede Plattform, für die .NET Core verfügbar ist.
OPC UA .NET Client/Server NuGet Paket OPC UA .NET Client NuGet Paket
OPC UA .NET Beispiele auf GitHub OPC UA .NET Online Handbuch
OPC UA .NET Client Development Guide OPC UA .NET Server Development Guide
OPC-Watch, ein Profi-Tool für die OPC UA Welt. Entwickelt mit dem OPC UA SDK .NET.
OPC Watch bietet:
using Opc.UaFx;
using Opc.UaFx.Server;
internal class SampleNodeManager : OpcNodeManager
{ private OpcDataVariableNode<bool> isStarted; public SampleNodeManager() : base("http://sampleserver/machines") { } protected override IEnumerable<IOpcNode> CreateNodes(OpcNodeReferenceCollection references) { OpcFolderNode machineOne = new OpcFolderNode(new OpcName("Machine_1", this.DefaultNamespaceIndex)); references.Add(machineOne, OpcObjectTypes.ObjectsFolder); new OpcMethodNode(machineOne, "StartMachine", new Action<OpcMethodContext>(StartMachine)); new OpcMethodNode(machineOne, "StopMachine", new Action<OpcMethodContext>(StopMachine)); this.isStarted = new OpcDataVariableNode<bool>(machineOne, "IsStarted", false); return new IOpcNode[] { machineOne }; } private void StartMachine(OpcMethodContext context) { // The code to start the machine. this.isStarted.Value = true; this.isStarted.ApplyChanges(context); } private void StopMachine(OpcMethodContext context) { // The code to stop the machine. this.isStarted.Value = false; this.isStarted.ApplyChanges(context); }
}
public class Program
{
new OpcServerApplication ("opc.tcp://localhost:12345/SampleServer", new SampleNodeManager()).Run();
Console.ReadKey();
}
OpcClient client = new OpcClient("opc.tcp://localhost:4711/MyServer");
client.UserIdentity = new UserIdentity("username", "password");
client.Connect(); // Connect to Server
To read nodes use one of the ReadNode overloads of the OpcNodeInfo class.
OpcValue value = client.ReadNode("2:Machine_1/IsStarted");
To read a different OpcAttribute as the value attribute specify the attribute to read as follows:
OpcValue description = client.ReadNode("2:Machine_1/IsStarted", OpcAttribute.Description);
To write nodes use one of the WriteNode overloads of the OpcNodeInfo class.
client.WriteNode("2:Machine_1/IsStarted", true);
To write a different OpcAttribute as the value attribute specify the attribute to write as follows:
client.WriteNode("2:Machine_1/IsStarted", OpcAttribute.Description, "Indicates the started state");
client.WriteNode("2:Machine_1/IsStarted", true);
client.Disconnect();
Site / Branch / Standort License
Single Developer License