[rusEfi] Miata NA 1990, 1.6L stock #21

Your chance to introduce yourself and your vehicle
Post Reply
tomiata
contributor
contributor
Posts: 234
Joined: Sat Aug 02, 2014 2:30 am
Location: Texas

Re: Miata NA 1990, 1.6L stock #21

Post by tomiata »

The problem is with the PE3 pin change. I made these changes to board.h and I can start fine:

Code: Select all

724c730
<                                      PIN_MODE_INPUT(GPIOE_PIN3) |        \
---
>                                      PIN_MODE_OUTPUT(GPIOE_PIN3) |        \
772c778
<                                      PIN_PUPDR_PULLDOWN(GPIOE_PIN3) |       \
---
>                                      PIN_PUPDR_FLOATING(GPIOE_PIN3) |       \
I didn't look into it, but is it coupled to PA6 because of the MEMS SPI or something in chibios? Maybe this pin should be put back to be GPIO_CS_SPI?
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Miata NA 1990, 1.6L stock #21

Post by kb1gtt »

I just wanted to take a minute and thank you for the effort. It's really handy that you tracked this down. I know @russian is doing what he can to make these bugs go away, but with out hardware, it's really handy to have some good descriptions and systematic approach for isolating a problem. So just wanted to take a moment and say thanks.
Welcome to the friendlier side of internet crazy :)
User avatar
AndreyB
Site Admin
Posts: 14323
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Miata NA 1990, 1.6L stock #21

Post by AndreyB »

Just committed your change, http://rusefi.com/build_server/ has the latest version with it already.

It's so amazing to get bug fixes! Thank you.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
tomiata
contributor
contributor
Posts: 234
Joined: Sat Aug 02, 2014 2:30 am
Location: Texas

Re: Miata NA 1990, 1.6L stock #21

Post by tomiata »

Yes, good to squish a bug, rather satisfying :-)

Back to the question from Oct 7:
russian wrote:I've made yet another fuel miss fix recently but have not yet had a chance to try it, any chance you can compare the before and current firmware versions?
Here are logs from a drive tonight with Oct. 17 firmware. Are you ok with rar compressed format? The files are a bit large from a 13 minute drive to the gas station and back. It drives pretty well. I notice a couple of misses but not many.
Attachments
2016-10-17.rar
(858.72 KiB) Downloaded 303 times
User avatar
AndreyB
Site Admin
Posts: 14323
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Miata NA 1990, 1.6L stock #21

Post by AndreyB »

tomiata wrote:I notice a couple of misses but not many.
I know spark missed fixing has not yet started (similar pattern just different code, so hopefully fixable), but the log also reports 11 occurrences of CUSTOM_OBD_SKIPPED_FUEL = 6046 so even fuel miss is still there.

The way I reproduce this on a bench: I take a naked discovery, add jumper wires for PC5, PC6, PD1 & PD2 (trigger input and simulation - the wires help me avoid noise on trigger input, for this wires are better than self-stimulation)
I then set some voltages using on of the following

Code: Select all

	addConsoleActionF("set_mock_clt_voltage", setCltVoltage);
	addConsoleActionF("set_mock_iat_voltage", setIatVoltage);
	addConsoleActionF("set_mock_maf_voltage", setMafVoltage);
	addConsoleActionF("set_mock_afr_voltage", setAfrVoltage);
	addConsoleActionF("set_mock_tps_voltage", setTpsVoltage);
	addConsoleActionF("set_mock_map_voltage", setMapVoltage);
	addConsoleActionF("set_mock_vbatt_voltage", setVBattVoltage);
}
for instance set_mock_vbatt_voltage 2.5 and then I tap my fingers on the rest of the input pins - this produces noisy inputs which produces full variation which I am hoping would reproduce the corner case of the logic on the bench.
Attachments
screenshot.png
screenshot.png (71.92 KiB) Viewed 17895 times
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
tomiata
contributor
contributor
Posts: 234
Joined: Sat Aug 02, 2014 2:30 am
Location: Texas

Re: Miata NA 1990, 1.6L stock #21

Post by tomiata »

stefanst wrote:I'm looking at your log (2016-10-08-14-24).
There are quite a few things that seem odd. Some or all of this may be explained in the previous pages, but I was too lazy to read it all. So my apologies if I'm asking something that has already been answered.

