PID
This online tuner calculates P, I, and D values to tune your real-world control loop and suggests a scan rate, based on data you supply. It’s an easy way to get very close to functional tuning for your real-world process PID. Note that the tuner is optimized for Opto 22’s Velocity Type C and similar algorithms. For more information on PID loops, see the Tuning a PID Control Loop Technical Note.
A PID control loop is (typically) a mathematical calculation that measures a process input, compares it to a desired setpoint, and applies an output designed to match the setpoint as closely as possible.
The output is derived from three values: proportional, integral, and derivative. This calculation is repeated at a set time interval called a scan time, usually in seconds.
You can use a common PID algorithm for nearly any process by selecting numerical values that determine the behavior of proportional, integral, and deriviative calculations.
Then you'll need to tune each PID control loop to determine the values for proportional, integral, and derivative that will achieve the ideal performance for your individual process.
An example
A very common use of a PID control loop is the heating system in a building.
- The setpoint is the desired room temperature.
- The input, or process variable, is the measured temperature in the room.
- The output, or controlled variable, is the setting of the furnace, which can be turned up or down to reach and maintain the desired temperature.
You can use this tutorial with any PID loop controller that meets the requirements under the red What You Need button.
Or you can use the Opto 22 SNAP PAC Learning Center, which provides a sample heating system to demonstrate and learn to use PID control. The Learning Center includes a specially built probe that is a combination heating element and temperature sensor, plus PAC Control software with graphical PID tuning.
What you need
This tutorial walks you through tuning a PID control loop using the Ziegler-Nichols Reaction Curve, or Open-Loop tuning method. This method as presented in this tutorial has a few requirements:
- The process response time should be around twice the loop dead time.
- The process should self-stabilize for a given step change in the controlled variable (the output).
- Your PID loop controller must be able to graph the PID loop.
- You should have access to either a printer or screen capture software so graph measurements can be taken at the end of the process.
- You'll also need a metric ruler to take precise decimal measurements and enter them into the tutorial.
The assumed measurement for time is seconds. You can enter a unit of measure (for example, degrees or PSI) for your process variable (y-axis) and for your ruler (mm, cm) in the fields below. These units of measure will be displayed wherever measurements are required to clarify whether you are measuring the process variable, the time, or the linear distance on your graph printout.
Step 1
Put the PID loop into manual, set the output at a non-zero minimum value, and allow the process to stabilize.
Once the process has stabilized, step the output to a higher value (typically around 20 to 40 percent higher than the minimum). Allow the process to stabilize again. Now look for the lower and upper values of the control variable (the output).
If the curve of the process overruns the time scale of your graph the first time, reset the process, extend the time scale, and step the process again. Or if the process is very responsive and the resulting curve is too compact to measure, reset the process and speed up the graph. You are trying to produce a curve very similar to the diagram at right.
When you have a suitable graph take a screen shot or, better still, a printout. Enter the high and low values for the control variable in the fields below.
Step 2
Now enter the high and low values of your process variable (input). These will be used in the final calculation.
Step 3
On the printout, find the 63.2% point of the curve by entering the measured distance from the lower value of the process to the upper value of the process (where the input ended up after the step change stabilized).
Step 4
After entering the linear distance between the high and low point of the process variable, click the Calculate 63.2% Change button. This will provide the height on your graph of the 63.2% change in the process variable. Measure to this point, then draw a line horizontally from this point to where to where it intersects the graph. Then draw a line straight down from this point on the graph.
Step 5
Now measure the time between when the input started to change as a result of the step change in the output, and the line you dropped down from the 63.2% point on the graph. Enter it below.
Step 6
The PID formula is linked to time, so we need to know the length of time that the graph spans. Measure the distance between two known values in time (say, 1 minute, or 30 seconds). Enter the time duration in seconds and the distance on the graph between those two values (in mm).
Step 7
Enter the scan rate. Now, measure the dead time linear units. Dead time is the time it took for the change in the output variable to begin to affect the process variable.
Step 8
All values are carried over from previous steps, so all you need to do is scroll down and press the "Calculate tuning" button.
Boom! There are your P, I, and D values. It's a thing of beauty.
Note that you may need to invert the integral value calculated here, depending on your PID loop controller formula. Check your formula or manual to find out.
Some tweaking may be required, but for the most part, you will be in the ballpark.