MEGAsquirt A place to collectively sort out this megasquirt gizmo

Megasquirt/TunerStudio "Tips and Tricks"

Thread Tools
 
Search this Thread
 
Old 05-17-2017, 11:08 AM
  #1  
SADFab Destructive Testing Engineer
Thread Starter
iTrader: (5)
 
aidandj's Avatar
 
Join Date: Apr 2014
Location: Beaverton, USA
Posts: 18,642
Total Cats: 1,866
Default Megasquirt/TunerStudio "Tips and Tricks"

Seems like every time I spend some time working on my tune, or reading about different features I find out some new little trick, or a new approach to tuning something. So I thought I would start a thread where people can post things that may not have been obvious to them, and helped them out. I'll start out with a few. Please keep the thread somewhat clean, so it can be a bit of an encyclopedia, instead of a discussion.

1. Working with Autotune.
Autotune can be both awesome and annoying at the same time. There are a few things that I change to make it work a little better.
  • Lock out your idle cells. Idle should not be autotuned. It produces weird results. So select the cells that you normally idle in, right click, and select "Lock Selected Cells"
  • Set up your minimum fuel load. One issue that I constantly ran into was autotune pulling fuel as I entered and exited overrun. To stop this set your minimum fuel load (Advanced Settings) to around what you idle at. That way it will still tune low load cruising, and not get confused with overrun. This works better than locking out your lowest row of fuel cells, because it allows proper interpolation with the lowest row.
  • If you are starting out fresh I like to start with the cell change resistance on easy. This will allow big changes, but also leave you with some jerky spots. So switch to normal afterwards and it will help smooth it out.
  • Finally, an autotuned fuel table is not a finished fuel table. Smooth it out, look for patterns and interpolate where you can. Then make some pulls, and look at your logs. Check that AFRs are correct and that it all looks good.

2. Re-bin Table
This one took me a while to find, but when I did it changed my life. If you already knew this, then it will be obvious, but if you didn't know this existed it will be great. When looking at any sort of table, you can click on the box with the 2 arrows at the bottom left corner of the table. This will open a new window that will allow you to edit the axis of your table, and then it will interpolate to match. This allows you to scale tables easily, compare to other tables, and is generally awesome.



3. Incorporate AFR Target
This is a setting that I just found out about that is pretty cool. It is in your general settings menu under "Incorporate AFRTarget". I'll do my best to explain how it works. This wont be of as much use for people who are already tuned, but if you are starting fresh I definitely suggest you use this.

When you aren't including AFRTarget the Megasquirt fueling equation looks something like this:
PW = ReqFuel * VE(rpm,map) * MAP * GammaE
With this equation, your VE table also specifies what AFR you want. So if you want to go richer, you add to the VE table, want to go leaner, you remove from the VE table. When you include AFR Target your fueling equation changes, and it pulls the AFR target out of the VE variable. Which allows separate control of AFR and VE.
PW = ReqFuel * VE(rpm,map) * MAP * stoich / targetAFR(rpm,map) * GammaE
What this allows you to do, is tune for the "actual" volumetric efficiency of your motor. Your VE table will be a lot flatter, and will represent the actual efficiency of the engine. This allows you to change what AFR you are targeting by just changing the AFR target table, instead of the whole VE table. Pretty cool.

I'll start with those 3. I'd love to hear from @DNMakinson about his EAE tuning experiences. And anyone else who found something they think might help. Could be anything, don't be afraid to share because its stupid, we might have missed it.
aidandj is offline  
Reply
Leave a poscat 15 Leave a negcat
Old 05-17-2017, 03:50 PM
  #2  
Elite Member
iTrader: (2)
 
ridethecliche's Avatar
 
Join Date: Aug 2016
Location: New Fucking Jersey
Posts: 3,890
Total Cats: 143
Default

Sticky this plzzzz!

Also, this should be set up so it can be added to over time. Maybe wiki-fi it?

Aidan, can you put together a write up on engine states like we had on my thread here: https://www.miataturbo.net/megasquir...7/#post1407468
That's a relevant post where we were hacking it out.

I think I need to redo things because my fast accel and decel have changed since the turbo install, so if you want to come up with a 'walkthrough' of sorts, I can do the tests and take logs for all of them and post the logs and tune/screenshots of where the settings go and how they changed things. I think that would be really helpful since that's the direction the developers seem to be taking.
ridethecliche is offline  
Old 05-17-2017, 04:38 PM
  #3  
afm
Senior Member
iTrader: (3)
 
afm's Avatar
 
Join Date: Nov 2015
Location: Berkeley, CA
Posts: 981
Total Cats: 508
Default