- The log does not show an RPM reading. Since rpm is calculated from the trigger (cam in your case, I believe), there is no way for the ECU to inject fuel or spark a plug if there's no rpm signal. Was that log taken while cranking?
- If it was taken while cranking, then you have a problem reading the cam-sensor
- Your log doesn't include pulsewidth
- MAP of around 10kpa does not make any sense for an engine at idle or cranking. Should be at least 25kpa or so. Check your sensor calibration. Does MAP change when cranking (should be lower than sitting still)
- At the very beginning, your MAP is at 133kpa. This also makes not sense (you'd have to be 3000m below the earth's surface for that)
- You are using MAP and not AFM- correct?

Good luck!

Ok, I worked on calibrating my MAP output. Now not reading below the earth's surface. And I had to start over on my tune. I got it sort of stable at idle and ran a long time of auto-tune with Tunerstudio. Tune is very rough but can you take a look and give a critique? Log show CLT is very noisy. I get some lean spikes, I'm not sure why. They don't coincide with fuel misses as far as I can tell.
ve-table-10-18.jpg
ve-table-10-18.jpg (204.28 KiB) Viewed 17882 times
Thanks!
Attachments

[The extension msq has been deactivated and can no longer be displayed.]

rus397.msl
(372.4 KiB) Downloaded 640 times
stefanst
contributor
contributor
Posts: 703
Joined: Wed Feb 17, 2016 12:24 am
Location: USA 08530

Re: Miata NA 1990, 1.6L stock #21

Post by stefanst »

I'd say the AFRs in your log look pretty good! Maybe not quite perfect, but definitely good enough. The only time you get those lean spikes is during tip-in. Meaning the highly dynamic situation when you press on the loud-pedal rapidly and cause injected fuel to deposit on the intake runners.
So "all you need to do" now is to tune your accel-enrichment.
You can probably start with tuning the TPS-based enrichment. Now here is where I'm not 100% ceratin anymore what is what, so I'm going on some assumptions here:
- What's called 'tps delta' in the log is what we base the accel-enrichment calculation on
- What's called 'tps fuel' in the log is the additional amount of fuel injected as accel enrichment based on TPS

So one thing is clear: In your log 'tps delta' never exceeded 28.07. Your threshold is set to 40. So TPS-based accel enrichment doesn't ever happen. I'd say lower the threshold drastically. Maybe '2'?

You do get into the range of the Engine Load based enrichment and this may very well be what made the car driveable at all.

There isn't much experience out there in tuning the enrichment on rusefi, so we should probably take an incremental approach. Make a change, drive around and log. Post log and discuss.

EDIT: You should probably also have a TPS accel multiplier of >0 :)
tomiata
contributor
contributor
Posts: 234
Joined: Sat Aug 02, 2014 2:30 am
Location: Texas

Re: Miata NA 1990, 1.6L stock #21

Post by tomiata »

There isn't much experience out there in tuning the enrichment on rusefi, so we should probably take an incremental approach. Make a change, drive around and log. Post log and discuss.
I didn't have much time to look at this tonight, but I tweaked the ve table a bit to look a little smoother. And I lowered tps enrichment to just 20%. But on the tps to tps table, I was not sure what it needs. I just set it to 1 for all values, I assume that does nothing, right? What would be reasonable values to try?

I drove with some more aggressive throttle. See what you think...

Thanks!
Attachments
rus402.msl
(350.82 KiB) Downloaded 572 times
stefanst
contributor
contributor
Posts: 703
Joined: Wed Feb 17, 2016 12:24 am
Location: USA 08530

Re: Miata NA 1990, 1.6L stock #21

Post by stefanst »

Great progress!

a few things I noticed so far:
- First the odd guy out: at 131 seconds you have a el_delta of 130.79, even though your MAP doesn't increase. Looks like a firmware bug to me.

- Your threshold for TPS accel still seems too high. Your real-life TPS delta barely ever gets above 20. I'd lower it to 2 or so and see what happens.
- The duration for TPS based accel with 12 cycles seems fairly long to me. I'd say we'd probably need more like 6- same as load-based. Or maybe even less, since TPS accel should really only deal with tip-in and load based should do the rest
- You need to fill in the other two accel tables: the taper for load based and the multiplier for TPS based enrichments

