Sign in to follow this  
Followers 0
devo.xx

PID Loops

7 posts in this topic

My question comes from not understanding what all the values are inside the PID loop setup. Looking through manuals, and searching everywhere online, I cannot find ANY examples, or ANY explanation. So here are the values I don't understand: RSLogix 5000, V17.00.00 (CPR 9 SR1) PID Instruction Configuration Tab Control Action: [sP - PV] or [PV - SV] - From what I can tell, this is DIRECT vs. REVERSE acting. Can someone confirm? Derivative Of: [Error] or [PV] - Would I use ERROR if I want to just use the PID to correct for the error, and use a Feedforward to control the typical speed? - Then use PV when I want the PID loop to run the whole system? Loop Update Time: [x.x secs] - I have found some stuff about this... but I don't understand it. I need to set my Loop update time to say 0.5sec, then a timer in front of my PID loop that cycles every 0.5sec. So then the PID loop only updates the CV every 0.5sec... Then why even have a timer in front? Scaling Tab - All of these confuse me. Process Variable (PV): [unscaled] and [Engineering Units] Control Variable (CV): [max/min] Tieback: [max/min] For the sake of my understanding, I will give my process and what I think these values need to be. But truly, I am just guessing as to what these represent... Process Variable (PV): Speed, 0 - 2200 counts (from my analog card, 2200 counts represents 3277 on my CV) Engineering Units (PV): Speed, 0 - 1000 thou/sec (or 0 - 1 inch/sec) Control Variable (CV): Valve position, 0 - 3277 counts (3277 represents FULLY OPEN valve) Tieback: I just want my PID loop to work, I can look at bumpless transfer later. I got my Process Variable numbers from watching the High Speed Counter card reporting while I opened up the CV. ie. Analog Out to my Valve: 3277 counts HSC in from my Encoder: 2200 counts +/- 70 counts Doing some math: 2200 counts = 1000 thou/sec Let's start here, if these settings are correct, then it must just be my tuning. But when I change my Scaling values even slightly, the whole PID loop runs wild. Which means I have no standard way of tuning this loop. Edited by devo.xx

Share this post


Link to post
Share on other sites
based on what you've posted: one MAJOR (and I mean REALLY major) item that you didn't mention is which PID Equation (Dependent or Independent) you're using ... how do you have that set? ... suggestion: if you're trying to come up with tuning values based on information from some "book" – then you "PROBABLY" would be better off using the "Dependent" equation ... oops! out of typing time ... gotta get back to work ... hope this helps ... Edited by Ron Beaufort

Share this post


Link to post
Share on other sites
I was using Independent because the constants Kp, Ki & Kd carry the same units that I am used to seeing in the Mitsubishi world of PIDs. I can't post the project itself, but I am posting some snapshots of the setting windows, perhaps that will help? In terms of Scaling, I am looking back through my notes and this is what I have written down: When Valve Analog Out (CV) = 3150, Speed (PV) = 1100 thou/sec When Valve Analog Out (CV) = 835, Speed (PV) = 130 thou/sec When Valve Analog Out (CV) = 1295, Speed (PV) = 290 thou/sec When Valve Analog Out (CV) = 1715, Speed (PV) = 550 thou/sec Plotting these gives me a non-linear response, the response is pretty well fit to a 2nd order poly (quadratic). However, the range I need my PID to control in is max 320 thou/sec, the response from 0-320 thou/sec is close enough to Linear. As for other things that you may see in my program: My PV is actually a calculation that the PLC is doing. I take a sample of my Linear Encoder distance, compare vs. the last sample, and divide by time to give me exactly Thou/Sec as my input: "BM_East_Enc.Velocity_thou_per_sec" I am not sending the HSC counts to the PID loop. I do suspect that I should be sending the HSC speed directly to the PID. *See HSC.jpg. Currently, both Channels are set to "Encoder 1x Mode", I changed Channel 0 to "Frequency Mode" just to show the different settings available to me. *Encoder 1x Mode monitors just position. Frequency Mode tells me how many pulses per sample (Speed). *Channel 0 is for my East Encoder. Channel 1 is for my West Encoder. 2 Identical systems, each with their own PID loop. I am sending the CV out to a DeviceNet card that has a range of 1638 - 8191. Neutral is at 4914.5. My range needs to be: Closed at 4914 --> PID output CV = 0 Fully Open at 1638 --> PID output CV = 3150 (actually 1765, I was trying to change the Scaling to see if my response got any better, no luck) So: SUB(4915,BM_East_PID.PID_PreOutput,DEVNET1_N20_S02_COS_O.Ch0Data) Thanks. Edited by devo.xx

Share this post


Link to post
Share on other sites
Another approach to the timer is to use a periodic task for the PID control. It does essentially the same thing, but the timing is more accurate. I don't understand either why they require you to use both a timer/periodic task and set the loop update time, but they do. Just a comment about PID loops in the AB versus Mitsubishi world. If you look at the actual formulas behind the control scheme, you'll see that the formula Mitsubishi doesn't match either Dependent or Independent in the AB. Despite what they call the gains, it's probably closer to Dependent. Just be aware of that in case it doesn't operate the way you expect. The Mitsubishi formula is the in the Analog Control Edition programming manual. The AB formulas are in the help files, though they're buried a little, so just keep looking!

Share this post


Link to post
Share on other sites
Remember that the PID instruction just performs a calculation every time it is scanned. That calculation will include factors that are time-based (integration and derivation), so the instruction needs to know the time interval since it was last scanned to give good results. I agree, the instruction itself could determine that time interval (elapsed system time since last scan), but IMHO it is better all-round if that time interval remains constant. I suppose in a sort of "reverse psychology" A-B are forcing you to make the scan of the instruction constant, by not measuring it itself. I'm also guessing mode changes (Run->Prog->Run) would mess up the "self-timing" so dramatically that it is unusable. All that said, just put your PIDs in a periodic task, and set the PID.UPD value to the same as the periodic task (and you can GSV the task period and load it to the .UPD parameter of your loops automatically in code), and all will be well. Automatically asserting the .UPD parameter also means that if you change the periodic task scan rate, your PIDs will be updated dynamically, and won't need retuning...!! Looking at your first attached pic, it appears that you are executing your PID every scan, since it looks like you have it on a branch with your cyclic timer - (although half the rung is hidden by the dialog) Edited by daba

Share this post


Link to post
Share on other sites
No, it is a TOF that self-triggers. It executes every 0.5sec. Does anyone have any insight on the SCALING parameters?

Share this post


Link to post
Share on other sites
From what you've written, this sounds like a motion control application. You aren't the first one to attempt to cobble together a servo system using HSC, PID, etc., but I would advise switching your approach to using a CLX motion module. But, if your hands are tied, and the process is glacially slow, you might have some measure of success. Hint: you need a cascade loop -- position & velocity.

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