MS1/MSPNP Closed-Loop EBC -- Works Well on my Car -- Details - 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 09-09-2011, 03:44 PM   #1
Elite Member
Thread Starter
iTrader: (3)
 
Join Date: Mar 2008
Location: Granbury, TX
Posts: 6,011
Total Cats: 583
Default MS1/MSPNP Closed-Loop EBC -- Works Well on my Car -- Details

Step 1: Wastegate Only:
I've taken a building block approach to EBC with my MSPNP. For the first couple of months after turbo install, I just concentrated on tuning my basic performance on the wastegate. This was facilitated by an "EBC Enable/Disable" toggle switch that I hid in my engine compartment (since my youngest daughter starts driving in October and has her eyes set squarely on the Miata). This is what my basic Greddy wastegate control looks like on a 3rd gear pull:


Overall, the control isn't bad. The wastegate kicks in at around 3300RPM and 5.2psi of boost. From 3300RPM to 6900RPM, there is a gradual 2.5psi of boost creep. Two things contribute to boost creep on my car:
1. I don't run an intercooler, therefore there is no pressure loss as the intake flow increases with RPM.
2. I run a performance cat and a 2.5" exhaust which gives less back pressure than stock. I use the stock Greddy downpipe with some porting. This tends to skew more of the exhaust flow through the turbine instead of the wastegate as flow increases.

Before delving into any form of boost control, you need to ensure that your wastegate basically works so that your boost control has a chance of controlling things. Also, your target boost needs to be higher than the maximum boost generated by the wastegate. The curve here is easily controllable and my boost target of 10psi is comfortably above 7.7psi. So, on to the next step.

Step 2: Open Loop EBC:
My next step was open loop EBC. I followed the directions in the MSPNP manual for this. Basically, you:
1. Setup the valve parameters;
2. Disable closed loop control; and
3. Tune valve duty cycle targets.

For valve parameters, I bought the DIY EBC valve and just used the defaults. Didn't mess with it. Seems to work.

There are a couple of ways to disable the closed loop control. The MSPNP manual recommends setting all cells of your "Boost kPa Target" table to 70kPa and the "Closed Loop kPa Limit" to 20kPa. Thus, so long as your MAP is at 90kPa or above (as it will be in boost), you will be beyond the "Closed Loop kPa Limits" and operating on open-loop duty cycles.

The other way to disable closed loop control is simply to set 0 as the "Closed Loop kPa Limit." Due to the normal noise on the MAP signal, this condition will never be true except for rare, momentary transitions.

Tuning the valve duty cycles is straightforward. What I did was log a series of third gear pulls with my entire duty cycle table set to a contant value. I would do the third gear pull until I either hit my RPM limit or my boost limit. This was my sequence:
1. Set duty cycle table to 100%. This essentially keeps the EBC valve and wastegate closed.
2. Perform a third gear pull. On this first run, you need to be careful because you are going to hit your boost limit WAY before your RPM limit. This run establishes the lowest RPM at which you can hit your target boost.
3. Set duty cycle to 90%.
4. Perform a third gear pull.
5. Repeat the above while incrementally lowering the duty cycle until you are hitting your RPM limit without hitting your boost limit.

With logs in hand, analyze to determine your DC vs. RPM curve for your target boost. My values were:

100%DC -- 3900RPM
90%DC -- 3950RPM
80%DC -- 4000RPM
70%DC -- 4100RPM
60%DC -- 4350RPM
55%DC -- 4400RPM + Held 10psi to Redline
50%DC -- Hit 9psi at 3900RPM and held 9psi to Redline

Armed with the above information, and with the benefit of a few 3rd gear pulls to smooth overshoots and undershoots, I ended up with the following duty cycle target table:


Note that since I have a TPS, I reduced the duty cycles at lower throttle positions to produce more linear throttle response and relieve turbine load at part throttle. This part is strictly optional.

Here's what an open-loop third gear pull looks like:


Control is good. You can see the rapid boost ramp from keeping high duty cycles at low RPMs. There is a slight overshoot where EBC starts really controlling around 3900RPM. These is also a slight sag in the middle and a little boost creep at the end. This pull shows boost controlled between 8.5-10psi (average around 9psi). With some more tuning, I'm sure I could get that line straighter.

