Modicon PID2 unwanted offset from SP


Thread Starter


PID2 function seems to prevent Manipulated value (Mv) from lowering to allow Present value (Pv) to come up to Setpoint (SP). Wastewater outfall to ocean controlling Total Chlorine residual to 0.100 of 0-1 range (Wallace & Tiernan Micro 2000).

Using the pid2 function for dosage control of bisulfite to neutralize total chlorine in our wastewater treatment plant disinfected effluent to the ocean, we cannot control at the chosen setpoint of 0.100 out of a range from 0.000 to 1.000. The pid2 function is set at pb=80, reset=00.12 repeats/min, rate=00.02min or 00.00. output clamp low of 409 out of 4095. the engineering range is 0 to 1000.

what happens is the manipulated variable will not continue to go lower (to reduce the bisulfite addition) even thought the pv is lower than the setpoint desired. it is as if the equation for the pid2 locks up and our final amount of total chlorine residual stays at 0.000 instead of 0.100.

we have temporarily set up a method of reducing the bisulfite pump stroke by 1% (lowering the Mv by 40) if the Pv stays below the SP at 0.001 or below for more than 10 minutes. The control loop is slow, about 8 minutes, that is why the reset number is so small. the rate/derivative number was given a little to make the system respond slightly faster, but did not change the basic problem of the Mv not continuing to decrease even though the Pv is less than the SP.

The details of the equation and flow blocks in the ladder logic block library user guide do not give enough information to determine why the lock up occurs. We are hoping that someone at Modicon can figure out why we may be running into this problem. We understand that you may not know the details of our process but we can help on that end if needed for your diagnosis. We have tried many different settings for the gain, reset parameters without success. proworx 32 has a better help file, but just basically duplicates the user guide.

We are using the PID2 for chlorine addition to maintain a 5.5 ppm total chlorine residual out of a range of 0-20.0 (0-200units) with the same parameters (although "maintain" usually means slightly below the 5.5 mark).

Also, the pump stroke is controlled by the residual pid2 function and the motor speed is controlled by a direct ratio to changes in flow. It has been suggested to control speed by the residual number and the stroke by the flow changes as the motor speed is more linear than stroke changes. Perhaps a blend of the two?

Has anyone solved this sort of problem before and can make some suggestions? Thanks. Modicon does not seem to want to touch the problem as the person who wrote the function no longer exists.
First guess… make sure your Hi and Lo Integral Windup limits are set properly; they default to zero which would cause problems. Given your output clamps, I’d normally set Lo Integral Windup to 409 and Hi to 4095 (understand that this will prevent your pump stroke from going lower than 10% of its range (ok?).

Now some other things (apologies if some appear too obvious to mention):
1) Have you used PID2 successfully in the past? If not, build a prototype employing spare registers and play with it until you understand how all the features actually work.
2) Make sure you load your measurement value (whatever 3x register) to the ‘Raw Analog Measurement’ register whether the PID2 is being executed or not.
3) Your ‘Pointer to Reset Feedback’ should be zero in this case (my favorite feature of PID2).
4) Double/Triple check your register assignments.

I’ve used PID2 numerous times without problems you mention. To qualify this, I always have done my scaling outside the PID2 function and have never (that I can recall) used integral preload.

As for your control strategy… if dosage flow is more linear with pump speed, I’d use pump speed / load flow ratio as you currently employ it (best if load flow changes occur with no load concentration changes). If pump stroke controller tends toward unfavorable range in the pump stroke while in auto, you could create a ratio controller (with PID2) with MV as ratio and SP a desired/most favorable/or mid-range pump stroke; this controller would be slower acting than the other one and would not operate in auto unless the other loop was in auto… you’d also need to limit the ratio calcs and do all setpoint and output tracking too.

Good luck,

Hi Jim,
I was curious about your 1 comment item 3 about setting the "Pointer to reset feedback" to zero. I remembering talking to Modicon about 4 years ago and never receiving a straight answer on what that function actually does. I remember the level example in the book showed it pointing to whatever the output of the PID block was. Do you have any insight on this.

Thanks Mike
I was just curious if you have checked all the loop status registers (4Y) in the PID2 block. I remember that there are some conditions that can cause the loop to lock-up such as counting registers not being cleared, # of loops solved per scan, etc. There is an error code in one of the status registers that indicates if there is a problem. Let me know how you make out.

