"Noisy" tpsDOT

This is a forum for discussing the development and testing of alpha MS2/Extra code. Documentation
(Runs on MS2 and Microsquirt)

Moderators: jsmcortina, muythaibxr

Post Reply
jsmcortina
Site Admin
Posts: 39569
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: "Noisy" tpsDOT

Post by jsmcortina »

robs wrote:Afraid you're right -- a patch file is a list of differences between one version of code and another. It's a fairly popular way of sharing edits among nerds (I pretend to be one from time to time).
diff/patch are indeed very useful tools to compare differences apply changes from one code to another. I wouldn't use the word 'nerd' myself, they are part of the toolbox of any serious programmer.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
vtmegasquirter
Helpful MS/Extra'er
Posts: 136
Joined: Tue Aug 31, 2010 11:17 am

Re: "Noisy" tpsDOT

Post by vtmegasquirter »

So, will this be incorporated in the next release or do we need to download the batch file?
Greg G
Experienced MS/Extra'er
Posts: 311
Joined: Thu Mar 10, 2011 11:33 pm

Re: "Noisy" tpsDOT

Post by Greg G »

Excellent reading for those who want to understand all this:
http://www.controlguru.com/wp/p82.html
1996 Mazda MX-5 1.6L NA6/ Mazdaspeed M45 SC/ BSP AW Intercooler/ Maruha F-cams/ 425cc RX-8 injectors/ DIYPNP

MS2/Extra test mule :)
robs
Master MS/Extra'er
Posts: 564
Joined: Sun Jan 17, 2010 4:26 pm
Location: Sydney, Australia

Re: "Noisy" tpsDOT

Post by robs »

A quick update on this stuff...

Just over a week ago, I finally got a good chance to do a concentrated tuning session on accel. Pretty happy with the results. I have been able to get it that the AFR doesn't change very much under acceleration and the car's response is quite bright for the old slug that it is.

Couple of points for anyone who wants to try the changes (for those who are unable to build, the TPS changes (but not the MAP changes) are in the gslender version):

  • tpsDOT now has a much larger range because the TPS lag value no longer affects it. As fast as I could stomp on the pedal in my car got about 1400. Actual fuel needed for those speeds didn't seem much different from the 4-500 range, so I spared my throttle cable the strain and didn't tune up there.
  • using mapDOT for gentle accel, augmented with tpsDOT for quicker bursts has worked out nicely. Slowest tpsDOT I work with is 40, but it only injects a tiny amount; 100 is where it starts to get more significant. Smallest mapDOT value was 8. Car was fairly driveable with tpsDOT alone, better with mapDOT alone, but nice with a 50:50 mix.
  • running 30% lag factors for both TPS (only cosmetic) and MAP (smoothed out the fuelling quite a bit).
  • economy continues to be good. Considering the more spirited driving, sitting and revving, etc., for tuning, the last fill was only marginally more fuel used than the one before it and more than 10% better mileage than other recent fills.
I had tried similar sessions with the existing accel code, but always seemed to end up chasing my tail. There was so much chatter in the tpsDOT log in particular; I tried but failed to get the accel enrichment I needed without getting a lot that I didn't need at other times. I ended up telling it to ignore everything below 60 and relied on MAP to look after the low speed stuff (which makes sense anyway). Now, there seems to be a much better correspondence between the graphs and I've brought in the TPS accel a good deal earlier.

Have fun,

Robert.
gslender
Super MS/Extra'er
Posts: 1072
Joined: Fri Sep 16, 2011 5:29 am
Location: Brisbane, Australia
Contact:

Re: "Noisy" tpsDOT

Post by gslender »

robs wrote:Couple of points for anyone who wants to try the changes (for those who are unable to build, the TPS changes (but not the MAP changes) are in the gslender version):
I'm gonna look at the mapDOT code and aim to intergrate this too... so keep a look out for v2 with this new feature.
robs wrote:running 30% lag factors for both TPS (only cosmetic) and MAP (smoothed out the fuelling quite a bit).
Can you explain this further - what do you mean by cosmetic lag factor for TPS? when previously you mentioned TPS was at 100% - are you now saying it works fine at 30% lag ??

