View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003722 | 10000-003: Address Space | Spec | public | 2017-01-31 16:51 | 2017-02-07 17:50 |
Reporter | Jim Luth | Assigned To | Jeff Harding | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Summary | 0003722: Support for Decimal as a base data type | ||||
Description | In most higher level system, the accuracy and exact calculation result that are provided with decimal mathematics are required (especially for financial and business based systems). OPC UA needs to support decimal. Propose two additions: Decimal and DecimalString be added. The support for DecimalString would not require any changes to the stack since it is just an extension of string type. For clients and servers that understand the type, they can convert it to a native decimal data type. This conversion may result in losses of accuracy, but no conversion error would result. Support for a native Decimal format would result in an upgrade to the stacks. Decimal would be able to be transmitted in a native binary format, with no loss of accuracy or conversions required. It would be a sub-type of number (i.e. that it is a numeric value) which would allow the use of this abstract datatype with regard to decimals. Stacks would be required to restrict transmission of decimal information to/from older versions of the stacks, (protocolVersion would be used to provide this support). Clients that are communicating to servers that are older will not send a decimal type as a base decimal type, but instead will send it as a DecimalString, a server that is communicating with a client that does is of an older version will encode decimals as there string representation. If the protocolVersions indicates that both support decimal than the decimal shall be encoded as the required decimal format (32, 64 or 128). See attached document for an additional description of the decimal format | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Commit Version | |||||
Fix Due Date | |||||
related to | 0002060 | closed | Randy Armstrong | 10000-005: Information Model | Support for Decimal as a base data type |
related to | 0003734 | closed | Jeff Harding | 10000-005: Information Model | Support for Decimal as a base data type |
|
Randy, I think the apps idea also causes end users to struggle since a generic client will not understand something and they will not be able to deal with it, So they can not just buy or use any client they will have to look for client and verify that the client supports decimal before being able to use it. And the next time something needs to be added then another newer version of an SDK is needed - what if the next updated is support by some, but different SDK's so then you can quickly get into a case where what is required is not available from any SDK. SDK's are not dictated by the specification and they can not be. If decimalis are not supported in the stack, then it need not be supported by an SDK, since it could just as well be support by custom applications, but then again one of the big benifits about OPC UA is that a client can browse the type system and based on what it finds, it can correctly interpret the data that it recieves. if a base type requires custom code than this important aspect of OPC UA is broken. Even worse, updating a single application could cause an entire system to fail, even a system built with the latest version of deliverables by the OPC Foundation. The OPC Foundation does not control SDK vendors. and application developed by a particular SDK does not advertise the SDK that was used. This makes it nearly impossible for an end user to determine if something is supported. We can add profiles to track what is supported, but again this is going to place a fair burden on the enduser. In general I think neither solution is good, so we need to come up with something that is better. Maybe the first step is to list requirements 1) Be able to support extension to the base types (generic?) Here are some ideas I had: If decimal is not a base type then it needs to be something, some possible alternatives: 1) Encode as an extension object (can be an actual decimal on the wire). Negative - is not a number, large structure on the wire - only supported by those that support the encode able object, would not be readable by a generic client Positive - would be part of a variant so SDK will be able to handle, but would require application code to do anything useful with it. 2) Encode as a sub type of string - needs to be supported as an option in any manner. Negative - not a number, application support would be needed in all cases to process it or perform anything useful with it. Can be very large on the wire, even for small decimals. Positive - Client could display something even if they do not know what it is. Readable in wire shark. It would be part of a variant so SDK will be able to handle. 3) Encode as a sub type of ByteString - Negative - not a number, application support would be needed in all cases to process it, client would not be able to display without code (even to understand what it is). would not be able to be interrupted by wire shark as anything but a blob Positive - smaller on the wire. It would be part of a variant so SDK will be able to handle. 4) Encode as a subtype of structure - Negative - not a number, but individual items are numbers, it would require code to understand it. Positive - smaller on wire than string (at least in many cases), client would be able to display structure (maybe not very useful) could be viewed by wire shark. It would be part of a variant so SDK will be able to handle. 5) Encode as a subtype of Int64array (2), int32array(4) or IntArray16 (8) - Negative/Positive - would be a number, but not convertible between other numbers without code, small on the wire, client could display, but not in a useful manner, could be viewed by wire shark It would be part of a variant so SDK will be able to handle. A larger issue with stacks does exist: currently there is no manner to exchange information between stacks about version of encoding supported by a protocol. (even protocol version is limited - Hopefully HTTPS will include something?) Providing version information would allow stacks to ensure backward compatibility. Other options: These are just thoughts and I think they maybe worth discussing at some point, Maybe someone else has a good idea. Paul On Sat, Jun 9, 2012 at 12:33 AM, Randy Armstong <randy@ravensjade.com> wrote: You present two options: 1) A lesser application developer experience for some developers because not all SDKs will support the new types; IMO – 1) is the only reasonable choice. The end user experience is more important especially since the change affects all end users but the SDK issue only affects developers who care about the decimal types. There is no issue with exchange of XML NodeSets because NodeSets include the UA DataType which will correctly identify the string as decimal. No matter how much we would wish it there is no way to change the wire encoding without creating IOP difficulties in the field. At this point in time the priority for the UA WG should be on how to make the UA end user experience better because that is critical to UA adoption at this point. Regards, Randy From: Paul Hunkar [mailto:Paul.Hunkar@Dsinteroperability.com] Randy, The problem is that there are 3 stacks and an unknown number of SDK's and there is no way for a client to determine if a server is built by a SDK that would support the update or vice a verse. Also a user of a server or client would not be able to tell, since neither advertises what SDK they were built by. Loading an information model (XML Model exchange) into a server would cause failures, in the server since it does not support a base type and you would not be able to tell. I guess if it is in an SDK then we can add profiles that would allow clients and servers to determine if they support decimal, but even in that case it will be a mess. One would have to connect first to determine if decimal is supported. A new encoding would make much more sense since it would be easy to determine what is supported, without even connecting. Any server that supports OPC UA Binary2 would also expose OPC UA Binary, by definition. Ideally what ever we do, we need a way to be able to extend encoding in the future - I can see int128 or other items in the future, so whatever the solution it would need to be able to include something that indicates a new version. The protocol version was the right idea, we just did not implement it in the correct manner. It should have allow encoding versions also. Maybe we will need to think how an encoding version can be shipped, so that a client and server can both gracefully fall back to an encoding that they both support. The import/export code also has to be able to support the new types so it is even more extensive. I'm still thinking about possible solutions, but nothing makes a lot of sense as of yet. Paul On Fri, Jun 8, 2012 at 7:42 PM, Randy Armstong <randy@ravensjade.com> wrote: The XML encoding can tolerate adding a decimal in theory but the XML decoder code has a switch statement that checks for the known types in a Variant. If an unknown type is encountered it throws an exception. In short – an application cannot send decimals in an XML variant unless it knows the receiver can understand them. Changing at the wire protocol level (even in V2) is too risky and will harm UA more than it helps. We should solve this at the SDK API layer. The users of the data do not care where it is solved as long as it works. From: Paul Hunkar [mailto:Paul.Hunkar@Dsinteroperability.com] Randy, Does the XML encoding support decimal? If it does then we can add decimal via a new encoding OPC UA Binary2. Decimal built in type in OPC UA Binary would be a string only? What do you think? Paul |
|
Discussed in F2F in Dallas. Current approach is to define a decimal as a numeric data type in the specification and include it the base system. Since the stacks can not add a new base data type - it would be encoded as a structure on the wire. An old stack would see a structure that they do not understand, but that is ok since they will not do anything with it. New stack would translate it back to the actual type. |
|
In PArt 3, add Decimal type as a subtype of number. Use this text from PArt 6 Draft 14: "A Decimal is an arbitrary-precision signed decimal number. It consists of an arbitrary precision integer unscaled value and an unsigned integer scale. The scale is the number of digits to the right of the decimal point. " |
|
Updated text: |
|
Added new DataType Decimal to Part3 |
|
Agreed to text edited in telecon. |
Date Modified | Username | Field | Change |
---|---|---|---|
2017-01-31 16:51 | Jim Luth | New Issue | |
2017-01-31 16:51 | Jim Luth | Status | new => assigned |
2017-01-31 16:51 | Jim Luth | Assigned To | => Randy Armstrong |
2017-01-31 16:51 | Jim Luth | Issue generated from: 0002060 | |
2017-01-31 16:51 | Jim Luth | Relationship added | related to 0002060 |
2017-01-31 16:52 | Jim Luth | Project | 10000-005: Information Model => 10000-003: Address Space |
2017-01-31 16:52 | Jim Luth | Assigned To | Randy Armstrong => Jeff Harding |
2017-01-31 16:54 | Jim Luth | Note Added: 0007817 | |
2017-01-31 17:00 | Jim Luth | Target Version | => 1.04 |
2017-02-04 05:05 | Randy Armstrong | Note Added: 0007847 | |
2017-02-07 17:19 | Jeff Harding | Issue cloned: 0003734 | |
2017-02-07 17:19 | Jeff Harding | Relationship added | related to 0003734 |
2017-02-07 17:42 | Jeff Harding | Note Added: 0007861 | |
2017-02-07 17:42 | Jeff Harding | Status | assigned => resolved |
2017-02-07 17:42 | Jeff Harding | Resolution | open => fixed |
2017-02-07 17:50 | Jim Luth | Note Added: 0007865 | |
2017-02-07 17:50 | Jim Luth | Status | resolved => closed |
2017-02-07 17:50 | Jim Luth | Fixed in Version | => 1.04 |