Bill Clemons

Your low output clamp is at 10%. So even if the Controller is directing 0% ouput, you will continue to send 10% to the dosing unit.

Also, may look at algorithm: (Feed Forward with Sum <starting point>, then Feed Forward with Multiplication, and some controllers can be manipulated to run a Compound control [Proportional Band*Flow + Residual*Integral]).

Pointer to reset feedback allows what’s commonly called ‘external reset feedback’ of the PID loop. External reset feedback is used to restrain the normal integral component of the PID calculation and is invaluable whenever you need to do constraint control. Simple forms of constraint control occur when you have one actuator, one primary control variable, and one or more other variables that are affected by the actuator but must be limited not to exceed (or go below) some preset value. A simple example for how you’d use the function:
Control temperature to setpoint (primary variable) with fail-closed control valve but do not allow pressure (secondary variable) to exceed 100 psi; say pressure of 110 psi interlocks/shuts block valve upstream of control valve. Build a TIC and a PIC with pointer to reset feedback X (register 4X). X is common to both pointer to reset feedback of the TIC and the PIC. When TIC in auto, PIC goes to auto. When in manual, valve output goes to TIC output, PIC output, and 4X. When TIC in auto, compare the outputs of TIC and PIC, choose the smaller and send this to both valve and 4X. Choose a PIC setpoint of 98 (and don’t allow operator ready access to this). In practice, TIC will prevail in the output comparison. Ordinarily, PIC would want to increase its output but the effect of reset feedback is to continually reinitialize the PIC’s integral contribution so it tracks the actual valve position (prevent integral windup). Should pressure increase, the PIC gracefully assumes control from the TIC and limits the valve output to prevent overpressurization; now TIC’s integral contribution tracks PIC’s so it can gracefully/bumplessly assume control of the valve when the pressure excursion subsides.

Other classic examples are found in just about any of F.G. (Greg) Shinskey’s books and include blending/pacing control, compressor control, fed-batch exothermic reactions, distillation control, et cetera.

I recently needed to control electronic expansion valves in a refrigeration system. Primary control was to regulate heat transfer oil temperature. Constraint controls were in effect to limit refrigerant suction pressure to compressor and minimum refrigerant superheat across the evaporator (oil heat exchanger). On startup, suction pressure prevailed, followed by minimum superheat, followed by oil temperature. It was simple, worked beautifully, addressed process constraint specifications directly. Without reset feedback, you’d have to resort to messy multistate logic that would underperform, not be robust, and probably lead to limit-cycling.

In my experience, most DCS systems offer PID functions with external reset feedback. Modicon’s PID2 is the only such one offered by a PLC manufacturer that I know of. I’ve received quite a few blank stares in my day from PLC product guys when questioned about external reset feedback and PID control.

Hope this helps.


Bruce Durdle


The "Reset feedback" version of the PI controller is one that doesn't make it into many of the standard text-books, (an exception is Harold Wade's "Regulatory and SAdvanced regulatory Controls" from ISA) but is more directly analogous to the old pneumatic controllers. Instead of the I term being derived from a pure integrator in the forward path, it is obtained by
feeding back an output signal via a time constant (time constant value giving the IAT) and adding it directly to the forward proportional signal.

In the standard form the signal fed back comes directly from the controller output, and acts as per the usual. However, by feeding back a different signal, a nore flexible version is obtained. One application is where two or more controllers are used to drive a single final element in a High Select configuration. If the controllers are of the conventional format, it
is very difficult to prevent windup of the unselected controller. Using Reset Feedback, the feedback signal is taken downstream of the selector and applied to both controllers - with this arrangement, there is no time lag while the incoming controller unwinds.

We had almost the same problem and ended up going to a compound loop. Two chlorine analyzers are used. One analyzer mesures the unsulfonated water and the other mesures a mixture of 33% sulfonated water and 66% unsulfonated water. The control uses 2 SP's. [[risidual(#1)*flow*sp(#1)]*.65]+[[[risdidual(#2)/risidual(#1)]-SP(#2)]*.35] The risidual at analyzer #1 is about 5 ppm with a range 0-10; this gives risidual of about 2ppm on analyzer #2 with a range of 0-5 ppm. The system has worked well for us and it even respond well when an additional efflluent pump cycles off and on.

hope this helps,
robin [email protected]