G
Mazda MX5 + MS3 Pro
muythaibxr
Site Admin
Posts: 8228
Joined: Thu Oct 14, 2004 12:48 pm

Re: "Noisy" tpsDOT

Post by muythaibxr »

gslender wrote:
robs wrote:Couple of points for anyone who wants to try the changes (for those who are unable to build, the TPS changes (but not the MAP changes) are in the gslender version):
I'm gonna look at the mapDOT code and aim to intergrate this too... so keep a look out for v2 with this new feature.
Woah there.. Please hold off on that for now. I want to get the other things you've been working on integrated separately.

As far as this stuff goes, I'm not sure I'm happy with how it's implemented. I would much prefer to see how James' sliding window code works on MAPdot and TPSdot as they don't require any special settings or tuning.

Ken
Megasquirt is not for use on pollution controlled vehicles. Any advice I give is for off road use only.
tpsretard2
Master MS/Extra'er
Posts: 662
Joined: Thu Feb 14, 2008 4:59 am

Re: "Noisy" tpsDOT

Post by tpsretard2 »

i like the idea of being able to set the filters for it.
like what was done with gslender's version.

but anything will help it :)
muythaibxr
Site Admin
Posts: 8228
Joined: Thu Oct 14, 2004 12:48 pm

Re: "Noisy" tpsDOT

Post by muythaibxr »

Basically, my goal is to get the best functionality possible with the least number of configuration options. I feel that the sliding window method is the best way to achieve this goal.

We're actively making changes in ms3 (such as our new AE that has far fewer tuning parameters, or some of my idle speed control changes that are coming in the near-term that are meant to reduce the amount of tuning necessary) that should simplify many features that will be backported to MS2 (and one or two of gslender's ideas will also be forward ported to ms3, with the ports in both directions being done for the sake of ease of maintainability).

In any case, in the case of rob's work, I believe that his work makes a positive difference, but I think the sliding window code will be more simple to understand and use for our users, and more simple to document; both while preserving similar filtering capability to what robs has done.

It's one thing to contribute code, and while I'm sure robs and gslender will be around for a while, James and I (and Jean for ms2) are the ones that will have to maintain and support that code, so I want to do what makes the most sense from that standpoint (and that's why I'm trying to simplify several other features while I'm at it; MAP sampling is another example).

Ken
Megasquirt is not for use on pollution controlled vehicles. Any advice I give is for off road use only.
robs
Master MS/Extra'er
Posts: 564
Joined: Sun Jan 17, 2010 4:26 pm
Location: Sydney, Australia

Re: "Noisy" tpsDOT

Post by robs »

gslender wrote:Can you explain this further - what do you mean by cosmetic lag factor for TPS? when previously you mentioned TPS was at 100% - are you now saying it works fine at 30% lag ??
The latest code (as posted in this thread) bases the tpsDOT and mapDOT values on the raw ADC reading. You can run whatever lag factor you like, it won't change the xxxDOT response. Since TPS isn't used for much, the lag value just makes the graph look better.
muythaibxr wrote: In any case, in the case of rob's work, I believe that his work makes a positive difference, but I think the sliding window code will be more simple to understand and use for our users, and more simple to document; both while preserving similar filtering capability to what robs has done.
No disagreement from me on the logistical argument -- you maintain the code you want to maintain. A couple of points though:
  • It would be possible to reduce the tuning parameters for the tpsDOT code to one -- a "significant TPS change" radius. The time parameter needn't be seen by the user; it can be inferred from the existing tpsthresh parameter (whatever it's called -- the minimum tpsDOT value that AE looks for). If the user wants tpsDOT down to 25%/s, and has specified a TPS change threshold of 1.0%, the code (MS or Tuner Studio) can work out that the anchor point must persist for at least 1/25s; four samples at today's polling rate. So all you have to explain to the user is that they should look at the typical jitter, be it from electrical noise or just vibration, and set the radius to something larger than this. Doesn't seem too hard.
  • I'd be keen to see a clear description of the planned solution. A sliding window could be any of a number of things, indeed it can be applied to what I have implemented (though I prefer the metaphor of a moving anchor). As I said earlier in this thread, the rpmDOT approach of working out the slope of the least squares line of best fit on a sliding window of recent samples is going to be horribly slow to respond unless you make the window so narrow that you barely get any noise reduction. But that's a shot in the dark, I simply don't know whether that's what you have in mind.