To our software guys: I think we should probably also have a taper for the TPS based enrichment. More testing is needed.

I have some suggestions for these tables below- again: I have NO CLUE what these values need to be. AFAIK nobody has tuned this yet. So I'm pulling numbers from places where they shouldn't be pulled from.

Taper:
In my experience when you give a constant additional shot of fuel for a number of cycles you get too rich towards the end. This also bears out with the wall-wetting theory. One way to deal with that is to taper off the enrichment.
suggested_accel_taper.png
suggested_accel_taper.png (19.83 KiB) Viewed 17861 times
TPS-based enrichment:
Going from 90% TPS to 100% TPS requires less additional fuel than going from 0% to 10%, because throttle bodies are not linear restrictions to flow and probably all kinds of other sciency stuff. So having a constant multiplier for your TPS delta applied across the hole range will not work too well. Hence we need a way to model that behavior. That's what the table below is for. Again those numbers are guesses. There is no real world experience behind them yet.
suggestd_tps_accel.png
suggestd_tps_accel.png (42.76 KiB) Viewed 17861 times
Please note that I changed the x- and y-axis from the original. Suggested spacing didn't make a lot of sense to me.

Keep up the good work and keep us posted with logs and corresponding MSQs. I don't think @ will be able to assist until Monday, but I'll be happy to try and diagnose what's going on.

Good luck!
stefanst
contributor
contributor
Posts: 703
Joined: Wed Feb 17, 2016 12:24 am
Location: USA 08530

Re: Miata NA 1990, 1.6L stock #21

Post by stefanst »

Also:
- Only tune accel enrichment on a warmed up engine. Cold engines need more fuel, that's not part of the firmware yet.
- If you lower the TPS threshold to 2 and enter the TPS-table, just idle the car and see what happens if you blip the throttle. If the engine bogs down and goes pig-rich, you need to lower the added fuel. I'd go with drastic steps- just multiply the whole table by 0.2 or so. If it still goes lean, do the opposite, but maybe a little less drastic.
tomiata
contributor
contributor
Posts: 234
Joined: Sat Aug 02, 2014 2:30 am
Location: Texas

Re: Miata NA 1990, 1.6L stock #21

Post by tomiata »

Wow, thanks a lot @stefanst, this is very helpful. I didn't try any more tweaks yet, but I have lots more data. I took the car on a trip tonight and ran rusefi for the first couple of hours, doing 65 to 75 highway driving. The misses/hesitations are pretty bad at times. I really want to work on that problem. It's late and I'll look more at the accel enrichments on Saturday.
Attachments
logs-10-21.rar
(1.51 MiB) Downloaded 302 times

[The extension msq has been deactivated and can no longer be displayed.]

stefanst
contributor
contributor
Posts: 703
Joined: Wed Feb 17, 2016 12:24 am
Location: USA 08530

Re: Miata NA 1990, 1.6L stock #21

Post by stefanst »

More data- Awesome!

Looks like you need another row below 30kpa in your VE table. Some of your troubles stem from running in cells that are outside your VE table and are therefore not properly tuned. If you look at the logs, you often get very lean conditions when you're coasting under part- or 0-throttle and then get back on the gas. Autotuning off the table doesn't really work too well :)

