10/04/2021
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.
05/30/2017
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:
1 Guest(s)