 # What is PID Controller?

PID controller (proportional–integral–derivative controller) is a control loop feedback mechanism widely used in process industry and a variety of other applications requiring continuously modulated control. We generally use analog sensors to get continuous signal i.e. Temperature, Pressure, position, etc.

A PID controller continuously calculates an error value as the difference between a desired setpoint (SP) and a measured process variable (PV) and applies a correction based on proportional, integral, and derivative terms (denoted P, I, and D respectively) which give the controller its name. systems and a variety of other applications requiring continuously modulated control.

A PID controller continuously calculates an error value as the difference between a desired setpoint (SP) and a measured process variable (PV) and applies a correction based on proportional, integral, and derivative terms (denoted P, I, and D respectively) which give the controller its name.

When you select Position, the PID object calculates the output as follows:

MV = Kc (en + integral sumn – Td / dT (Pv n – Pv n-1))

where:

dT = time increment between current and previous calc.

MV = controller output (manipulated variable)

Kc = controller gain (units: % output / % error)

en = error at sample n (error = SP – Pv n )

integral sumn = integral sum n–1 + dT / Ti (en – en–1 ) also called bias

Td = rate, or derivative time

Pvn – Pvn–1 = change in PV from previous to current calculation

The output of the velocity form of the PID equation is the velocity or rate of change of the output signal. The velocity form of the PID equation is the first derivative of the position form of the PID equation with respect to time, so the result is the rate of change of the controller position.

When you select Velocity, the object calculates the output as follows:

