Support
News
Client Portal
Contact

# PID Control Explained

We use various tools in the name of temperature control automation and one of the most widely used methods is the PID, which is an algorithm designed to apply accurate and optimal control of a process variable, such as space temperature.  PID stands for Proportional-Integral-Derivative, which are the three main components of the calculation, and the purpose of a PID is to adjust the output of a system based on the difference between a desired setpoint and the current state of the system. A PID is programmed onto an Analog Output point that will be controlled and requires two supporting points, a feedback and a setpoint, to complete the calculation. The feedback is typically provided by a temperature sensor and the setpoint will be an analog software point. The analog output point is what will be adjusted up or down to affect the variable being monitored by the feedback point, and setpoint is the value we want the feedback point to maintain.

A PID loop continuously calculates an error value, which is the difference between the setpoint and the actual value of the variable, and applies a correction based on proportional, integral, and derivative terms, which is where the name comes from. It is important to have all three terms working together, rather than just a proportional or proportional+integral, to achieve the desired result because each portion of equation works to adjust the final outcome. We can highlight this fact by expounding on what each term actually does:

• Proportional (P) Control: In the simplest terms P is percentage of change multiplied by the present error. The proportional term calculates the present error, or value between the desired setpoint and the current state of the system, and generates an output that is proportional to this error. The proportional gain (Kp), which is a constant that the user enters when initializing the PID, determines the strength of the response. For example, if Kp is 5 than an error of 20% will give you a 100% change to the output variable, e.g. opening a valve 100% of the span.  Likewise with a P of 10 an error of 10 will also give you 100%.  A P of 100 will give you 100% with an error of 1.

A higher value of Kp leads to a more aggressive response, but it can also cause overshooting or instability. A high proportional gain results in a large change in the output for a given change in the error. If the proportional gain is too high the system can become unstable and make it difficult to dial in to the setpoint as the error value gets smaller because we won’t be able to make small adjustments. If the proportional gain is too low the control action may be too small when responding to system disturbances, making achieving setpoint a difficult and timely process. Best practices dictate that the proportional term should contribute the bulk of the output change and be fine-tuned by the other variables. Using proportional control alone will result in a perpetual error between the set point and the process value due to the fact that the PID requires a non-zero error to generate the proportional output response. Thus, the target value is never achieved because as the difference approaches zero, so too does the applied correction.

• Integral (I) Control: The integral term takes into account the past values of the Error, sums them up as a function of time, and multiplies them by the integral gain (Ki), which is also a constant entered by the user during the initialization phase. The integral term seeks to eliminate the residual error by adding a correction factor to the proportional calculation; this correction factor is scaled based on the values of the past errors. As the error approaches zero the integral term will cease to grow. This will result in the proportional effect diminishing as the error decreases, but this is compensated for by the growing integral effect. For example, if a space temperature remains too hot the Integral would act to open the Chill Water Valve even more. However, rather than closing the valve when target is reached it attempts to drive the cumulative error to zero, resulting in an overshoot. The contribution from the integral term is relative to both the magnitude of the error and the duration of the error.

The I term also affects how fast the PID will respond. E.g. For an I of 60, if the error persists for 60 seconds, the output will be commanded by P.  This means that for an I of 60 and P of 10, then after 60 seconds of error the output will be commanded by 10 * Error (the I is in seconds).  Of course the command occurs gradually over the 60 seconds, not all at once.  But the total command over the 60 seconds would be equal to the P term.

• Derivative (D) Control: The derivative term considers the rate of change of the error. It provides a predictive element to the controller by anticipating future trends based on the current rate of change. The derivative gain (Kd) determines the influence of this term and limits the amount of change the derivative process can implement upon the final output. Term D is a best-guess estimate of the future trend of the Error value based on its current rate of change, and the derivative control helps to dampen the response, reduce overshoot, and improve system stability. It is sometimes called “anticipatory control”, as it is effectively seeking to reduce the effect of the Error by exerting a control influence generated by the rate of error change. The more rapid the change, the greater the controlling or damping effect. Derivative tuning attempts to reduce overshoot by slowing the correction factor applied as the target is approached.

By combining these three terms, the PID loop calculates an appropriate control signal to adjust the system’s output. The formula typically looks like this:

Output = (Kp * Error) + (Ki * Integral of Error) + (Kd * Derivative of Error)

The tuning of PID parameters (Kp, Ki, and Kd) is crucial for achieving optimal system performance, as different seasons or conditions for the same system may require different tuning approaches. As a rule of thumb we recommend that larger values be used with slower-reacting mediums, like space temperature, and smaller values used for faster-acting mediums like chill water or supply temp. This approach will reduce hunting and establish an appropriate baseline to enable auto-tune functions.

The combination of Proportional, Integral, and Derivative (PID) produces a versatile and robust sequence that reacts immediately to disturbances, reduces error, and begins backing off before a set point is overshot. This grants the user a powerful tool that not only assists with tenant comfort but also energy management and ease of use, which is the end goal of the automation industry.