Notices
General Engine Management / Tuning Forum Discuss general EMS tuning concepts that do not pertain to a specfic brand or product.

Dyno Plot smoothing for the mathmatically inclined.

Old Jul 7, 2005 | 09:38 PM
  #16  
barney malone's Avatar
Newbie
 
Joined: May 2005
Posts: 39
Likes: 2
From: california
The reason you can find a "shift" which puts the interpolation back on the curve is because you know where the original location is. If you _know_ the underlying function, you can do a least squares fit or something and get a much better approximation. I have been unable to properly formulate the power/torque curve of a modern automobile -- at least in any kind of closed form.
I was only commenting on the observed shifts in your data because you gave the fit and the noise-less data. As for my fit, I did absolutely NO shifting to fit the original noise-less data.
Also, look at your first NNA plot. At an X_value of 50 your estimate looks like Y_estimate~15. But all the data from X>16 is all above 15. Clearly you are doing something wrong.

Actually the NNA plots _are_ using a 4 point window. The examples I've posted have the filters applied multiple times in order to exaggerate the effects. Each time you apply the smoothing, the plots shifts a little, but it's not a shift 4, 2, or anything that I've found to be meaningful.
Let me guess. In your simple test plots near the top, your "multiple times" was about 100, right? Since your averaging window 4 is even, you will get a 1/2 index shift each time you apply it. Your shift is about 50 so I figure you iterated about 100 times. Try your NNA's with an odd number so that you are averaging the target position and an equal # on either side and your pronounced shifts should go away (you can still obviously get some random shifts, but they should be much much smaller that the rediculous ones you have now).
Note: if you are using much more than 100, then you might be doing things better than I state above, but it is still clear you have an algorithm induced error.

Here's a plot of raw dyno samples, which I've found to be quite a bit more difficult to fit correctly.
Boy, that is some kind-o-crappy data. It brings to mind that there is no magic perfect filter for this kind of application where the actual values can have a relatively arbitrary form. You are basically stuck with a trade off between trying to reduce the noise and to preserve what you can out of the higher spatial frequencies.

That was dustin's car which should have a very stock evo-like poweband. What I don't like about NNA is how resistant it is to sudden peaks or dips.

Perhaps there is a better windowsize to pick for this particular example. Still, a moving window average will have the tendancy to push your points "up" in the direction that you iterate. Here, you can see that the hp level appears artificially high. It even appears to keep going after power is pulled (a little before 7k rpm if memory serves).
I am not sure what you mean by 'have the tendancy to push your points "up" in the direction that you iterate' but it seems obvious to me that you have an artificial ~450rpm shift in torque because of the way you are filtering. Since HP is proportional to TQ*rpm that MIGHT account for the HP shift, I can't tell. Again I urge you to use an odd # of samples in you NNA so that the averaging window stays centered on the target.

Also, your use of very small NNA windows and then re-using it many many many times seems counter productive to me. The width of the impulse response to such filtering is 1+(NW-1)*N_iteration (where NW is the width of your averaging window per smoothing). That is why the fit "appears to keep going after power is pulled" and you won't have very good ability to preserve any high to moderately high spatial frequency content. You would be better off using something like a single iteration of something like the "suggested filter window" shown in that attached plot (although you need to pick its 2 widths yourself). Yeah, the resulting plot won't look as smooth as yours do, but on the one hand you complain about lack of high spatial frequency responce
What I don't like about NNA is how resistant it is to sudden peaks or dips.
if on the other hand you want plots as smooth as yours in the presence of the kind of noise you have... well good luck. Sorry, but you can't have it both ways.

Alternatively, you can take a hint from the image process world and use a median filter or combine a median with one of a variety smoothing filters. The median will get rid of the bad "high flyers" that are obviously bogus and then the smoothing filters don't have to work so hard and can preserve more of the higher spatial frequencies.

Good luck,
B
Attached Thumbnails Dyno Plot smoothing for the mathmatically inclined.-noisefilt2.gif  
Reply
Old Jul 7, 2005 | 10:08 PM
  #17  
galvitron's Avatar
Evolving Member
iTrader: (2)
 
Joined: Sep 2004
Posts: 287
Likes: 0
From: South Bay
Wow, this is INTERESTING. I merely have a minor in Mathematics (major Computer Science), but I follow what is being discussed. I wish I could contribute something but these last couple of posts reached my limit. You guys are obviously serious about curve-accuracy! I'll ask my savvy friends if they got any ideas...