This pull also illustrates the deficiency in open-loop EBC. The day I tuned it, my average was 10psi. On the day that I logged this pull, it generated 9psi. Open-loop EBC cannot target a boost level. It just sets up physical operating parameters for the valve based upon RPM and TPS. The boost you get depends entirely upon external conditions (atmospheric pressure and temperature, engine compartment heat soak, etc.). This is kind of annoying.

Step 3: Closed-Loop EBC:
So, I lived with Open-Loop EBC for awhile. It was pretty good, and I just tolerated that it would control to "around" 10psi. The word around MT.net was that Closed-Loop EBC didn't work on the MS1. If you wanted closed-loop, you needed at least an MS2. The MSPNP directions were equally discouraging, descibing closed-loop as "experimental" and "use at your own risk."

Well, my friends, the above is total bullshit. Closed-loop EBC works just fine on the MS1. Read on.

One evening, I was driving home from work, and open-loop was only hitting around 8psi. There had been some recent, dramatic weather changes in our area (we were FINALLY below 100F -- actually, well below), and this was impacting where open-loop was settling. I was near my 3rd gear pull test area, and I had my laptop with me . . . what the heck, let's give it a try.

I setup my target boost table, and left the default values for Proportional Gain (49.8%), Differential Gain (9.8%) and Closed Loop kPa Limit (20kPa). Did a 3rd gear pull. It wasn't pretty (3psi), but it was obviously controlling. Time to tune.

