Notices
ECU Flash

MAP averaging

Thread Tools
 
Search this Thread
 
Old May 15, 2008 | 06:08 PM
  #1  
tephra's Avatar
Thread Starter
EvoM Guru
15 Year Member
iTrader: (6)
 
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

Last edited by tephra; May 15, 2008 at 06:12 PM.
Reply
Old May 15, 2008 | 06:41 PM
  #2  
kkarim's Avatar
Evolving Member
iTrader: (2)
 
Joined: Sep 2007
Posts: 214
Likes: 0
From: Florida / Lebanon
I would raise the current to 1.0 and lower the old2 to about 0.2 or 0.3

should give a smoother, more "up to date" curve.
Reply
Old May 15, 2008 | 06:46 PM
  #3  
tephra's Avatar
Thread Starter
EvoM Guru
15 Year Member
iTrader: (6)
 
Joined: Feb 2007
Posts: 9,486
Likes: 67
From: Melbourne, Australia
Well it's a balance between being "up to date" and "smoother". You cant really be both

But I am open to algorithm change suggestions
Reply
Old May 15, 2008 | 06:49 PM
  #4  
EvoBroMA's Avatar
Evolved Member
 
Joined: Feb 2006
Posts: 1,345
Likes: 1
From: MA
you're using a weighted moving average

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)
the "up to date" is solved by being centered.

this is what i use for my road dyno calcs.
Reply
Old May 15, 2008 | 06:53 PM
  #5  
kkarim's Avatar
Evolving Member
iTrader: (2)
 
Joined: Sep 2007
Posts: 214
Likes: 0
From: Florida / Lebanon
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?
Reply
Old May 15, 2008 | 06:57 PM
  #6  
EvoBroMA's Avatar
Evolved Member
 
Joined: Feb 2006
Posts: 1,345
Likes: 1
From: MA
Originally Posted by kkarim
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?
thats an inherent problem of the general smoothing function.
the "ends" have to be solved using weighted averages the same as he does now.
Reply
Old May 15, 2008 | 07:12 PM
  #7  
tephra's Avatar
Thread Starter
EvoM Guru
15 Year Member
iTrader: (6)
 
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.
Reply
Old May 15, 2008 | 07:13 PM
  #8  
EvoBroMA's Avatar
Evolved Member
 
Joined: Feb 2006
Posts: 1,345
Likes: 1
From: MA
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.
Reply
Old May 15, 2008 | 07:16 PM
  #9  
EvoBroMA's Avatar
Evolved Member
 
Joined: Feb 2006
Posts: 1,345
Likes: 1
From: MA
Originally Posted by tephra
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 think the only way you're gonna find out is trying out different algorithms
should be fun
Reply
Old May 16, 2008 | 12:49 AM
  #10  
tephra's Avatar
Thread Starter
EvoM Guru
15 Year Member
iTrader: (6)
 
Joined: Feb 2007
Posts: 9,486
Likes: 67
From: Melbourne, Australia
Okey Dokey 5pt weighted+centered average. Formula =
Code:
((H2*0.2)+(H3*0.4) + (H4) + (H5*0.9) +(H6*0.8))/(0.2+0.4+1+0.9+0.8)
Reply
Old May 16, 2008 | 05:32 AM
  #11  
jcsbanks's Avatar
Evolved Member
 
Joined: May 2006
Posts: 2,399
Likes: 6
From: UK
See PID thread I've posted. You may want to try it without smoothing, worked for my EBC using PID.
Reply
Old May 16, 2008 | 09:04 AM
  #12  
mrfred's Avatar
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.
Reply
Old May 16, 2008 | 09:25 AM
  #13  
jcsbanks's Avatar
Evolved Member
 
Joined: May 2006
Posts: 2,399
Likes: 6
From: UK
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.
Reply
Old May 16, 2008 | 06:44 PM
  #14  
tephra's Avatar
Thread Starter
EvoM Guru
15 Year Member
iTrader: (6)
 
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..
Reply
Old May 16, 2008 | 07:28 PM
  #15  
mrfred's Avatar
EvoM Guru
iTrader: (50)
 
Joined: Mar 2006
Posts: 9,675
Likes: 132
From: Tri-Cities, WA // Portland, OR
Originally Posted by tephra
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..
You're going to skip every 10 cycles?? Suggest against that.
Reply



All times are GMT -7. The time now is 06:25 PM.