Easy fix: Add a row below 30kpa (I have one at 10kpa in my tune. Of course that means rescaling your VE table. I took the liberty of doing this for you. Just to make it a little more fun, I scaled X- and Y-Axis logarithmic. This seems to assign the resolution more where you need it.

Please note that the interpolation I used for rescaling your table isn't really proven yet, so please run the car with the new VE table first, make sure the cells, especially around 30kpa and 10kpa below 4krpm are properly tuned. Or regenerate the table as you see fit. I can send you the Excel sheet I used to create the interpolated table.

After re-tuning VE, change the accel settings.

And, as always, send more data!
stefanst
contributor
contributor
Posts: 703
Joined: Wed Feb 17, 2016 12:24 am
Location: USA 08530

Re: Miata NA 1990, 1.6L stock #21

Post by stefanst »

I was trying to upload just the VE table, but the forum doesn't allow posting of *.msqpart files. So I renamed it to msq- rename back to msqpart so you can import it in the file dialog in the VE table.
Attachments

[The extension msq has been deactivated and can no longer be displayed.]

tomiata
contributor
contributor
Posts: 234
Joined: Sat Aug 02, 2014 2:30 am
Location: Texas

Re: Miata NA 1990, 1.6L stock #21

Post by tomiata »

After re-tuning VE, change the accel settings.
Thanks a lot for the tips. I picked the adjusted ve tune and put in the accel updates. Oops, I applied them together. Here is data.
I'm in Mississippi visiting my brother, and it was a cold morning at 45F, and was a bit hard to get started. I see my CLT numbers are way off. CLT was reading -9C when I tried starting, and I updated the cranking and warmup tables. Then warmed it up completely before trying autotune again.

Here is another Miata in the family, 2001-automatic, almost the same as @russian's new one, might look at rusefi someday:
ms-miata.jpg
ms-miata.jpg (132.75 KiB) Viewed 17841 times
Attachments

[The extension msq has been deactivated and can no longer be displayed.]

rus426.msl
(248.35 KiB) Downloaded 596 times
stefanst
contributor
contributor
Posts: 703
Joined: Wed Feb 17, 2016 12:24 am
Location: USA 08530

Re: Miata NA 1990, 1.6L stock #21

Post by stefanst »

Well, I have good news and not-so-good news :)
The good news:
- TPS-accel is adding fuel
- The lean condition when going from decel back on the throttle seems improved, presumably due to the added VE bottom row
- The taper for MAP based accel seems to be working as well

Not-so-good:
You need more VE tuning, as well as -of course- accel enrichment tuning.
I noticed some extremely lean conditions around 4600 rpm and MAP > 90kpa. That also shows in your VE table as very low VEs. Check the cells for 89 and 101kpa and 4600 and 5410rpm. They dip waaay below the neighboring cells- indications that there's something fishy going on there. I suspect Autotune screwed up.

Autotune is supposed to ignore dynamic conditions. It usually does that by ignoring any records where there is any enrichment. It seems that this is not happening, presumably because all the enrichment stuff has been changed around.

Suggestion: Manually increase the VE in the extreme cells to be more in line with the neighboring cells. Then drive around WITHOUT autotuning and record. Post the log file. I wrote some SQL queries in MS-Access that will take a log and calculate how far the AFRs in the recorded cells are from target AFRs, thus telling you how to change the VEs. I'll download your log and edit the table for you. This may take a while though, since I'm going to be quite busy the next few days.

Also: you didn't change the X- and Y-Axis values for the TPS-Accel table as per my post above :)
stefanst
contributor
contributor
Posts: 703
Joined: Wed Feb 17, 2016 12:24 am
Location: USA 08530

Re: Miata NA 1990, 1.6L stock #21

Post by stefanst »

I made some changes to your tune and uploaded the file here. Have fun with it.
As I said- you're well on your way. We'll have this baby running better than stock in no time!
BTW: I didn't touch your ignition table, but it seems very conservative to me. Do you have reliable access to 93 octane fuel? If so, I think it would be OK for you to run my (fairly) aggressive table. It's from a '99 with a squaretop, so a significantly different engine. If you decide to use it, I'll send it to you, but listen for knock- that table has never been run on a 1.6! But on the plus side, I'd guess you can make 5 more hp with it, if it doesn't knock

Did you manage to get your temp sensor calibrations sorted? Your IATs are constantly over 100*F- are you sure you got that right? I don't know anything about the air intake on the NA, so it may be correct. (Edit: ignore the IAT comment. Not sure what I was looking at, but your IATs look fine).
Also: Both your CLT and your IAT signals are noisy and move in tandem. Usually indicative of a weak GND. Maybe run a few more wires to ground the ECU? On the other hand your TPS signal seems fairly solid and I assume it's running off the same ground, so wtf?

(Edit: just realized, that the GND for the TPS is likely supplied by the ECU, while the IAT and CLT sensors use engine ground. So: Check engine ground!)

How did you calibrate your TPS? Are you sure you have it zeroed correctly? I'm asking because having an accurate TPS signal, especially at almost closed throttle, is very important for TPS-accel base enrichment. rusefi cuts off a signal that is below the 0 TPS level, so if your zero-point is too high, you may miss the first few degrees of throttle opening, making enrichment tuning in that range essentially impossible.

