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
Difference array attributes in Variable versus VariableType
Moderator: Support Team
-
- Sr. Member
- Posts: 13
- Joined: 02 Oct 2014, 09:08
- Support Team
- Hero Member
- Posts: 3072
- Joined: 18 Mar 2011, 15:09
Re: Difference array attributes in Variable versus VariableT
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
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
-
- Sr. Member
- Posts: 13
- Joined: 02 Oct 2014, 09:08
Re: Difference array attributes in Variable versus VariableT
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
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
- Support Team
- Hero Member
- Posts: 3072
- Joined: 18 Mar 2011, 15:09
Re: Difference array attributes in Variable versus VariableT
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
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