PID controls

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

Moderators: jsmcortina, muythaibxr

Post Reply
coyotanark
MS/Extra Newbie
Posts: 32
Joined: Wed Aug 21, 2013 7:32 am

PID controls

Post by coyotanark »

Hi

I may don't understand it well, but I'm surely a little bit lost with this. How does the slider works in basic mode for PID control, as much for idle control and boost? When in advanced mode, we can still move this slider, does it have an impact even in advanced mode? It's not clear for me in the docs. Sorry if I'm a bother.
jsmcortina
Site Admin
Posts: 39618
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: PID controls

Post by jsmcortina »

Yes, it still works in advanced mode. It is a simple way to change the overall sensitivity of the closed-loop system.

If response is too slow - make it more sensitive.
If response is too quick (massive overshoot or jumping from 0% to 100% duty) - make it less sensitive.

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".
coyotanark
MS/Extra Newbie
Posts: 32
Joined: Wed Aug 21, 2013 7:32 am

Re: PID controls

Post by coyotanark »

I passed hours trying to get idle control work. never succeeded. A step by step would be great. If it ever exists, I never found it. But I search longly on this.
JAM
Master MS/Extra'er
Posts: 626
Joined: Sun Jan 22, 2006 7:58 pm
Location: Cincinatti,OH

Re: PID controls

Post by JAM »

there is some good info on this thread about the idle PID

http://www.msextra.com/forums/viewtopic ... 03#p406520
muythaibxr
Site Admin
Posts: 8230
Joined: Thu Oct 14, 2004 12:48 pm

Re: PID controls

Post by muythaibxr »

coyotanark wrote:I passed hours trying to get idle control work. never succeeded. A step by step would be great. If it ever exists, I never found it. But I search longly on this.
Did it idle well in warmup mode? What version of the firmware?
Megasquirt is not for use on pollution controlled vehicles. Any advice I give is for off road use only.
coyotanark
MS/Extra Newbie
Posts: 32
Joined: Wed Aug 21, 2013 7:32 am

Re: PID controls

Post by coyotanark »

Yes it idle well in warmup mode. Around 750-850 rpm. But I want to use close loop, mostly because I'm perfectionist. I'm just a little bit rich, because if I lean the mixture I'm struggling with the injector lower limit. I'm in semi-sequential for the moment, I'll soon be full sequential so this problem will be solved with half opening time. I'm waiting an order for a cam sensor. I joined my project if you wanna see.

For boost control, for the moment I'm doing tests so the settings can seems strange, it's normal.
muythaibxr
Site Admin
Posts: 8230
Joined: Thu Oct 14, 2004 12:48 pm

Re: PID controls

Post by muythaibxr »

Generally when people manage to get into PID for idle control, if they complain that they can't tune it, they have instabilities in their fuel/ignition tables that get magnified by PID. I will take a look at your config later today. A log would be more useful if it is not in that zip file (posting from ipad at the moment so can't tell).
Megasquirt is not for use on pollution controlled vehicles. Any advice I give is for off road use only.
coyotanark
MS/Extra Newbie
Posts: 32
Joined: Wed Aug 21, 2013 7:32 am

Re: PID controls

Post by coyotanark »

I made a datalog at the moment just for you, but I can't upload it because it's bigger than 1MB. Give me a way to post or to send it to you. Idle is not perfect, but I think that is sufficient to be able to run on closed loop. The datalog had been made with the exact same config as the project posted above.

Thanks
muythaibxr
Site Admin
Posts: 8230
Joined: Thu Oct 14, 2004 12:48 pm

Re: PID controls

Post by muythaibxr »

If idle is not perfect then it is not sufficient to run PID idle. It needs to be perfectly stable before turning on PID. Pare down your log to something smaller that shows what you want and then try posting.
Megasquirt is not for use on pollution controlled vehicles. Any advice I give is for off road use only.
coyotanark
MS/Extra Newbie
Posts: 32
Joined: Wed Aug 21, 2013 7:32 am

Re: PID controls

Post by coyotanark »

Ok. So I made a very short one. Here it is.
2014-11-27_17.38.29.msl
muythaibxr
Site Admin
Posts: 8230
Joined: Thu Oct 14, 2004 12:48 pm

Re: PID controls

Post by muythaibxr »

In that log, PID never engages, and RPM is jumping around by almost 100 rpm. If that was a log of the problem, then the problem is you're never activating closed loop idle control.

Ken
Megasquirt is not for use on pollution controlled vehicles. Any advice I give is for off road use only.
coyotanark
MS/Extra Newbie
Posts: 32
Joined: Wed Aug 21, 2013 7:32 am

Re: PID controls

Post by coyotanark »

No, on this one I use the configuration which is in the project above, in warmup mode. It's the best I can have in warmup mode. It seems to not be stable enough for closed loop when I put it on.
muythaibxr
Site Admin
Posts: 8230
Joined: Thu Oct 14, 2004 12:48 pm

Re: PID controls

Post by muythaibxr »

Can you log what it is doing in closed loop?
Megasquirt is not for use on pollution controlled vehicles. Any advice I give is for off road use only.
farbird
MS/Extra Newbie
Posts: 31
Joined: Mon Dec 03, 2012 10:01 pm

Re: PID controls

Post by farbird »

This is what I do when I tune PID.

P = the initial deviation to add/subtract to get the measured output as close to the desired value.
I = if it overshoots, how much to correct [ relative to P ]
D = how fast to do the corrections the next round based on the "P" and "I" live data

so, P will be the first adjustment [ if your tuning is not really close the desired output yet, u may need a huge P ]
"I" will be the corrections required if "P" overshoots past the desired result. [ if u have a high P, try a low I ] and vice versa.
"D" is something that can only be tuned once P and I is acceptable.. ie control output is achieved with minimal times it overshoots the desired point.

ie, if u look at a sine wave and the desired point is zero on the y axis, an almost perfect P and I, will probably cross the y axis 2-3 times before it settles at zero.
If your P and I achieves that already, minimal overshoot occurrence to reach desired point, then u begin adjusting the D.

Gradually increase it from zero or start at 50% and decreasing it until the time required for P and I to settle is reduced.

see the table here [ it was a good read for me ]
Effects of increasing a parameter independently

http://en.wikipedia.org/wiki/PID_contro ... ual_tuning

On my MS, I use PID only for o2 AFR control.

These are my PID settings
P=10%
I=50%
D=20%

Each PID will be different as VE tables are different and so are AFR tables.

For those whom are more academic can try the Ziegler Nichols Method

http://en.wikipedia.org/wiki/PID_contro ... ols_method

It provides u a systematic way of getting the PID by starting with the P first.
There are also other methods which teaches u to start varying the I first.
But as described earlier, the D can only be tuned after the P and I is fixed. [ no 2 ways about the order of D being the last to derive after getting the P and I]
coyotanark
MS/Extra Newbie
Posts: 32
Joined: Wed Aug 21, 2013 7:32 am

Re: PID controls

Post by coyotanark »

Hi! Great guide. I'm trying make it work but I have few free time. I'll keep you in touch as soon as I achieve something good enough.
Post Reply