View Full Version : Questions about the Evo 7-9 program code
jcsbanks
03-02-2009, 08:55 PM
Put your questions here and if I know the answer I'll post.
Areas I've put a lot of work into are:
Serial port (logging) communications (with customisations)
Sensor calibration/errors
IC Spray
SAS
MAF sensor processing
IPW calculation
Map lookups, moving/resizing/replacing/deleting maps
Knock control
General flow of the code/interrupts
Disassembly generally
GrayW
03-02-2009, 09:13 PM
John, Many thanks for your input.
Graham
AndyF
03-02-2009, 10:58 PM
Hi John,
Do the later ECU's use piecewise linear transformations??? If so, any chance you could give me a quick run through of how they work etc.
Cheers
Andy
jcsbanks
04-02-2009, 11:32 AM
The 3d maps use bilinear interpolation, 2d maps use a linear interpolation. I don't believe it is different to the earlier ECUs.
AndyF
04-02-2009, 11:59 AM
That's good to know... do you understand the way that the code/maths behind it works though?
I know you get an initial offset and then a couple of other bytes after that it uses for the interpolation and I'm struggling to work out how the interpolation actually works and how it uses the values.
Any insight??
Cheers
Andy
jcsbanks
04-02-2009, 05:57 PM
Just so happens I've written a new set of map for speed density today.
Here is a grab of the headers in Ecuflash.
On the left is the pointer to the header just to the right of it. The FFFF6ABC is the MAP sensor raw value, the 8 represents an 8 item lookup table (which is the top part of the 2d table), and the destination variable is FFFF699C. The next reference to 699C (FFFF not shown here) means that this variable is used to interpolate the lower part of the 2d table. This 699C variable is split into an index lookup and an interpolation factor that tells the table lookup routine how far between the two indices the real value is. Cross multiplication is used.
The 3d maps follow a similar pattern, but obviously more complex with the two interpolated axes.
Does this answer your question? Are you trying to change or improve how it works?
AndyF
05-02-2009, 09:38 AM
Cheers for that John,
I have a feeling that the early stuff works slightly differently but I was having a look at it last night and believe that I've cracked it :smile:
In my code, I get 2 bytes first that give a limit and an offset and then I get a table of 3 byte chunks that give an addition factor, a division factor and then a final check value...
So they can look something like this:
$0A, $03
$02, $03, $05
$00, $02, $FF
The first $0A is the ultimate limit value for the transform and the $03 is the offset to be applied to the input value in all cases.
The next 3 values are the addition, division and limit for the 1st part of the graph and are applied as follows
y = x - $03 (the offset) + $02 (the addition) / 2 ^ ($03 (the division factor) - 1)
so we end up with y = (x - $01) / 4 between the values of $00 and $04 (one below the limit value at the end of the 3 byte string)
Similarly, the next section of the transform is dealt with in the same way and comes out as
y = (x - $03) / 2 between the values of $05 and the limit value of $09
then any value after that simply is limited using the equation
y = ($0A - $03) / 2
and so ultimately we end up with a x and y relationship as follows:
x y
0 -1/4
1 0
2 1/4
3 1/2
4 3/4
5 1
6 1 1/2
7 2
8 2 1/2
9 3
10 3 1/2
11 3 1/2
12 3 1/2
Andy
jcsbanks
05-02-2009, 12:38 PM
Oh I see what you mean. In the later ECUs it has a variety of x*y/z type routines, and others that limit x to between y and z, but they seem to be called individually within specific subroutines, or the calculations are in a few cases just hard coded for things that are not mappable. It seems they use any excuse to use an interpolated map lookup for things rather than a linear transformation of the type you describe.
AndyF
05-02-2009, 01:25 PM
In the early ecu's it would appear to be mainly used to describe various tables where the spacings are not linear across the table.
From doing a fair bit of hunting, there doesn't appear to be any code that contains labels that show the headings like they do in the later ECU's and the ranges appear to be set from these piecewise transforms.
Andy
jcsbanks
05-02-2009, 02:13 PM
Yes, the SH2 ECUs use an interpolated lookup for the axis, rather than a calculation.
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.