Cruise control, PID and integral wind-up - Page 1
Forum section: electronics / projects

author: Circlotron
author_rank: Super Contributor
timestamp: April 30, 2019, 01:16:09 am
content: Just thinking, if a normal analog PID setup was used in a car cruise control then if a hill came along and the car slowed somewhat then recovered, it would overshoot the original speed and then settle down to the set speed again. This overshoot "problem" as I see it is not a deficiency in the circuit but simply the car catching up to thepositionit would have been at if it had not slowed down.The question is - how can you make an analog system that doesn't overshoot greatly, that once it reaches the set speed again it dumps the integral wind-up? In other words, is happy once it regains the set speed rather than the lost position.

author: jeremy
author_rank: Super Contributor
timestamp: April 30, 2019, 02:38:32 am
content: A leaky integral term is a simple way. For every unit time, subtract some small value from the absolute value of the integral error. Essentially the integral term will always decay to zero.You could also not use the integral term at all. In some systems the I term can actually increase error (although I have no idea about cruise control)

author: IanB
author_rank: Super Contributor
timestamp: April 30, 2019, 02:54:47 am
content: Quote from: Circlotron on April 30, 2019, 01:16:09 amThis is not necessarily the case.QuoteI don't think this is how control loops work. The control loop doesn't know the vehicle's position--it is not using GPS, for example. It only knows the instantaneous speed of the car.QuoteThis is easy, it is all a matter of tuning. If you tune for an over-damped control response then there will be no overshoot.

author: Phoenix
author_rank: Frequent Contributor
timestamp: April 30, 2019, 03:00:10 am
content: Cruise control these days is digital. Anti windup is as simple as limiting a variable or stopping the integral summation if the output is >100%.Similar can be done with an opamp pid using a zener diode across the integrator capacitor.Sent from my G8441 using Tapatalk

author: David Hess
author_rank: Super Contributor
timestamp: April 30, 2019, 03:22:23 am
content: Cruise controls or at least the analog ones do suffer from windup and will overshoot when recovering but the effect is usually well controlled.Integrator windup is ameliorated either by including anti-windup circuits or using a topology which does not suffer as much from it like a transconductance error amplifier. Some operational amplifiers include "clamping" inputs which can be used to limit windup. The old LM301A operational amplifier is a favorite of mine because one of its compensation pins provides access to the transconductance node and can be used for clamping.

author: Circlotron
author_rank: Super Contributor
timestamp: April 30, 2019, 03:34:21 am
content: ^^ Overshoot when recovering. After thinking about it further, that sounds right. The integrating cap gets charged one polarity as the car falls behind when initially slowing on a hill, so later, when the hill levels off to flat road again, the car overspeeds to get back to its “rightful” position on the road, causing the cap to discharge. Any sag in speed must be balanced by a later bump in speed. Equal area under the curve.Edit -> add "when the hill levels off to flat road again"

author: coppercone2
author_rank: Super Contributor
timestamp: April 30, 2019, 03:38:20 am
content: Yes, what you are asking for sounds like it would be refereed to as a PID-Heuristic. That is, non-linear PID behavior which transfer function (or I guess control loop plot?) is easier described with words then a equation.To implement an analog solution you would need to figure out how to turn that words into a equation that is valid over some response.The art of electronics calls this non-simple behavior heuristics. The different solutions people proposed here to modify the PID have different complexities (kind of like different approximations to a simple resistor with inductance, capacitance, etc.. you can get deeper and deeper into it to get a more ideal response).Maybe along the lines of if this and that term of the PID are in this and that region connect them to dummy loads and monitor them but swap in another circuit (or add another circuit to their response to weigh after their buffered/isolated in the signal chain).You can also add a digital supervisor to a analog loop, I believe typically you would do digital-bulk and analog-mini to get more precision, or analog-bulk and digital-trim to get better response but I am not sure. They will obviously fight each other but you can get a favorable response.If it needs memory then its more complicated. What I mean is like if integral output is between 7-10V, then add in a dampening circuit, otherwise isolate that circuit to change response. If you want something like a response to a term-high 5 seconds ago being weighed into the response etc.. i can imagine its going to get very hairy, i think sample and holds etc (then you are looking at digital filter math for more complicated stuff to be practical)i.e. i between 5-7V means P gets gain loss.when the PID frequency response differs greatly from your desired heuristic time, then digital starts to make more sense.**The question is - how can you make an analog system that doesn't overshoot greatly, that once it reaches the set speed again it dumps the integral wind-up? In other words, is happy once it regains the set speed rather than the lost position.something like connect a drain resistor to discharge the I some how rapidly when absolute ~ 0 if I is > then some number and P and D are within some range? soft comparator connected to a voltage dependant drain resistor?

author: IanB
author_rank: Super Contributor
timestamp: April 30, 2019, 03:57:41 am
content: There seems to be a misunderstanding in this thread about what integral windup is. Integral windup is not "excess" integral action that has to be "dumped" once you reach the set point (the desired speed).Integral windup is rather a continuing accumulation of integral action after the manipulated variable (the gas pedal) has hit the limit and can move no further. For example if you perhaps were going up a very steep hill and the pedal hit the floor and therefore no more control action were possible.In normal freeway driving with reasonable inclines and a reasonable excess capacity in the engine to recover the dropping speed then integral windup will not occur and no special action will be required to compensate for it.As I mentioned above a normal PID control loop can be tuned more aggressively or less aggressively. With aggressive tuning you can get overshoot. With less aggressive tuning you can have a damped response with no overshoot. It's a choice you can make. It does not require any kind of special non-linear control algorithms or special logic to achieve in the normal control domain.

