Sign in to follow this  
Followers 0
dimented

PID Loop

13 posts in this topic

I am a complete beginner when it comes to PID loops. After many years of programming I have some how avoided them. Well now I have a couple I need to do and although they are very simple they are throwing me for a loop. I have a VFD drive that is controlling a valve. The more material needed to go through the valve the faster the speed, the less material, the slower the speed. Hoprfully giving me a very precise amount of material going through the valve. How do I set up this PID loop in an enhanced PLC 5? I have the PID loop but am becoming a little lost from there. The way I see it I have three parts to this. The amount of material needed, the amount of material currently through the valve, and the speed in which the valve will run. I am not seeing a place for all of this data in the PID loop unless I am missing something. Could somebody please give me a hand setting up this loop? Thanks in advance!

Share this post


Link to post
Share on other sites
For a PID loop you need three varibles. Control Varible Process Varible Setpoint varible. In the system you described, the PV is the current flow rate, the CV is the output to the VFD, and the Setpoint is the desired flow rate. The PID compares the PV to the Setpoint, using the tuning parameters and calculates a value for the CV to "correct" the difference or "error" between the desired septoint and the current Process varible. The above description is the basic feed back loop, there also feed forward loops, and cascading loops. The Loop tuning is often what gives most people the largest problem.

Share this post


Link to post
Share on other sites
To see the internals and setup your EU etc. double click the screen setup at the bottom of the instruction.

Share this post


Link to post
Share on other sites
There's a forum specifically for PID loops. http://www.expertune.com/forum/viewforum.php?f=8 You may get more info there.

Share this post


Link to post
Share on other sites
This guy's blog has some good stuff on PID loops: http://www.controlguru.com/

Share this post


Link to post
Share on other sites
Greetings dimented, what am I missing? ... normally I don’t think of a VFD (Variable Frequency Drive) as “controlling” a valve ... instead the VFD normally controls the speed of a motor ... and I don’t think of valves as having a “speed” ... instead a valve has a “setting” of 10% open, etc. ... maybe it’s just me, but I’m having a hard time understanding exactly what you’re describing ... when I substitute the word “PUMP” in every place where you’ve used the word “VALVE”, then your question seems to make more sense ... have you simply transposed the two words? ... or am I just missing something here? ... I’m sure that we can help with that ... but first we’ll need to know a LOT more about your system ... and we’ll also need to know how the analog signals for your system are set up ... for example: are you using a 1771-IFE/C module for 4 to 20 mA signals for your inputs? ... and if so, how are those signals being scaled? ... example: from 0 to 4095? ... and how does the PLC send its output signal to the VFD? ... for example: through a 1771-OFE2 analog output module for a 4 to 20 mA signal? ... or by directly controlling the VFD speed reference with a number such as 0 to 30,000 written to a remote I/O address? ... suggestion: if there’s nothing “secret” or “proprietary” about your program, then post your .RSP file ... that will probably remove several days worth of “back-and-forth-question-and-answer” typing for you and for the rest of us ... big issues: ... is it safe for you to “experiment” with this system while you learn? ... or is this something that we might read about in the papers if things get out of hand? ... and what’s your deadline for getting this to work? ... if the answer is anything less than several weeks, then I’d suggest that you consider calling in reinforcements ... most people tend to consider PID to be “the deep end of the pool” ... it’s going to be difficult (but not impossible) for us to give you all of the information that you’re going to need through this “forum” type of communications ... and it’s going to take a LOT longer than you think to get everything covered ... and by the way, welcome to the forum ... we hope to hear from you again soon ... and just a final thought: this thread would probably get more attention if you had posted it in the “Allen-Bradley” section of the forum ... many (most?) people don’t expect to see this type of detailed problem in the “lounge” section ...

Share this post


Link to post
Share on other sites
Ron I don't know dimented's app but it made me think of something I once worked on. It was a gravel hopper at concrete yard, the valve was really a gate or door if you will. This door opened with a gear motor and a VFD the feed back was from a scale that the truck sat on. They wanted to control the flow of gravel with the gate. Later we did another one with hydraulics. Just a thought.

Share this post


Link to post
Share on other sites
thanks, Smoke ... that's the first time I've ever heard of that particular application ... but then I don't get around as much as some of you other guys do ... anyway, I guess that time will tell ... this could get interesting ...

Share this post