The MS1 code provides for both proportional and differential gain. Tuning proportional control loops is simple, and you can always achieve a safe and stable gain (I've attached a handy and relatively understandable reference to this post on different control loop types). Differential is a lot trickier, and depends upon a very clean relationship between the control variable and the control parameter to be useful. Our MAP signal is just plain too noisy for it to be of any use, so I ignored it. After setting Differential Gain to 0%, I did 4 3rd gear pulls and quickly settled on a Proportional Gain of 15% and a Closed Loop kPa Limit of 15kPa. I also made sure that my kPa target table had easily attainable targets around the 4000RPM corner to minimize control overshoots. This is where I ended up with my closed loop parameters:



And here's a 3rd gear pull:


Works well! Still a slight overshoot at the corner, but beyond we're at 10psi 0.5psi. And, theoretically, this control method should not be dependent upon weather conditions (although I've only been running it this week -- we'll see how it handles more drastic weather changes).

Comparisons:
Here's a comparison of the three control methods in RPM vs. Time. Note that time is in MS logging frequency units (~16Hz -- a value of 160 is about 10 seconds). The lines are 2500RPM to 6900RPM pulls. The steeper the line, the faster the acceleration. More boost = more power . . . no suprise here.


Here's another comparison of kPa vs. Time for the same three pulls. Pretty happy with the closed-loop line.


Conclusions:
1. Closed-loop EBC on MS1 works just fine. Use it.
2. Make sure you do things in sequence. Step 1 is to make sure your wastegate can adequately control boost.
3. Step 2 is to tune open loop. This is important. Not only is open-loop the fallback control method if closed-loop doesn't work, but it also provides the basic duty cycle value that the closed-loop algorithm modifies to achieve desired boost. If it is way off, you don't have a chance.
4. Step 3 is to tune closed loop. Apply KISS. Do proportional only and take it easy with the gains and targets so you get good control.

I'm cross-posting this to my build thread as well.
Attached Thumbnails
MS1/MSPNP Closed-Loop EBC -- Works Well on my Car -- Details-wastegate.png   MS1/MSPNP Closed-Loop EBC -- Works Well on my Car -- Details-boostdc.jpg   MS1/MSPNP Closed-Loop EBC -- Works Well on my Car -- Details-openloop.png   MS1/MSPNP Closed-Loop EBC -- Works Well on my Car -- Details-boostcontrol-1.jpg   MS1/MSPNP Closed-Loop EBC -- Works Well on my Car -- Details-kpatargets.jpg  

MS1/MSPNP Closed-Loop EBC -- Works Well on my Car -- Details-closedloop.png   MS1/MSPNP Closed-Loop EBC -- Works Well on my Car -- Details-rpmcomparison.jpg   MS1/MSPNP Closed-Loop EBC -- Works Well on my Car -- Details-boostcomparison.jpg  
Attached Files
File Type: pdf PIDcontrolbook2.pdf (921.3 KB, 601 views)

Last edited by hornetball; 09-09-2011 at 04:51 PM.
hornetball is offline   Reply With Quote
Old 09-09-2011, 03:58 PM   #2
Murderator
iTrader: (76)
 
18psi's Avatar
 
Join Date: Apr 2008
Posts: 36,206
Total Cats: 2,587
Default

Very nice writeup. Should be stickied IMO
18psi is offline   Reply With Quote
Old 09-09-2011, 04:00 PM   #3
Boost Czar
iTrader: (61)
 
Braineack's Avatar
 
Join Date: May 2005
Location: Chantilly, VA
Posts: 72,908
Total Cats: 1,793
Default

wait till the weather turns and report back.

please log boost duty while you are at it...you need to atler the .ini file IIRC
Braineack is online now   Reply With Quote
Old 09-09-2011, 04:39 PM   #4
Elite Member
Thread Starter
iTrader: (3)
 
Join Date: Mar 2008
Location: Granbury, TX
Posts: 6,011
Total Cats: 583
Default

Quote:
Originally Posted by Braineack View Post
wait till the weather turns and report back.

please log boost duty while you are at it...you need to atler the .ini file IIRC
Wilco. Expect to report back in about a month or so. Our weather is really changing now (FINALLY).

So far, it looks good with ~40F temperature swings (55F to 95F).
hornetball is offline   Reply With Quote
Old 09-09-2011, 06:59 PM   #5
Elite Member
iTrader: (11)
 
Join Date: Feb 2009
Posts: 2,982
Total Cats: 10
Default

Good writup. I always tried to get exactly what I needed from the EBC using th ePID algorrithm. I never though about demanding slightly less from the EBC so that it wasn't trying to maintain itself at the limit while trying toinitially stabilize.
miatauser884 is offline   Reply With Quote
Old 09-09-2011, 07:56 PM   #6
Elite Member
Thread Starter
iTrader: (3)
 
Join Date: Mar 2008
Location: Granbury, TX
Posts: 6,011
Total Cats: 583
Default

Quote:
Originally Posted by djp0623 View Post
Good writup. I always tried to get exactly what I needed from the EBC using th ePID algorrithm. I never though about demanding slightly less from the EBC so that it wasn't trying to maintain itself at the limit while trying toinitially stabilize.
The MS1 only has "P" and "D" terms. Not sure what system you're using. Note that my write-up is specifically for MS1, although some of the principles, like smoothing out targets to help the control loop, are generally applicable.

Using an "I" (integral) term for EBC can be problematic if you are trying to control MAP rather than intake pressure. The reason is that you always have to guard against integral windup. During most engine operations, MAP is controlled by the throttle. It is only during WOT (or near WOT) that MAP is controlled by the wastegate. Thus, to successfully control an "I" term when controlling MAP, your algorithm needs to be smart about throttle position. This is not needed if you are controlling boost in the intake tubing (pre-throttle) rather than MAP.

In addition, from the logs, it appears that the MAP signal naturally has enough noise that neither an "I" nor "D" term are needed. A "P" only algorithm is much easier to understand and tune and doesn't suffer from issues like integral windup.
hornetball is offline   Reply With Quote
Old 09-09-2011, 11:32 PM   #7
Elite Member
Thread Starter
iTrader: (3)
 
Join Date: Mar 2008
Location: Granbury, TX
Posts: 6,011
Total Cats: 583
Default

Quote:
Originally Posted by Braineack View Post
wait till the weather turns and report back.

please log boost duty while you are at it...you need to atler the .ini file IIRC
Fortunately, boost duty was being logged. Here's the closed loop pull with boost duty plotted instead of idle duty:


The duty cycle signal is smooth and stable. It settled at 65%, which is a full 10% above the open loop setting at higher RPM -- it is capable of aggressively seeking its target without going wacky. This portends good things. Stay tuned for a cold day.
Attached Thumbnails
MS1/MSPNP Closed-Loop EBC -- Works Well on my Car -- Details-closedloop2.png  
hornetball is offline   Reply With Quote
Old 09-12-2011, 04:36 AM   #8
Elite Member
iTrader: (1)
 
Join Date: Jun 2006
Location: Warrington/Birmingham
Posts: 2,658
Total Cats: 39
Default

Good job Hornetball.

Nice to know closed loop does actually work afterall.
richyvrlimited is offline   Reply With Quote
Old 09-12-2011, 11:08 AM   #9
Elite Member
Thread Starter
iTrader: (3)
 
Join Date: Mar 2008
Location: Granbury, TX
Posts: 6,011
Total Cats: 583
Default

Let me get some good, cold days under my belt before we declare total victory. Sure worked beautifully this morning though. Brain's suggestion to log boost control duty cycle is a good one . . . let's you fine tune proportional gain and you can easily see when things are getting unstable. Drove this morning with a proportional gain of 20.
hornetball is offline   Reply With Quote
Old 09-12-2011, 11:23 AM   #10
Tour de Franzia
iTrader: (6)
 
hustler's Avatar
 
Join Date: Jun 2006
Location: Republic of Dallas
Posts: 29,114
Total Cats: 351
Default

If you can figure out how to make this work, I might bring you a beer next time I visit MSR.
hustler is offline   Reply With Quote
Old 09-12-2011, 11:41 AM   #11
Boost Czar
iTrader: (61)
 
Braineack's Avatar
 
Join Date: May 2005
Location: Chantilly, VA
Posts: 72,908
Total Cats: 1,793
Default

The key is more or less getting the open loop table close. I had mine tuned perfectly on MSI, but could see a difference of upwards of 4psi from morning to afternoon depending on the ambient temps. I'm sure if I turned on closed loop it would have worked well. Having that really tight 15kPa hystersis probably helps, I know Ben was seeing large oscillations when trying it.

IIRC, they are putting back the open loop reference table into the PID closed loop code for MS2/3. Doing this for idle code as well...
Braineack is online now   Reply With Quote
Old 09-13-2011, 03:45 PM   #12
Elite Member
Thread Starter
iTrader: (3)
 
Join Date: Mar 2008
Location: Granbury, TX
Posts: 6,011
Total Cats: 583
Default Learning More . . . .

I've continued playing with CL EBC. It remains consistent across temperature, and in 3rd gear+ works beautifully. However, in 2nd (I don't really mess much with 1st), I usually get an overshoot. Unfortunately, the overshoot can be pretty big, and sometimes kisses overboost protection. This is a typical 2-3-4:
Name:  CL_EBC_234_IW.png
Views: 63
Size:  97.6 KB