author: IanB
author_rank: Super Contributor
timestamp: April 30, 2019, 03:59:03 am
content: Quote from: coppercone2 on April 30, 2019, 03:38:20 amThere is no such difficulty. You simply tune the controller for the response you want.

author: ejeffrey
author_rank: Super Contributor
timestamp: April 30, 2019, 04:00:44 am
content: Quote from: IanB on April 30, 2019, 02:54:47 amThis is actually what happens in an ideal PID controller. In the steady state of a PID controller, the P and D terms are zero and the I term provides 100% of the output. i.e., If you need 10% throttle to maintain speed, the I term will be 10%. After a temporary external disturbance (such as going up a hill), the system will regain equilibrium at the same level of 10%. That means that the velocity error integrated across the disturbance sums to zero. It will have as much area "too fast" as "too slow", and you end up in the same position as you would have without the disturbance.The simplest "solution" to this is actually to just increase the gain. That reduces the undershoot and therefore the overshoot. Beyond that you need something non-linear. That could be just picking a sensible saturation level for the integrator, or a more sophisticated anti-windup circuit. What you need depends on your system and tolerance for exceeding the setpoint.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: April 30, 2019, 04:10:01 am
content: The circumstance you describe is not usually a case of integrator windup, just the normal (LTI) dynamic, how much overshoot it exhibits.Integrator windup is a nonlinear process, where the integrator has positive and negative saturation limits beyond the input range of the plant being controlled. Typically this arises due to internal nodes (e.g., a multistage amplifier where the internal node has a range of state outside your control), or due to explicit nonlinear elements added to the control loop to provide additional functionality (e.g., the wired-OR diodes in an analog bench supply).A complementary process is slew rate limiting, where the integrator cannot move fast enough to match the input -- this is typically a saturation process earlier in the chain (i.e., in a diffamp's input or volt-amp stage).Incidentally, note that traditional dominant-pole-compensated voltage mode op-amps are "leaky" integrators, in and of themselves -- they have a dominant -20dB/dec frequency response, starting from a quite low frequency pole, with reasonably high DC gain (say 0.01Hz-1kHz and 60-140 dB).With definitions cleared up -- where else might we expect windup?To use the same example, we might actually expect it for a sufficiently steep upwards hill (where the cruise control would be flooring the throttle), assuming the control is designed for full control authority of course (which it might not be? I wonder).Note that, for a given RPM, the engine is only capable of so much torque at full throttle, and it reaches nearly this torque (say within 90%) at some fraction of full throttle. This happens because the engine isn't drawing its maximum intake flow rate, so the partially-opened throttle has little pressure drop, and the manifold air pressure is nearly atmospheric.This won't be so noticeable in an automatic car -- the transmission will downshift when high throttle is demanded, increasing engine RPM and extending the useful throttle control range. It is noticeable in a manual car, especially in an especially high gear (low engine RPM) for a given cruising speed, where torque maxes out quickly with respect to throttle range.We might also expect it for adownwardshill, where the throttle backs off completely (the hill is steeper than the vehicle's "glide slope" and it accelerates), then comes out of saturation as speed returns to nominal.Incidentally, between automatic and manual cars, the cruise response is quite stark -- the automatic must take account of the slow throttle, torque converter and transmission response. The whole thing is a squishy mess, and this decouples throttle input from wheel torque and therefore speed change. In control terms, there are additional poles in the system. Typical cruise controls have a dominant pole around 1Hz.Manual cruise controls can act much faster, and indeed could even be designed to use engine RPM instead of ground speed, or even a phase lock to a DDS (which corresponds to a position lock with respect to other traffic going the exact same speed*). Throttle response of a traditional engine is pretty straightforward (having a dominant pole in the maybe 5-10Hz range) so the cruise can be much more stable.*Although, unfortunately you'd never see this in practice due to variations in tire size and inflation, for example.Modern auto transmissions with locking gears should be able to do this as well, but I don't know if they are made to.And the less said about CVTs, the better?The one of those I test drove, the whole traction system (since it's fly-by-wire and not meaningfully an engine and transmission, but a whole system unto itself) had a dominant pole of fractional Hz, very unpleasant to drive. (I suspect a lot of that is intentional -- psychology. Mass produced things have a ridiculous amount of psychology driving their design, no matter how stupid. CVTs with simulated gears, for example...) Unclear if the cruise would be integrated into that system (and therefore the CVT can be set to anticipate the "intent" of the cruise control), or external and therefore even slower still (with a plant of fractional-Hz, the control would have to roll off at 100s mHz!).Tim

author: IanB
author_rank: Super Contributor
timestamp: April 30, 2019, 04:13:07 am
content: Quote from: ejeffrey on April 30, 2019, 04:00:44 amThis analysis assumes that you started and ended on a level road and there was a temporary incline somewhere in between. But in this case there is no overshoot due to integral windup, there is just the natural action of the controller when the incline ends. The car starts going slightly too fast as the gradient levels out and the speed control compensates.

author: Circlotron
author_rank: Super Contributor
timestamp: April 30, 2019, 05:36:51 am
content: And part of the problem, if you'll pardon the pun, is that I misunderstood the *term* "wind-up". I thought that was the proper description of the value accumulated in the integrator at any given moment, not a problem with a saturated control loop caused by a maxed out integrator.