Jeremy
Reply
Old Jul 8, 2005 | 06:48 AM
  #18  
donour's Avatar
Thread Starter
Evolved Member
iTrader: (6)
 
Joined: May 2004
Posts: 2,502
Likes: 1
From: Tennessee, USA
Originally Posted by barney malone
I was only commenting on the observed shifts in your data because you gave the fit and the noise-less data. As for my fit, I did absolutely NO shifting to fit the original noise-less data.
Also, look at your first NNA plot. At an X_value of 50 your estimate looks like Y_estimate~15. But all the data from X>16 is all above 15. Clearly you are doing something wrong.
That's not clear to me. If if my reasoning is incorrect I definitely want to know why.

Let me guess. In your simple test plots near the top, your "multiple times" was about 100, right? Since your averaging window 4 is even, you will get a 1/2 index shift each time you apply it. Your shift is about 50 so I figure you iterated about 100 times.
An good guess, but incorrect. I'm only applying the filter 4 times (which a window size of 4).

Try your NNA's with an odd number so that you are averaging the target position and an equal # on either side and your pronounced shifts should go away (you can still obviously get some random shifts, but they should be much much smaller that the rediculous ones you have now).
Note: if you are using much more than 100, then you might be doing things better than I state above, but it is still clear you have an algorithm induced error.
Quite likely, although I _am_ using an equal number of points left and right.

EDIT: yup, you're right. One big glaring bug had me not using equal length windows on both side and that shifted everything WAY right.

[quote]

Boy, that is some kind-o-crappy data. It brings to mind that there is no magic perfect filter for this kind of application where the actual values can have a relatively arbitrary form. You are basically stuck with a trade off between trying to reduce the noise and to preserve what you can out of the higher spatial frequencies.
[quote]

Exactly. It's also the data of data where you want to be able to see very quick and severe dips as they can correspond to engine events.


I am not sure what you mean by 'have the tendancy to push your points "up" in the direction that you iterate' but it seems obvious to me that you have an artificial ~450rpm shift in torque because of the way you are filtering. Since HP is proportional to TQ*rpm that MIGHT account for the HP shift, I can't tell. Again I urge you to use an odd # of samples in you NNA so that the averaging window stays centered on the target.

Also, your use of very small NNA windows and then re-using it many many many times seems counter productive to me.
Me too, but again, I'm not applying it a high number of times.

[quote]

The width of the impulse response to such filtering is 1+(NW-1)*N_iteration (where NW is the width of your averaging window per smoothing). That is why the fit "appears to keep going after power is pulled" and you won't have very good ability to preserve any high to moderately high spatial frequency content. You would be better off using something like a single iteration of something like the "suggested filter window" shown in that attached plot (although you need to pick its 2 widths yourself). Yeah, the resulting plot won't look as smooth as yours do, but on the one hand you complain about lack of high spatial frequency responce

if on the other hand you want plots as smooth as yours in the presence of the kind of noise you have... well good luck. Sorry, but you can't have it both ways.

[quote]

You're absolutely right. Using a low pass filter, it's not realistic to expect very smooth plots from such messy data.

Alternatively, you can take a hint from the image process world and use a median filter or combine a median with one of a variety smoothing filters. The median will get rid of the bad "high flyers" that are obviously bogus and then the smoothing filters don't have to work so hard and can preserve more of the higher spatial frequencies.

Good luck,
B

Thanks!

d

Last edited by donour; Jul 8, 2005 at 06:59 AM.
Reply
Old Jul 8, 2005 | 07:30 AM
  #19  
donour's Avatar
Thread Starter
Evolved Member
iTrader: (6)
 
Joined: May 2004
Posts: 2,502
Likes: 1
From: Tennessee, USA
Ok, I feel a little better now. barney was right that my NNA plot looked a little retarded. Let's try that one again.

Here's the NNA and savgol applied to previously mentioned ugly dyno data. The plot 0 is the NNA, plot 1 is the savgol:



Here's the same plot after applying more agressive smoothing:



Lo and behold, they are very similiar. This makes sense to me _now_, but again I have very limited experience with signal processing and zero knowledge of image filters.