Link to post
Share on other sites
Another application I've of is pneumatic blowing, where you feed grain etc into a pipe at variable rates using a rotary valve.

Share this post


Link to post
Share on other sites
Thanks for all of the input. It is a rotary valve being controlled by a VFD. The output to the VFD id in the form of a percentage. 0%-100%. Everything is scaled from 0-4095. I can't post a copy of my program at the moment. I have been doing tons of research and think I am understanding enough that I can maybe bring this down to more spefific questions. My first couple are: Where do you put that addresses for the 3 variables. I see that you can put the address on the main instruction for the Control Variable and the Process Variable but where do I put the address for the setpoint at. Also, can I just fill in the tieback with a 0? Or do Ineed a tag in there. This valve is controlling the last step of my batch process. So the last part of material is being put into a tank based upon weight. Once the tank gets to a certain weight the valve needs to stop letting material in. Changing the speed will control how fast the material is released thus allowing for a precise amount of material into the tank. Will the PID loop work for this scenarion? Thanks again for all of your help. I have been doing controls for years but never touched a PID loop. Mostly conveyance equipment and Automobile plants. Which didn't need any of this PID stuff.

Share this post


Link to post
Share on other sites
I have done material charging hundreds of times, and have never used a PID instruction. I have a couple of different methods I have used with good success. I assume you are filling a large quantity, if not you may have to make a few adjustments to the step down points and the speeds, the ones I used are an example only. Method 1. In the beginning run the VFD at 100%, continuously monitor the fill weight, when the desired quantity reaches around 98%, start stepping the VFD down until when you reach something like 99.8% you are only running at 10-15%, then when desired quantity is reached, simply stop the VFD. You may have to adjust the starting point for the ramp down, and then number of steps, depending on how fast your system fills the tank. I have had very good results with this method. If you have any "coast" in your system, you may have to implement a "preact" and kill the VFD at some point slightly before 100%. Method 2. This method only works if you have some way of measure the flow rate. If you have only load cells, the rate can be derived with code. Like method one run the VFD at 100% until 98% of desired quantity is delivered, then slow down to around 25%, then use the following formula to determine the preact. The step down is needed if you have very fast filling, if the rate is slow the step down can be eliminated. I also use this method on non-VFD applications with good results. Preact= (flowrate * k) I use the same pump for delivery to multiple destinations and the "k" for each destination is different, k has to be determined by trial and error start out with a very small k, something like 0.125), but once it's set, the system is somewhat dynamic, as the equipment wears, the flowrate will drop, and the preact qty will decrease. Larger values of k will stop the pump earlier, so the bigger the k the less qty you get. (k is usually a small decimal number .25, .312 etc...) Then when (delivered qty + preact qty) >= desired qty, stop the VFD.

Share this post


Link to post
Share on other sites
I'm pretty much in agreement with Ken's #1 approach. For a rotary valve, your resolution is determined by the volume of each segment of the rotary valve. If each segment drops 5 pounds of material, then your weight is going to go up in 5 pound increments. Of course this assumes your feeder valve stays flooded. The best situation for batching is if the rotary valve dumps directly into the tank. In this situation you can run at high speed until you reach close to the setpoint (say 98%), then slow down to a dribble speed and add the last few increments. The time lag from rotary valve to scale is very short. If you airvey it to the tank, you have more variables to deal with. However, if your batch time will allow it, you can eliminate most of the variables. When you hit 98%, stop the feeder and wait long enough for all the material to enter the tank. Then run the feeder at dribble speed to add the remaining amount. For example, say your rotary valve has 6 segments and it takes 12 seconds to make a full revolution at dribble speed. That would make 2 seconds run time add 5 pounds of material. So run the rotary valve for the appropriate seconds, wait for all the material to reach the tank and recheck. Make another addition if needed. In batching, you can usually trade addition speed for addition accuracy up to a point. And you can also increase addition speed while maintaining accuracy with a more complicated algorithm. See Ken's #2 approach. Good luck,

Share this post


Link to post
Share on other sites
Yes, you can just stick a 0 in tieback. Your setpoint can be moved into the data structure PD10:0.sp if you're using a pd file type, or look up the word number if it's an integer type. I would not use a PID for this. I would use 100% speed till I got close and then a slow speed till I reached total weight minus some pre-act value. I would also put in some code to adjust the preact value for the next run by 1/2 of the error, so long as the error was within some pre-determined boundries. Using a PID will just screw up and slow down your process.

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