Sign in to follow this  
Followers 0
MattS

AB PID loops

12 posts in this topic

Hello folks, I am trying to access the AB online Knowledge Base, chasing up TechConnect numbers etc and assuming that our toolkit is eligible for this, but I am also interested to know if there are examples of code elsewhere using PID loops to regulate pump drives and flow and level control valves with RSLogix 5000. Pumps are using pressure setpoints in Auto and speed setpoints in Manual. I noticed a recommendation to use PIDEs instead of PIDs so examples of these may be useful. I have used PIDs before to control linear axes (in SoftLogix) but I can't seem to make head nor tail of the current format. What is a tieback? Before AB we used A, B and K gains. Does anything equate to these? From browsing here I have found one tip, ie to put the PID block on its own rung.

Share this post


Link to post
Share on other sites
Greetings MattS ... and welcome to the forum ... first of all, the PIDE instruction that you mentioned is only available in Structured Text or Function Block Diagram programming ... specifically, not in regular Ladder Logic programming ... in other words, you’ll need an extra cost “add-on” package to use the PIDE - unless you already have that capability in your RSLogix5000 system ... as for a “sample” - if you used the regular default installation procedures for RSLogix5000, then you probably already have an example program on your computer hard drive ... look in the “Samples” directory for FBDLevelControlSimulation.ACD and TemperatureControl.ACD ... these might be enough to get you going - but you’ll need the extra-cost FBD “add-on” software for RSLogix5000 to open them up ... basic idea of “Tieback” ... this is an analog signal from an operator’s manual control station (often just a potentiometer, etc.) ... when the PID is placed in “manual” mode, the PID feeds this tieback signal to the output ... in some systems, the Tieback is entered as a ZERO - which just disables the feature - and manual control is provided from some other means ... survival tip: ZERO the tieback until you get the rest of the PID working ... then worry with that part ... not sure what you mean by that ... as far as I know, there was no “before Allen-Bradley” period of time ... hope this helps ...

Share this post


Link to post
Share on other sites
Ron, Thank you for the comments. I believe we have a full development toolkit but I have not found the files you mentioned, though I will keep looking. I will leave the structured text out for now, though it should be part of my repertoire and it should be available somewhere. Perhaps it is easier than I think. If I label the PID, fill in the Process Variable with the pressure setpoint and the Tieback with the manual speed setpoint (zero at first) and feed the Control Var to the drive, with correct scaling, then something should happen. It may be that the gains etc are configured on the drive. I will start with a small one, not the 250 kW ones, and perhaps assume that the default settings are OK. By then I'm sure someone will know what to do. What is a bit frustrating is the search for documentation on the topic, which must be there somewhere, just buried amongst a lot of other stuff. The AB sample code facility requires a title, for example, but I only have a topic. Before we used Allen Bradley I had occasion to set A, B and K gains when we developed robotic drive systems. I believe these are related to the amount of feedback for the P and I and D loops. Pumps are a lot less critical than motion control in response times, but there may be some issues around switching from Auto to Manual etc. I have found bits and pieces about this but no coherent discussion or tutorial or, as yet, example, but I know it must be there somewhere. Cheers, MattS

Share this post


Link to post
Share on other sites
just a few more tips before I head for home ... with AB you get a choice between two PID equations ... in MOST cases, the “dependent gains” is the one that you’ll want to work with - IF (big IF) you’re already familiar with the way most other manufacturer’s implement PID ... basic idea: with the “dependent gains” equation, a change to the Proportional setting WILL also change the amount of both the Integral action and the Derivative action ... specifically, the other two actions “depend” on the setting of the Proportional action ... on the other hand, with the “independent gains” equation, a change to the Proportional setting will NOT change the amount of the Integral action or the Derivative action ... specifically, the other two actions are “independent” of the Proportional action setting ... at first glance it would seem easier to work with the “independent gains” equation - because you can increase or decrease the Proportional action without having to make “compensatory” changes (or tweaks) to the Integral and Derivative actions ... but ... if you’ve already developed a “feel” for tuning PID which is based on the more common “dependent gains” system, then you’ll basically have to start over from scratch to get a “feel” for the “independent” way of doing things ... one big issue: with “dependent gains” you enter a SMALLER number in order to get MORE Integral action ... on the other hand, with “independent gains” you enter a LARGER number in order to get MORE Integral action ... and even though the values for the Proportional settings are the same, the values for the Integral setting and the Derivation setting are VERY different between the two systems ... also ... explore the Help selection on the RSLogix5000 main menu (top of screen) ... you should have “Online Books” available ... look in the “General Instructions” book to get started ... the chapter on “Special Instructions” has quite a bit of material on setting up the PID feature ... if you don’t have those books already loaded on your computer, you NEED to fix that situation ... get the CD and reinstall the software if necessary ... got to go (supper time) ... hope this helps ...

