Difference array attributes in Variable versus VariableType

Unified Architecture topics related to OPC UA Specification, compliant behavior and any technical issues of OPC UA, like Security, Information Model, Companion Specs DI, PLCopen, ADI, ...

Moderator: Support Team

Post Reply
pfp.meijers
Sr. Member
Sr. Member
Posts: 13
Joined: 02 Oct 2014, 09:08

Difference array attributes in Variable versus VariableType

Post by pfp.meijers »

Both the VariableNode as well as the VariableTypeNode (to which it refers) contain attributes to specify the value rank and array dimensions.
What's the difference? Does the VariableTypeNode attr contain the default array dimensions and thus the actuals (from the VariableNode) may differ at run-time?

Grt, Patrick

User avatar
Support Team
Hero Member
Hero Member
Posts: 2532
Joined: 18 Mar 2011, 15:09

Re: Difference array attributes in Variable versus VariableT

Post by Support Team »

Hi Patrick,

The attributes DataType, ValueRank and ArrayDimension together define the content of the Value attribute.

If the VariableType defines concrete attribute values like DataType=Boolean, ValueRank=Scalar(-1) and ArrayDimensions=null, the Variable can only contain exactly the same combination.
If the VariableType defines only abstract values like DataType=BaseDataType, ValueRank=Any(-2) and ArrayDimensions=null, the Variable can use any data type and value rank.
Everything in between is possible.

The Variable can further restrict the settings from the VariableType but it cannot extend the settings.

Best Regards,
Unified Automation Support Team

pfp.meijers
Sr. Member
Sr. Member
Posts: 13
Joined: 02 Oct 2014, 09:08

Re: Difference array attributes in Variable versus VariableT

Post by pfp.meijers »

So the added value of the VariableType is mainly being a placeholder for putting a default value.
Or do I miss important use cases where I need a VariableType to specify things I cannot put in the Variable definition itself or the DataType?

Grt, Patrick

User avatar
Support Team
Hero Member
Hero Member
Posts: 2532
Joined: 18 Mar 2011, 15:09

Re: Difference array attributes in Variable versus VariableT

Post by Support Team »

There are use cases where the semantic defines the use of a certain VariableType e.g. StateVariableType as a component of StateMachineType is always a LocalizedText.
For "normal" Variables representing a process value you would define the DataType for the Variable instance not for the VariableType.

Best Regards,
Unified Automation Support Team

Post Reply