Well, the above just doesn't make sense for proportional-only control. Why would proportional-only control overshoot at modest gain settings? Why would it be so dependent upon the rate of RPM change? Why would proportional-only control exhibit what looks exactly like integral windup (see how the duty cycle climbs to and gets to 100% right before saying "oh, oh" and dropping like a rock).

So, I opened the code (msns-extra.asm). Guess what? MS1/MSPNP CL EBC isn't proportional at all. In fact, it would properly be described as Integral + Derivative. The so called "Proportional Gain" is really an integral gain . . . it adjusts how fast the integrator responds when off setpoint. The equation is:

DC = DC + "Proportional Gain" x ( kPa Target - kPa ) - "Differential Gain" x ( kPa - kPa_previous )

Since the control is mainly integral, a different tuning strategy is required. Fortunately, we've got effective tools available -- although the way we'll use some of the parameters will be a little "different." I feel another long-winded tuning explanation coming on. But, like President Obama, I'm going to present it AFTER vacation.

In the meantime, here's the same 2-3-4 with proper tuning to whett your appetite:
Name:  CL_EBC_234.png
Views: 63
Size:  95.5 KB

Hustler, I'm asking 3 beers and a track ride to tune your closed loop EBC.

Last edited by hornetball; 09-13-2011 at 04:57 PM.
hornetball is offline   Reply With Quote
Old 09-13-2011, 05:04 PM   #13
Elite Member
iTrader: (1)
 
Join Date: Jun 2006
Location: Warrington/Birmingham
Posts: 2,658
Total Cats: 39
Default

Honetball, again, GREAT JOB!
richyvrlimited is offline   Reply With Quote
 
 
Reply

Related Topics
Thread Thread Starter Forum Replies Last Post
MS PNP requires reading and following directions??? satisfied MEGAsquirt 141 10-06-2015 11:44 AM
1.8, C30-74 Rotrex, 9psi, 235WHP/190WTQ (E85) Lincoln Logs Dynos and timesheets 4 09-23-2015 01:26 PM
VE values too low? compuw22c MEGAsquirt 4 09-12-2015 08:42 PM
Now shipping NC MX-5 (2006-15) Precision Sliding Seat Mounts FAB Fab9 Tuning - Miata Performance Parts 0 09-11-2015 01:02 PM
Obligatory "N00B" post! D_Breezy Meet and Greet 5 09-08-2015 06:37 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 12:55 PM.