Originally Posted by aidandj
3. Incorporate AFR Target
This is a setting that I just found out about that is pretty cool.t.
Noob
afm is offline  
Old 05-17-2017, 04:39 PM
  #4  
Senior Member
iTrader: (1)
 
acedeuce802's Avatar
 
Join Date: Dec 2010
Location: Farmington Hills, MI
Posts: 1,218
Total Cats: 175
Default

Some of the things that I've been interested in, but haven't yet taken the time to figure out or play around with (mostly because I didn't get around to it before starting the V8 swap) are knock sensor settings and long term fuel trims. I know there is lots of info on both of these around here, so at some point I'll gather up info and include them, unless someone else already has this stuff gathered.
acedeuce802 is offline  
Old 05-17-2017, 04:39 PM
  #5  
SADFab Destructive Testing Engineer
Thread Starter
iTrader: (5)
 
aidandj's Avatar
 
Join Date: Apr 2014
Location: Beaverton, USA
Posts: 18,642
Total Cats: 1,866
Default

How to tune engine states.


1.4.1 didnt have engine states. They are the backbone of the tune. Used for cl idle, idle ve, idle timing, overrun, etc.

Here is my best guess on how to tune engine states. Waiting on confirmation from Ken. And tuning them myself.

Fast acceleration threshold: Some low gear, step on the throttle. Pick the lowest(?) RPMdot while accelerating. Set the fast acceleration threshold just below that?

Slow acceleration threshold: Datalog idle and see what the highest RPMdot is during idle. Add and remove loads to get rpm changes. Set to just above the highest RPMdot at idle

Fast deceleration threshold: Rev high in neutral and let it drop back to idle. Set it slightly above the highest RPMdot from that test.

Slow deceleration threshold: Same as Slow acceleration threshold, but with negative RPMdot

TPS: Pretty self explanatory, value when tps is closed, and when full throttle

Overrun Map Threshold: Set as high as possible, I usually use a MAP value just under the lowest MAP I see on idle.
aidandj is offline  
Old 05-17-2017, 10:30 PM
  #6  
Tweaking Enginerd
iTrader: (2)
 
Ted75zcar's Avatar
 
Join Date: Mar 2013
Location: Boulder, CO
Posts: 1,773
Total Cats: 355
Default

You can get great results autotuning idle cells by allowing the car to idle in gears 1-3 on various road grade angles. Use a slow clutch to hit the high left.

+1 x 1000 on incorporate AFR target

you can export sections of logs from MLV and then open them again in MLV if you copy the header from the original file into the short exported file.

autotuning the decel load cells (no fuel cut) can give you an indication of how close your dead-time is to the actual value. High numbers indicate too short, low numbers indicate too long. Vintage injectors need not apply, the open close transition is junk.

dead-time voltage correction can be characterized at idle by turning on various accessories and then post processing the data

dead-time characteristic curve can be plotted at idle by changing AFR target

the dead time stuff up is a bit complicated may put something more official together.
Ted75zcar is online now  
Old 07-22-2017, 09:00 PM
  #7  
Senior Member
 
Schroedinger's Avatar
 
Join Date: Apr 2016
Location: Atlanta
Posts: 790
Total Cats: 188
Default

Excellent thread gentlemen.

I only do VEAL after disabling all other features that affect fueling. I turn Overrun Cut and Accel Enrichments completely off, and set EGO authority to zero. I'm finding that this leaves me with a much more stable VE "base" to work from when I turn those features back on, and makes it easier to tune them.

My opinions on smoothing the VE table keep changing. I went through the progression of VEAL easy, medium and hard resistance. By the time I got to hard, it made no changes at all. The table was indeed jagged/spikey, and I tried several different smoothing methods. No matter how I did it, I had numerous lean/rich spots. So I autotuned again, and the table went right back to the same jagged pattern I tried to smooth out. At this point I think the motor wants what the motor wants, the table doesn't have to look pretty to my eye. My car has the best driving characteristics without smoothing after VEAL.

I've read your section about "Incorporate AFR Target" about 20 times, and I still don't really get it. I turned it on anyway (prior to tuning). I think the implication is that now that the car is tuned, I can change the fueling by either adjusting the AFR target table or the VE table. With the "incorporate" feature turned off, the AFR target table is basically useless for anything except autotuning. Do I have that right?

You guys have much more experience than I do, feel free to straighten me out if anything I wrote above is incorrect. Keep up the good work, this thread is great.
Schroedinger is offline  
Old 07-22-2017, 10:37 PM
  #8  
Tweaking Enginerd
iTrader: (2)
 
Ted75zcar's Avatar
 
Join Date: Mar 2013
Location: Boulder, CO
Posts: 1,773
Total Cats: 355
Default

AFR table is also the EGO target

edit: and you can leave EGO enabled during autotune.
Ted75zcar is online now  
Old 07-23-2017, 05:27 AM
  #9  
Senior Member
iTrader: (6)
 
yossi126's Avatar
 
Join Date: Sep 2013
Posts: 854
Total Cats: -15
Default

I too am tuning with ego on. Thing is my controller authority is not fixing **** and it is set to 25%. When I experimented veal with ego off it dropped the numbers a bunch. Need to test more.
yossi126 is offline  
Old 07-23-2017, 09:34 AM
  #10  
Senior Member
 
Schroedinger's Avatar
 
Join Date: Apr 2016
Location: Atlanta
Posts: 790
Total Cats: 188
Default

So Ted, according to Aidan's math above- if the Incorporate feature is turned on, then during driving the injector pulsewidth will be influenced by:

1) a factor of the AFR target (at instant load, rpm) vs. stoich mix; and
2) EGO corrections using a factor of the AFR target (at instant load, rpm) vs. instantaneous AFR