d
Reply
Old Jul 10, 2005 | 10:34 PM
  #20  
SaabTuner's Avatar
Evolving Member
 
Joined: Jul 2005
Posts: 274
Likes: 0
From: Davis, California
I find it interesting that so much in depth mathematics is necessary to smooth a shape that the human eye can easily perceive; you could draw a line with your hand that would be nearly as accurate as some of the smoothing techniques. (Though a lot less repeatable.)

This got me into thinking. And, though I'm by no means highly qualified, it gave me some ideas. One thought is to use airmass/sec curves to guide the smoothing program as they are directly linked to power. But internal friction causes the peak airmass/sec to be slightly to the right of peak power, and ignition timing farks the whole deal up rather quickly in the likelihood of a knock-event. D'oh!

The other thing I noticed is that these rough curves look a lot like an audio-signal. The "noise" just looks like high-frequency vibrations in the dynamometer. I'd be curious to see if it were possible to simply turn down to the higher frequencies. The "smoothed" graphs just look like a low-frequency audio sample and the "unsmoothed" like a mixed low/high sample.

Since vibration is very likely the source of the erratic measurements in the first place, and since vibration usually happens at certain frequencies and harmonics, it seems natural to try to simply tune them out. Unfortunately I don't have the tools to even attempt to do this.

Just food for thought I suppose ...

Adrian~
Reply
Old Jul 11, 2005 | 06:56 AM
  #21  
donour's Avatar
Thread Starter
Evolved Member
iTrader: (6)
 
Joined: May 2004
Posts: 2,502
Likes: 1
From: Tennessee, USA
Originally Posted by SaabTuner
I find it interesting that so much in depth mathematics is necessary to smooth a shape that the human eye can easily perceive; you could draw a line with your hand that would be nearly as accurate as some of the smoothing techniques. (Though a lot less repeatable.)
Sometimes yes, sometimes no. There really isn't much mathematics in it at all (no proofs). A lot of processes that seem simple on the surface, turn out to me dazzlingly complex in practice.

This got me into thinking. And, though I'm by no means highly qualified, it gave me some ideas. One thought is to use airmass/sec curves to guide the smoothing program as they are directly linked to power. But internal friction causes the peak airmass/sec to be slightly to the right of peak power, and ignition timing farks the whole deal up rather quickly in the likelihood of a knock-event. D'oh!
One could argue that we're going about this is the wrong way and that what we should do is model generated kinetic energy and then try to fit the data. So, who wants to come up with the model?...Enjoy reading thousands of SAE back journals


The other thing I noticed is that these rough curves look a lot like an audio-signal. The "noise" just looks like high-frequency vibrations in the dynamometer. I'd be curious to see if it were possible to simply turn down to the higher frequencies. The "smoothed" graphs just look like a low-frequency audio sample and the "unsmoothed" like a mixed low/high sample.
They look sort of like an audio signal, but the number of samples is much, much lower. I tried to remove some of the sever outliers, but ended up introducing a scale bias that would throw off calibration attempts.

Since vibration is very likely the source of the erratic measurements in the first place, and since vibration usually happens at certain frequencies and harmonics, it seems natural to try to simply tune them out. Unfortunately I don't have the tools to even attempt to do this.
Actually, I blame the ugliness on the sampling rate. The event were're measuring isn't very long ( a few seconds) and we only get about 1000 samples total. I think it would clean up significantly with more samples and higher precision PC. That data isn't taken directly from the tach signal wire. That is a datalog from an Xede and the sampling is done by a script on my laptop.

d

Last edited by donour; Jul 11, 2005 at 07:06 AM.
Reply
Old Jul 11, 2005 | 09:38 AM
  #22  
SaabTuner's Avatar
Evolving Member
 
Joined: Jul 2005
Posts: 274
Likes: 0
From: Davis, California
There really isn't much mathematics in it at all (no proofs). A lot of processes that seem simple on the surface, turn out to me dazzlingly complex in practice.
Ahhh. I should have just said "computations". I've just managed the through Mult-var-calc and diff-eq and hadn't heard of some of these. But I've done nothing with signal processing/filtering.

