cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Thingworx property bound to Kepware tag receives incorrect values.

mdeshpande-2
7-Bedrock

Thingworx property bound to Kepware tag receives incorrect values.

Hello All,

 

I have a set of data coming from industrial gateway to ThingWorx using Manufacturing Apps Suite and we are successfully polling machine data. 

We are using kepware where machine data is pushed initially. 

 

We have a tag called Diameter. The data type of the tag on Kepware side is Float type.

On the ThingWorx side, the tag is bound to a thing property of data type Number.

 

The issue that I am facing is that,

For example at Kepware we can see the value of the Diameter tag as 1.6.

But when we receive this data in the ThingWorx property, the value is 1.600000023841858.

 

I would like to understand the reason behind this behavior and also how I can fix this issue and get correct values.

 

Appreciate all help.

 

Thanks & Regards,

Madhumita

1 ACCEPTED SOLUTION

Accepted Solutions

Edit:  Apologies for the delay, however I could resolve this issue, here is the reason for the behavior as per my understanding:

The number data type in Thingworx is 64-bit double precision, that is essentially a Double.

However the type in Kepware was Float which is a 32-bit single precision. Hence, when data was pushed from Float to double, due to precision change, additional bits were mapped. 

The double representation of float value 1.6 turned out to be 1.600000023841858.

 

I changed the tag type from Float to Double at Kepware and that resolved the issue. Values at both end remain same as they have the same data type and in turn same precision.

 

 

View solution in original post

4 REPLIES 4
slangley
23-Emerald II
(To:mdeshpande-2)

Hi @mdeshpande-2.

 

The 1.600000023841858 value you are seeing in ThingWorx would have to be coming from Kepware.  You should be able to format the display to suit your needs in your mashup depending on the widget you're using.

 

Regards.

 

--Sharon

Hi Sharon,

 

Yes, I had restricted the number of decimal digits whenever displaying this data on mashups.

 

However, the major issue was for data calculation, as many of these properties were required for KPI calculations and rounding off / truncating the values was not an option.

 

I could find a fix, after a bit of exploration on data types and bit mapping.  

 

Thank you for helping out.

 

Warm Regards,

Madhumita

 

slangley
23-Emerald II
(To:slangley)

Hi @mdeshpande-2.

 

Good job on solving the issue!  Please feel free to mark your response as the Accepted Solution for the benefit of others on the Community.

 

Regards.

 

--Sharon

Edit:  Apologies for the delay, however I could resolve this issue, here is the reason for the behavior as per my understanding:

The number data type in Thingworx is 64-bit double precision, that is essentially a Double.

However the type in Kepware was Float which is a 32-bit single precision. Hence, when data was pushed from Float to double, due to precision change, additional bits were mapped. 

The double representation of float value 1.6 turned out to be 1.600000023841858.

 

I changed the tag type from Float to Double at Kepware and that resolved the issue. Values at both end remain same as they have the same data type and in turn same precision.

 

 

Top Tags