MS-II Closed Loop Boost Control - PID - Page 4 - Miata Turbo Forum - Boost cars, acquire cats.

Welcome to Miataturbo.net   Members
 


MEGAsquirt A place to collectively sort out this megasquirt gizmo

Reply
 
 
 
LinkBack Thread Tools
Old 01-30-2010, 12:43 PM   #61
Junior Member
 
Join Date: May 2007
Location: Columbia, MD
Posts: 248
Total Cats: 0
Default

I can see that being helpful for CL boost. However the way I wrote the PID code integral windup is not an issue. I am adding the PID math output to the previous output. This means that I need to take the derivative of the ideal PID form leaving me with an I term that does not wind up. Addionally, as long as I pick my output start point relatively well, It works similarly to other more traditional PID algorithms. In addition, I further modified the PID math so that the P term is not dependent on change in error but change in boost (rpm for idle). In the idle code this makes the P term much more responsive to small changes in rpm due to increased load. In tbe boost code it helps keep overshoot at a minimum. However it does not act exactly like other PID code in that the P term alone will not necessarily get you close to the target.

For idle I would need 2 feedforward tables (cold vs hot air/clt), a curve that linearizes the valve response and the PID numbers if I wanted to add the feedforward table. However I do not really think it would help much if at all compared to the current method, and it would be a lot more complicated to tune. Early in the idle code I did use feedforward, but the valve position that gives a certain rpm varies widely depending on air temp. It did not work well at all. I am leaving the idle code alone for now. As I said in that thread, getting fuel right (no oscillation in AFR) and using the idle advance feature can largely reduce the RPM drop when engaging more load. I am also adding feedforward for the AC button and e-fan to that code (should already be in 3.0.3). That code works and I am sure I can help resolve any tuning issues.

For boost, I am willing to call it a work in progress. My planned changes to this are (in order of what I think is most necessary to improve the algorithm):

1) switch to a type-b loop so that changes in target are handled more quickly by P and I combined instead of just I.
2) Add an "initial condition" table (the open-loop duty table) which sets the initial output for my PID loop to work from.
3) In combination with 2, add a setting which disables PID and just uses the open-loop table until you are <user-settable> kpa from the target.

As far as the way the code works now, I already have a 3d target table based on tps and rpm, and I have the PID vars.

These modifications were all things I was thinking about to improve the algorithm after talking on the phone with wes kiser. However, I would like to get Braineack's setup working before I make any changes. I am 100% confident that given a few more tuning iterations, his boost would have matched the MBC graph (with a fraction of a second ramp to the target).

For more info on how I wrote my PID code, check out: Three Types of PID Equations

Braineack: Just let me know when you are ready. You will have a PM shortly with my phone number.

To explain the behavior in your logs, when boost was dropping off and the duty was dropping too, that was the code trying to close the wastegate and generate more boost. It looks to me like you just needed an I term closer to 50-60% to get it to close fast enough and far enough to hold boost without going overboard and causing overshoot.

Ken
muythaibxr is offline   Reply With Quote
Old 04-05-2010, 10:44 AM   #62
Boost Czar
Thread Starter
iTrader: (61)
 
Braineack's Avatar
 
Join Date: May 2005
Location: Chantilly, VA
Posts: 72,814
Total Cats: 1,780
Default

Just an update. I appears that during my initial testing, one of the wires for my solenoid ripped out of the body. After repairing and trying this again it seems to be working.

