QUOTE(Wild Bill @ Aug 12 2006, 04:58 PM) [snapback]38199[/snapback]
Like I said, I'm new to PID. so here is the information:
SLC 5/03 with a 1746NI04V 2 in/out 0 to 10 volt card. Using a Thermocouple as the input and the SCP instruction to scale for 260 to 300 degrees. My output for the SCP is N10:28. (Using the AB reference manual here).
The PID control block is N10:0
Process variable is N10:28
Control variable is N10:29
And the block length is 23
My output to the oven is an analog device controlling a valve modulating from closed to full open.
If i knew how to attach the RSS file, I would, but cant find any place to do an attachment on this board. If I;\'d learn to read some I'd see it below!!!!!!!!

So, I have attached what I have started. I know the output must be scaled to the valve which is also 0 to 10 DC an I plan on using the SCP function here also. But, where is the output of the PID?????? Am I stupid or what or just dont see whats happening in the PID.[attachmentid=2974]
Frankly, you're much better off using the PD data files the first time and NOT the integer ones. Mostly because it is much easier to remember the mnemonics. When you go to create a PD data file, watch your memory usage! These things are pigs so most people don't set the data file length to more than 10-20 elements.
If you do that, then on the setup, don't worry about the "tieback" for now. Just give it any available integer. Key in the location of your temperature variable as an input (PV). You *can* do all the scaling in the PID loop directly without bothering with your SCP instruction, which is kind of convenient.
You need to trigger the loop on a fairly regular timing interval. Personally I put all of my PID's in a single ladder (along with the interface code) and simply trigger them from the PLC's STI input (software timer interrupt). This gaurantees nice and even timing...and I know exactly what to plug into the loop timing information (the firing rate of the STI). Remember to look at your actual scan times and don't set the STI to fire close to the current scan times or you can end up firing it several times per scan which will royally slow your normal ladders down.
Next, the interfacing is easy.
The PID loop assumes that the PV (input variable) is an unscaled value from 0 to 4095.
Key in the values of 0 and 4095 (from raw input variables) into the engineering units. If you prefer not to do it that way, then just use "0" and "4095". Either way, PDxx:yy.PV is the "scaled" input of the PID loop that you can use for display purposes.
PDxx:yy.OUT is the output signal. It will be spanned from 0-100% as a floating point variable. Scale appropriately and move it into your output. If you are using a 12 bit output card, simply do something like "MUL PDxx:yy.OUT 40.95 Nxx:yy".
PDxx:yy.SWM and PDxx:yy.MO are your friends. The PID loop is meant to have this whole disconnected remote manual loop but there's a much easier way. Simply toggle .SWM on when you want to go into "manual" mode and then input your manual signal (0-100 in floating point values) into .MO. Toggle it back to a 0 for "automatic" mode. When it is in manual mode, the .MO value will be copied directly to the .OUT value. When you switch back to automatic, it will do a "bumpless" transfer...the PID loop will begin adjusting the output as-is. If you don't do it this way, then the "tieback" and all the other manual-mode related stuff has to be set up which is a pain.
Another word of warning. The first time you attempt to set up a PID loop, the moment you put the instruction in if you are in remote online mode, it WILL fault your PLC the first time when the PID loop initializes. This is a one-time "gotcha" that happens when you are programming it the first time...not every startup. Another "gotcha" is that if your input value ever falls outside the engineering unit limits, it will fault. So make sure to set it up correctly and guard your inputs if you are not simply pointing it to raw values off an input card.
Once you get that far, look around for "model based control" for tuning rules. Use independent gains as it is much easier than the "integrated" equation to tune.
Since you're doing an oven, you really will probably only need a "PI" loop in most cases. Derivative terms help when you have lots of external disturbances and you need to "anticipate" corrections to the output. This is how I'd do it by hand. First get into online programming mode. Set up a trend chart in Logix. You want the chart to show 3 things: the set point (PDxx:yy.SP), the process variable (PDxx:yy.PV), and the output signal (PDxx:yy.OUT). Initially get everything running in manual mode. Set the "P" term to 1. Now flip on the auto bit. Watch what happens. Is it slower than molasses? Or is it oscillating wildly? You will need to increase/decrease the proportional gain to get it to get fairly close to the correct output without too much oscillation. Initially increase/decrease the P term by a factor of 10 at a time. Once it is getting close, drop down to doubling/halving the value. If you've got a nice trending pattern, you will have to either switch to manual and purposely screw up the output or else give it different set points to give the system something to do as you watch how it responds.
Once you have that much, then set the integral term equal to 10% of the proportional term. Watch the trend chart and it should lock it fairly quickly on your set point. As you adjust the integral term to larger values it will reach the set point faster but if you go too far, it will overshoot and tend to oscillate.
You will probably tend to have "slow" loops when you tune by hand. This is usually considered OK by most folks. If you push the tuning (increase the gains) enough, you will eventually have some oscillations but the loop will react faster. If you really want a fast loop, you'll probably end up shelling out for one of the tuning programs out there.
Since you're dealing with an oven, I have found one exception to the rule. I just got through tuning the oven where I work at and it was a pain in the rear. See, this particular oven has "flat" burners. It heats primarily by indirect firing...it heats the refractory which in turn heats the product. The problem is that the refractory tends to make the whole thing act "second order". On top of that, the product has a large amount of thermal mass itself, so the system "gains" are not very predictable...you can never optimally tune this loop.
In this case, I tuned the loop with a huge derivative gain, a somewhat smaller proportional gain, and a much smaller integral gain. Whenever there is a disturbance, the oven reacts very quickly to turn up/down the gas. Once this is underway, then the derivative term fine tunes the gas over a much larger time span to move the oven back towards the set point. The old discrete controllers (Omega 4000 series) used a "fuzzy logic" loop which mostly just tended to constantly run in oscillation back and forth between low and high fire. It was that fuzzy logic loop that actually had everyone fooled into believing that the oven was an on/off control which in reality it was continuous!