Closed n10n-n10n closed 11 months ago
I believe this is related to #884 - indeed with 7.2.0 DBC decoding seems to correctly interpret signed integers as demonstrated by fuel_temperature_2
output of above snippet
$ pip show asammdf | grep Version
Version: 7.2.0
$ python3 issue.py
fuel_temperature_1: [6547.6]
fuel_temperature_2: [-6.]
fuel_temperature_3: [-6.]
@n10n-n10n please try the development branch code
@danielhrisca thank you!
Development branch seems to fix the issue both for the above simple test case as well as multitude of my actual metrics - I think we can call this case closed.
$ pip show asammdf | grep Version
Version: 7.3.19.dev7
$ python3 issue.py
fuel_temperature_1: [6547.6]
fuel_temperature_2: [-6.]
fuel_temperature_3: [-6.]
@n10n-n10n please try the development branch code what mean???
not0439@DZ-NOT-0439:~/下载/asammdf$ git branch
Available platform plugins are: minimal, vnc, xcb, minimalegl, eglfs, offscreen, wayland, wayland-egl, vkkhrdisplay, linuxfb.
branch development still error
Python version
('python=3.9.13 (main, May 24 2022, 21:28:44) \n' '[Clang 13.0.0 (clang-1300.0.29.30)]') 'os=macOS-13.6-x86_64-i386-64bit' 'numpy=1.24.3' ldf is not supported xls is not supported xlsx is not supported 'asammdf=7.3.17'
Code
MDF version
N/A - generated MDF file
Code snippet
Traceback
N/A - no errors are thrown
Description
Having a DBC file as below, referred to as 'issue.dbc' in the code section:
The snippet outputs the following:
The data extracted by DBC file is 16-bit signed integer starting from bit 39: 0xFFC4. It's extracted three times -
fuel_temperature_1
as unsigned integer,fuel_temperature_2
as signed andfuel_temperature_3
as signed but offset by 1 bit and only 15 bits of length.Correct representation of 0xFFC4 as signed decimal is -60, hence -6.0 should be the correct result from DBC conversion minding the scaling and offset.
fuel_temperature_1
gives a correct result for unsigned integer - thus validating start bit and lengthfuel_temperature_2
yields a clearly incorrect result - while the result is negative it's value is out of reasonable ranges.fuel_temperature_3
yields correct looking result but has incorrect start bit in DBC and loses 1 bit of resolution.