4. There is no increase in the CV until the setpoint is reached; I think with rockwells formula, I would need a derivative term in order to affect the CV before the setpoint is reached. Until setpoint is exceeded, there is no positive error for the P and I terms to calculate.
It is not Rockwell's formula, it is
- the generic PID formula,
- with anti-windup reset to limit the accumulating I term to prevent the CV from exceeding its hard limits
- plus the fact that the primary problem is during startup i.e. climbing from (near-)zero pressure to operating pressure.
- Those hard limits happen to be 0-16383 for Rockwell PIDs
1) The generic PID formula sums four terms that each scale values of error (E = PV-SP or SP-PV) in different was over time in discrete steps
called loop update times (
Δt) to calculate the output CV:
1.1) P - Proportional: KC E
1.2) I - Integral: KC ΣE Δt / TI
1.3) D - Derivative: KC dE/dt TD / Δt
1.4) Bias - a constant to offset
There are slight difference in various PID implementation details:
- scalings;
- time units*;
- whether KC is part of the I and D terms, or the gains are independent;
- whether the P and D terms operate on Error or PV;
- how anti-windup reset is implemented;
- etc.
*
e.g. Δt and TI and TD have the same units above; in Rockwell PID, there is a factor of 60 for TI and TD, which have units of minutes, while Δt has units of seconds.
But all versions of discrete valid PID implementations boil down to those same mathematical terms, and will yield essentially the same results when given the same inputs (PV and SP) and equivalent tuning parameters.
A few things to note about some of those terms:
- If SP is constant, which is usually the case, then its contribution to the P term is constant, and the P term can be replaced with
- KC PV - KC SP
- The important part being that the part in blue is constant over time i.e. over multiple loop updates.
- Again if SP is constant, then SP's contribution to the D term is 0, because dE/dt is equal to dPV/dt
- The bias term is constant.
What this means is that, for any period where SP does not change, SP and bias perform essentially the same function; stated another way, the effect changing either SP or bias alone could be accomplished by changing the other by some amount determined by the tuning parameters.
2) With anti-windup reset,
2.1) at each re-calculation of
2.1.1) the P, I (accumulation), D, bias terms,
2.1.2) and their sum into a new CV,
2.1.3) based on the inputs at each loop update,
2.2) the PID implementation checks to see if that calculated CV sum exceeds either CV hard limit (0 or 16383 for Rockwell PID)
2.2.1) If either limit is exceeded, the implementation adjusts the value of the I (accumulation) term so the CV sum is within that limit.
Again, how this is actually implemented will vary from manufacturer to manufacturer or even instruction to instruction (e.g. PID vs. PIDE), but mathematically the result is the same: the I accumulation is prevented from driving the CV outside its hard limits.
3) What does this mean for the current thread?
3.1) As has been stated, the reason for overshoot is that the valve remains closed, i.e. the PID CV output is 0, during startup pressurization until the PV pass the SP.
3.1.1) The P and I terms are driving the CV negative; the P term less so each update; the accumulating I term, absent anti-windup, more so each update
3.1.2) The D term is driving the CV sum positive.
3.2) However, because CV is 0 for all of that time, we can be fairly certain that anti-windup is active, so the PID equation
CV = P + I + D + bias
becomes
0 = P + I + D + bias
and by rearranging we can know the integral accumulation recalculated by anti-windup
I (accumulation) = -(P + D + bias)
at least until CV is no longer 0. As long as anti-windup is recalculating that I accumulation, that recalculated accumulation must be non-negative (if the recalculated value were negative, then P+D+bias would be positive and CV would be within the limit i.e. zero or greater).
Note also that those P, D, and bias terms are recalculated from scratch on
each loop update. So is the I accumulation, of course, but that calculation is overwritten by the anti-windup.
3.3) As the PV approaches the SP and the CV is still closed, from update to update
3.3.1) the D term (linear with dE/dt) will be decreasing on each update as the pressure rate of rise slows; this drives CV negative, will actually
delay the end of anti-windup action, but only slightly, so we will ignore in order to bias this analysis.
3.3.2) the bias term is constant, so it has been long since "assimilated" into the I accumulation (resistance is futile), so it has no effect on CV,
3.3.3) The
per-update I (
ΔI accumulation) from the PID equation (i.e. KC E Δt / TI) is negative, so it is still driving CV negative, but in smaller steps at each update,
3.3.4) The P term is still negative, but of smaller magnitude on each update update, so its change (
ΔP) is actually driving CV positive.
3.3.5) So the end result is that, from update to update, as long as anti-windup is recalculating I accumulation each time, the equation above yields
ΔI accumulation = -ΔP
Where
ΔP is positive and fairly constant, and I accumulation, calculated by anti-windup is decreasing (because ΔI accumulation is negative).
3.3.5) Net result:
3.3.5.1) CV will cross 0 when the PID equation calculates a CV sum that is non-negative i.e. that anti-windup does not have to override by adjusting I accumulation.
3.3.5.2) That will happen when the per-update I term from the PID equation is no more negative than what anti-windup would calculate i.e. no more negative than -
ΔP, or
ΔI accumulation = -ΔP
KC E Δt / TI = - KCΔE ### N.B. E is negative and increasing, so ΔE is positive
E = -(ΔE / Δt) TI
3.3.5.2) (ΔE / Δt) is the time rate of change of Error, so also of PV, which rate is relatively constant near the PV=SP crossing for a slow process like this; multiplying that rate by T
I will yield the error when CV will be non-negative and anti-windup action will end.
So the final result is that when the valve will open is dependent on the rate of change of PV near SP with the valve closed and the integral time constant T
I.
The main result for me is that derivative action will not reduce overshoot when anti-windup is active, which makes sense, because the PID algorithm assumes a change in the CV sum
as calculated by the PID equation, will effect a change in PV, and that assumption is invalidated
when anti-windup is overriding the PID-calculated CV.
Caveat: I am not sure this analysis is correct; there are a lot of approximations and assumptions (linear behavior near SP, etc.). It seems reasonable, but it predicts CV to become non-negative one T
I period before PV reaches SP, i.e. 30s on the trend on Post #100, and that is not what I see.