One could argue that we're going about this is the wrong way and that what we should do is model generated kinetic energy and then try to fit the data. So, who wants to come up with the model?...Enjoy reading thousands of SAE back journals
Hah. Yeah, been there, done that. I actually have a pretty nice non-SAE doctoral thesis from Linkoping about ignition control modelling using an ion-sensor. It gives interesting pressure-modelling possibilities and the ion-sensor was the spark-plug, which makes it mechanically simple. With the pressure modelling you could get an extremely accurate pressure reading for the cyllinder. Integrating over the motion of the piston against the crank would give very detailed combustion analysis. But that's waaaaay overkill for these purposes. Anyway, if you want to read, here's a link to the PDF.

Actually, I blame the ugliness on the sampling rate. The event were're measuring isn't very long ( a few seconds) and we only get about 1000 samples total. I think it would clean up significantly with more samples and higher precision PC. That data isn't taken directly from the tach signal wire. That is a datalog from an Xede and the sampling is done by a script on my laptop.
Ok, that makes more sense. I was sitting here wondering how on earth that much noise got picked up through the motion/flow sensors on whatever style dynamometer that was. It makes much more sense now. But, why not just run the RPM signal off the tach-wire? (Pardon my Evo n00bness if there's an obvious reason for that. My Viggen has Direct Ignition, but the tach wire is still easy enough to find.)

Sorry for butting into your discussion.

Adrian~
Reply
Old Jul 11, 2005 | 10:15 AM
  #23  
donour's Avatar
Thread Starter
Evolved Member
iTrader: (6)
 
Joined: May 2004
Posts: 2,502
Likes: 1
From: Tennessee, USA
Originally Posted by SaabTuner
Ahhh. I should have just said "computations". I've just managed the through Mult-var-calc and diff-eq and hadn't heard of some of these. But I've done nothing with signal processing/filtering.



Hah. Yeah, been there, done that. I actually have a pretty nice non-SAE doctoral thesis from Linkoping about ignition control modelling using an ion-sensor. It gives interesting pressure-modelling possibilities and the ion-sensor was the spark-plug, which makes it mechanically simple. With the pressure modelling you could get an extremely accurate pressure reading for the cyllinder. Integrating over the motion of the piston against the crank would give very detailed combustion analysis. But that's waaaaay overkill for these purposes. Anyway, if you want to read, here's a link to the PDF.
Yeah, you posted that to nasioc. It's on the stack of stuff for me to read when i get to my office tomorrow.

Ok, that makes more sense. I was sitting here wondering how on earth that much noise got picked up through the motion/flow sensors on whatever style dynamometer that was. It makes much more sense now. But, why not just run the RPM signal off the tach-wire? (Pardon my Evo n00bness if there's an obvious reason for that. My Viggen has Direct Ignition, but the tach wire is still easy enough to find.)
Oh, it's not problem at all if you want build a full service dyno system, but lots of people already do that. I'm interested only in processing logfiles generated by the Xede (or other ecu systems). The motivation is to up the sophistication of your at-home ecu mapper, not contend with mustang or dynojet.

Sorry for butting into your discussion.
Not a problem. Thoughtful input is always welcome.

d
Reply
Old Jul 14, 2005 | 10:26 PM
  #24  
Matz's Avatar
Evolving Member
iTrader: (3)
 
Joined: Feb 2005
Posts: 293
Likes: 6
From: Earth
Originally Posted by galvitron
Wow, this is INTERESTING. I merely have a minor in Mathematics (major Computer Science), but I follow what is being discussed. I wish I could contribute something but these last couple of posts reached my limit. You guys are obviously serious about curve-accuracy! I'll ask my savvy friends if they got any ideas...

Jeremy
I'm finding this discussion very interesting as well, but despite having taken many math courses, I have no idea what the hell anyone is talking about.

Anyone want to tutor me in math? )
Reply
Old Jul 15, 2005 | 05:32 AM
  #25  
donour's Avatar
Thread Starter
Evolved Member
iTrader: (6)
 
Joined: May 2004
Posts: 2,502
Likes: 1
From: Tennessee, USA
Originally Posted by Matz
I'm finding this discussion very interesting as well, but despite having taken many math courses, I have no idea what the hell anyone is talking about.

Anyone want to tutor me in math? )
The idea is that we have signal (an our case torque calculate by torque = dRPM/dTime), which is noisy. We want to filter out that noise so that patterns and features of the signal are visible to the eye. As it stands, raw input looks pretty much like a sea of points.