I'll be very happy to see my code consigned to the scrapheap by a simpler, equally effective alternative.

Have fun,

Rob.
muythaibxr
Site Admin
Posts: 8228
Joined: Thu Oct 14, 2004 12:48 pm

Re: "Noisy" tpsDOT

Post by muythaibxr »

Fair enough, we're still testing the method I think will work just as well in MS3.

If you can get the tunables down to as few as possible, I'll consider it for inclusion into the ms2/extra code provided that your licensing terms are such that I can port it to MS3 as well, but only if the sliding window option doesn't work or doesn't work as well.

Ken
Megasquirt is not for use on pollution controlled vehicles. Any advice I give is for off road use only.
robs
Master MS/Extra'er
Posts: 564
Joined: Sun Jan 17, 2010 4:26 pm
Location: Sydney, Australia

Re: "Noisy" tpsDOT

Post by robs »

muythaibxr wrote: If you can get the tunables down to as few as possible, I'll consider it for inclusion into the ms2/extra code provided that your licensing terms are such that I can port it to MS3 as well, but only if the sliding window option doesn't work or doesn't work as well.
So should gslender un-whoa on incorporating the mapDOT changes? If you'd rather he didn't, I'll leave further tweaks to the xxxDOT stuff until you've come to a decision on the sliding window approach. OTOH, if he is to go ahead, he and I can discuss how to trim down the tunables.

[Edit] For the record, unless I say otherwise at the time, code I post to these forums is in the public domain; do with it as you please.

Have fun,

Rob.
muythaibxr
Site Admin
Posts: 8228
Joined: Thu Oct 14, 2004 12:48 pm

Re: "Noisy" tpsDOT

Post by muythaibxr »

I want to compare sliding window to your method before incorporating it anywhere as well as discussing with James.

Ken
Megasquirt is not for use on pollution controlled vehicles. Any advice I give is for off road use only.
Jobro
Helpful MS/Extra'er
Posts: 139
Joined: Wed Aug 16, 2006 12:24 am
Location: Brisbane, Australia

Re: "Noisy" tpsDOT

Post by Jobro »

What about increasing the sample rate and using a real DSP filter.
1982 RX-7 12A, MSII V3.0, running ms2extra 2.1.0E

Series 5 RX-7 throttle bodies, 2xID725, 2x1600
Complete fuel,ignition, and electric fan control. 11.828@124.30mph
robs
Master MS/Extra'er
Posts: 564
Joined: Sun Jan 17, 2010 4:26 pm
Location: Sydney, Australia

Re: "Noisy" tpsDOT

Post by robs »

Jobro wrote:What about increasing the sample rate and using a real DSP filter.
Your suggestion is too vague. MAP or TPS? What specific filter do you think would be appropriate: for the value; and for valueDOT?

Have fun,

Rob.
Jobro
Helpful MS/Extra'er
Posts: 139
Joined: Wed Aug 16, 2006 12:24 am
Location: Brisbane, Australia

Re: "Noisy" tpsDOT

Post by Jobro »

Take 8/4/2 adc samples (10bit fullscale = 1023counts), accumulate them into a a 16 unsigned variable. Count should range between 0 to 8184 decimal. Roll that s*** right 3/2/1 times without carry. That is your sample. Send that s*** into the filter I describe below.

Fs=100Hz
Fc=10Hz
4th order fixed point implementation of IIR Butterworth decomposed into 2x SOS (second order systems).
1982 RX-7 12A, MSII V3.0, running ms2extra 2.1.0E

Series 5 RX-7 throttle bodies, 2xID725, 2x1600
Complete fuel,ignition, and electric fan control. 11.828@124.30mph
muythaibxr
Site Admin
Posts: 8228
Joined: Thu Oct 14, 2004 12:48 pm

