Using C# is it possible to use .Net reference OPC.Ua.Server DLL from the OPC Foundation to connect KepServerEx6 programmatically|OPC UA Standard|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
Using C# is it possible to use .Net reference OPC.Ua.Server DLL from the OPC Foundation to connect KepServerEx6 programmatically
Avatar
Craig Wallace
Member
Members
Forum Posts: 4
Member Since:
11/04/2020
sp_UserOfflineSmall Offline
1
02/23/2021 - 09:43
sp_Permalink sp_Print

Using C# is it possible to use .Net reference OPC.Ua.Server from the OPC Foundation to connect KepServerEx6 so I can capture the Server shutdown event and Server Status. I can use OPC.UA.Client to create a session to the server but am unable to connect to the server itself.

I know this was possible using Opc.Da but as I understand Opc.Ua has superseded that version, any simple coding examples are more than welcome.

Avatar
Randy Armstrong
Admin
Forum Posts: 1451
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
02/23/2021 - 19:34
sp_Permalink sp_Print

It is not clear why you are switching between a client and a server.

You need a client to connect to KepServerEx6.
That client can be part of a server but that detail is not relevant to the connection to KepServerEx6 .

You need to create a subscription with KepServerEx6 and monitor these variables.

Server_ServerStatus_CurrentTime
Server_ServerStatus_State
Server_ServerStatus_SecondsTillShutdown
Server_ServerStatus_ShutdownReason
If the KepServerEx6 provides enough time your client should detect a change to Server_ServerStatus_SecondsTillShutdown.

Avatar
Craig Wallace
Member
Members
Forum Posts: 4
Member Since:
11/04/2020
sp_UserOfflineSmall Offline
3
02/24/2021 - 02:35
sp_Permalink sp_Print sp_EditHistory

Thanks for the update.

I have subscribed to monitor a number of tags via a Client connection that works fine using the OPC .Net Standard code library but cant find the variables you mentioned above like Server_ServerStatus_State etc is there any type of API documentation available to point to where or how I can get hold of those variables?

 

By the way I'm connecting to KepServer 6.8 would that make a difference?

Avatar
Randy Armstrong
Admin
Forum Posts: 1451
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
4
02/24/2021 - 13:02
sp_Permalink sp_Print

You should find them by browsing the mandatory Server object:

https://reference.opcfoundatio.....rt5/8.3.2/

Documentation is here:

https://reference.opcfoundatio.....rt5/6.3.1/

Avatar
Craig Wallace
Member
Members
Forum Posts: 4
Member Since:
11/04/2020
sp_UserOfflineSmall Offline
5
02/25/2021 - 10:05
sp_Permalink sp_Print

Sorry to bother you but I'm a little confused.

I can’t see how the documentation relates to these variables?

Have you a simple C# example, I am developing using Visual Studio 2019 in C# using the latest .Net OPC.Ua dll. The variables you mentioned seem to be in the VariableIds class but I’m not sure how I can connect it to my session or even apply them in code?

Randy Armstrong said
You should find them by browsing the mandatory Server object:

https://reference.opcfoundatio.....rt5/8.3.2/

Documentation is here:

https://reference.opcfoundatio.....rt5/6.3.1/

  

Avatar
Randy Armstrong
Admin
Forum Posts: 1451
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
6
02/25/2021 - 16:04
sp_Permalink sp_Print sp_EditHistory

You need to understand the design patterns that are built into the OPC .Net Standard code.

These design patterns allow you to go easily from the specification to C# constants and structures.

In the example above you want the variable that belongs to the ServerStatus component of the Server object.

This means the NodeId constant in code will be

VariableIds.Server_ServerStatus_SecondsTillShutdown

Avatar
Craig Wallace
Member
Members
Forum Posts: 4
Member Since:
11/04/2020
sp_UserOfflineSmall Offline
7
02/26/2021 - 02:57
sp_Permalink sp_Print

I

Randy Armstrong said
You need to understand the design patterns that are built into the OPC .Net Standard code.

These design patterns allow you to go easily from the specification to C# constants and structures.

In the example above you want the variable that belongs to the ServerStatus component of the Server object.

This means the NodeId constant in code will be

VariableIds.Server_ServerStatus_SecondsTillShutdown

  

Do I always need to create a server object can I skip this part?

Currently I have created a client session connected directly to the PLC which is reading the tags and get updates from the ones I monitor.  I will never need more than a one to one connecting with this PLC so do I need an OPC Server or can I just use the OPC Client to connect to the PLC and not bother creating an OPC Server object ?

Avatar
Randy Armstrong
Admin
Forum Posts: 1451
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
8
02/26/2021 - 08:25
sp_Permalink sp_Print
Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online: Pradeep Patel, Gregor Schuetz
Guest(s) 33
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1351
Posts: 4579