Data logging P, I, and D contributions to closed loop
Moderators: jsmcortina, muythaibxr
-
- Super MS/Extra'er
- Posts: 17499
- Joined: Thu Apr 16, 2009 8:08 pm
Data logging P, I, and D contributions to closed loop
I've had a couple customers who were annoyed at how their PID tuning (one for boost, one for O2 correction) was behaving. Is it possible to change the code to add a feature to data log the internal calculations - contributions from the P, I, and D terms, for example? This might aid in troubleshooting these sorts of issues.
Matt Cramer -1966 Dodge Dart slant six running on MS3X
-
- Experienced MS/Extra'er
- Posts: 226
- Joined: Fri Apr 08, 2005 2:08 pm
- Location: Wathlingen, Germany
Re: Data logging P, I, and D contributions to closed loop
yes please!
Best looking and most advanced CAN-bus gauge
Toyota Supra 7MGE, 7M-GTE and 1JZ-GTE Plug and play ECUs: http://www.perfecttuning.net
Serial to Bluetooth or Serial to WiFi
DIYAutotune Canadian, EFI Source and ECUMaster reseller!
Toyota Supra 7MGE, 7M-GTE and 1JZ-GTE Plug and play ECUs: http://www.perfecttuning.net
Serial to Bluetooth or Serial to WiFi
DIYAutotune Canadian, EFI Source and ECUMaster reseller!
-
- Super MS/Extra'er
- Posts: 2221
- Joined: Tue May 04, 2004 8:20 pm
- Location: St Louis
- Contact:
Re: Data logging P, I, and D contributions to closed loop
Assuming you could get the programmers to include this in the logs, explain how you would use this to solve a hunting idle or AFR issue.
Andy
Andy
-
- Super MS/Extra'er
- Posts: 17499
- Joined: Thu Apr 16, 2009 8:08 pm
Re: Data logging P, I, and D contributions to closed loop
This is something to help with a sort of "higher level" complaint - customers who insist that the code must be broken because it's either not applying correction as quickly as they'd like, or are baffled by some sort of weird behavior. This log was taken from a test on a Stim where I was trying to establish that PID correction speed had not changed significantly between the 1.4.1 and 1.5.0 code, but it has a set of "spikes" to the EGO correction that I don't understand. Logging the P, I, and D terms might give some explanation.whittlebeast wrote:Assuming you could get the programmers to include this in the logs, explain how you would use this to solve a hunting idle or AFR issue.
Andy
And since I don't really have the programming skills (or time) to take apart the code and prove to a customer (who may very well have even worse programming skills than me) that the code is working, something like this could save me a lot of time on some of the more difficult customer support conversations. They don't happen extremely often, but when they do these tend to take up a disproportionate share of time.
Matt Cramer -1966 Dodge Dart slant six running on MS3X
Re: Data logging P, I, and D contributions to closed loop
I've already written this code as I was trying to figure out why P is doing almost nothing to correct the fueling. Let me look it up and I can post a patch here.Matt Cramer wrote:I've had a couple customers who were annoyed at how their PID tuning (one for boost, one for O2 correction) was behaving. Is it possible to change the code to add a feature to data log the internal calculations - contributions from the P, I, and D terms, for example? This might aid in troubleshooting these sorts of issues.
The man behind MS Labs
2005 Audi A3 2.0L TFSI DSG AWD - Extreme MS3
2002 Mazda Miata 1.8 6sp - Enhanced MS3 1.4.0, sequential injection, sequential ignition, big turbo, lots of boost
2005 Audi A3 2.0L TFSI DSG AWD - Extreme MS3
2002 Mazda Miata 1.8 6sp - Enhanced MS3 1.4.0, sequential injection, sequential ignition, big turbo, lots of boost
-
- Super MS/Extra'er
- Posts: 855
- Joined: Sun Oct 10, 2010 6:33 am
Re: Data logging P, I, and D contributions to closed loop
Knowing what each of the terms are doing would massively help to dial in the control for anyone familiar with standard control systems. Not logging them means you are trying to tune the control loop blind.whittlebeast wrote:Assuming you could get the programmers to include this in the logs, explain how you would use this to solve a hunting idle or AFR issue.
Andy
-
- Super MS/Extra'er
- Posts: 2221
- Joined: Tue May 04, 2004 8:20 pm
- Location: St Louis
- Contact:
Re: Data logging P, I, and D contributions to closed loop
Ok, so how would we document what the three numbers mean and how to tune them?
Andy
Andy
-
- Super MS/Extra'er
- Posts: 2221
- Joined: Tue May 04, 2004 8:20 pm
- Location: St Louis
- Contact:
Re: Data logging P, I, and D contributions to closed loop
This is one of the best (simple minded) explanation of a PID logic that I have ever seen. Still trying to get my head around bringing this back to a log and "Here is the problem, grab that knob"
https://commons.wikimedia.org/wiki/File ... imated.gif
Andy
https://commons.wikimedia.org/wiki/File ... imated.gif
Andy
-
- Site Admin
- Posts: 8228
- Joined: Thu Oct 14, 2004 12:48 pm
Re: Data logging P, I, and D contributions to closed loop
Did you find anything other than AFR has to be changing for it to have an effect?Reverant wrote:I've already written this code as I was trying to figure out why P is doing almost nothing to correct the fueling. Let me look it up and I can post a patch here.Matt Cramer wrote:I've had a couple customers who were annoyed at how their PID tuning (one for boost, one for O2 correction) was behaving. Is it possible to change the code to add a feature to data log the internal calculations - contributions from the P, I, and D terms, for example? This might aid in troubleshooting these sorts of issues.
Megasquirt is not for use on pollution controlled vehicles. Any advice I give is for off road use only.
-
- Experienced MS/Extra'er
- Posts: 299
- Joined: Wed Oct 29, 2008 8:26 am
- Location: Frankfurt / Germany
Re: Data logging P, I, and D contributions to closed loop
+1 for this feature for both EGO and Idle control
Honda CRX B16A1 Turbo | MS3 running | pre1.5.1 beta7 Firmware | 24/1 Dual Wheel | COP ignition | 725cc ID injectors
-
- Super MS/Extra'er
- Posts: 2221
- Joined: Tue May 04, 2004 8:20 pm
- Location: St Louis
- Contact:
Re: Data logging P, I, and D contributions to closed loop
If you enter PID in the TS search box, you get 8 different things that can be controlled with PID, or 24 new possible fields to log.
-
- Super MS/Extra'er
- Posts: 17499
- Joined: Thu Apr 16, 2009 8:08 pm
Re: Data logging P, I, and D contributions to closed loop
It would make sense to allow this to be turned off or on, like Port Status.
Matt Cramer -1966 Dodge Dart slant six running on MS3X
-
- Super MS/Extra'er
- Posts: 2221
- Joined: Tue May 04, 2004 8:20 pm
- Location: St Louis
- Contact:
Re: Data logging P, I, and D contributions to closed loop
James may chine in here, but I wonder what the format of the P, I, and D are under the covers.
Andy
Andy
-
- Site Admin
- Posts: 39587
- Joined: Mon May 03, 2004 1:34 am
- Location: Birmingham, UK
- Contact:
Re: Data logging P, I, and D contributions to closed loop
They are signed 32bit numbers. So adding all of these could require 96 bytes of "outpc" space.whittlebeast wrote:James may chine in here, but I wonder what the format of the P, I, and D are under the covers.
Andy
James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk
My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
Re: Data logging P, I, and D contributions to closed loop
96bits.
The man behind MS Labs
2005 Audi A3 2.0L TFSI DSG AWD - Extreme MS3
2002 Mazda Miata 1.8 6sp - Enhanced MS3 1.4.0, sequential injection, sequential ignition, big turbo, lots of boost
2005 Audi A3 2.0L TFSI DSG AWD - Extreme MS3
2002 Mazda Miata 1.8 6sp - Enhanced MS3 1.4.0, sequential injection, sequential ignition, big turbo, lots of boost
-
- Site Admin
- Posts: 39587
- Joined: Mon May 03, 2004 1:34 am
- Location: Birmingham, UK
- Contact:
Re: Data logging P, I, and D contributions to closed loop
24 fields according to Andy. x 4 bytes each -> 96 bytes.Reverant wrote:96bits.
James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk
My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
Re: Data logging P, I, and D contributions to closed loop
I think Matt mostly said about EGO and boost control, not really everything.
Like I said before, I myself had the same idea when I saw logs of stock ECUs and other ECUs doing closed loop fuel control REALLY quick, and no matter what I would do, I couldn't get the MS3 to react as quickly, and after a little code hacking, led me to the observation that if I had PID values of 100,0,0, a target of 14.7 and an actual AFR of 10 (pegged rich), the closed loop would just sit there and won't make any corrections at all.
Now, Ken has said that he has implemented the type B algorithm and that's fine, but is type B really suited in this case? I've had so much better results with closed loop fuel control since I converted Kp = (long) (error * (long)set_Kp);
And then there's the limiting size of outpc, which is probably the current biggest development issue right now. We can't add any new features that need gauges or datalogging without increasing the size of outpc.
Like I said before, I myself had the same idea when I saw logs of stock ECUs and other ECUs doing closed loop fuel control REALLY quick, and no matter what I would do, I couldn't get the MS3 to react as quickly, and after a little code hacking, led me to the observation that if I had PID values of 100,0,0, a target of 14.7 and an actual AFR of 10 (pegged rich), the closed loop would just sit there and won't make any corrections at all.
Now, Ken has said that he has implemented the type B algorithm and that's fine, but is type B really suited in this case? I've had so much better results with closed loop fuel control since I converted Kp = (long) (error * (long)set_Kp);
And then there's the limiting size of outpc, which is probably the current biggest development issue right now. We can't add any new features that need gauges or datalogging without increasing the size of outpc.
The man behind MS Labs
2005 Audi A3 2.0L TFSI DSG AWD - Extreme MS3
2002 Mazda Miata 1.8 6sp - Enhanced MS3 1.4.0, sequential injection, sequential ignition, big turbo, lots of boost
2005 Audi A3 2.0L TFSI DSG AWD - Extreme MS3
2002 Mazda Miata 1.8 6sp - Enhanced MS3 1.4.0, sequential injection, sequential ignition, big turbo, lots of boost
Re: Data logging P, I, and D contributions to closed loop
And to answer this: no. P was only making corrections if the AFR was wildly swinging up and down (big changes in error). On a relativelt calm engine, with just a massive error in AFR, P is doing nothing and only I is working over time to bring it in line.muythaibxr wrote:Did you find anything other than AFR has to be changing for it to have an effect?Reverant wrote:I've already written this code as I was trying to figure out why P is doing almost nothing to correct the fueling. Let me look it up and I can post a patch here.Matt Cramer wrote:I've had a couple customers who were annoyed at how their PID tuning (one for boost, one for O2 correction) was behaving. Is it possible to change the code to add a feature to data log the internal calculations - contributions from the P, I, and D terms, for example? This might aid in troubleshooting these sorts of issues.
The man behind MS Labs
2005 Audi A3 2.0L TFSI DSG AWD - Extreme MS3
2002 Mazda Miata 1.8 6sp - Enhanced MS3 1.4.0, sequential injection, sequential ignition, big turbo, lots of boost
2005 Audi A3 2.0L TFSI DSG AWD - Extreme MS3
2002 Mazda Miata 1.8 6sp - Enhanced MS3 1.4.0, sequential injection, sequential ignition, big turbo, lots of boost