Data logging P, I, and D contributions to closed loop
Moderators: jsmcortina, muythaibxr
-
- Site Admin
- Posts: 8230
- Joined: Thu Oct 14, 2004 12:48 pm
Re: Data logging P, I, and D contributions to closed loop
EGO is actually type C. Boost is "ideal" PID at this point. It is pretty easy to experiment with the different types.
Megasquirt is not for use on pollution controlled vehicles. Any advice I give is for off road use only.
Re: Data logging P, I, and D contributions to closed loop
I'm assuming this was directed at me? I'm not sure what you mean by documenting what they mean and how to tune them? As in a "how to guide to PID tuning"? Thats not what I was getting at. There is plenty of information online on how to tune PID loops. I'm just referring to being able to log what each parameter is doing during the loop. For any PID loop, you should really be able to see what each term is doing when a disturbance is introduced and how the terms contribute to getting the loop back on target. Without this information you are just blindly stabbing at numbers until you get to a place where it "sort of" works. You might be lucky and get it first try or it could take a long time to get the control where you want it. At least if you can see what the terms are doing then you can make some educated guesses on where each term needs to be for your particular application.whittlebeast wrote:Ok, so how would we document what the three numbers mean and how to tune them?
Andy
On the topic of documenting though, I think it would be very useful to document what type of algorithm each PID loop is which would also help tuning it. There is no mention of this in the manuals that I can see of what type of algorithms are used which makes tuning the loop more difficult unless you dig into the source code. Happy to be proven wrong on that one though. Searching on the forums will likely dig up an answer but I'm sure it would be no harm to include more information in the manuals to help people out?
-
- Site Admin
- Posts: 39612
- Joined: Mon May 03, 2004 1:34 am
- Location: Birmingham, UK
- Contact:
Re: Data logging P, I, and D contributions to closed loop
I've had a look at implementing this but run into some problems getting the data out that may be TS/MLV issues.
James
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 had also put in a request for this
I have used another branded ecu which shows the PID gains (as they use a table for the PID gains, its not a fixed number like the MS) and the P,I,D Output numbers, so for example for closed loop idle it would show P = 5% I -2% D=0% etc depending on what its doing. Made it much easier to tune the gains to to get it to reach the target cleanly, and see what parameter is having most effect.
I have used another branded ecu which shows the PID gains (as they use a table for the PID gains, its not a fixed number like the MS) and the P,I,D Output numbers, so for example for closed loop idle it would show P = 5% I -2% D=0% etc depending on what its doing. Made it much easier to tune the gains to to get it to reach the target cleanly, and see what parameter is having most effect.
Re: Data logging P, I, and D contributions to closed loop
Another +1!
For a while I was running a self-modded version of the MS3 code and one of my mods was that it logged P/I/D parameters for boost control. It made tuning *much* easier!
There are a few caveats though:
1) The MS code, particularly the older stuff, uses a weird (IMHO) implementation where the P, I, and D parameters are not calculated the usual way. So outputting them to the datalog isn't just a simple matter of adding/copying the internal variables to the logged dataset.
1a) The code uses a single function to implement several different PID controls. So there's not a separate P, I, and D value stored for each.
2) In order for this to help with tuning, you have to have a fairly good understanding of how PID controllers work. If you don't know how to interpret the numbers, it won't be any help.
When I did my mod I wrote separate PID-control code for boost, which eliminated issues 1 and 1a, but that of course makes the code size larger, just like having separate P/I/D variables for things makes the data size larger.
If anyone's curious, I've attached a log file showing boost PID parameters.
For a while I was running a self-modded version of the MS3 code and one of my mods was that it logged P/I/D parameters for boost control. It made tuning *much* easier!
There are a few caveats though:
1) The MS code, particularly the older stuff, uses a weird (IMHO) implementation where the P, I, and D parameters are not calculated the usual way. So outputting them to the datalog isn't just a simple matter of adding/copying the internal variables to the logged dataset.
1a) The code uses a single function to implement several different PID controls. So there's not a separate P, I, and D value stored for each.
2) In order for this to help with tuning, you have to have a fairly good understanding of how PID controllers work. If you don't know how to interpret the numbers, it won't be any help.
When I did my mod I wrote separate PID-control code for boost, which eliminated issues 1 and 1a, but that of course makes the code size larger, just like having separate P/I/D variables for things makes the data size larger.
If anyone's curious, I've attached a log file showing boost PID parameters.
Eric Law
1990 Audi 80 quattro with AAN turbo engine: happily running on MS3+MS3X
2012 Audi A4 quattro, desperately in need of tweaking
Be alert! America needs more lerts.
1990 Audi 80 quattro with AAN turbo engine: happily running on MS3+MS3X
2012 Audi A4 quattro, desperately in need of tweaking
Be alert! America needs more lerts.
-
- 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 a plot of the data ELaw posted
http://www.nbs-stl.com/mlvhd/ELaw%20PID ... hot%20.png
Back to my question... How do we use this and how do we teach/document this?
Andy
http://www.nbs-stl.com/mlvhd/ELaw%20PID ... hot%20.png
Back to my question... How do we use this and how do we teach/document this?
Andy
Re: Data logging P, I, and D contributions to closed loop
I don't mean to thread jack, but I have searched around and could not figure out what p,I,d did. That explanation you posted was very informative. Although I have no clue the inner workings of ms. I think it would be easier to tune if there was a p,I,d out that gave numbers on the effects of each of them.
For example p is adding x, I is subtracting x, and d is adding x. Even if it was an add-in or "plug in" to tuner studio that calculated these values on the tuning computer based on the tune data. (The plug in calculated them in parallel to mega squirt - calculated field on tuning computer only, no changes to Ms code) I don't think the exact number would be as beneficial as just seeing witch is increasing and witch is subtracting in sudo real time......
For example p is adding x, I is subtracting x, and d is adding x. Even if it was an add-in or "plug in" to tuner studio that calculated these values on the tuning computer based on the tune data. (The plug in calculated them in parallel to mega squirt - calculated field on tuning computer only, no changes to Ms code) I don't think the exact number would be as beneficial as just seeing witch is increasing and witch is subtracting in sudo real time......
92 Dakota Work in progress (ms3x)
-
- Site Admin
- Posts: 39612
- Joined: Mon May 03, 2004 1:34 am
- Location: Birmingham, UK
- Contact:
Re: Data logging P, I, and D contributions to closed loop
I've added logging of Idle, AFR1, Boost1 PID terms to SDcard "internal fields" for the next pre-1.5.1 beta.
James
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".
-
- 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
Here is what the Alpha code looks like on a running motor. I run PID on AFR only. My Gego correction is set up to run 4% max authority.
http://www.nbs-stl.com/tuning/PID%20Ego ... ection.png
Note that I am getting data at 200 samples per sec. Each spike in the next_spark.tooth is one full engine cycle. I am finding that a typical big AE event on my motor is about 5 engine cycles long. This is all done on a MS3 Ultimate running a Honda ITB motor.
Andy
http://www.nbs-stl.com/tuning/PID%20Ego ... ection.png
Note that I am getting data at 200 samples per sec. Each spike in the next_spark.tooth is one full engine cycle. I am finding that a typical big AE event on my motor is about 5 engine cycles long. This is all done on a MS3 Ultimate running a Honda ITB motor.
Andy
-
- Site Admin
- Posts: 39612
- Joined: Mon May 03, 2004 1:34 am
- Location: Birmingham, UK
- Contact:
Re: Data logging P, I, and D contributions to closed loop
This is now released as pre-1.5.1 beta 3.jsmcortina wrote:I've added logging of Idle, AFR1, Boost1 PID terms to SDcard "internal fields" for the next pre-1.5.1 beta.
You need to enable INTERNAL_LOG_FIELDS in your project properties, then you can add fields like these to your SDcard datalog. These are not available in regular datalogs.
pid_log_idle_p
pid_log_idle_i
pid_log_idle_d
pid_log_idle_count
Note that these are in internal units which won't necessarily correspond to the externally visible units e.g. for idle the 0-100% scale is handled 0-255 internally. Viewing the "idle steps" field gives you 0-255. The "count" field increments each time the calculation is run, so log this as well.
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
Thank you for adding the PID gains for boost and the idle controller. yay.
-
- Super MS/Extra'er
- Posts: 3653
- Joined: Fri Apr 02, 2004 8:40 pm
- Location: Virginia Beach, VA
- Contact:
Re: Data logging P, I, and D contributions to closed loop
Would it be difficult to add to VVT?
Sent from my XT1254 using Tapatalk
Sent from my XT1254 using Tapatalk
Peter Florance
PF Tuning
81 BMW Euro 528i ESP Car
60-2 Wheel LS2 Coils, Low Z Inj
Co-Driver 1999 BMW E46 DSP car.
PF Tuning
81 BMW Euro 528i ESP Car
60-2 Wheel LS2 Coils, Low Z Inj
Co-Driver 1999 BMW E46 DSP car.
-
- Site Admin
- Posts: 39612
- Joined: Mon May 03, 2004 1:34 am
- Location: Birmingham, UK
- Contact:
Re: Data logging P, I, and D contributions to closed loop
Not particularly, but which channel?!Peter Florance wrote:Would it be difficult to add to VVT?
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".
-
- Super MS/Extra'er
- Posts: 3653
- Joined: Fri Apr 02, 2004 8:40 pm
- Location: Virginia Beach, VA
- Contact:
Re: Data logging P, I, and D contributions to closed loop
I'm not sure I understand the question.jsmcortina wrote:Not particularly, but which channel?!Peter Florance wrote:Would it be difficult to add to VVT?
James
I'm my case, I might want to tune VVT 1 or 2 as that is intake and exhaust.
Thanks
Sent from my XT1254 using Tapatalk
Peter Florance
PF Tuning
81 BMW Euro 528i ESP Car
60-2 Wheel LS2 Coils, Low Z Inj
Co-Driver 1999 BMW E46 DSP car.
PF Tuning
81 BMW Euro 528i ESP Car
60-2 Wheel LS2 Coils, Low Z Inj
Co-Driver 1999 BMW E46 DSP car.
-
- Site Admin
- Posts: 39612
- Joined: Mon May 03, 2004 1:34 am
- Location: Birmingham, UK
- Contact:
Re: Data logging P, I, and D contributions to closed loop
Added for beta 7.Peter Florance wrote:Would it be difficult to add to VVT?
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
Anyone try logging values and tuning based on it? I am going to try, but was curious.
I also found this thread which was very interesting that talks about about the different Types of PID equations and why Type C is superior in most cases. http://bestune.50megs.com/typeABC.htm
I also found this thread which was very interesting that talks about about the different Types of PID equations and why Type C is superior in most cases. http://bestune.50megs.com/typeABC.htm
'90 Corrado G60 on MSns -e -> MS3 - '62 Harley Panhead
Supercharged 2L-20v Project Build -> https://forums.vwvortex.com/showthread.php?2805002
Making 02m 6speed Conversion Mounts for VW MKII and MKIII -> http://www.generalprinciple.com/02m
Supercharged 2L-20v Project Build -> https://forums.vwvortex.com/showthread.php?2805002
Making 02m 6speed Conversion Mounts for VW MKII and MKIII -> http://www.generalprinciple.com/02m