10/26/2022
Hello,
I want to make a reporting program using C# and .NETFramework technologies. We have PLCs and our PLC tags are coming to Kepware’s OPC server.
According to my research, it seems reasonable to use OPC UA, but I couldn’t find any useful(uncomplicated) documentation. I just want to get the tree list from the OPC server and transfer it to treeview, which is a .NETFramework component.
Later, I want to log the tags I have determined by reading 1 per minute. Very detailed samples are too heavy for me.
Are there a method like GetStructors() or a small sample to get the tree structure and read a tag? Please help.
10/26/2022
I just tried that example and I get a result like
OPC UA Console Reference Client
OPC UA library: 1.4.370 @ 11/03/2022 08:49:12 — 1.4.370
Connecting to… opc.tcp://10.0.254.195:49320/
BadCertificatePolicyCheckFailed ‘SHA1 signed certificates are not trusted.’
Untrusted Certificate rejected. Subject = CN=KEPServerEX/UA Server, O=Unknown, C=US, DC=ISKIAATSRV
Create Session Error : SHA1 signed certificates are not trusted.
Could not connect to server! Retry in 10 seconds or Ctrl-C to quit.
I can connect with UA Reference/Reference Client but can’t cannect with Console Reference Client. Please help thanks.
05/30/2017
Sample with a simple tree view here:
10/26/2022
Hi again, I found a simple sample on this; most people know this sample.
link: click
This is a console app and it gives tag values, I moved them to the windows form app. But there is a problem with that.
Here is a function call subscription.Create();
It gives tag values that are in the monitored item list per PublishingInterval time. When I run it on the windows form app it gives an error. Because the windows form app can’t run it like a console app. How can we return these values like subscription.Create(); method.
Any information you provide will be very useful for all of us, thanks.
10/26/2022
On Console App
var subscription = new Subscription(session.DefaultSubscription) { PublishingInterval = 1000 };
Console.WriteLine(“Step 5 – Add a list of items you wish to monitor to the subscription.”);
var list = new List<MonitoredItem>();
MonitoredItem CikisDebi = new MonitoredItem(subscription.DefaultItem)
{
DisplayName = “Cikis Debi”,
StartNodeId = “ns=2;s=AATSRV.AATSRV.@LOCALMACHINE::.List of all tags.B080Cikis_Debi”
};
MonitoredItem GirisSeviye = new MonitoredItem(subscription.DefaultItem)
{
DisplayName = “Giris Seviye”,
StartNodeId = “ns=2;s=AATSRV.AATSRV.@LOCALMACHINE::.List of all tags.B080Giris_Seviye1”
};
list.Add(GirisSeviye);
list.Add(CikisDebi);
list.ForEach(i => i.Notification += OnNotification);
subscription.AddItems(list);
Console.WriteLine(“Step 6 – Add the subscription to the session.”);
session.AddSubscription(subscription);
subscription.Create();
Console.WriteLine(“Press any key to remove subscription…”);
Console.ReadKey(true);
}
There is no Console.WriteLine method but this subscription.Create(); method prints the values per { PublishingInterval = 1000 }; ms.
WinForms doesn’t have a property for run this method.
I mean how can we run it like subscription.Create();
picture example about subscription.Create(); how its running:
Thanks for your replies.
05/30/2017
I don’t understand what the issue it.
Using WinForms has no impact on the OPC UA APIs that are available.
The only difference between a Console OPC UA client and a WinForms OPC UA client are mechanisms used to provide feedback to the user.
Questions about those user interface APIs are a .NET framework question rather than an OPC UA question.
1 Guest(s)