AEM 30-71XX Infinity Stand-Alone Programmable Engine Mangement System Full Manual User Manual

Page 70

Advertising
background image

64

© 2014 AEM Performance Electronics

Infinity User Manual

Below is an example of how table_math_13 is solved.

// Simple interpolation fill in Y direction

table_math_13 = "cell(ix, sb) * (1 - sy / (st - sb)) + cell(ix, st) * (sy / (st - sb))"

(st - sb) is the number of selected cells minus one. This is just "selection_top minus
selection_bottom."
And "sy" will go from zero to that number.

So, (sy / (st - sb)) will be a value that goes from zero to one. It will be zero at the bottom of the
selection and one at the top, and some fraction in the middle.
Let's call that value "delta." Now we can rewrite the whole thing as:

(cell(ix, sb) * (1 - delta)) + (cell(ix, st) * delta)

Those "cell" calls would just give you the cell at the bottom of the selection and the cell at the top
of the selection, so it's basically:

bottom * (1 - delta) + top * delta

The "1 - delta" part will just be the opposite of delta. As delta goes from zero to one, "1 - delta"
will go from one to zero.

The end result is all the cells between top and bottom will be some combination of top and
bottom, based on that "delta" value. This is a pretty standard way to do what is called "linear
interpolation."

The "table_math_14" expression is a 2D version of the same thing. It has a "delta" in the X
direction and another "delta" in the Y direction. Every cell inside the selection would be some
combination of the four corners weighted by those two deltas.

Advertising