Have the table set for 201kPa, and its averaging 195, so I should lower the P a tiny bit. I ended up having to bring it up to 180%, and judging by the high DC% numbers, I think I need increase the Hz it runs at from 19.5Hz to 26Hz (unless because I'm running inverted the DC% numbers logged are actually in reverse?).

here's a fourth gear log from this morning:

Braineack is offline   Reply With Quote
Old 04-05-2010, 11:31 AM   #63
Elite Member
iTrader: (11)
 
Join Date: Feb 2009
Posts: 2,982
Total Cats: 10
Default

It's looking pretty good. What PID numbers did you settle on. I plan on using yours as a jump point to adjust until I can get on DIY's dyno for tuning. Hopefully I'll have an appointment for dyno time by the end of May. This engine swap has taken forever. OF course it's turned into a: new engine, trans, suspension, and computer swap.
miatauser884 is offline   Reply With Quote
Old 04-05-2010, 11:53 AM   #64
Boost Czar
Thread Starter
iTrader: (61)
 
Braineack's Avatar
 
Join Date: May 2005
Location: Chantilly, VA
Posts: 72,814
Total Cats: 1,780
Default

180
0
0

Don't use my numbers and just do this to tune:
  1. Set Integral and Differential Gains to 0% - To make tuning the Proportional gain easier, set the Integral and Differential gains to 0%.
  2. Set Proportional gain to 150% and slowly lower - While tuning Proportional gain, higher numbers mean slower boost climb and lower final boost. For safety, start with a very high gain (150% should be sufficient). Find the RPM that typically spools quickly, and fully and quickly depress the accelerator. Note how much boost is reached. If boost overshoots the target, increase the Proportional gain. Otherwise, reduce the Proportional gain and try again. Do this until boost reaches the target with little or no overshoot.
  3. Tune the Integral Gain - The next step after the target is reached consistently is to tune the Integral gain. Starting from the RPM used to tune the P-gain, fully depress the accelerator and watch the boost as the engine climbs through the RPM range. As the engine accelerates through the rev range, the boost will probably creep away from the target. Keep increasing the I gain until the controller adequately maintains the target with minimal oscillation.
  4. Tune the Derivative Gain - If overshoot cannot be tuned out with the P gain on a quick acceleration, increase the D gain until the overshoot is minimized. Care must be taken when increasing the D gain as too much D gain can over-dampen the effects of the P and I gains.
Braineack is offline   Reply With Quote
Old 04-05-2010, 12:16 PM   #65
Elite Member
iTrader: (11)
 
Join Date: Feb 2009
Posts: 2,982
Total Cats: 10
Default

Quote:
Originally Posted by Braineack View Post
180
0
0

Don't use my numbers and just do this to tune:
  1. Set Integral and Differential Gains to 0% - To make tuning the Proportional gain easier, set the Integral and Differential gains to 0%.
  2. Set Proportional gain to 150% and slowly lower - While tuning Proportional gain, higher numbers mean slower boost climb and lower final boost. For safety, start with a very high gain (150% should be sufficient). Find the RPM that typically spools quickly, and fully and quickly depress the accelerator. Note how much boost is reached. If boost overshoots the target, increase the Proportional gain. Otherwise, reduce the Proportional gain and try again. Do this until boost reaches the target with little or no overshoot.
  3. Tune the Integral Gain - The next step after the target is reached consistently is to tune the Integral gain. Starting from the RPM used to tune the P-gain, fully depress the accelerator and watch the boost as the engine climbs through the RPM range. As the engine accelerates through the rev range, the boost will probably creep away from the target. Keep increasing the I gain until the controller adequately maintains the target with minimal oscillation.
  4. Tune the Derivative Gain - If overshoot cannot be tuned out with the P gain on a quick acceleration, increase the D gain until the overshoot is minimized. Care must be taken when increasing the D gain as too much D gain can over-dampen the effects of the P and I gains.
Thanks for spoon feeding that to me. I think that is the clearest that I have seen it explained. I feel confident that I will be able to get mine tuned on my own now. You should ad that post under the useful saved posts. Especillay if it removes the voodoo that surrounds EBC. I think a properly tuned ebc would eliminate the need for an MBC (other than max limit failsafe).

Thanks again
miatauser884 is offline   Reply With Quote
Old 04-08-2010, 09:17 PM   #66
Junior Member
 
Join Date: May 2007
Location: Columbia, MD
Posts: 248
Total Cats: 0
Default

Braineack: that is a pretty good method for tuning boost on ms2. On MS3 it might change a little due to the change I made to the P term, but I'm not sure exactly how to explain it yet. I think the gist would be that the P term is more sensitive and responds to target changes, so you'll probably be able to lower both the P and I terms, and D will be required. Wes Kiser over at the msextra forums was telling me that the new MS3 boost control is able to make the boost climb a lot faster now.

As far as the duty being 70% goes, I'd say if it's working, leave the frequency alone. Just keep up the tuning and get the I and D terms tuned in.

Ken
muythaibxr is offline   Reply With Quote
Old 04-08-2010, 09:24 PM   #67
mkturbo.com
iTrader: (24)
 
shuiend's Avatar
 
Join Date: May 2006
Location: Charleston SC
Posts: 13,775
Total Cats: 1,106
Default

Quote:
Originally Posted by muythaibxr View Post
Braineack: that is a pretty good method for tuning boost on ms2. On MS3 it might change a little due to the change I made to the P term, but I'm not sure exactly how to explain it yet. I think the gist would be that the P term is more sensitive and responds to target changes, so you'll probably be able to lower both the P and I terms, and D will be required. Wes Kiser over at the msextra forums was telling me that the new MS3 boost control is able to make the boost climb a lot faster now.

As far as the duty being 70% goes, I'd say if it's working, leave the frequency alone. Just keep up the tuning and get the I and D terms tuned in.

Ken
I will be trying to tune my EBC tomorrow afternoon on my MS3. Which means I will probably have a good many questions for you on Saturday with getting it all dialed in perfectly. I will probably need help with my idle a little bit to.

PS. Expect lots of beer.
shuiend is online now   Reply With Quote
Old 04-09-2010, 11:51 AM   #68
Junior Member
 
Join Date: May 2007
Location: Columbia, MD
Posts: 248
Total Cats: 0
Default

I'll probably be there in my (very dirty right now) rx8 or the corolla (if I can find time to unpack it from its winter sleep between now and then).

Ken
muythaibxr is offline   Reply With Quote
Old 04-09-2010, 11:57 AM   #69
Boost Czar
Thread Starter
iTrader: (61)
 
Braineack's Avatar
 
Join Date: May 2005
Location: Chantilly, VA
Posts: 72,814
Total Cats: 1,780
Default

cool. Hopefully my new solenoid comes this afternoon, my repair on my old valve failed again.
Braineack is offline   Reply With Quote
Old 04-14-2010, 07:26 PM   #70
Junior Member
 
Join Date: May 2007
Location: Columbia, MD
Posts: 248
Total Cats: 0
Default

So I helped shuiend get his CL boost on ms3 tuned on Saturday. It seems to work pretty well. I told him I could smooth out the boost a little more but he said he was happy with it the way it is now. I've attached that run's datalog for those who want to see it.

It overshot by about 4 kPa as it reached the target. I could've tuned that out with a bit more D term I think, and then the oscillations later were probably because of a P term that was slightly too high, but all in all it looks good.



Ken
Attached Thumbnails
MS-II Closed Loop Boost Control - PID-boostctl.png  
muythaibxr is offline   Reply With Quote
Old 04-15-2010, 01:17 AM   #71
Senior Member
iTrader: (2)
 
Join Date: Oct 2007
Location: Northeastern CT
Posts: 547
Total Cats: 2
Default

i cannot WAIT to try this, these datalogs look fantastic! my MS2 is having boost control and some other options added to it right now, switching from B+G to extra code at the same time obviously..

with a basic EBC (profec B spec II) and MBC i had the same annoying issue of spooling to 22-23 psi, falling off to 18-19 around peak torque, and slowly climbing back to 22-23 by 7k. this is with an external wastegate. i even get the same basic curve when running wastegate boost, but it is less pronounced at lower boost (1 bar spring).
therieldeal is offline   Reply With Quote
Old 04-15-2010, 09:30 AM   #72
Boost Czar
Thread Starter
iTrader: (61)
 
Braineack's Avatar
 
Join Date: May 2005
Location: Chantilly, VA
Posts: 72,814
Total Cats: 1,780
Default

Seems to be operating mine fairly well now too, just too lazy to post logs.
Braineack is offline   Reply With Quote
Old 04-15-2010, 11:29 AM   #73
Junior Member
 
Join Date: May 2007
Location: Columbia, MD
Posts: 248
Total Cats: 0
Default

Since the changes I made in ms3 seem to be working pretty well (that's what was used in the log I posted) I'll likely be backporting those changes.

Ken
muythaibxr is offline   Reply With Quote
Old 04-15-2010, 01:10 PM   #74
Senior Member
iTrader: (2)
 
Join Date: Oct 2007
Location: Northeastern CT
Posts: 547
Total Cats: 2
Default

what would you reccomend for an "extra" code newb? i was thinking i should go with the latest 2.x stable code rather than the 3.x code, just because i'm a little paranoid about having any sort of glitch at close to 400hp on a 1.8......
therieldeal is offline   Reply With Quote
Old 04-15-2010, 01:54 PM   #75
Junior Member
 
Join Date: May 2007
Location: Columbia, MD
Posts: 248
Total Cats: 0
Default

2.1.0 is the latest stable code, however you won't get the MAP sampling fixes that are in 3.0.3. Those changes will likely help a lot with boost control tuning.

Ken
muythaibxr is offline   Reply With Quote
Old 04-15-2010, 02:57 PM   #76
Senior Member
 
Join Date: Mar 2006
Location: Schwarzenberg, Germany
Posts: 1,497
Total Cats: 81
Default

That looks sooooo nice...

Whe will the backport happen, Ken? As I have to re-tune my PID anyhow due to a new turbo...

Greets
Zaphod is online now   Reply With Quote
Old 04-15-2010, 03:26 PM   #77
Junior Member
 
Join Date: May 2007
Location: Columbia, MD
Posts: 248
Total Cats: 0
Default

Hard to say. it shouldn't be that hard to backport so hopefully before the next alpha/beta release.

Ken
muythaibxr is offline   Reply With Quote
Old 04-15-2010, 03:28 PM   #78
Boost Czar
Thread Starter
iTrader: (61)
 
Braineack's Avatar
 
Join Date: May 2005
Location: Chantilly, VA
Posts: 72,814
Total Cats: 1,780
Default

That great thing is Shuiends could never hold boost flat past 5K, now he can.
Braineack is offline   Reply With Quote
Old 04-15-2010, 03:31 PM   #79
Ben
Supporting Vendor
iTrader: (33)
 
Ben's Avatar
 
Join Date: Jul 2006
Location: atlanta-ish
Posts: 12,689
Total Cats: 99
Default

Nice. Boost control on my car is a challenge (turbo hardware issues, not management), so I look forward to that.
Ben is offline   Reply With Quote
Old 05-28-2010, 01:24 AM   #80
Senior Member
iTrader: (2)
 
Join Date: Oct 2007
Location: Northeastern CT
Posts: 547
Total Cats: 2
Default

finally got my valve working, hooking up the vac hoses tomorrow and giving this a shot

what are you all using for a frequency setting on the DIY valve? their website says 19.5-40hz which technically gives me three options (19.5, 26, 39). The valve seems to be quieter with higher frequencies, not that that really matters.
therieldeal is offline   Reply With Quote
 
 
Reply

Related Topics
Thread Thread Starter Forum Replies Last Post
Project Gemini - Turbo Civic on the Cheap Full_Tilt_Boogie Build Threads 57 07-19-2017 05:11 PM
Another Cast Manifold Corky Bell Prefabbed Turbo Kits 18 11-22-2016 10:01 PM
Going back to stock. Need some 1.6 parts. Trent WTB 2 10-01-2015 01:15 PM
Time to start learning and play with tuning The Gleas MEGAsquirt 3 10-01-2015 10:30 AM
Bad head gasket or ? shooterschmidty Engine Performance 8 09-30-2015 11:28 PM


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -4. The time now is 11:15 AM.