OPC-UA DataType and TypeDefinition

General topics regarding OPC Foundation and communication technology in general.

Moderator: Support Team

Post Reply
JohnBurr
Jr. Member
Jr. Member
Posts: 2
Joined: 15 Aug 2013, 14:53

OPC-UA DataType and TypeDefinition

Post by JohnBurr »

Very many of the variables in the Unified Automation demo server (.NET SDK) have a HasTypeDefinition of “BaseDataVariableType” and one example is the Demo.Static.Scalar.Boolean varialbe. I believe this use of the HasTypeDefinition is compliant with the specification, but is it typical or best practice? Someone is telling me that all variables with a data type of Boolean should have a HasTypeDefinition of "TwoStateDescreteType" but I cannot confirm this. I can find information about a variable's DataType and about a HasTypeDefintion reference in the specifications and I find information about deriving custom object types, but I cannot find this kind of advice, nor can I find a reference server that claims to be following best practices. My use case is essentially providing an OPC-UA server that shows values that come from an embedded controller that is much like a PLC. I am particularly interested in understanding Integers that have enumerated values (such as 0 means "red" and 1 means "blue" and 2 means "green") and in Booleans with and without associated text for the meaning of True and False. Thank you in advance for any advice or reading material.

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

Re: OPC-UA DataType and TypeDefinition

Post by Support Team »

Hello John,

If the semantic information for a Boolean is available, you can expose it via a TwoStateDiscreteType. There is an example in our DemoServers (Demo > 010_ComplianceTest > DA Profile > DiscreteType). If the semantic information is available for an unsigned integer, you can expose it via a MultiStateDiscreteType or a MultiStateValueDiscreteType. Alternatively you can create an enumerated DataType and use this Enumeration for the Variables.
Best regards
Unified Automation Support Team

Post Reply