DanielT / a2ltool

A tool to edit, merge and update a2l files
Apache License 2.0
41 stars 14 forks source link

The upper limit of the characteristic #32

Closed Monf1a closed 1 month ago

Monf1a commented 1 month ago

When I merged multiple a2l files with a2ltool2.0.0, I compared it to the original a2l, but I found that the upper limit attribute of the characteristic was incorrectly updated.

original: /begin CHARACTERISTIC ATS_TstDemMaxEngN_C "" VALUE 0x802A2BB9 Val_Wu8 10200. EngN_LRes 0.00 10200. FORMAT "%5.0" /begin IF_DATA CANAPE_EXT 0x64 LINK_MAP "DATA_ATS_Std_dir._ATS_TstDemMaxEngN_C" 0 0 0 0 0 0 0 /end IF_DATA /end CHARACTERISTIC

a2ltoolMerged: /begin CHARACTERISTIC ATS_TstDemMaxEngN_C "" VALUE 0x802AC891 Val_Wu8 10200 EngN_LRes 0 255 FORMAT "%5.0" /begin IF_DATA CANAPE_EXT 0x64 LINK_MAP "DATA_ATS_Std_dir._ATS_TstDemMaxEngN_C" -2144679791 0 0 0 1 135 0 /end IF_DATA SYMBOL_LINK "DATA_ATS_Std_dir._ATS_TstDemMaxEngN_C" 0 /end CHARACTERISTIC

also, I found that it has something to do with COMPU_METHOD. It appears that the upper limmit of this characteristic deposit is UpperLimmit after COMPU_METHOD processing

COMPU_METHOD EngN_LRes: /begin COMPU_METHOD EngN_LRes "" RAT_FUNC "%6.1" "rpm" COEFFS 0 0.025 0 0 0 1 /end COMPU_METHOD

DanielT commented 1 month ago

Yes, you're correct. I was not aware that the upper limit of a characteristic with a RAT_FUNC conversion should reflect the physical value range rather then the internal value range. As a result, the upper limit of this parameter was reduced to the upper limit of the u8 data type.

Monf1a commented 1 month ago

Hi, Daniel Thanks for your reply. So should I change the source code according to my needs? I checked the source code and found that the adjustment should be done in the adjust_limits function in mod.rs?

DanielT commented 1 month ago

The easiest workaround for you would be to simply comment out the two lines (121, 122) that apply the values from adjust limits.

My plan is to derive the INT to PHYS scaling factor from the COMPU-METHOD and then provide this as an additional parameter to adjust_limits. I'm not sure when I'll get to that though.

Monf1a commented 1 month ago

Okay, thank you. I found the place you told me about. Have a nice day :)