Closed Loop boost (beginner to pro) log

All questions about MS2/Microsquirt/Microsquirt module. See also MS2/Extra manuals

Moderators: jsmcortina, muythaibxr

darsondriss
Helpful MS/Extra'er
Posts: 66
Joined: Wed Oct 07, 2009 3:29 pm

Closed Loop boost (beginner to pro) log

Post by darsondriss »

Im trying to get closed loop working on my car and figured id start this thread to log my steps from start to finish getting closed loop boost working, naturally with alot of help from the pros. Hopefully having a topic organized like this will guide other beginner users on how to set up their closed loop boost with ms.

My previous experience with CL boost control - Back when i first switched to MS, i tried ms1 closed loop boost. I think by some coding witchcraft it was coded to act perfectly for a few days irregardless of what the monkey in control of the settings did. I started it up and turned it on without knowing what a PID was and it magically worked perfectly. Then a few days later, everything changed, all of a sudden i would overboost everytime and couldnt figure out the right settings to get it to stop. So i gave up on CL until today.

That is the entirity of my experience with closed loop boost. For others interested in learning from this thread and want to start on the same page i did all you have to learn is what PID stands for.

My Current setup - I am running a 2.2 board running a 3.0 alpha release of MS2extra (20090912). I have an 02 nissan Sentra Spec V with a QR25DE 2.5l motor with a 60 trim turbo running 9 psi daily. I am currently running a 36-1 wheel for wasted fuel/spark.

My boost control - I am running a AEM solenoid with increasing DC = increasing boost. Wastegate pressure gives me 5 psi.

My current settings:
  • Boost control Settings Window
    Boost control Enabled - On
    Solenoid Fequency - 26Hz
    Control Interval(ms) - 10
    Boost Control Pin - JS11
    Output polarity - inverted
    Closed Duty(%) - 0
    Open Duty(%) - 100
    Algorithm - Closed-loop
    Proportional Gain(%) - 50
    Integral Gain(%) - 50
    Differential Gain(%) - 0
  • Overboost Protection window
    Overboost protection - Spark Cut
    Maximum Boost(kPa) - 200.0
    Hysteresis - 10.0
    Cut X sparks - 10
    From Y events - 10
20091007 TRIAL
* Initial settings input
  • P=50
    I=50
    D=0
* first trial resulted in immediate overboost
* could only get boost under control at part throttle.

Ive attached MSQ and 2 datalogs of the run 200

2009-10-07_17.33.21.msl - this contains the only WOT run i did resulted in immediate overboost to find run jump to max map.
2009-10-07_17.42.51.msl - a few part throttle runs which didnt result in overboost.

NOTE: 2009-10-7_17.42.51.msl is too large to upload to the forum so heres a link to it:
http://www.yousendit.com/transfer.php?a ... TVZFQlE9PQ

observations:
It takes around 38% DC to maintain my desired 9 psi goal.
Right now i am targetting 155.0 cross the board in closed loop (less than 9 psi but more space before spark cut).

What should i use for initial values because until i can get this to some better starting point im at a loss as to what to do for the PID values. besides less P and I....
muythaibxr
Site Admin
Posts: 8228
Joined: Thu Oct 14, 2004 12:48 pm

Re: Closed Loop boost (beginner to pro) log

Post by muythaibxr »

Actually if it's overshooting, you want more P.

My recommendation at this point is to do the following:

First, turn off all I.
Second, Adjust P higher. Keep going higher until it gets close to your boost without overshooting (a little overshoot is OK here).

Once you get to this point, adjust the I term until the code will hold your target boost across the rev range.

Last, adjust the D term to get rid of any leftover overshoot, and to help with any oscillation that might pop up.

Ken
Zaphod
Master MS/Extra'er
Posts: 390
Joined: Thu Aug 14, 2008 11:38 pm
Location: Germany

Re: Closed Loop boost (beginner to pro) log

Post by Zaphod »

Yep - that worked quite well for me.
At the moment I am at 105/48/150.

Greets
--------------------------------
fun is not a straight line

Image

Sven
http://www.mx-5club-sachsen.de
http://miata.cardomain.com/id/svenmx5
NB-1998-1,6-Garrett T25 HGP Turbo Stage I
darsondriss
Helpful MS/Extra'er
Posts: 66
Joined: Wed Oct 07, 2009 3:29 pm

Re: Closed Loop boost (beginner to pro) log

Post by darsondriss »

20091008 Trial

Settings Changed
  • Boost Control Settings Window
    Proportional Gain(%) - 125
    Integral Gain(%) - 0
    Differential Gain(%) - 0
Test
* This time boost was held at WOT.
* I logged about 170kpa(10 psi) while targetting 155kpa(8 psi)
* The boost went straight up to 170kpa and stayed there the whole run, didnt start to taper back down to 155
* DC was around 50-55 while holding boost.

