This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

rounding error
#1
Hi Admin,

It's acceptable the Logic Machine has to store values with a rounding error.  It's more worrying when stored values with rounded errors cannot returned back to the KNX bus with the correct value.

For example,  a floating point number of 103 is stored as 102.96.  I use rounding function to restore the value back to 103,  now if I use grp.response or grp.write to return 103 back to KNX  bus,  I see in the ETS group monitor 102.96.  Even if I try,  grp.repsonse('1/1/1',103), then the ETS monitor displays 102.96

Can you please correct the grp.response and grp.write functions?


Thanks,


Roger
Reply
#2
Roger, can you provide a full example and which data type are you using?
Reply
#3
Hi Admin,

I have tested with 2 byte floating point and the temperature variant. So create just an object of 2 byte floating point. then write an event script for this new object that looks like,

if(event.type='groupwrite')then
grp.write(event.dst,103)
elseif (event.type=='groupread')then
grp.response(event.dst, 103)
end

Then use ETS to monitor the LM, in both cases 102.96 is sent on the bus.


thanks,


Roger
Reply
#4
If you try writing 103 with ETS you will get 103.04. The thing is that it's not possible to encode 103 as a 2-byte float value, you either get 102.96 or 103.04. If you need better precision then use 4-byte float if your devices support it.
Reply
#5
Because of this thing every KNX display has an option to round a value to a specified number of digits after the decimal point.
Reply


Forum Jump: