PDA

View Full Version : table lookup



steveo
12-18-2022, 06:34 AM
low level question to help me with a development project.

for table lookups, the old ecms i'm used to dealing with usually use linear interpolation between cells. so in an imaginary table with 4 columns like 10,20,30,40 and a set of values like 2,3,4,5, a lookup of 10 would give you 2, but a lookup of 35 would give you 4.5.

so functionally if you have a pair of columns x0,x1 and a pair of values y0,y1 you could do something like y0+((x-x0)/(x1-x0))*(y1-y0) to find the value of the column position x

and in a table with both columns and rows, it's just bilinear, so you'd do a lookup against row and column and average it.

my question is do modern ECMs do any more smooth lookups such as cubic/bicubic splines for anything? i have used bicubic spline functions for 3d lookup where my table is low resolution and i know the output should be smooth, so i am wondering if this was used on any of the ECMs we work with.

kur4o
12-18-2022, 10:42 AM
I would say it depends on the processor being used.
68332 motorola[vpw gm stuff] have built in table look up commands[opcodes], and cpu does in its own.

newer stuff with ppc processor uses old style tablelookup, not sure about precision and methods used but maf table on e38+ is really short, so the lookup should do really well. codes for lookup can be reversed to c++ code and figured if needed.

I think the extra precision comes from 16 and 32 bit values used, along with some float point maths.

What cpu your project have.

steveo
12-19-2022, 02:08 AM
What cpu your project have.

any cpu...its for a universal tool i'm writing in my spare time, that besides log analysis just does some useful things with tables, one of its functions is table interpolation.

probably really handy for 'old to new' ecm swaps, but also in the subaru tuning world that i play in, you can freely modify the table columns and rows of any table to modify its resolution, so you are constantly re-shaping tables

it's not flawless but saves a lot of time for me

linear interpolation between two tables can create flaws, see below example pic.. in reality it's close enough for an engine tuning baseline.


maf table on e38+ is really short, so the lookup should do really well.

then we can probably assume it does use some kind of method involving curvature like a spline since mafs are just a curve


68332 motorola[vpw gm stuff] have built in table look up commands, and cpu does in its own.

i had no idea, i will have to look into that