Representing fixed point scaling of numbers|OPC UA Standard|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
Representing fixed point scaling of numbers
Avatar
Peter Harding
Australia
New Member
Members
Forum Posts: 1
Member Since:
12/19/2018
sp_UserOfflineSmall Offline
1
10/08/2019 - 06:39
sp_Permalink sp_Print

I am implementing a minimal OPC-UA server in an embedded device (ARM Cortex-M4).  Our system uses almost entirely fixed-point arithmetic - that is 16 and 32 bit integers.  We use standard "Q Notation" for describing the scaling on each variable.

What is the best strategy to expose these fixed point variables over OPC-UA?

The objective is that the client application can easily and transparently view the value in SI / Engineering units and (generally) be oblivious to the underlying fixed point implementation.

 

More information:

All of our variables have an engineering units, say Volts, and a scale factor which is usually an exponent of 2.  For example, voltage_sense might be Int16 Q8, which means it has a range of [-128,128) volts, which a least significant bit of 2^-8 = 1/256 Volts. 

I have in the past worked in the automotive industry where  XCP/CCP/ASAM-MCD protocols are used and do somewhat similar function to the OPC-UA, although coming at the problem from a totally different direction.  In those protocols, each variable can define a "conversion function" on how to interpret the physical value.  In this example above, the conversion would be the factor of 2^-8.  This is all done client side transparently to the user/consumer who usually just wants to see the engineering value.

I make a clear distinction between the Represented Value (the 16 bit number) and the Physical Value (with SI units of Volts). 

I anticipated that the OPC-UA standard would also provide this capability, but now I'm half way through the implementation and I can't find it anywhere.  This is a very big missing if this is the case and may preclude us from migrating from our custom system to the standard OPC-UA.

It would be very clean for ConversionFunction to be specified by the VariableType (or is it DataType?).  I could make up my own DataTypes that specify custom scaling, but I'm not sure that is useful unless clients actually read it. 

It is possible for us to just convert everything to floating point at the server interface: expose everything as double and scale and cast it on reading and writing.  I've been down that road before on other projects and it just introduces more problems than we want to go into.

If OPC-UA is really targeting nano devices, I expect others will want this and it wold be a standard feature.  Have I missed this somewhere in the standards?

Avatar
Randy Armstrong
Admin
Forum Posts: 1457
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
10/11/2019 - 12:26
sp_Permalink sp_Print

There are number of tools available to use.

Decimal is now a fixed point type and available in 1.04.

You can create your own subtype of UInt16 and defined the semantics that includes scaling.

You can use Properties on the Variable to specify the scaling rules.

Or you can submit a feature request on Part 8 here:
https://apps.opcfoundation.org.....n_page.php

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 23
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1354
Posts: 4590