Share this post


Link to post
Share on other sites
Ron, Looking over the Instruction Help it looks a bit clearer than the first time. I expect it is fairly simple after the first few times. There are some obscure settings which may need some study, but not too many. Configuring the drives may or may not be complicated, depending on how suitable are the default settings, but I will come to that down the track and read the instructions. It should be possible to set up a basic simulation.....hmmm. MattS OK, just got the last post. That's good stuff. Thank you. MattS

Share this post


Link to post
Share on other sites
There's some confusion going on here. The set point is something of an "internal" setting (.SP). The .PV is where you feed in your feedback signal to the loop. The control variable is the "output". The easiest way to implement software-based manual PID control is with the .SWM (software manual) control bit, and the .SO (set output) inputs. Usually when someone wants a "manual/auto" control, they really want the .SWM and .SO controls, NOT the tieback. To go to manual, turn .SWM on. To feed your manual command, change the .SO input value. Using this mode, you also do NOT touch the station auto/manual bit. Typically I don't even use the tieback. You can get "bumpless" transfer with the .SO option as well as the tieback but you can't use an integral term and expect bumpless transfer with the tieback input. In addition, make sure that you clock your PID loop at a very regular rate or you will experience a behavior that is similar to a variable (and random) system gain. If you are running your PID loop very slowly, you can probably get away with just a free running timer. Otherwise, put it in a timed task (on CLX) or trigger it from an STI (PLC-5/SLC). If you use the PIDE (in structured text or function block), there are two advantages. First, the PIDE instruction is actually a velocity-control loop (PIV), which is better for motion control and the like. Second, it has a built-in autotuner. If you want an autotuner you will have to get RS-Tune (an option for the lower end versions of Logix 5000, Logix 5, and Logix 500).

Share this post


Link to post
Share on other sites
Hi Paul, What we are trying to do is drive the pump using two different measurements, ie pressure or speed. Auto/manual may be superficial, as you suggest. With pressure, the desired value is loaded into the setpoint var, while the actual value is fed into the ProcessVr, as I understand it, since a variety of factors affect the speed/pressure relationship. But when a speed setpoint is required then this can be loaded into the .SO value directly and then .SWM is turned on, if I understand you right. Then to stop the .SO could be changed to zero, although resetting EnableIn is the correct method, I expect. Hmmm, maybe not. Outputs would not be updated! I would initially clock the PID loop at around 250ms, ie 4 Hz. Might be a bit slow. I expect that using an integral element could require a regular time delay so I will look at the CLX function. I remember using PIV loops when we first tried AC motors instead of DC and it did help a lot. The PIDE has been recommended here so I will give it a look. There are a lot of parameters and the Autotune is greyed out on the office version. Correction: giving it an autotune tag name allowed some access. Thanks for your help. It may be a while before we need to run the program but it is good to know there is some expertise available. If it is left to me then there may be some more questions coming. Edited by MattS

Share this post