This seems peculiar to me. It's basically doing the same correction against the AFR table twice over; in one case it's referencing 14.7 stoich, in the other case it's referencing instantaneous AFR. Seems like potential for conflicting inputs, feedback loops or overshoot. One wouldn't it be better (in theory) to use either Incorporate OR EGO correction? Maybe it's more accurate to say that if Incorporate is on, EGO authority should be more conservative.

Any thoughts on my comment regarding smoothing above? Everyone seems determined to do it, I feel like it's unneccesary or maybe bad. Or maybe I just haven't found the best method.
Schroedinger is offline  
Old 07-25-2017, 05:36 AM
  #11  
Senior Member
iTrader: (6)
 
yossi126's Avatar
 
Join Date: Sep 2013
Posts: 854
Total Cats: -15
Default

Did a test yesterday. Turned off ego and started veal. Obviously pulled a lot of fuel. Turned ego on, nothing. No correction. Authority is set to 20%. Anyone can confirm that ego works for him and corrects real time?
yossi126 is offline  
Old 07-25-2017, 12:46 PM
  #12  
Boost Czar
iTrader: (62)
 
Braineack's Avatar
 
Join Date: May 2005
Location: Chantilly, VA
Posts: 79,494
Total Cats: 4,080
Default

sounds like you simply don't know how to make EGO work...
Braineack is offline  
Old 07-25-2017, 10:46 PM
  #13  
Tweaking Enginerd
iTrader: (2)
 
Ted75zcar's Avatar
 
Join Date: Mar 2013
Location: Boulder, CO
Posts: 1,773
Total Cats: 355
Default

Originally Posted by Schroedinger
So Ted, according to Aidan's math above- if the Incorporate feature is turned on, then during driving the injector pulsewidth will be influenced by:

1) a factor of the AFR target (at instant load, rpm) vs. stoich mix; and
2) EGO corrections using a factor of the AFR target (at instant load, rpm) vs. instantaneous AFR

This seems peculiar to me. It's basically doing the same correction against the AFR table twice over; in one case it's referencing 14.7 stoich, in the other case it's referencing instantaneous AFR. Seems like potential for conflicting inputs, feedback loops or overshoot. One wouldn't it be better (in theory) to use either Incorporate OR EGO correction? Maybe it's more accurate to say that if Incorporate is on, EGO authority should be more conservative.

Any thoughts on my comment regarding smoothing above? Everyone seems determined to do it, I feel like it's unneccesary or maybe bad. Or maybe I just haven't found the best method.
Not exactly. The AFR target table and the VE table are used to calculate the initial value or bias. This pulse width will be close to the required fuel. Other factors and error sources will cause this initial value to be off by some amount. This calculation is an open loop calculation, where feedback is not used.

The EGO uses the AFR table as a target input to a closed loop PID equation. Megasquirt uses a funky PID form, but essentially the current AFR is subtracted from the target AFR resulting in a residual error. This residual error is then used to vary the output parameter to force zero error. The P is an instant reaction, the I is a reaction averaged over time, and the D is a POS that is used to compensate for an overly aggressive P term.

a PID that has less error to compensate out will reach target more quickly and is easier to stabilize. Additionally, the VE and AFR tables serve to normalize/linear-ize the system plant or transfer function. In simple terms, this allows you to use a single set of PID coefficients for the entire operating space. PID output changes at low load and RPM have the same effect on the error term as high load, high RPM operating points.

