Rounding error J1939 parameter

young123
Posts: 14
Joined: Thu Jan 16, 2014 4:59 am

Rounding error J1939 parameter

Post by young123 » Wed Jun 04, 2014 6:28 am

Hi,

I found a rounding error in the conversion of a J1939 parameter.

1.) PV 2.7.10419
2.) PV780
3.) Windows 7 Prof UK
4.)
I use a J1939 parameter that shows the longitudinal position (in degrees) from a gps module.
Settings of this spn:
SPN 0
Start Byte 5
Start bit 1
Byte length 4
Bit length 0
Resolution 1E-07 (per bit)
Offset -180
Unit DEG
Min value -180
Max Value 180

When I put in the value that corresponds to 0 degrees ( raw value 1800000000) i get the longitude value 0.0000021.
This means that I have an error of 21 bits.

Do you perhaps use 32 bit floating point calculation for this ?
That could explain such an error.

If so, this would be a bit weird because for your database access in the scripts (smRead/write) I have to use double ( 64 bit ?).

I made a workaround by doing the conversion from raw value (Resolution=1) to degrees in a script.
This results in a much better accuracy.

I would like to hear your comment on this ...
stalley
Enovation Controls Development
Enovation Controls Development
Posts: 618
Joined: Tue Mar 18, 2014 12:57 pm

Re: Rounding error J1939 parameter

Post by stalley » Wed Jun 04, 2014 5:14 pm

Hi!

Again, we thank you for the information you have provided about the resolution problem. The issue has been logged so we can look into this in detail.

We hope the work around you mentioned is sufficient for now and appreciate your help.
Sara Talley
Software Engineer
Enovation Controls