The typical method used in data analysis is called the linear regression. Specifically, most people use a least squares fitting (http://mathworld.wolfram.com/LeastSquaresFitting.html). This works very well if you have an model for the data that you're trying to fit. However, I've never seen a formulation of torque vs. RPM for a forced induction engine. We know general things about the shape of the curve, but I would need to find something more precise to use least squares. Thus I've been exploring other options.

I hesitate to call what I'm doing math, because it's very much of a black art. Even numerical recipes admits that this is a "murky area" where there is little theoretical foundation.

d
Reply
Old Aug 4, 2005 | 04:44 PM
  #26  
ShaunSG's Avatar
Evolving Member
iTrader: (1)
 
Joined: Nov 2003
Posts: 296
Likes: 0
Originally Posted by SaabTuner
Integrating over the motion of the piston against the crank would give very detailed combustion analysis.
Hi Adrian, the problem with is that in the upper RPM range which is of major concern in high performance and racing applications is that the crankshaft is more ratcheting rather than rotating. Crankshafts are twisting and bending, rods are bending, twisting, and stretching, camshafts twisting and bending. The cam drive system also has some degree of distortion.


Kind regards
Shaun
Reply
Old May 15, 2010 | 09:18 AM
  #27  
donour's Avatar
Thread Starter
Evolved Member
iTrader: (6)
 
Joined: May 2004
Posts: 2,502
Likes: 1
From: Tennessee, USA
*yawn*

Time to wake up a dead thread. I haven't looked at this problem in about 5 years, but now it's back.

I'm very curious to know what people are doing and especially how they are handling samples that are not uniformly distributed in time.

d
Reply
Old May 15, 2010 | 01:00 PM
  #28  
mrfred's Avatar
EvoM Guru
iTrader: (50)
 
Joined: Mar 2006
Posts: 9,675
Likes: 132
From: Tri-Cities, WA // Portland, OR
Originally Posted by donour
*yawn*

Time to wake up a dead thread. I haven't looked at this problem in about 5 years, but now it's back.

I'm very curious to know what people are doing and especially how they are handling samples that are not uniformly distributed in time.

d
I do all my dataset analysis in Excel these days. I can accomplish most things using in-cell formulas, but if needed I use VBA. Using linear interpolation, should be pretty straightforward to convert a non-uniformly spaced dataset into a uniformly spaced dataset. I haven't looked at how I would implement it, but it seems that it might be possible to do it using an in-cell formula, and if not, I'm sure it can be done using VBA.

If you haven't already taken a peek, my code in VDR is just NNA. I never bothered with trying to make an evenly spaced dataset, but I think J_of_T added it to VDR to simplify the final data smoothing operation.
Reply
Old May 15, 2010 | 02:32 PM
  #29  
donour's Avatar
Thread Starter
Evolved Member
iTrader: (6)
 
Joined: May 2004
Posts: 2,502
Likes: 1
From: Tennessee, USA
Originally Posted by mrfred
I do all my dataset analysis in Excel these days. I can accomplish most things using in-cell formulas, but if needed I use VBA. Using linear interpolation, should be pretty straightforward to convert a non-uniformly spaced dataset into a uniformly spaced dataset. I haven't looked at how I would implement it, but it seems that it might be possible to do it using an in-cell formula, and if not, I'm sure it can be done using VBA.

If you haven't already taken a peek, my code in VDR is just NNA. I never bothered with trying to make an evenly spaced dataset, but I think J_of_T added it to VDR to simplify the final data smoothing operation.
I'd be interested in seeing your spreadsheet. I'm amazed that JoT's vdr code produces a dyno plot that looks almost exactly like a recent dynojet pull of my car. My smoothing code produces similar results, but not feature-for-feature.

d
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Boosted Tuning
Evo Dyno Tuning / Results
128
May 23, 2025 01:08 PM
akeric
Evo Dyno Tuning / Results
12
Jul 18, 2011 04:49 AM
donour
Evo Dyno Tuning / Results
17
Dec 2, 2010 08:42 AM
DrivelineSales
Vendor Announcements
50
Feb 23, 2010 10:24 AM
razorlab
Evo Engine / Turbo / Drivetrain
40
Mar 10, 2008 11:19 PM


Thread Tools
Search this Thread

All times are GMT -7. The time now is 02:35 PM.