dMV = MVn – MVn–1 = Kc ((en – en–1) + Tsen / Ti + Td / Ts (Pvn – 2PVn–1 + PVn–2)

where:

MV = controller output position (manipulated variable)

dMV = contoller output velocity

Kc = controller gain (units: % output / % error)

en = error at sample n (error = SP– Pvn )

Td = rate, or derivative time

PV = process variable

The PID object compares a Process Variable to a Setpoint. If there is a difference, it calculates the error and adjusts its output to compensate until the Process Variable is equal to the Setpoint.

PID stands for Proportional-Integral-Derivative. These are three factors in the equation that can be applied against the calculated error.

You specify Gain which is the proportional factor,

Reset (the integral factor), and Rate (the derivative factor) to define how the object responds

to the error.

NOTE: The way in which the PID object responds to your process can vary greatly according to the parameters you enter and the process you are controlling.

Type selects either positional control or velocity control .

Process Variable (PV) is typically the numeric signal from the field that you want to control. The PID loop equation does not expect this value to be normalized; rather the PID object performs the scaling of loop input and output values from engineering units.

Setpoint (SP) is typically the value of a Pot object, a constant numeric value, or the output signal from another PID object in a cascaded loop. Like the process variable, the setpoint is also scaled internally by the PID object.

Setpoint Min and Max are numeric constants that specify the range of SP and PV in engineering units.

Manual Output is a numeric parameter that specifies the output of the object when it is in manual mode; that is, when the Automatic Enable expression is FALSE. Users typically enter either a constant, or the name of a Pot object in this field.

Output Min and Max are numeric constants that specify the range of the object output signal. The output is often referred to as the manipulated variable (MV).

Sample Pulse indicates the frequency at which the PID object executes. This parameter field can contain either a numeric constant or a logical variable. If you use a numeric constant (like 0:01 for one second), the object calculates a new output value at the defined frequency. If you use a logical variable, then the variable should pulse at some desired frequency. Any time the pulse transitions from FALSE to TRUE, the object calculates a new output value. It is very important not to over-sample your data. Start with a slow sample rate.

Gain (Kc) is a numeric parameter that determines the overall sensitivity of the PID loop to changes in error. A gain value of 1.00 changes the proportional increment of the PID equation by 50 percent when there is a 50 percent change in error. A gain value of 0.25 changes the proportional increment by 12.5 percent with a 50 percent change in error.

Reset (Ti) also referred to as integral time, is a numeric parameter that specifies the amount of time it takes for the integral sum increment of the PID loop equation to react to a given change in error. For example, if the error suddenly changes by 20% and reset = 0:10 (10 seconds), the integral increment of the PID loop increases at a rate of 0.5 percent per second until it has changed by 20 percent after 40 seconds. This 20 percent contribution is multiplied by the gain, so if the gain is 2.0, the integral term contributes 40% to the loop output in this example. In other words, the shorter the reset time, the faster the object output responds to a change in either PV or SP.

Rate (Td) also referred to as derivative time, is a numeric parameter that dampens loop response. It is calculated based upon the rate of change of PV and adds an increment to the output that attempts to anticipate and slow the change in PV. As an example, if PV is increasing by 10 percent per minute, and rate is 0:30 (0.5 minutes), the derivative increment is calculated as –(10%/min. x 0.5 minutes)= –5% (or –0.05). So the derivative term would contribute –5% to the output if the gain is 1.0.

Automatic Enable specifies whether the loop controller is operating in automatic mode or manual mode. When it is ON, controller is operating in automatic mode and the output signal is being calculated using the PID algorithm. In manual mode, the output signal is equal to the Manual Output input signal.

The PID object provides bumpless transfer from manual to automatic operation- when the controller is switched from manual to automatic, its output begins changing from the current manual output setting. Contrast this with a loop controller without bumpless transfer. When such a controller is in manual, the integral term continues to accumulate. When the controller is switched to automatic, the loop controller would immediately go to a high or low output.

Add proportional increment specifies whether the loop equation adds the proportional increment of the PID equation to MV. This value is typically ON.

Freeze Enable specifies whether the loop bias should be frozen or actively back-calculated when the controller output signal goes out of range. In either case, the loop controller is protected from integral wind-up, but if Freeze Enable is OFF (recommended setting), the bias is actively back-calculated to prevent controller overshoot when PV comes back into range.

The PID object protects against integral windup in one of two selectable ways: It either freezes the bias term when the controller output goes out of range, or it actively back-calculates the bias so the controller responds smoothly with less chance of overshoot when its output returns to range.

Output Time is a numeric constant that specifies the time domain of the controller output when operating in velocity mode. For example, if the object output controls a value with dimensions of inches per minute, output time would be 1:00 (one minute).

Low Limit Enable is used in velocity control mode. It is an optional logical signal that clips the PID output to a value grater than or equal to zero when TRUE. This input can be used to signal the controller that the low limit switch on the controlled device has been activated.

High Limit Enable is used in velocity control mode. It is an optional logical signal that clips the PID output to a value less than or equal to zero when TRUE. This input can be used to signal the controller that the high limit switch on the controlled device has been activated.

The proportional term of the PID equation contributes an amount to the output equal to the error multiplied by the Gain. This provides an immediate output compensation when the error value changes.

The integral term of the PID equation calculates a running total of the error summed (or integrated) over time—think of this increment as adding the area under the curve of a plot of error versus time. While SP is greater than PV, the integral term is increasing, and while PV is greater than SP, the integral term is decreasing. The sensitivity of the integral output is set by the gain and the reset variables. Integral action can be eliminated by setting Reset to a higher number. At least some Integral action is required, however, for the loop controller to operate properly with bias adjustment. If you do not use any Integral, you may experience offset, a condition in which the output is adjusted to compensate for the error, but not enough to correct the error.

The derivative term of the PID equation acts to dampen the change in PV by adding a negative value for a positive-going PV and a positive value for a negative-going PV. Because PV is subject to sudden small changes and signal noise in many process loops, derivative action can cause a loop to respond erratically. Rate can be set to 0, especially when initially tuning the loop, to eliminate derivative action. Derivative action dampens process loops that tend to oscillate around the setpoint and thus provide better loop response. Rapidly changing loops such as liquid flow control in a pipe may not benefit from derivative action, but more sluggish loops that tend to build momentum, such as temperature control, benefit from derivative action by preventing overshoot and dampening oscillatory action.

1. PID Positional Control

2. PID Velocity Control

3. PID Data Members

NOTE: The way in which the PID object responds to your process can vary greatly according to the parameters you enter and the process you are controlling.

2 Likes