Your cranking rpm seems high- mine is set at 450rpm. Usually cranking is around 180-200rpm or so, so 450rpm is well into running territory. But I haven't touched it, not knowing if you have a reason for your value other than 'it works' :)
Attachments

[The extension msq has been deactivated and can no longer be displayed.]

tomiata
contributor
contributor
Posts: 234
Joined: Sat Aug 02, 2014 2:30 am
Location: Texas

Re: Miata NA 1990, 1.6L stock #21

Post by tomiata »

stefanst wrote:Did you manage to get your temp sensor calibrations sorted?
Also: Both your CLT and your IAT signals are noisy and move in tandem. Usually indicative of a weak GND. Maybe run a few more wires to ground the ECU? On the other hand your TPS signal seems fairly solid and I assume it's running off the same ground, so wtf?
The low temp CLT was way off on Sunday. I didn't try fixing it when I was out of town. Tonight I checked the temperature of water in the radiator with a rod analog thermometer and it was pretty close at 70C. So I didn't touch it. I'll try measuring again when it's a cold Saturday morning in Texas.

ECU is grounded to a near by ground. For TPS, I ran a have a separate ground wire, +5 and signal wire for the analog TPS running direct from the ECU. CLT and IAT are both stock sensors. I'll check grounds on those later.
How did you calibrate your TPS? Are you sure you have it zeroed correctly?
TPS calibrated with TS calibrate dialog. I observed it showed 0% when not touching the pedal, and would go up to 95% for WOT. I recalibrated tonight.
Your cranking rpm seems high- mine is set at 450rpm. Usually cranking is around 180-200rpm or so, so 450rpm is well into running territory. But I haven't touched it, not knowing if you have a reason for your value other than 'it works' :)
I started the tune from the one @thommm posted a while back, and I didn't touch crank rpm since it "worked".
BTW: I didn't touch your ignition table, but it seems very conservative to me. Do you have reliable access to 93 octane fuel? If so, I think it would be OK for you to run my (fairly) aggressive table. It's from a '99 with a squaretop, so a significantly different engine. If you decide to use it, I'll send it to you, but listen for knock- that table has never been run on a 1.6! But on the plus side, I'd guess you can make 5 more hp with it, if it doesn't knock
Yes, I can get 93 octane here. I'd like to try it after getting the rest of the tune stable.
I made some changes to your tune and uploaded the file here. Have fun with it.
As I said- you're well on your way. We'll have this baby running better than stock in no time!
Great, thanks for the help! Sunday night and tonight something is different after the trip I made over the weekend ~1000 miles running mostly stock ECU. The new tune you sent was way lean and I had to bump up most values by 5 to 10% in the ve table. Not sure why, but I did have to add a quart of oil on Sunday afternoon. I notice valves rattling more than usual on startup, checked oil and it was a full quart low.

I ran with your new tune and worked with it to bump up ve values to be happy with auto-tune and manual tweaks. Did not drive it, just moving a little in the driveway made AFR value to up to 17+. See logs below captured while tuning. Didn't have much time to work on it tonight.
Attachments
rus435.msl
(1.05 MiB) Downloaded 533 times
tomiata
contributor
contributor
Posts: 234
Joined: Sat Aug 02, 2014 2:30 am
Location: Texas

Re: Miata NA 1990, 1.6L stock #21

Post by tomiata »

I tweaked on the last ve table to get the AFR values back to normal and ran auto-tune another while. It seems like the TPS/TPS mult accel table makes it go unstable. I set it to back to all zeros and got things more close to normal and drivable. See log file rus441.msl.

I put the modified TPS/TPS table back in afterwards and drove just a short distance. With in place I see wide swings of AFR, that is in log rus444.msl.
My latest tune is attached.

Can you explain the TPS/TPS table and what the values are supposed to be doing from:
http://rusefi.com/forum/viewtopic.php?f=3&t=660&p=20832#p20832

Thanks again for the help!
Attachments

[The extension msq has been deactivated and can no longer be displayed.]

rus441.msl
(415.23 KiB) Downloaded 413 times
rus444.msl
(182.42 KiB) Downloaded 516 times
stefanst
contributor
contributor
Posts: 703
Joined: Wed Feb 17, 2016 12:24 am
Location: USA 08530

Re: Miata NA 1990, 1.6L stock #21

Post by stefanst »