My thoughts on improvement
* Add to P gain to get actual boost levels closer to 160kpa
* Start adding in I to get stable at target boost level

is this right?


*Edit* forgot to attach MSQ/log
muythaibxr
Site Admin
Posts: 8228
Joined: Thu Oct 14, 2004 12:48 pm

Re: Closed Loop boost (beginner to pro) log

Post by muythaibxr »

Sounds like you're on the right track.

Ken
darsondriss
Helpful MS/Extra'er
Posts: 66
Joined: Wed Oct 07, 2009 3:29 pm

Re: Closed Loop boost (beginner to pro) log

Post by darsondriss »

20091008 Trial 2

Settings Changed
  • Boost Control Settings Window
    Proportional Gain(%) - 150
    Integral Gain(%) - 0
    Differential Gain(%) - 0
Test
* Initial spike to 160kpa
* drops to 156kpa
* Followed by ocillation from 155kpa up to 168kpa and back down.
* DC ocillation between 55% and 70%

My thoughts on improvement
* Start increasing I to stop ocillations
darsondriss
Helpful MS/Extra'er
Posts: 66
Joined: Wed Oct 07, 2009 3:29 pm

Re: Closed Loop boost (beginner to pro) log

Post by darsondriss »

20091008 Trial 3

Settings Changed
  • Boost Control Settings Window
    Proportional Gain(%) - 150
    Integral Gain(%) - 25
    Differential Gain(%) - 0
Test
* Initial spike to 160kpa
* drops to 156kpa
* Followed by another spike at 165kpa
* settles down at 160kpa.
* DC ocillation between 60% and 75%

My thoughts on improvement
* change I to combat secondary spike

questions
* Do i increase or Decrease I Gain to stabilize the system?
* Is theres a general rule/guideline as to when to adjust I and when to adjust D?
muythaibxr
Site Admin
Posts: 8228
Joined: Thu Oct 14, 2004 12:48 pm

Re: Closed Loop boost (beginner to pro) log

Post by muythaibxr »

I would increase I, and start tuning the D term.

Increasing I will get you closer to the target. Tuning D should both help the initial overshoot, and help gain stability once the target is reached.

Ken
Perkele
Helpful MS/Extra'er
Posts: 135
Joined: Tue Feb 17, 2009 11:15 am
Location: Finland

Re: Closed Loop boost (beginner to pro) log

Post by Perkele »

I have been trying to perfect the boost control but I cannot get my head around on few things about the PID. My is code 2.1.0.
My setting are
19,5Hz
10ms,
Inverted
0% Closed
100% Open
And both log pictures has the PID parameters on the name.
And boost target is 220kpa
In the first log with the 14-9-2 settings theres almost no overshoot (only to 226kpa) but it comes down to 205kpa at 6000rpm do I need to make I bigger or what to get rid of the decay.
And in the 15-12-15 the rise is a bit faster but the boost isn't so smooth but keeps it still quite good, overshoot to 230 lowers to 209 and then back to 220.
Both quite good but I want it to be perfect :D
Why the boost PWM starts to rise earlier in the 14-9-2 even the D is smaller it makes the boost rise slower. I want to keep all the pressure away from the WG before target boost. Whitch way should I change the paramaters.
Zaphod
Master MS/Extra'er
Posts: 390
Joined: Thu Aug 14, 2008 11:38 pm
Location: Germany

Re: Closed Loop boost (beginner to pro) log

Post by Zaphod »

@Perkele - use the 2.1.0 final firmware with the 10x higher PID values - this gives you much improved tuning abilities.
And use the steps Ken posted to get it tuned.
--------------------------------
fun is not a straight line

Image

Sven
http://www.mx-5club-sachsen.de
http://miata.cardomain.com/id/svenmx5
NB-1998-1,6-Garrett T25 HGP Turbo Stage I
muythaibxr
Site Admin
Posts: 8228
Joined: Thu Oct 14, 2004 12:48 pm

Re: Closed Loop boost (beginner to pro) log

Post by muythaibxr »

Hrmm, I think I just came up with a new modification to help boost climb to the target faster when you're already boosting and you press the throttle.

Right now if you just blast full throttle from below boost, boost will shoot up really quick (can happen in a fraction of a second depending on turbo, engine, wastegate and settings), but if you're already maintaining a target and you give more throttle, boost doesn't climb very quickly anymore.

This is because it's all the I term after that helping you reach your target, and the type-C loop does not really respond to target changes very fast, only changes in the process variable (boost in this case).

I may try switching it to a type B loop, that will allow the P term to respond to target changes, and hopefully cause boost to climb much more quickly if the PID loop is already controlling boost.

