View Issue Details

IDProjectCategoryView StatusLast Update
000608010000-006: MappingsSpecpublic2020-12-01 16:29
ReporterThomas Merk Assigned ToRandy Armstrong  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Summary0006080: Decimal data type encoding
Description

The encoding of data type "Decimal" is not clearly defined.

In Part 6 it is stated:
The decimal data type shall be encoded as

  • EncodingByte (always 1)
  • Length (Int32)
  • Scale (Int16) with meaning deciaml number * 10-scale
  • Value (array of bytes) with meaning:
    A 2-complement signed integer representing the unscaled value
    The number of bits is inferred from the length of the length field.
    If the number of bits is 0 then the value is 0.
    The integer is encoded with the least significant byte first.

It is also stated, that decoders that do not understand the Decimal type shall treat it like any other unknown structure.

However every other "unknown" structure is described at other places, what is missing completely for this data type.
In the NodeSet2 XML this data type does not have a "Definiton" tag to describe the components
The binary dictionary does not include a data type named "Decimal"
However another data type "DecimalDataType" is included (which is nowhere referenced!
<opc:StructuredType Name="DecimalDataType" BaseType="ua:ExtensionObject">
<opc:Field Name="Scale" TypeName="opc:Int16" />
<opc:Field Name="Value" TypeName="opc:ByteString" />
</opc:StructuredType>
The encoding here does not match the encoding of "Decimal" is different to the encoding described in Part 6!!!
I find this very confusing.

Without additional infomation (in Definition" or dictionary) it is impossible for decode this structured value.

TagsNo tags attached.
Commit Version
Fix Due Date

Activities

Thomas Merk

2020-09-22 13:03

reporter   ~0012959

Even the typical refernce "HasEncoding" is missing at this data type.
So there is no chance to handle this data type as other structures.

Is it intended, that this data type has to be implemented like a built-in type?
If yes, that please state this explicitely in specification.

Even built-in types (e.g. "LocalizedText") are described in dictionary, so why not this data type?

BjarneBostrom

2020-09-29 11:42

reporter   ~0012984

I think the DecimalDataType is something specific to the Foundation's .NET implementation. There are a lot of other types that do not exist as well. However it should be noted that this is only in the "Services" NodeSet, as far as I'm aware the current 1.04.7 standard nodeset does not have this. In addition at least now it is propertly marked as "CodeGenerator" specific, which to my knowledge means it is not a real type, only something the .NET impl needs.

In our Prosys OPC UA SDK for Java codegen I'm ignoring every CodeGenerator marked type as they are not real types

(in the services nodeset it is like this at the moment):
<UADataType NodeId="i=17861" BrowseName="DecimalDataType" Purpose="CodeGenerator">
<DisplayName>DecimalDataType</DisplayName>
<References>
<Reference ReferenceType="HasSubtype" IsForward="false">i=22</Reference>
</References>
<Definition Name="DecimalDataType">
<Field Name="Scale" DataType="i=4" />
<Field Name="Value" DataType="i=15" />
</Definition>
</UADataType>

And I think the original spec text of "like other structures" mean as a Structure for which there is no encoding defined, i.e. it will remain as binary/xml/json raw ExtensionObject. So basically it is a "built-in" type without taking a built in type number (of which are limited amount spaces left).

David Levine

2020-09-29 15:12

developer   ~0012985

Here is a quote from an email I received about this:

We are currently on the way of defining the requirement for the decimal data type to be implemented in the SDK. On this way we are struggling a little bit. The information regarding Decimal is quite confusing in specification.

It is represented below “Number” and has

no data type description assigned
no information in data type dictionary
not even a “HasEncoding” reference
In the binary dictionary a data type “DecimalDataType" is described, which looks “a little bit” like the “Decimal” data type, but is not identical to the encoding described in Part 6.

So we are not sure how we have to

implement encoding / decoding
represent this data type in our SDK

All this implies that we cannot treat the “Decimal” data type as any other structured type.

Jim Luth

2020-09-29 15:23

administrator   ~0012986

Add text to clarify in Part 6 that stacks that want to encode/decode this type need to custom code this like is done for all other built-in types because The "structure" metadata is not present in the address space/nodeset.

Randy Armstrong

2020-11-27 08:31

administrator   ~0013302

Fixed in Draft 22.

Jim Luth

2020-12-01 16:29

administrator   ~0013329

Agreed to changes in Telecon.

Issue History

Date Modified Username Field Change
2020-09-22 12:37 Thomas Merk New Issue
2020-09-22 13:03 Thomas Merk Note Added: 0012959
2020-09-29 11:42 BjarneBostrom Note Added: 0012984
2020-09-29 15:12 David Levine Note Added: 0012985
2020-09-29 15:23 Jim Luth Note Added: 0012986
2020-09-29 15:23 Jim Luth Assigned To => Randy Armstrong
2020-09-29 15:23 Jim Luth Status new => assigned
2020-11-27 08:31 Randy Armstrong Status assigned => resolved
2020-11-27 08:31 Randy Armstrong Resolution open => fixed
2020-11-27 08:31 Randy Armstrong Note Added: 0013302
2020-12-01 16:29 Jim Luth Status resolved => closed
2020-12-01 16:29 Jim Luth Fixed in Version => 1.05
2020-12-01 16:29 Jim Luth Note Added: 0013329