That's quite strange: Both logs show absolutely ZERO TPS fuel! And that even though in both logs you are clearly above the TPS-threshold of 3.0 in many places.

Explanation:
The values in the TPS-Table establish how much fuel is added per throttle movement. So when you start at 0% TPS and go to 10% TPS, the algorithm should add another 10% of fuel on top of what it would typically be injecting based on the VE table. When you go from 0% to 20% TPS, it should be adding 17%. When you go from 10% to 20% it should be adding 10% and so forth. So for my thinking the algorithm should have added fuel, which according to the log it didn't do. Maybe I'm understanding something wrong there.

But since both logs show no differences in accel enrichment, I'm kind of surprised that you noticed differences in drive-ability. Could you mark the times when you just experienced some drive-ability troubles in the log by hitting the space-bar next time? That would help narrowing down where the problems are.

Also try to no vary the throttle too much in a short period of time while driving. Constantly moving throttle is the hardes to tune, so let's start with single events- one push and then steady-state for a bit.....

Good luck!
tomiata
contributor
contributor
Posts: 234
Joined: Sat Aug 02, 2014 2:30 am
Location: Texas

Re: Miata NA 1990, 1.6L stock #21

Post by tomiata »

Did the code change for the values needed in the TPS/TPS table after this post was written:
http://rusefi.com/forum/viewtopic.php?f=5&t=979&p=17738&hilit=Enrichment#p20280

Looks like now it's a percent fuel add rather than a multiplier.
User avatar
AndreyB
Site Admin
Posts: 14323
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Miata NA 1990, 1.6L stock #21

Post by AndreyB »

tomiata wrote:Did the code change for the values needed in the TPS/TPS table after this post was written
Looks like now it's a percent fuel add rather than a multiplier.
Probably not. I've made changes to MAP-based acceleration but not much to TPS
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
stefanst
contributor
contributor
Posts: 703
Joined: Wed Feb 17, 2016 12:24 am
Location: USA 08530

Re: Miata NA 1990, 1.6L stock #21

Post by stefanst »

My question remains: Why is there no TPS-enrichment, if we're clearly above the threshold?
@: are you sure you had the table entered and the TPS threshold set at 3.0 for the log you posted? I'm asking because I can't find much accel-related problems in that log and no TPS-based acceleration happening either. I'm talking about the rus444.msl log where you had lot of stab-the-throttle in idle, or maybe first gear in the beginning.

Can you describe what the drive-ability problems you experienced were like?
tomiata
contributor
contributor
Posts: 234
Joined: Sat Aug 02, 2014 2:30 am
Location: Texas

Re: Miata NA 1990, 1.6L stock #21

Post by tomiata »

stefanst wrote:My question remains: Why is there no TPS-enrichment, if we're clearly above the threshold?
@: are you sure you had the table entered and the TPS threshold set at 3.0 for the log you posted? I'm asking because I can't find much accel-related problems in that log and no TPS-based acceleration happening either. I'm talking about the rus444.msl log where you had lot of stab-the-throttle in idle, or maybe first gear in the beginning.

Can you describe what the drive-ability problems you experienced were like?
Yes, the rus444.msl log should be with TPS/TPS table you made up with values 0, 10, 17,... 37 in first column a few posts back. The odd behavior was pushing the accelerator and I see the AFR guage make a wide swing very lean to very rich. I am confused with what I'm seeing also. I'll re-run the test and get another set of data.

But, are the table values supposed to be percent additional fuel or multiplier for current fuel or fixed amount of extra fuel to add for a given TPS from/to entry? Below is what looks like the code block in question.

Code: Select all

