Import PLC Variable Templates into .Net Framework OPC UA Client Application|OPC UA Implementation: Stacks, Tools, and Samples|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
Import PLC Variable Templates into .Net Framework OPC UA Client Application
Avatar
Yiming Sun
Germany
Member
Members
Forum Posts: 6
Member Since:
10/04/2021
sp_UserOfflineSmall Offline
1
04/01/2022 - 03:49
sp_Permalink sp_Print sp_EditHistory

Hello, I have an OPC UA Client WPF Application, it reads the Variables from PLC (Beckhoff TwinCAT 3) through OPC UA Server once it’s connected. 

In PLC there are some variables which are customer-defined struct DataType, for example, the Variable “PLCStartTime” is a struct Variable, it contains Int Variables such as Year, Month, Day, Hour and Second. Some struct Variables have more than one level,  like parent – children -grandchildren -grand grand children…

 

Can I pre-define those PLC struct variables Templates in Config.xml, so that I only need to read the value from every single element (children, grandchildren..) from the variable? Like this, before the Client Application starts, I write PLC Struct Variable Templates in the file Quickstarts.Client.Config.xml,  and it loads:

ApplicationInstance application = new ApplicationInstance();

application.LoadApplicationConfiguration(“Quickstarts.Client.Config.xml”, silent: false); 

Then what I need to do is just to use m_session.Read(the NodeId of one element in the struct variable), is it feasible? 

 

or is there any other better way to pre-define it in Client Application? 

 

Thanks in advance.

Avatar
Randy Armstrong
Admin
Forum Posts: 1580
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
04/01/2022 - 13:08
sp_Permalink sp_Print

There is no way to read a single element in a structure value unless the server breaks out the individual elements as separate variables.

The SubscriptionDiagnosticsType is an example of a VariableType with a Structure value that does this:

https://reference.opcfoundatio…..art5/7.12/

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 28
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1446
Posts: 4891