Link to post
Share on other sites
that’s not a bad idea - but in the earliest stages, the simulation can be VERY simple ... just manually feed a number into the PV and trend the PID’s output ... as long as you keep your gains low enough - and your PID execution slow enough - then you can learn a LOT about how the AB PID equation does its work - even without a constantly changing PV signal ... basic idea: just manually plug in a value for PV which is slightly “off-target” from the SP ... then trend the output ... then slightly change the settings for the Proportional, Integral, and Derivative actions one at a time and trend the differences in response ... this is a simple exercise that will help you identify how the different settings affect the PID’s operation ... going further ... next you can program a “sort-of-kind-of” simulation which will automatically feed a prerecorded “profile” from consecutive memory locations into the PV ... this will go even further in helping you see how the different components (Proportional, Integral, and Derivative) react as the PV rises and falls at different rates ... for an example, take a look at page 19 in the “What is P in PID?” paper on my website ... look in the “Sample Lessons” area ... the concepts are very basic, but you might find the method of developing the data to be useful ... note: these simple “simulations” that I’ve mentioned above will NOT allow you to actually practice “loop tuning” - but they are VERY valuable for helping you get a feel for how each of the settings affect the different components ... my distinguished colleague Peter Nachtwey has written some “dynamic” simulations that might be more useful as you dig deeper into the subject ... you can probably find links to Peter’s work by searching the forum ... or some of the other members might be able to point you to them ... gotta go ... students are coming in ... I’m teaching this week so my time for typing is limited ... wish I had more time to play ... hope this helps ...

Share this post


Link to post
Share on other sites
One thing you can do with the PIDE is to place only the PIDE instruction with a valid tagname on a function block sheet in a periodic task. Then from ladder you can read/write values and set/clear bits to the PIDE tag using XIC, OTE, MOV and Math ladder instructions. If the PIDE tag is locally scoped then the ladder must be under the same Task/program - so make the ladder the main task and call the FB with a JSR. If the PIDE tag is globally scoped then the tag elements can be accessed by any ladder can be under any Task/Program. Something to consider if you or your people are not familiar with FB. Edited by Alaric

Share this post


Link to post
Share on other sites
Correction. My mistake. It's not a PIV loop (which requires a separate velocity and position input, useful for position control loops). It's simply the "velocity" form of PID. Effectively this means that instead of implementing the PID equation more or less directly, take the derivative. This effectively converts the integral calculation to a direct one and eliminates "windup" and some "bumping" problems that affect the PID terms. The PID calculation produces a delta from the previous calculation which is added to calculate the new output. This method is also very amenable to loop cascading and has some other advantages. It is the typical form that is used in DCS systems. All that you really need to know is that the PIDE instruction has a lot more options and generally runs smoother. If you don't have access to PIDE, don't worry too much about it. I've gotten by without it for years. I'm not 100% sure what you're doing but one additional change that you may want to make is to turn the PID calculation into a feed forward/backward system. Here's how: Let's say you are getting 100 PSI when the CV (output) is at 25%. Then you'd get 400 PSI if the CV is at 100%. So simply take the set point and divide by 4 (100%/400) to calculate a feed forward output. ADD your feedforward CV to the loop output CV, clamp it (so that it doesn't exceed 0-100%), and feed that output to your analog output. PID loops are always reactionary and adding feedforward speeds up the controls considerably. If you do this, the PID really just provides fine tuning of the output rather than winding up every time an adjustment has to be made.

Share this post


Link to post
Share on other sites
Thank you for your responses. I like this area and will try to gain some experience. Just now I am occupied with a different project but I hope to return in a few weeks. <<One thing you can do with the PIDE is to place only the PIDE instruction with a valid tagname on a function block sheet in a periodic task.>> Thanks for that idea. I like it and I will try it, but I am on a different project for a few weeks so I may have some more queries after that. Whew! There's quite a bit of info there. Some of it I have seen before but it is very helpful to get relevant points adressed. Although I have fiddled with these things before I did not set them up so it is hard to get a feel for it without doing simulations or actual testing. At that point I will have a clearer picture but that may not be for a few weeks. I will report back on progress, assuming I am still involved at that stage of the project, which is what I am hoping.

Share this post


Link to post
Share on other sites
A, B and K gains sound like a lead/lag controller. K is the gain, B is the zero and B is the pole. I have rarely seen these in use for control. A lead/Lag control is like a PD controller with a low pass filter. Are you controlling speed or pressure? The pressure will go up roughly proportional to the speed squared. Controlling the pressure is non-linear.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0