the fuel table-AFR calculation and EGO do not interact. VEAL backs out the EGO correction prior to making changes. So with EGO on ( and properly configured for a damped response) VEAL will actually work better because the engine is operating at the AFR you are trying to tune to.
Incorporate allows you to change the AFR for a given cell or cells without a re-tune. Plus, you get a real VE table, which contains very useful information.
Ted75zcar is online now  
Old 07-25-2017, 11:12 PM
  #14  
Senior Member
 
Schroedinger's Avatar
 
Join Date: Apr 2016
Location: Atlanta
Posts: 790
Total Cats: 188
Default

Thanks Ted- great information, appreciate you taking the time to clarify. It all makes perfect sense. I've been doing a lot of experimenting and reading up on PID tuning methods while dialing in my closed loop idle, but I'm still using the simple algorithm for EGO. I'll probably try to tackle that one next.

I also used the re-bin feature described in Aidan's OP tonight. Worked like a charm, and saved me a ton of time. Great stuff!
Schroedinger is offline  
Old 12-08-2017, 11:33 AM
  #15  
Newb
 
Heetstroke's Avatar
 
Join Date: Dec 2017
Posts: 2
Total Cats: 0
Default

Can you elaborate on how to setup the minimum fuel load to what your idle is and incorporate afr.

New to tuning and there seems to be a few weird spots i cant get smoothed out in ny tune. A/f reads great (13.0) part throttle but seems like its busting up lean

I havent messed or heard about these tips
Heetstroke is offline  
Old 12-09-2017, 03:25 AM
  #16  
Senior Member
iTrader: (2)
 
SchmoozerJoe's Avatar
 
Join Date: Aug 2013
Location: Houston, TX
Posts: 746
Total Cats: 85
Default

I'll go ahead and throw my $.02 in...

Use a Custom Linear WB for your EGO Sensor when calibrating the AFR table.
One size does not fit all. Wiring, grounding points, controllers, etc. all affect each car, differently.

Set the Custom Linear to say, .94 volts/11.88 for Point 1 and 3.28 volts/16.54 for Point 2.

Get the car up to operating temp.
Turn off EGO control.
Turn off Incorporate AFR.
Fix your ignition table.
Get the car idling at 14.2 by adjusting the VE values.
Then.
Fatten up the idle cells until you are at 11.88 or so on your Wideband and then adjust the voltage in Tuner Studio as required for the TS values and WBO2 values to match.
Then, lean out the idle cells until you're at 16.54 on the Wideband and adjust your TS values as well, for Point 2, until they match as well.

I've found that you can get them your values to be within one to two tenths of a point difference by setting the two end points for your particular setup.

Then, re-enable EGO control and incorporate AFRs in your tune.
VEAL will thank you for this. Not to mention logging will be much more accurate.

Last edited by SchmoozerJoe; 12-09-2017 at 03:43 AM.
SchmoozerJoe is offline  
Old 12-09-2017, 07:48 AM
  #17  
Newb
 
Heetstroke's Avatar
 
Join Date: Dec 2017
Posts: 2
Total Cats: 0
Default

Thanks schmoozer.

I do have my wideband setup and its within 2 tenths.
I believe im overthinking the minimum fuel req to match your idle.
Heetstroke is offline  
Old 04-16-2018, 05:36 PM
  #18  
Senior Member
iTrader: (1)
 
acedeuce802's Avatar
 
Join Date: Dec 2010
Location: Farmington Hills, MI
Posts: 1,218
Total Cats: 175
Default

https://www.youtube.com/channel/UC6U...-aD6M-A/videos

A lot of this guys stuff is related to MLV more than TS, but it's good knowledge on how to use datalogging to tune an engine with math. I really like his "Advanced Hand Fuel Tuning and Blended Tables" video, which even if you don't use blended maps, is useful on how to plot a useful scatter plot for VE tuning.
acedeuce802 is offline  
Old 12-03-2019, 05:18 PM
  #19  
Junior Member
 
maxpro's Avatar
 
Join Date: Sep 2016
Location: Dallas
Posts: 73
Total Cats: 2
Default

This is an awesome thread. Thank you all. I will be sifting thru this for a while. THANK YOU.
maxpro is offline  
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
CTSparky
Meet and Greet
32
08-16-2015 10:37 PM
KentonKochRacing
Meet and Greet
9
07-12-2013 09:33 AM
jared8783
Insert BS here
0
01-30-2012 10:34 AM
TravisR
Adaptronic
2
10-02-2009 08:56 AM
Don Belisle
DIY Turbo Discussion
5
08-24-2008 11:20 AM



Quick Reply: Megasquirt/TunerStudio "Tips and Tricks"



All times are GMT -4. The time now is 04:09 PM.