PID Controller
The PID Controller (Proportional-Integral-Derivative Controller) is an analog control node used to regulate a process and maintain a measured value as close as possible to a desired target value.
The controller continuously compares the Measured value with the Desired value and calculates an analog Output according to three control components:
- Proportional (Kp) — reacts to the current error.
- Integral (Ki) — reacts to the accumulated error over time.
- Derivative (Kd) — reacts to how quickly the error is changing.
The basic control error is:
Error = Desired value - Measured value
The controller output can be conceptually represented as:
Output = Proportional action + Integral action + Derivative action
A PID controller is particularly useful when the controlled output must change gradually rather than simply switching between ON and OFF.
Typical applications include temperature regulation, pressure control, speed control and other continuously regulated processes.
Connectors
| Connector | Type | Description |
|---|---|---|
| Measured value | Input | Current value measured from the controlled process, for example the actual room temperature. |
| Desired value | Input | Target value or setpoint that the controller should maintain. |
| Output | Output | Analog control value calculated by the PID controller. The resulting value is limited by the Minimum and Maximum properties. |
Main properties
| Property | Description |
|---|---|
| Sampling Time | Defines, in seconds, the interval between two consecutive PID calculations. |
| Threshold | Defines the tolerance used by the controller when evaluating the difference between the measured value and the desired value. It can be used to avoid reacting to very small variations around the setpoint. |
| Kp | Proportional coefficient. Determines how strongly the controller reacts to the current error. |
| Ki | Integral coefficient. Determines how strongly the controller reacts to an error that persists over time. |
| Kd | Derivative coefficient. Determines how strongly the controller reacts to the speed at which the error is changing. |
| Maximum | Maximum value that can be generated on the Output connector. |
| Minimum | Minimum value that can be generated on the Output connector. |
Operation
Error calculation
The controller continuously compares the two input values:
Error = Desired value - Measured value
For example:
- Desired value = 22 °C
- Measured value = 20 °C
The resulting error is:
22 - 20 = +2 °C
The PID controller uses this error, together with the configured coefficients, to calculate the required output.
Proportional action - Kp
The proportional component reacts directly to the current error.
Conceptually:
P = Kp × Error
A larger error therefore produces a stronger proportional correction.
If the measured value approaches the desired value, the proportional contribution progressively decreases.
Increasing Kp generally makes the controller react more strongly to a difference between the setpoint and the measured value.
A proportional gain that is too high may cause the controlled value to oscillate around the setpoint.
A proportional gain that is too low may make the regulation excessively slow.
Integral action - Ki
The integral component considers how long the error has been present.
Even when the instantaneous error is small, if it remains present for a long period the integral contribution progressively increases.
This allows the controller to compensate for a persistent residual error that cannot be completely removed by the proportional component alone.
Increasing Ki increases the correction applied to errors accumulated over time.
The integral component is useful for eliminating a persistent difference between the measured value and the desired value.
An excessively high integral coefficient can make the system react too strongly and increase overshoot.
Derivative action - Kd
The derivative component considers how quickly the error is changing.
It can therefore react not only to the current difference from the setpoint, but also to the direction and speed at which the process is moving.
For example, if a temperature is rapidly approaching the setpoint, the derivative component can reduce the control action before the setpoint is exceeded.
Increasing Kd increases the influence of the rate of change of the error.
The derivative contribution can therefore help reduce overshoot and stabilize the regulation.
Sampling Time
The Sampling Time defines how frequently the PID calculation is updated.
For example, with:
Sampling Time = 5 seconds
the controller updates its calculation every 5 seconds.
The appropriate sampling time depends on the controlled process.
A rapidly changing process may require a shorter sampling interval, while slow systems such as room temperature regulation generally do not require extremely fast calculations.
Threshold
The Threshold defines a tolerance around the desired operating condition.
Small variations around the setpoint can therefore be considered within an acceptable error range, reducing unnecessary reactions to minor measurement fluctuations.
This is especially useful when the measured value is not perfectly stable.
Output limits
The calculated PID output is constrained between the configured Minimum and Maximum values.
For example:
| Property | Value |
|---|---|
| Minimum | 0 |
| Maximum | 100 |
the output will always remain within:
0 ≤ Output ≤ 100
Even if the PID calculation produces a value outside this range, the resulting output is limited by the configured boundaries.
The Minimum and Maximum values should be configured according to the expected range of the destination command or actuator.
Example
Consider a heating system where the PID output controls the heating power.
Assume:
| Parameter | Value |
|---|---|
| Desired value | 22 °C |
| Measured value | 20 °C |
| Minimum | 0 |
| Maximum | 100 |
The initial error is:
22 - 20 = +2 °C
The controller therefore generates an output according to the configured Kp, Ki and Kd coefficients.
As the room temperature approaches the desired value, the behaviour can be represented conceptually as follows:
| Measured value | Error | Typical PID behaviour |
|---|---|---|
| 20.0 °C | +2.0 °C | Strong correction is required. |
| 21.0 °C | +1.0 °C | The proportional contribution decreases as the temperature approaches the setpoint. |
| 21.8 °C | +0.2 °C | Only a small correction may be required. The integral component can compensate for a persistent residual error. |
| 22.0 °C | 0 °C | The setpoint has been reached. The required output depends on the previous integral contribution and process conditions. |
| 22.3 °C | -0.3 °C | The control action is reduced or corrected because the measured value is above the setpoint. |
The exact Output value cannot be determined from the current measured value alone.
A PID controller also depends on the configured coefficients, the sampling time, previous errors and the accumulated integral state.
PID Controller vs Comparator
Both the PID Controller and the Comparator / 2 Points Regulator can be used for regulation, but their behaviour is different.
| PID Controller | Comparator / 2 Points Regulator |
|---|---|
| Generates a continuously variable analog output. | Generates a binary ON/OFF output. |
| Uses proportional, integral and derivative regulation. | Uses ON and OFF thresholds. |
| Suitable for modulating actuators. | Suitable for actuators requiring simple ON/OFF control. |
| Can gradually reduce the control action when approaching the setpoint. | Changes state when the configured thresholds are crossed. |
| Requires PID coefficients to be configured correctly. | Generally simpler to configure. |
Verification through simulation
The behaviour of the PID Controller can be checked directly using the Logic Module simulation tools.
During Offline Simulation, the input values can be modified manually while observing the values passing through the node connectors.
A typical test can be performed as follows:
- Connect a variable or simulated value to Measured value.
- Connect the required setpoint to Desired value.
- Configure Minimum, Maximum, Sampling Time, Threshold, Kp, Ki and Kd.
- Start the simulation.
- Modify the measured value.
- Observe how the Output changes over time.
- Gradually move the measured value toward and beyond the setpoint.
- Verify that the output remains between the configured Minimum and Maximum limits.
Online Simulation can also be used to observe the node while the logic scheme is running directly on the Thinknx server.
Offline Simulation is useful for understanding the logical behaviour of the node, but the final PID tuning should be verified on the real controlled system because physical characteristics such as inertia, delays and actuator response influence the regulation.
Configuration notes
- Make sure that Measured value and Desired value use the same physical unit and scale.
- Configure Minimum and Maximum according to the valid range of the controlled actuator or destination value.
- Choose a Sampling Time suitable for the speed of the controlled process.
- A very short sampling time is usually unnecessary for slow processes such as room temperature regulation.
- Use the Threshold to avoid excessive reactions to insignificant fluctuations around the desired value.
- Increasing Kp makes the controller react more strongly to the current error.
- Increasing Ki increases the correction of errors that persist over time.
- Increasing Kd increases the response to rapid variations of the error.
- PID coefficients should be adjusted progressively while observing the behaviour of the controlled system.
- A common commissioning approach is to begin with the proportional component and then progressively introduce the integral and derivative contributions when required.
- Always verify the final configuration on the real installation, especially when controlling processes with significant inertia or delay.