MAP averaging
Thread Starter
Joined: Feb 2007
Posts: 9,486
Likes: 67
From: Melbourne, Australia
MAP averaging
Hey Chaps,
I have mentioned this before but this morning I got to try it.
Basically we are implementing an averaging function on the MAP input ADC.
You can see from the graph below that the Dark Blue line is a lot smoother (but still a bit up/downy) than the Light Blue line.

So one of the advantages of such a system is that we get a smoother input to the TBEC calculations.
The formula for the averaging is basically mapavg = (0.5*mapold2 + 0.7*mapold1 + 0.9*mapcurrent)/(0.5+0.7+0.9)
Thoughts?
ps the log for the above was very minimal (rpm,2byteload,real map and avg map)
Cheers
David
I have mentioned this before but this morning I got to try it.
Basically we are implementing an averaging function on the MAP input ADC.
You can see from the graph below that the Dark Blue line is a lot smoother (but still a bit up/downy) than the Light Blue line.

So one of the advantages of such a system is that we get a smoother input to the TBEC calculations.
The formula for the averaging is basically mapavg = (0.5*mapold2 + 0.7*mapold1 + 0.9*mapcurrent)/(0.5+0.7+0.9)
Thoughts?
ps the log for the above was very minimal (rpm,2byteload,real map and avg map)
Cheers
David
Last edited by tephra; May 15, 2008 at 06:12 PM.
you're using a weighted moving average
a general solution is standard smoothing (which is just a centered average)
so you can adjust S.
the "up to date" is solved by being centered.
this is what i use for my road dyno calcs.
a general solution is standard smoothing (which is just a centered average)
so you can adjust S.
Code:
S = smoothing factor
F(n-S)...F(n-1) F(n) F(n+1) ...F(n+S)
-------------------------------------
1+(2*S)
this is what i use for my road dyno calcs.
dexmix, i don't think your function helps them much, since they can't read the future MAP input, unless they can bear with the delay of reading the next values before taking a "past" desicion...
am i making any sense??? :P
tephra, i am assuming this is for direct closed loop boost control right?
am i making any sense??? :P
tephra, i am assuming this is for direct closed loop boost control right?
dexmix, i don't think your function helps them much, since they can't read the future MAP input, unless they can bear with the delay of reading the next values before taking a "past" desicion...
am i making any sense??? :P
tephra, i am assuming this is for direct closed loop boost control right?
am i making any sense??? :P
tephra, i am assuming this is for direct closed loop boost control right?
the "ends" have to be solved using weighted averages the same as he does now.
Thread Starter
Joined: Feb 2007
Posts: 9,486
Likes: 67
From: Melbourne, Australia
yes direct boost control 
I suppose we could use a past avg as the input to the boost routines.
the value gets updated so quickly (100 times a second) that it probably doesn't matter if we ditch 2 of those updates to have a 5 point centred average.

I suppose we could use a past avg as the input to the boost routines.
the value gets updated so quickly (100 times a second) that it probably doesn't matter if we ditch 2 of those updates to have a 5 point centred average.
Trending Topics
Actually tephra - I didn't realize you're using this as a real time calculation.
weighted avg is really the best you're gonna do - for calculating an error.
If you going to a full PID, then the smoothing would be adjusted using a lower derivative gain.
weighted avg is really the best you're gonna do - for calculating an error.
If you going to a full PID, then the smoothing would be adjusted using a lower derivative gain.

should be fun
EvoM Guru
iTrader: (50)
Joined: Mar 2006
Posts: 9,675
Likes: 132
From: Tri-Cities, WA // Portland, OR
For what you've tried here, it looks like 5 pt is the one that makes a significant difference but has the most overhead and lag. The raw data shows a lot of saw tooth. I'm wondering if a 2 pt (0.5*current + 0.5*previous) might provide the most smooth for the least amount of lag and overhead.
I think jcsb has a point though about whether its necessary.
I think jcsb has a point though about whether its necessary.
The DSM (see disasm on the yahoo group) uses an exponential averaging algorithm on the MAF sensor time between pulses. IIRC it is only 10% weighted to the most recent sample yet it responds quickly, but as stated if you can be bothered to put D into your PID you won't need it at all.
Thread Starter
Joined: Feb 2007
Posts: 9,486
Likes: 67
From: Melbourne, Australia
well i will finish implementing the PID and see if we need averaging at all...
i suspect we will, because the PID algoritm will skip over every 10 MAP values or whatever, so it would be good to get some sort of an average..
the 5pt from above isn't a true indicator as I just did that in excel... I can implement it in code and retry it if you think it will be worthwhile..
i suspect we will, because the PID algoritm will skip over every 10 MAP values or whatever, so it would be good to get some sort of an average..
the 5pt from above isn't a true indicator as I just did that in excel... I can implement it in code and retry it if you think it will be worthwhile..
EvoM Guru
iTrader: (50)
Joined: Mar 2006
Posts: 9,675
Likes: 132
From: Tri-Cities, WA // Portland, OR
well i will finish implementing the PID and see if we need averaging at all...
i suspect we will, because the PID algoritm will skip over every 10 MAP values or whatever, so it would be good to get some sort of an average..
the 5pt from above isn't a true indicator as I just did that in excel... I can implement it in code and retry it if you think it will be worthwhile..
i suspect we will, because the PID algoritm will skip over every 10 MAP values or whatever, so it would be good to get some sort of an average..
the 5pt from above isn't a true indicator as I just did that in excel... I can implement it in code and retry it if you think it will be worthwhile..



