PID controller simulator
A PID controller is what keeps an oven's temperature, a tank's level or a network's pressure steady when conditions change. Tuning it by eye on the machine is slow and sometimes dangerous. Here you can try, on an electric oven and a water tank, what each action (P, I and D) does, how the open-loop step test used for tuning works, and what happens with an aggressive tuning, with the steady-state error of proportional action, or without anti-windup.
Measurement (PV)Setpoint (SP)Output (CV)
Try this
How to use it
- Process: a slow oven with plenty of dead time, or a fast tank. Time is speeded up: in the oven, one second on screen is 10 real seconds.
- Starting tuning: four typical tunings to compare. If you move Kp, Ti or Td, it switches to «Custom».
- Automatic or manual: in automatic the PID is in charge; in manual you move the output yourself, as in a commissioning test.
- Chart: measurement and setpoint at the top; the controller output at the bottom. The boxes measure the overshoot and settling time of the last change.
The control loop
A loop has four parts: the measurement (PV, the process variable, for example the temperature from a probe), the setpoint (SP, what we want), the controller, which compares the two, and the final control element, which receives the controller output (CV, 0 to 100 %): a solid-state relay feeding the heaters, a valve, a drive. The difference between setpoint and measurement is the error, and the PID's whole job is to bring it to zero and keep it there when something changes.
The three actions
- Proportional (P): the output is proportional to the error, multiplied by the gain Kp. The larger Kp, the harder it reacts. But a P-only controller needs an error to produce an output, so it always leaves a steady-state error (offset). Try it with the «P only» tuning.
- Integral (I): it adds up the error over time and keeps pushing while any error remains, however small. It is what removes it completely. It is set with the integral time Ti: the smaller Ti, the stronger the integral, and if it is too strong the loop oscillates. Some controllers use integral gain Ki = Kp/Ti instead, which works the other way round.
- Derivative (D): it reacts to how fast the measurement is changing and brakes the rise before it gets there, which reduces overshoot in slow processes such as an oven. It amplifies measurement noise, so most flow, level or pressure loops do not use it, and in this simulator it acts on the measurement and is filtered, as industrial controllers do.
In industry the vast majority of loops are PI. D is kept for temperatures and slow processes with a lot of delay.
How to tune it: the open-loop step test
The most practical method for a technician is to measure the process before tuning:
- With the process steady, switch the controller to manual and change the output in one step, for example from 30 to 50 %.
- Read three figures from the chart: the dead time θ, how long the measurement takes to start moving; the time constant τ, how long it then takes to cover 63 % of the change; and the gain K, how much the measurement changes in total divided by how much the output changed.
- With those figures, a cautious and widely used PI tuning (lambda tuning) is: Ti = τ and Kp = τ / (K × (λ + θ)), where λ is how fast you want it; taking λ as one or two times θ gives a quick response without much overshoot.
In the simulator's oven, K is 3.5 °C per % of output, τ about 120 s and θ about 15 s. With λ = 30 s you get Kp ≈ 0.76 and Ti = 120 s, which is exactly the «well-tuned PI». Do it yourself in manual and check the numbers.
Many controllers, such as PID_Compact in TIA Portal or panel temperature controllers, have an auto-tune that runs a similar test on its own. It is useful, but it pays to understand what it does: if the process is disturbed during the test, the result can be poor.
Integral windup
A controller output has limits: it cannot give more than 100 % or less than 0 %. If the setpoint cannot be reached, or the process is very slow, the output sits at its limit and the integral, if nothing stops it, keeps growing. When the measurement finally gets there, the integral has built up so much that the output stays at 100 % for a good while and the process overshoots badly. Anti-windup stops integrating while the output is at its limit. Every industrial controller has it; untick it in the simulator to see what happens without it.
Common mistakes
- Tuning by eye by raising Kp until it «responds quickly»: the loop ends up oscillating when the load changes.
- Mixing up Ti with integral strength: a small Ti is a strong integral, not a weak one.
- Adding derivative to a noisy loop, such as a flow loop: the output jitters and wears the valve.
- Switching from manual to automatic with a jump: good controllers do it bumplessly, starting from the output that was there.
- Tuning around a faulty final element: a valve with backlash or a failing relay is not fixed with the PID.
- Scaling the measurement wrongly: if the analog input is badly scaled, the controller works with false data. Check it with the Siemens analog scaling tool and the 4–20 mA converter.
Found it useful? Share it with your class or your team: WhatsApp · Telegram · LinkedIn · Email