For idle-speed control a type-C loop is best because the target doesn't really change much or quickly, but the loop should respond very fast to changes in RPM... but in the boost case, response to target changing should be very quick, and the I term can handle changes in boost away from the target.

This would require (yet another) retune, but I think the performance would be a lot better. I need to get eage8's rx7 (testing ms3 right now) set up for MS boost control so I can test these changes in person!

Ken
darsondriss
Helpful MS/Extra'er
Posts: 66
Joined: Wed Oct 07, 2009 3:29 pm

Re: Closed Loop boost (beginner to pro) log

Post by darsondriss »

Im down for any spool increase. dont really need it but if its possible why not lol. I was at the track earlier and did a few updates to the PID but am to tired to post tonight so have to do it tomorrow. Ill need a bit of second opinion though, now im to a point where i get the initial spike and then boost stays about 1 psi under the target. My thought is i need more I term? more details tomorrow.
muythaibxr
Site Admin
Posts: 8228
Joined: Thu Oct 14, 2004 12:48 pm

Re: Closed Loop boost (beginner to pro) log

Post by muythaibxr »

Sounds like you need more I-term, although if you're getting within 1 psi, that's pretty good.

Ken
darsondriss
Helpful MS/Extra'er
Posts: 66
Joined: Wed Oct 07, 2009 3:29 pm

Re: Closed Loop boost (beginner to pro) log

Post by darsondriss »

yep its getting really close... im very impressed by the new code.

20091009 Trial

Settings Changed
  • Boost Control Settings Window
    Proportional Gain(%) - 150
    Integral Gain(%) - 35
    Differential Gain(%) - 40
Test
Boost Target = 165kpa
* Initial spike to 158kpa
* Varies between 155-160kpa
* DC ocillation between 60% and 75%

My thoughts on improvement
* Increase I term to raise boost up to target

question
*my initial boost spike is below target, should i increase P term as well or will adding I add to initial spike?


EDIT: forgot msq/log/pic again :(
Last edited by darsondriss on Sat Oct 10, 2009 10:01 am, edited 1 time in total.
muythaibxr
Site Admin
Posts: 8228
Joined: Thu Oct 14, 2004 12:48 pm

Re: Closed Loop boost (beginner to pro) log

Post by muythaibxr »

IF the initial spike is below the target, then decrease P a little.

I'll be testing code to make boost control respond better to changes in target here soon too, but those changes will likely change what you need for P tuning.

Ken
darsondriss
Helpful MS/Extra'er
Posts: 66
Joined: Wed Oct 07, 2009 3:29 pm

Re: Closed Loop boost (beginner to pro) log

Post by darsondriss »

ahhh so if i change boost targets i need to fool with P term some? I and D stay the same?
muythaibxr
Site Admin
Posts: 8228
Joined: Thu Oct 14, 2004 12:48 pm

Re: Closed Loop boost (beginner to pro) log

Post by muythaibxr »

For now, yes that sounds right. D *might* need a little fiddling too.

Ken
darsondriss
Helpful MS/Extra'er
Posts: 66
Joined: Wed Oct 07, 2009 3:29 pm

Re: Closed Loop boost (beginner to pro) log

Post by darsondriss »

20091012 Trial

Settings Changed
  • Boost Control Settings Window
    Proportional Gain(%) - 130
    Integral Gain(%) - 35
    Differential Gain(%) - 60
Test
* Initial spike to 165kpa
* drops to 160kpa
* Then goes back up to 170kpa and looks perfect +-2kpa
* DC ocillation between 50% and 65%

My thoughts on improvement
* Decrease P or increase I to get the boost to reach initial target faster

Questions
* should i mess with P term or I term?


boost line is starting to look VERY nice :)
pit_celica
Master MS/Extra'er
Posts: 682
Joined: Tue Jul 18, 2006 3:12 pm

Re: Closed Loop boost (beginner to pro) log

Post by pit_celica »

wow, really nice thread! Good luck!

Sam
TheAlien
Experienced MS/Extra'er
Posts: 259
Joined: Fri May 08, 2009 2:59 am

Re: Closed Loop boost (beginner to pro) log

Post by TheAlien »

Hey, I cannot really contribute to this thread, but I have a question myself. Hope it's okay that I chime in here.
I am running a boost solenoid with the following settings on MS2 V3 with MS Extra Rel 3.0.3h:
boost.JPG
Problem is, that it doesn't seem to work. And the log files show me 0 Boost Duty all over my logs. What am I doing wrong ?
As far as I understand it, Boost Duty is the 'number' that MS is sending to the solenoid...
Running MS2/extra alpha 3.0.3s - 1991 Saab 900 Turbo
Post Reply