Basic PID examples

lawebster

Member
Join Date
Dec 2006
Location
Baton Rouge, Louisiana
Posts
16
I am relatively new to ladder programming and was wondering if anyone had example code (I am using RSLogix5) of flow control using a PID function? I have read all the AB docs but still have questions, mainly how to do the code the right way. I basically understand PID and tuning ideas but my shortfail is coding it.

Any examples, nudges, comments, etc is appreciated.

Thanks!
 
there is lots of examples on this site do a search also there is a good article from Ron Beauford with a full explaination of how PID works
 
Greetings lawebster ...

and welcome to the forum ... I'm teaching this week - so I won't have too much time to help - but here are some "just-getting-started" tips on your project ...

depending on which PLC-5 processor you're using, different "flavors" of PID are available ... this approach is pretty much "plain vanilla" - without some of the most confusing bells-and-whistles of some of the other methods ...

pid101_a.JPG


pid101_b.JPG


the settings that I've highlighted in yellow are the most important ones if you're just getting started ... ALL of the values - and ALL of the addresses - that I've entered are strictly for purposes of example ... we won't be able to give you any detailed information until you tell us a LOT more about your system ...

we look forward to hearing from you again soon ...

and thanks to everyone for the kind "referrals" ...
 
Thanks for all the info from everyone, I appreciate it. I come from an IT background and am just learning ladder logic. Have a little bit of instrumentation knowledge, have worked with various HMI's, Bristol controllers etc so I think I can pick it up. I just want to make sure I am taking the right approach to the code, and unfortunately I was "volunteered" for this project and told we need it done yesterday.



Here is more background of what I am trying to do:

Using an AB Enhanced PLC-5/20 16384 mem. and AB 1794 remote I/O

I am trying to do a ratio control based on flow. FI-1067 should be 10% of FI-501. So if FI-501 is 2000 I want FI-1067 to flow 200. I have a flow control valve to control, FV-1067, for this purpose.



I need to be able to do the following:

Be able to run FV-1067 in Manual and drive the output

Turn Ratio control, as stated above, ON and OFF

Be able to run FV-1067 in Automatic and manual input a Setpoint



I guess my main questions are how to set up the "manual" code. When the PID instruction bit is set manual, where does the output get driven from is this separate coding or will the PID instruc handle this?



What is the right code to turn the PID bit (word 1 bit 1) on/off when I want the valve to be manual/auto?



What value should go in the tieback word?

Attached is my coding attempt, does this look proper?



I appreciate any ideas, comments, nudges



Thanks!
 
glanced at your code, a couple of quick observations.
1. I believe your scaling code needs to have the DIV instruction A: and B: terms reversed.
2. When labelling bits, instead of using things like ON/OFF bit, use the true condtion only, else how will someone else know what the true value represents is it on or is it off.
 
Thanks for the pointers!

I have another question concerning Auto/Manual mode of the controller..

The Auto/Man bit for the PID instruction is Word 0 Bit 1
What coding do I need to change the mode using an HMI like wonderware?
Do I need ladder logic to do this or just point WW to the right bit?

Thanks
 

Similar Topics

A simple PID simulator for my first steps with Python, might come in handy for some demos https://github.com/Destination2Unknown/PythonPID_Simulator
Replies
22
Views
10,741
I'm kicking around revisiting an idea I had a few years back. I have very little programming experience, just from school a few years ago. I had...
Replies
6
Views
1,868
In the HVAC field I have seen many controls technicians and integrators struggle for hours on end trying to get various PID loops tuned in for...
Replies
12
Views
6,936
Greetings from Michigan, I want to use a PID instruction to control simple oil flow in one of our machines, that obviously uses an oil pump and...
Replies
1
Views
1,645
Hey guys I was just making a basic program for some game thing I was tryin out. I havent writ a plc program in probally a year so Im a little...
Replies
8
Views
6,882
Back
Top Bottom