floatms_t AccelEnrichmemnt::getTpsEnrichment(DECLARE_ENGINE_PARAMETER_F) {
        int index = getMaxDeltaIndex(PASS_ENGINE_PARAMETER_F);

//      FuelSchedule *fs = engine->engineConfiguration2->injectionEvents;
        float tpsTo = cb.get(index);
        float tpsFrom = cb.get(index - 1);
        float d = tpsTo - tpsFrom;

        float valueFromTable = tpsTpsMap.getValue(tpsFrom, tpsTo);

        floatms_t extraFuel;
        if (d > engineConfiguration->tpsAccelEnrichmentThreshold) {
                extraFuel = valueFromTable;
        } else if (d < -engineConfiguration->tpsDecelEnleanmentThreshold) {
                extraFuel = d * engineConfiguration->tpsDecelEnleanmentMultiplier;
        } else {
                extraFuel = 0;
        }
tomiata
contributor
contributor
Posts: 234
Joined: Sat Aug 02, 2014 2:30 am
Location: Texas

Re: Miata NA 1990, 1.6L stock #21

Post by tomiata »

I put the TPS accel mult coeff value up to 1.5 and now I think you can see some added fuel from TPS. See if this looks better.

If I set the engine load accel threshold very high, like 40 to turn it off. I do see the wide swing of lean rich when I stab the accelerator. That was probably what I observed before.
Attachments
rus452.msl
(682.8 KiB) Downloaded 496 times

[The extension msq has been deactivated and can no longer be displayed.]

stefanst
contributor
contributor
Posts: 703
Joined: Wed Feb 17, 2016 12:24 am
Location: USA 08530

Re: Miata NA 1990, 1.6L stock #21

Post by stefanst »

Tuning accel enrichment is all about drive-ability and not really perfect AFRs. In a perfect world we'd have perfect AFRs under accel conditions, alas this is never going to happen. At least not without somebody tuning this who knows a TON more than I do.

Running the stock ECU, there are some serious fluctuations in AFRs as well- that's not too worrying. Your engine going pig-rich for a split second is really nothing to be concerned about. Going too lean and experiencing stumbling is what we want to avoid.

So: your log actually looks pretty decent to me. There are a few spots with lean conditions that may lead to stumbling, but I'd say it seems to run reasonably well.

How is the drive-ability right now? Is it OK? if so, I suggest to continue trying to get the VE table tuned and not bother with accel-enrichment too much. Send me a log of a nice long run - maybe half an hour or so, trying to hit all cells in the VE table, but trying to keep TPS changes to a minimum and I'll try to run the log through my database and give you some pointers for tuning your VE table. the VE table is the basis of all tuning. Once that is sorted, we'll take care of the rest.

One thing: It looks like your engine load threshold is still too high. Drop it down to maybe 2 or 3.
stefanst
contributor
contributor
Posts: 703
Joined: Wed Feb 17, 2016 12:24 am
Location: USA 08530

Re: Miata NA 1990, 1.6L stock #21

Post by stefanst »

I just looked at the code and it seems straightforward enough so even I can mostly understand what it is doing. It calculates a delta (tpsTo - tpsFrom) and if that exceeds the threshold, we look up the value in the table (presumably using tpsTo and tpsFrom again) and that is your enrichment.

One question I have on this is how often this code runs. we really need the time difference between two readings to be constant, otherwise we don't get a proper 'd' value. And since I'm seeing a reference in the code to 'injectionEvents' it looks like it may be tied to injection timing which will of course change with RPM. But finding that in the code is beyond my capabilities.
tomiata
contributor
contributor
Posts: 234
Joined: Sat Aug 02, 2014 2:30 am
Location: Texas

Re: Miata NA 1990, 1.6L stock #21

Post by tomiata »

Here is another log from a longer drive over a variety of speeds and conditions with auto tune off and trying to keep it smooth. Thanks again for the extra eyes checking the logs!
Attachments

[The extension msq has been deactivated and can no longer be displayed.]

rus10-29-16.msl
(3.66 MiB) Downloaded 515 times
stefanst
contributor
contributor
Posts: 703
Joined: Wed Feb 17, 2016 12:24 am
Location: USA 08530

Re: Miata NA 1990, 1.6L stock #21

Post by stefanst »

That's looking pretty good!

I have to apologize for the advise to lower your EL_Fuel threshold. It looks like you're real close to signal-noise level with your threshold (3), so we get a lot of enrichment where we shouldn't. Please increase it back to 6.
Also: I don't understand why you sometimes get EL_fuel enleanment when you snap off the throttle, even though threshold for enleanment and multiplier are both set to 0. @ - any idea?

I'll see if I can run your log through my analysis DB and give you pointers on your tune. But it does look pretty solid as-is.

@: All the analog inputs still look a bit jittery. CLT and IAT are moving together, TPS, AFR and VBATT move exactly opposite to them. Any idea how this can be improved? I get how ground issues can cause noise in most of the signals, but I don't understand how TPS can be so noisy if it gets ground and 5V directly from the ECU.
Trying to fine-tune a car with noisy inputs is tricky to say the least....
stefanst
contributor
contributor
Posts: 703
Joined: Wed Feb 17, 2016 12:24 am
Location: USA 08530

Re: Miata NA 1990, 1.6L stock #21

Post by stefanst »

Alright - I ran your AFRs through a DB to analyze and we're looking pretty good!
Your VE table seems to be close. The error shown is in percent. A negative number means you're running too rich, a positive number means you're too lean.

Don't pay too much attention to the cells with a low record count- that may not be very reliable.

So: I suggest to adjust the VE cells with more than 100 hits according to the error table. I.E if you're too rich by 2%, lower the VE by 2%.
The cells with fewer hits I would adjust a bit more carefully- maybe just go half-way.
When in doubt, assume that the table should be somewhat smooth and adjust the cells accordingly.

Rinse-repeat.
Attachments
AFR errors.xlsx
(10.65 KiB) Downloaded 211 times
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Miata NA 1990, 1.6L stock #21

Post by kb1gtt »

It's cool that the tune is getting good enough that the sensors noise is becoming an issue.

I guess I should start at the real world, by inquiring if @tomiata drinks coffee, energy drinks, etc. Noisy TPS could be the real world, loose cable, or other things like that. I doubt it, but should always cover the things I can't see personally.

Do we know the ohms across the POT's resistor? What does the wiper to GND measure at WOT, and closed? AKA what is the min and max ohms that the ECU see's, as well what is the ohms across the non-wiper leads. Commonly that non wiper leads will be 1k ohm, 5k ohm, or 10k ohms. It's possible that we might get a better signal if we decrease the ECU's input impedance, such that more current flows through the ECU. Right now we are sensing basically with a 500k input impedance, which means that it only takes something like 2nA of engine bay noise to generate 1mV of ripple on the ECU input. Also do we know how much current the wiper is rated for? Does the TPS POT have a wattage stamped on it?

On the original ECU, when NOT connected to the vehicle harness can @tomiata measure the resistance from that TPS pin to GND pin? To get the best noise rejection, we should mimic those ohms here. Same goes for the MAP, CLT signals. We should know those measurements. When I chose the ECU's impedance, I choose a high impedance because it would be less likely to burn things up or cause damage. However when I did that I sacrificed some noise immunity. We can probably tune this for this particular application to get a better signal into the ECU.

I'm also a bit ignorant about what a TPS of 14.97 is as a voltage. When I see ripple on the signal, I don't know if I'm looking at 1mV noise, or 100mV of noise?

In TS what is the target? Also what is tCharge? Don't I recall those being alternator control. I see patterns in the target signal which may influence the noise. I also see patterns between timing and the AFR noise, also perhaps an influence on the Vbat noise. I suspect that the alternator might be bouncing around, which then might be seen in the signals. We may need to add a Vbat noise compensation mechanism. I also suspect that the high impedance of the ECU is allowing small watts of RF energy to influence the volts seen by the STM32 ADC.

Can I confirm that the TPS POT is getting it's 5V from the ECU not 12V? I'm looking for potential ratio-metric issues. Basically the ADC is a number of clicks between the MCU's 5V and MCU GND. Lets say you have a solid 1V signal, and lets also say that the ADC happens to consider this to be 100bits of the ADC input. If you drop the 5V, to say 4.5V that same 1V input signal would change to perhaps 102bits of the ADC, even though it's the same source voltage signal. However lets say your signal is a POT that uses the 5V as your MCU. If the 5V drops a bit, then your voltage on the wiper will drop a bit as well, and you will still be 100 ticks as seen by the STM32 ADC. So please verify that the TPS is powered by the MCU 5V. I'm reasonably sure that this is not a problem, but should cover it to make sure.

Is there a way for us to measure the 5V and get that into these logs?

I'm fairly certain that we can get a better signal into the ECU by changing the ECU's impedance. If that doesn't make it go away, then we can tune the low pass filtering caps to block the noise.

I see there are other things connected to the TPS signal wire. A WOT POT seems to get switched in, and some shielding wiring on the air flow meter. Perhaps those are adding some noise. Of course look for loose connections, as those can make noise as well.
Welcome to the friendlier side of internet crazy :)
Post Reply