Consistency between DataType, VariableType, Variables and their Children|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
Consistency between DataType, VariableType, Variables and their Children
Avatar
martin lampacher
New Member
Members
Forum Posts: 2
Member Since:
04/16/2021
sp_UserOfflineSmall Offline
1
04/16/2021 - 07:57
sp_Permalink sp_Print

Hello, I've just recently started reading through all the standards and now started to try out some modelling tools.

One main point that I struggle with is the value of variables, DataTypes and consistency between Type Definitions and Variable Types. For complex variables that are modeled using structures (instead of the "Object" approach as listed in the Annex), I feel that there is some kind of redundancy, e.g.: ServerStatusType.

The ServerStatusType is a VariableType that models a structure with several children. This ServerStatusType also has the "Data Type" ServerStatusDataType which is a subtype of Structure and lists the very same children that the ServerStatusType has.

Now in my Objects, I can create a Variable with the "Type Definition" ServerStatusType, and therefore also have to use the ServerStatusDataType as "Data Type". This automatically gives me a Variable with all the children from the ServerStatusType.

However:

  1. In my Variable I could also add additional children - wouldn't I violate the Data Type by doing this?
  2. Associating the ServerStatusDataType to my ServerStatusType seems to be completely optional. I could also create additional Children in the ServerStatusType (if it was my definition) or not have any of the Children as specified in the ServerStatusDataType
  3. If I'd associate a BaseType to my ServerStatusType I could even select a Boolean Data Type for my Variable.

So what I don't seem to completely grasp yet is the relation between Children of a Variable and the Value Attribute of a Variable. The only way to explain this to myself is the following:

  1. When creating a structure that is atomically updated by the server I must start with a CustomStructureDataType definition and define all my children there.
  2. Now I have two options: Define a Variable of BaseDataVariableType directly and give it the Data Type CustomStructureDataType or create a new Variable Type. The downside of a BaseDataVariableType is that a Client always has to read the full value of my structure.
  3. If I want my Client to be able to read individual members (children) of my structure I need to create a Variable Type CustomStructureType and set its Attribute Data Type to CustomStructureDataType.
  4. Now I can create a Variable with the Type Definition CustomStructureType and the Data Type CustomStructureDataType, which automatically inherits all the child nodes.
  5. The client has now the possibility to read the Variable as a whole or only one child. If the variable was writable, writing to my Variable of type CustomStructureType would also set the value of its children?

The key sentence I've found in the standard is this: "Data types are used to describe the structure of the Value Attribute of Variables and their VariableTypes". However, the duplicity remains: For a complex variable like the ServerStatusType, what is the content of the Value Attribute? Are the values stored by the Variable itself or its children?

Maybe my confusing question allows someone to point out how structures are really defined, I could not grasp this concept completely yet.

Avatar
Randy Armstrong
Admin
Forum Posts: 1451
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
04/16/2021 - 10:13
sp_Permalink sp_Print sp_EditHistory

For a complex variable like the ServerStatusType, what is the content of the Value Attribute? Are the values stored by the Variable itself or its children?

The Nodes are window into your system. How the information is stored is a implementation detail, however, the expectation is the value of the field in the structure is the same as the value read from the corresponding component variable.

A server could implement this behavior by having a single 'source of truth' internally that is accessed whenever a read operation occurs.

Another could server could decide that it can keep multiple copies of the value in sync.

In either case, the client does not care as long as the server behaves as if the value is the same whether the variable or structure is accessed.

Avatar
martin lampacher
New Member
Members
Forum Posts: 2
Member Since:
04/16/2021
sp_UserOfflineSmall Offline
3
04/16/2021 - 10:55
sp_Permalink sp_Print sp_EditHistory

Ah ok - understood, so essentially

  1. ServerStatusDataType could be used as Data Type for a simple variable that can be read by any client and always contains the full structure
  2. ServerStatusType is a complex variable, when reading the value of variable the client would get return the same value as if it was read from a simple variable with the Data Type ServerStatusDataType. At the same time this complex variable exposes sub-fields as separate (possibly simple) variables, but the consistency between reading the value of the child or the complex variable must be guaranteed by the server (same data source).

Thanks a lot for the very fast reply!

Avatar
Randy Armstrong
Admin
Forum Posts: 1451
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
4
04/16/2021 - 11:52
sp_Permalink sp_Print

In the majority of cases, structures are used with simple variables.

The complex variables with fields exposed as component variables are for special cases.

There is no requirement that all fields be exposed as component variables - servers can pick a subset that makes sense.

Properties which are not fields in the structure can also exist on complex variables.

Any target if a HasComponent reference has the same name same name as field in the structure then the value/datatype has to be the same.

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