04/01/2014
Hi Team,
I have a created a new Custom Structure as DataType. This structure contains one Enum (DiagnosticLevel) and one Int Variables as below:
<UADataType NodeId=”ns=1;i=3002″ BrowseName=”1:MyCustomStructure”>
<DisplayName>MyCustomStructure</DisplayName>
<References>
<Reference ReferenceType=”HasEncoding”>ns=1;i=5002</Reference>
<Reference ReferenceType=”HasEncoding”>ns=1;i=5004</Reference>
<Reference ReferenceType=”HasEncoding”>ns=1;i=5003</Reference>
<Reference ReferenceType=”HasSubtype” IsForward=”false”>i=22</Reference>
</References>
<Definition Name=”1:MyCustomStructure”>
<Field DataType=”DiagnosticsLevel” Name=”TestEnum”/>
<Field DataType=”Int16″ Name=”TestInt”/>
</Definition>
</UADataType>
Now, when I create Instance (Variable node with value) for this Customer Structure, it looks like this:
The Enum in this contains value in form of name_value where ‘name’ is the field name and ‘0’ is the value of that field. Is this correct or should it be only 2.
<UAVariable DataType=”MyCustomStructure” NodeId=”ns=1;i=6001″ BrowseName=”1:MyTestVariable” AccessLevel=”3″>
<DisplayName>MyTestVariable</DisplayName>
<References>
<Reference ReferenceType=”HasTypeDefinition”>i=63</Reference>
<Reference ReferenceType=”Organizes” IsForward=”false”>i=85</Reference>
</References>
<Value>
<uax:ExtensionObject>
<uax:TypeId>
<uax:Identifier>ns=1;i=5003</uax:Identifier>
</uax:TypeId>
<uax:Body>
<MyCustomStructure xmlns=”http://shubhi.org/testproject/Types.xsd”>
<TestEnum>Info_2</TestEnum>
<TestInt>125</TestInt>
</MyCustomStructure>
</uax:Body>
</uax:ExtensionObject>
</Value>
</UAVariable>
Regards,
Shubhi Gogna
05/30/2017
In the NodeSet values are encoded using the XML encoding.
In the XML encoding the enumerations are strings of the form “name_value”.
In the binary encoding the enums are Int32 values.
You can find the formal definition of the XML encoding in the XSD that is published with the NodeSet:
https://files.opcfoundation.or……Types.xsd
<xs:simpleType name="DiagnosticsLevel"> <xs:restriction base="xs:string"> <xs:enumeration value="Basic_0"/> <xs:enumeration value="Advanced_1"/> <xs:enumeration value="Info_2"/> <xs:enumeration value="Log_3"/> <xs:enumeration value="Debug_4"/> </xs:restriction> </xs:simpleType>
1 Guest(s)