Re: "Noisy" tpsDOT

Post by muythaibxr »

I think the only way you are going to get that kind of filter on MS is to implement it in analog form. Reading around on digital implementations makes it look very math heavy with a lot of floating point math. i wouldn't mind doing this with a DSP but this kind of filter on the ms2 or ms3 chips would spend a lot of the chip's time just filtering.

Ken
Megasquirt is not for use on pollution controlled vehicles. Any advice I give is for off road use only.
1031
MS/Extra Newbie
Posts: 17
Joined: Wed Apr 14, 2010 4:39 am

Re: "Noisy" tpsDOT

Post by 1031 »

Hello. I did quick reading of this topic (so sorry if this has came up before) We had similar problems at our rally car, noise on tps signal, so much that triggered accel enrichmet and AFR went too rich..we was able to finish that rally.... about 8 spark plugs was needet :lol:
I looked some signals wiht oscilloscope and there was really "noise floor" that was culprit and it triggered that accel enrichmet.
My solution was replace polyfuse (F1) wiht normal (miniatyre) one. board in question is V3.0 /MS2. Vref goes throught it.
robs
Master MS/Extra'er
Posts: 564
Joined: Sun Jan 17, 2010 4:26 pm
Location: Sydney, Australia

Re: "Noisy" tpsDOT

Post by robs »

Jobro wrote:Take 8/4/2 adc samples (10bit fullscale = 1023counts), accumulate them into a a 16 unsigned variable. Count should range between 0 to 8184 decimal. Roll that s*** right 3/2/1 times without carry. That is your sample. Send that s*** into the filter I describe below.

Fs=100Hz
Fc=10Hz
4th order fixed point implementation of IIR Butterworth decomposed into 2x SOS (second order systems).
You have answered one of the three questions. Are you interested in MAP or TPS? Is the filter targeted at MAP or mapDOT; TPS or tpsDOT?

In any case, oversampling by 8 or 4 or 2 and using the mean of those samples isn't much of an improvement over using the lag filters. As for using a software bandpass filter, why?

If we're talking TPS, it's just a glorified volume control knob; it's not like the TPS value is itself very important.

If it's MAP, the sound wave effects within the intake tract would certainly make for some interesting analysis, but I would be surprised if the output of a general purpose Butterworth filter was any better than what we have now. The largest fluctuations in the MAP reading aren't noise, they are all (well, mostly, see MAP spike thread) legitimate point samples of the manifold pressure. The code hopes to turn this into a single number well correlated to how well filled each cylinder is going to be. The current algorithm allows the user to pick a part of the engine cycle which will be sampled and the lowest MAP reading in that window is our magic number. It may be that some other heuristic would more closely relate to cylinder filling. Seems to me that this is an interesting area for research.

But doing all this number crunching without a clear model in mind seems to me to be in the same league as astrology.

Have fun,

Rob.
Jobro
Helpful MS/Extra'er
Posts: 139
Joined: Wed Aug 16, 2006 12:24 am
Location: Brisbane, Australia

Re: "Noisy" tpsDOT

Post by Jobro »

Hi

I meant all Raw Measurements (especially those that make a big impact of fueling or ign angle)

MAP
TP
CLT
MAT
BATTV

Fs= Sampling Frequency
Fc = Cutoff frequency

FYI meant Butterworth lowpass.

The two techniques I listed are sound DSP techniques. There will be a negligible time lag, and the consequence of having good measurements will be priceless.
1982 RX-7 12A, MSII V3.0, running ms2extra 2.1.0E

Series 5 RX-7 throttle bodies, 2xID725, 2x1600
Complete fuel,ignition, and electric fan control. 11.828@124.30mph
jsmcortina
Site Admin
Posts: 39569
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: "Noisy" tpsDOT

Post by jsmcortina »

robs wrote:In any case, oversampling by 8 or 4 or 2 and using the mean of those samples isn't much of an improvement over using the lag filters.
I didn't spend a great deal of time considering it, but my thoughts were that it _could_ help with single point noise in particular. The increased sample rate would add more filtering with greater response.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
Post Reply