Allen Bradley PID Blocks


Thread Starter

Allen Nelson

I tried to get a answer to these questions on the RSLogix forum, and got NOTHING. My mistake for not going to the real experts first. I've programmed PLC-5s and SLCs for many years, and have used PID blocks successfully in many applications. Yet I've always felt uneasy in using them, as I don't understand their subtleties, or why they do what they do. I've looked through the help files, but they tell you to put data in the fields, but they don't explain the relationships between the feilds, or what the data is supposed to "look like". I've looked through the manuals, and they explain PID theory, but don't explain how to apply the theory to the PID block. I've tried the examples. I CAN make them work. But.... I've catagorized my questions, and I'm even pretty sure I know the answers to some of them (but am asking them anyway as a confirmation). =============== ENABLING The loops can be either in an STI block, or be enabled periodically with a timer. A. How can you determine which method to used? (This one the help files are pretty clear on, when taken together). Per RSLogix500.hlp: "...processor scan time should be at least ten times faster than the loop update time...". What is 'loop update time' here - natural frequency of the loop. I/O update time? AO device movement time? (from 0 to 100%; from 50 to 51%)? Per RSLogix5.hlp: "Enter an update time... at 1/5 to 1/10 the natural period of the load (load time constant).... Periodically enable the PID instruction at a constant interval equal to the update time. When the program scan time is close to the required update time, use an STI to ensure a constant update interval." B. Are the following the "correct" method of programming the PID rung in each case: STI: MUL S:30 0.001 PD30:0.UPD PID PD30:0 AI_PV AI_TIE AO_CV OTU PD30:0.EN (this rung is in the N: file example, but not the PD: file example - is it even needed ?) Timer: XIO T4:0.DN TON T4:0 1 10 0 MOV T4:0.PRE PD30.0.UPD XIC T4:0.DN PID PD30:0 AI_PV AI_TIE AO_CV C. How do you handle the situation where you have more than one PID block which require STI, but they have different periods? D. What is the "best" method for 'disabling' a PID ? 1) Put an XIC bit on the PID block branch to enable. 2) Set the PID manual mode bit (SWM? MAN?) and set the .SO value to 0. 3) Other ? E. (PLC5 only) The examples have the BTW/BTR blocks in the STI file along with the PID. Is this really such a good idea ? =========================== MANUAL MODE CONTROL F. What is the difference between the manual bits SWM and MAN bits (PLC-5 only). When do you set one versus the other? G. What is the "best" way of programming "bumpless" Auto/Man transfer. (Bumpless, as I understand it, is no change in output when toggling between auto and manual modes.) Is this it: XIO PD30:0.SWM MOV PD30:0.OUT PD30:0.SO ================= TIEBACK H. What is the tieback used for? The help file refers to a manual control station (such as a single loop controller, which is physicaly wired to the valve?). If you don't have one, do you just enter a 0, or is/can it be used for other things (Do you feedback the actual position of, for instance, the control valve into the tieback (with the tank level as the PV)) ? I. How does it affect how the PID equation changes? (When transitioning SWM auto/man, the current position is the initial value of .SO.)? J. Is this a scaled value (engineering units) or raw (0-4095) ? K. How would / should tieback be programmed in a SLC to accomplish the same functionality ? =================================== SCALING L. (PLC-5 only) What is the difference between MAXS/MINS and MAXI/MINI ? I think that the MAXS scales the setpoint, while the MAXI/MINI scales the PV. M. Should the PV address entered in the PD block be raw (0-4095) or scaled (eng. units)? If it doesn't matter (and I've programmed it both ways), what values should the MAXI/MINI have (the desire, of course, is to monitor the PID block, online and with an HMI, in engineering units.) N. What is the scaling on the SP that is MOV'ed into the PD setpoint (raw, scaled, or "doesn't matter as long as its the same as the PV's")? If both SP and PV are in engineering units, should (must?) the MAXS and MAXI values be the same ? O. Since .SP is a 32-bit float in the PD file type, can Float be MOV'ed into .SP ? P. The SLC has only MAXS/MINS - is PV raw or eng units? Is SP the same scale as PV, or is only SP affected by MAXS scaling. Q. Obviously, it is good practice to do error checking on both the PV and SP, as in: BST LES HMI_SP_ENTRY PD30:0.MINS MOV PD30:0.MINS HMI_SP_ENTRY NXB GRT HMI_SP_ENTRY PD30:0.MAXS MOV PD30:0.MAXS HMI_SP_ENTRY BND BST LES AI_PV PD30:0.MINS MOV PD30:0.MINS AI_PV NXB GRT AI_PV PD30:0.MAXS MOV PD30:0.MAXS AI_PV BND Are there any other rungs that you typically have in your PID routines ? ======================= MISC. PID THEORY R. In setting up the PID, you can make it either Independant (aka AB, if using N: instead of PD:) or Dependant (aka ISA). Which should you use in a particular application, how can you tell, and why do you use it ? S. Which type (Independent/Dependant) is SLC ? Can it be set up to do the other one? T. (PLC-5 only) You can set up 2 PIDs to be Cascaded loops (master /slave). When/why would you do this? How does this kind of loop respond differently from a single one? How do you go about tuning it? What should be the relationship between all the parameters (Kp, Ki, Kd, MaxS/MinS MaxI/MinI, update rate, etc) between the two PID blocks? How should the slave be programmed (enabled on .DN of Master block ? Vice versa ? Please include sample code.) U. If a loop is reacting too fast (overshooting, then undershooting, etc), what values should be tweeked: Update time (STI/TON.PRE); Ki,Kp,Kd (which way, larger or smaller)? V. What about too slow a response ? W. (PLC-5 only). You can have the derivative value based on PV or Error. How do you tell which is right for your application, and how does one type behave differently from the other?

Johan Bengtsson P&L Automatik AB

See my answers below, I have skipped most questions for other to answer... I don't know the specifics about the PID block in Allen Bradley so my answers will be more general, but I hope you can apply them In my answers below I have supposed Kp to be the proportional gain Ki to be the integrating time and Kd to be the derivate time. This varies form one manufacturer to another, that is why I state this assumption here. /Johan Bengtsson ---------------------------------------- P&L, Innovation in training Box 252, S-281 23 H{ssleholm SWEDEN Tel: +46 451 49 460, Fax: +46 451 89 833 E-mail: [email protected] Internet: ---------------------------------------- -----Original Message----- >G. What is the "best" way of programming "bumpless" Auto/Man transfer. >(Bumpless, as I understand it, is no change in output when toggling between >auto and manual modes.) Is this it: > >XIO PD30:0.SWM MOV PD30:0.OUT PD30:0.SO Auto to Man: Use the previous output value as the initial manual value I suppose there is no problem with that. Man to Auto: The output is in automatic mode calculated as a sum of 1. the P part of the controller, this is control error*Kp 2. the I part, the integrated value of the P part. This is probably stored in a separate register 3. the D part, the derivated value of the P part, or of the process value*Kp 4. a possible offset, this do however have no effect when the I part of the PID is turned on and might share the same register The part to adjust during the transfer is the I part, this means backwards calculating the I part that will produce the manually set output >T. (PLC-5 only) You can set up 2 PIDs to be Cascaded loops (master /slave). >When/why would you do this? How does this kind of loop respond differently >from a single one? How do you go about tuning it? What should be the >relationship between all the parameters (Kp, Ki, Kd, MaxS/MinS MaxI/MinI, >update rate, etc) between the two PID blocks? How should the slave be >programmed (enabled on .DN of Master block ? Vice versa ? Please include >sample code.) When and why to do this: The "theoretical" answer: You could do it when you can measure an intermediate value that is affecting the value you really want to control and you can control that value faster then the interesting one. you should do it when you could and have use for it. This answer might be hard to get thru, so here comes some examples: 1. Level control in a tank, where a valve changing the incoming flow of water. You can use a single PID, proces value = level, output goes to valve. However, if you do it like this instead: two cascaded controllers, one level control where process value = level, this output goes as a setpoint to a flow controller where process value = the measured incoming flow output from this controller goes to the valve. What do you gain with this? Well first of all, a change in pressure will affect the flow right? a change in flow will affect the level. In the first case (without cascaded controllers) the level will be affected and the controller will adjust for that eventuelly. In the second case (with cascaded controllers) the flow is affected, but the setpoint for the flow is of course unchanged. This will make the flow controller take immediate action to correct for the changed pressure and the level controller will hardly notice if the correction was done fast enough. The key is "fast enough" a recomendation says: The inner loop in a cascaded control should be at least 5 times faster, if not - don't bother. The optimisation is done from inside out, in this case the flow controller (with the level controller preferably in manual mode) and when that is done you get to the level controller. Another example 2. Servo In a servo system you normally have tree cascaded controllers The innermost is controlling the current to the motor and thereby the torque The one outside that is controlling the speed of the motor The primary is controlling the position The primary controller is the one you actually care about, the output from that is desired speed to reach the position you want. The next controller is resposible for the speed, output from this controller is desired torque. A certain torque will accelerate the motor to the desired speed, this controller is responsible for finding out what torque that is. And innermost, the torque. The torque is essentially the current drawn by the motor, output from this is needed voltage to get the desired torque. The common part here is that the innermost controller is taking care of a subtask. By splitting the responibilities and using more sensors you get better overall performance. The incomming flow is really not important, but keeping the flow at the desired value will make the task a lot easier for the level controller, and keeping the flow from changing will make it easier for other parts of the factory too since changing flow gives changing pressure. I hope that my these examples you anderstand when cascaded controllers are used. >U. If a loop is reacting too fast (overshooting, then undershooting, etc), >what values should be tweeked: Update time (STI/TON.PRE); Ki,Kp,Kd (which >way, larger or smaller)? Well, this is causes that will give you this behaviour and ultimately oscillations too long update time too high Kp too low Ki (note: too "low") too low or high Kd the update time should be less than approx 1/3 of the process time contant Increasing Kp gives you a faster and more unstable control Decreasing Ki does the same, but in a different manner Note that what is the best one to change is not really easy Kd should be 0 when not needed, if you need to have a faster control than you can get with only PI you add D, increasing Kd makes the control more stable, up to a point where it makes it unstable again >V. What about too slow a response ? The oposite of above >W. (PLC-5 only). You can have the derivative value based on PV or Error. How >do you tell which is right for your application, and how does one type >behave differently from the other? The difference is that if you base the derivative on the error a change in SP will be sublect of derivation and sudden changes in SP will give you spikes in the output. Normally you base the derivative on PV since the other behaviour isn't desired.