Tuning a PID Loop with the PID Reverse Loop Simulator
Contents
- How the simulator is organised
- The faceplate
- Settings panel (left)
- Chart box (right)
- Control Valve parameters
- Plant parameters
- Instrument parameters
- Tuning tips
- Exercise
Type: Tutorial Audience: Engineering students and trainees Goal: By the end of this tutorial, you will know every page of the simulator, you will have closed a simulated control loop, changed the setpoint and observed how the PID settings, the control valve, the process and the transmitter affect the response.
How the simulator is organised
The simulator closes a complete loop: the controller output (OUT) drives the control valve, the valve acts on the process (plant), and the transmitter (instrument) returns the process variable (PV) to the controller.
The screen has two areas, each with its own page selector (the ◀ ▶ arrows and the "1 / 3" counter):
- Left: the controller. It shows the faceplate (PV, SP, RS, FF and OUT bars and values). The ⚙ button opens the settings panel with three pages: Keypad, Ranges & PID, and Statistics. The ⚙ button inside the panel returns to the faceplate.
- Right: the chart box, with three pages: P&ID, Charts, and Parameters.
The faceplate
Values
- PV: process variable measured by the transmitter (read-only).
- LS / LSP: local setpoint, entered by the operator. RS / RSP: remote setpoint, received from another controller or system.
- FF: feedforward value added to the controller output.
- OUT: controller output sent to the valve, in %.
Symbols and indicators
- Vertical scale (0, 25, 50, 75, 100): percentage of the range, shared by all the bars.
- Yellow bar: PV. Green bar: local setpoint (LS). Light-blue bar: remote setpoint (RS). Purple bar: feedforward (FF). The height of each bar follows its value on the scale.
- Orange bar (bottom): the controller output (OUT).
- White double arrow ▲▼ next to LS and RS: the value can be edited by the operator. Click the number to type a new value.
- ⇒ arrow next to OUT: the output is moving freely within its limits. It disappears when OUT reaches a limit.
- High limit icon (flat bar on top): lights up when OUT reaches its upper limit. Low limit icon (flat bar at the bottom): lights up when OUT reaches its lower limit. The output is clamped there, which is useful to spot valve saturation.
- ⚙ button (top left): opens the settings panel.
- Mode box: shows the active mode. Click it to cycle through the modes:
- LOCAL (grey): no control calculation; OUT stays where it was. Switching back to AUTO is bumpless.
- MANUAL (orange): you set OUT directly; the PID does not calculate it.
- AUTO (green): the PID calculates OUT to bring PV to the local setpoint.
- REMOTE (light blue): the PID works in automatic using the remote setpoint (RS).
Settings panel (left)
Page 1 — Keypad
The operator keypad of the controller:
- Select what you want to edit: LSP, RSP or OUTPUT.
- Type the value on the keypad entry line and press Enter, or use the ▲ ▼ ◀ ▶ arrows to adjust it in steps.
- Use AUTO, MANUAL, REMOTE and LOCAL to change the operating mode and the active setpoint source.
Page 2 — Ranges & PID
- PID Equation: choose the algorithm (Ideal, Series or Parallel) and, when applicable, the parameter form: gains (Kp, Ki, Kd) or times (Kp, Ip, Dp). The effective equation is shown below the selector, with a warning if the combination is not valid. The three equations are explained in PID equation forms below.
- Action: Reverse (E = SP − PV; OUT rises when PV falls) or Direct (E = PV − SP; OUT rises when PV rises). The simulator starts in Reverse, as in a loop where opening the valve raises the PV.
- SP Follows PV: when ON, the setpoint tracks the PV while the controller is in MANUAL, giving a bumpless transfer to AUTO.
- Engineering units table: low, high and unit for PV, SP, RS, FF and OUT.
- Tuning: the proportional gain, integral and derivative values. Their labels change with the selected equation and form.
Page 3 — Statistics
Loop performance indicators calculated while the simulator runs:
- Settings: the expected design mode, whether the loop is in service (OFF excludes planned stops from the count) and the thresholds used by the indicators (saturation ε, stable SP window, variability threshold and ratio threshold).
- 1 · Incorrect mode: percentage of time the loop is not in its design mode.
- 2 · Limited control: percentage of time in AUTO with OUT at its high or low limit.
- 3 · Large variability: how much the PV varies compared with the stored baseline. It needs AUTO and a stable setpoint.
- Set Baseline stores the current variability as the reference for a well-behaved loop. Reset Stats clears all counters.
PID equation forms: Ideal (ISA), Series and Parallel
The same PID controller can be written in three ways. They all give the same behaviour if the settings are converted correctly, but the numbers you type are different. Entering Ideal settings in a Series controller (or the other way round) gives a different loop. The simulator converts every form internally to the Ideal one and shows the equivalent values under the selector.
In all equations, $E$ is the error, OUT is the controller output, and $s$ is the Laplace variable. For a Reverse controller $E = SP - PV$; for a Direct controller $E = PV - SP$.
Ideal (ISA, standard or non-interacting)
Parameters: $Kc$ (proportional gain), $Ti$ (integral time) and $Td$ (derivative time).
This is the form defined by the ISA standard. Kc multiplies the three terms, so changing it changes the proportional, integral and derivative actions together, while Ti and Td keep the same meaning in seconds. The three actions do not interact, which is why it is also called non-interacting. This is the simulator default and the one most textbooks use.
Series (interacting, classical)
Parameters: $Kc'$, $Ti'$ and $Td'$. The PI and PD actions are connected one after the other:
Expanding the product shows the interaction between the integral and derivative actions:
It comes from the pneumatic and analogue controllers, and many commercial DCS and PLC still use it. In practice the derivative action also changes the effective proportional gain and integral time. The simulator warns you when $Td' > Ti'$, because the equivalent Ideal settings are no longer valid. Keep $Td' < Ti'$.
Parallel (independent)
Parameters, in gains form: $Kp$, $Ki$ and $Kd$:
Each action has its own gain and they do not depend on each other. In the times form (labelled Kp, Ip and Dp in the simulator), the integral and derivative terms are written with a time instead of a gain:
This form is common in textbooks and in simulation software, but it is gain-sensitive: changing $Kp$ does not scale the integral and derivative actions, so a change in the process gain needs all three parameters to be retuned. The simulator shows a warning and does not recommend it for normal use.
Conversion between forms
The simulator converts everything to the Ideal form, where $Kc$, $Ti$ and $Td$ are the equivalent Ideal settings:
| From | To Ideal |
|---|---|
| Series | $Kc = Kc'\left(1 + \dfrac{Td'}{Ti'}\right)$ |
| Series | $Ti = Ti' + Td'$ |
| Series | $Td = \dfrac{Ti'\,Td'}{Ti' + Td'}$ |
| Parallel (gains) | $Kc = Kp$, $\quad Ti = \dfrac{Kp}{Ki}$, $\quad Td = \dfrac{Kd}{Kp}$ |
| Parallel (times) | $Kc = Kp$, $\quad Ti = Kp\,Ip$, $\quad Td = \dfrac{Dp}{Kp}$ |
With no integral action ($Ki = 0$ or $Ip = 0$ in Parallel, or $Ti' = 0$ in Series) the integral term is disabled, and the equivalent value of Ti is shown as 0.
Try it: set Series with $Kc' = 2$, $Ti' = 10$ s and $Td' = 2$ s, and read the equivalent Ideal settings under the selector: $Kc = 2.4$, $Ti = 12$ s and $Td = 1.67$ s. Then enter these three values in Ideal and check that the response is the same.
Chart box (right)
Page 1 — P&ID
A live P&ID of a level loop: tank T-101, level transmitter LT-101, level controller LIC-101 and control valve LV-101. The tank level follows the PV, and the diagram shows the current PV, SP and OUT.
Page 2 — Charts
- The upper chart shows PV and SP against time; the lower chart shows OUT.
- Full History ON shows every sample since the page was loaded, so you can review a whole test. Long runs are thinned out automatically to keep the chart fast. OFF shows only the latest 20 seconds.
- Auto Scale ON adjusts the axes to the data. OFF uses the variable ranges with a ±10 % margin.
Page 3 — Parameters
The three field elements of the loop are shown side by side. Their default values are ideal (no lag, no dead band, no noise), so the loop starts as clean as possible. The sections below explain each parameter in detail.
Control Valve parameters
The valve turns the controller output (OUT, 0–100 %) into flow through the process. Inside the valve, the signal goes through these steps in order: fail position → dead band → lag and stroke time → position → characteristic → flow. The panel also shows live readouts: Position (stem travel, %), Flow (% of maximum flow), Cv (current) and the Est. Flow in m3/h and gpm.
| Parameter | Unit | Default | What it does |
|---|---|---|---|
| Fail Position | – | Close (air-to-open) | Sets the action of the valve |
| Characteristic | – | Linear | Relation between stem position and flow |
| Cv (rated) | gpm/psi^0.5 | 100 | Rated (maximum) flow coefficient of the valve |
| Pressure Drop | bar | 1 | Constant pressure drop across the valve, used for the flow estimate |
| Specific Gravity | – | 1 | Specific gravity of the liquid (water = 1) |
| Rangeability | – | 50 | Ratio R of the equal percentage trim |
| Stroke Time | s | 0 | Time for a full 0–100 % travel |
| Dead Band | % | 0 | Backlash of the actuator or positioner |
| Lag | s | 0 | First-order lag of the actuator |
Cv (rated)
The flow coefficient Cv is the US gallons per minute of water that the fully open valve passes with a 1 psi pressure drop; a larger valve has a larger Cv. Here it is informative: the flow stays expressed as a % of the maximum flow, so changing it does not alter the plant response. Cv (current) is the rated Cv multiplied by the flow %.
Estimated flow
The liquid flow is estimated with Q = Cv × √(ΔP / SG), with Q in gpm and ΔP in psi (the simulator converts from bar). With the defaults (Cv 100, ΔP 1 bar, water) the fully open valve passes about 381 gpm, or 87 m3/h. It assumes a constant pressure drop, so it is an estimate: in a real installation ΔP changes with the flow.
Fail Position
- Close (air-to-open): more signal means more opening. OUT = 0 % is closed and OUT = 100 % is fully open. If the air supply fails, the valve closes.
- Open (air-to-close): the signal is inverted (position = 100 − OUT). If the air supply fails, the valve opens. With this valve the controller must be set to Direct action in Ranges & PID, otherwise the loop will be unstable.
Characteristic
- Linear: flow is proportional to position (flow % = position %). The gain of the valve is constant.
- Equal %: each equal step of travel changes the flow by the same percentage of the current flow. At low openings the valve is gentle; at high openings it is much more sensitive. It is common when the valve takes a small part of the system pressure drop.
- Quick opening: flow rises very fast at small openings (flow % = 100 × √(position %)) and flattens near full open. It is typical of on/off service.
Rangeability
Only used with the equal percentage characteristic. It is the ratio between the maximum and minimum controllable flow, with a typical value of 50. The higher it is, the more curved the characteristic is. It must be greater than 1; values of 1 or less give a linear response.
Stroke Time
Limits the speed of the valve: a full 0–100 % travel cannot be completed faster than this time. A 5 s stroke time means a maximum rate of 20 % per second. With 0 the valve is as fast as the controller asks. A slow valve adds delay to the loop and can lead to oscillation when the controller is tuned aggressively.
Dead Band
The command must move more than the dead band before the valve responds. With a 2 % dead band, after a change of direction the valve does not move until OUT has crossed about 2 %. It represents backlash, friction or a poor positioner. In a loop with integral action it produces a limit cycle: a continuous small oscillation of OUT and PV. A value above 10 % shows a warning because control becomes very difficult.
Lag
A first-order delay between the commanded and the actual position. The valve reaches about 63 % of a step after one lag time. It is smoother than the stroke time, which is a constant speed limit, and both can be combined.
Plant parameters
The plant is the process. This simulator uses the Tank with outlet resistance model: the tank is fed by the control valve and drains by gravity through a fixed manual valve (HV-101), so the outflow grows with the square root of the level (Torricelli's law).
tau · dPV/dt = gain · OUT(t − delay) − |offset| · √(PV / 50)
OUT here is the valve flow in %. |Offset| is the outflow, in % of valve flow, when the level is 50 %. The PV is limited to 0–100 %. The level settles by itself where inflow equals outflow: PV = 50 · (gain × OUT / |offset|)². With the default values, OUT = 50 % gives a level of 50 %, OUT = 30 % gives about 18 % and an OUT above about 70 % fills the tank (PV = 100 %). The process is self-regulating but non-linear: the higher the level, the faster it drains, so the process gain depends on the operating point. The Est. Flow shown under HV-101 on the P&ID is the live outflow.
The Model selector also offers the Integrating (tank level) model (a constant outflow, so the level is a ramp) and First Order Delay Time (FOPDT). Auto Fit works only with FOPDT.
The plant works in % of the transmitter span. The Plant parameters (gain, offset, noise) refer to 0–100 % of the Instrument range, so if you change the Range Low / High the process is rescaled: for example, with a range of 0–500 the PV can reach 500 and the loop still works without touching the plant.
| Parameter | Unit | Default | What it does |
|---|---|---|---|
| Gain | – | 1.0 | Inflow per 1 % of OUT, in the same units as the outflow |
| Time Constant | s | 10.0 | Larger values make the level move more slowly |
| Delay | s | 0.0 | Dead time before the process reacts |
| Offset | – | −50.0 | Its absolute value is the outflow through HV-101 at a level of 50 % |
| Noise | % | 0.0 | Random disturbance on the PV |
Gain
How sensitive the process is to the valve. With a gain of 1, a 10 % increase in flow raises the steady-state PV by 10 units. A higher gain makes the loop more sensitive, so the controller gain must be reduced. A negative gain gives a process that goes the opposite way and would need the opposite controller action.
Time Constant (tau)
The time the PV needs to reach 63 % of its final change after a step, and about 95 % after three time constants. Large values describe slow processes such as big tanks or temperature loops, and small values describe fast ones such as flow loops. It must be greater than 0 (5 s is used otherwise). A warning appears when it is shorter than 5 times the sample time (0.1 s), because the simulation would have a large discretisation error.
Delay (dead time)
The time between a change in OUT and the first reaction of the PV. It is caused by transport of material, long pipes or slow sensors. Dead time is the main enemy of good control: the larger the ratio delay / tau, the lower the controller gain and the slower the loop must be to remain stable. Values shorter than the sample time are interpolated between samples and show a warning.
Offset
A constant added to the steady-state value, so that PV = gain × OUT + offset. It represents a load or disturbance, such as an ambient temperature or an uncontrolled inflow. It does not change the dynamics but changes where the PV ends up for a given OUT. A controller with integral action compensates for it.
Noise
A random disturbance added to the PV at every simulation step, expressed in the PV units. It represents process turbulence or disturbances, not measurement noise (this one is in the Instrument). A controller with a high derivative action reacts strongly to it.
Auto Fit
Identifies gain, time constant, delay and offset by least squares from the recorded data. To get a good fit, put the controller in MANUAL, make a step in OUT and wait until the PV settles. It needs at least 30 samples and a PV that moves; otherwise it shows a message. If the data come from the simulator itself it simply reproduces the current values; its real use is to identify a model from measured data. The result is shown with R² and RMSE as a measure of the quality of the fit.
Instrument parameters
The instrument is the transmitter that measures the process. Inside it, the true value goes through: sensor response (tau) → bias → noise → damping → saturation → output signal. The panel shows four live readouts: Gain (100 / span, in % per engineering unit), Measured PV, Signal (0–100 %) and Current (4–20 mA).
| Parameter | Unit | Default | What it does |
|---|---|---|---|
| Range Low / High | EU | 0 / 100 | Calibrated range of the transmitter (LRV / URV) |
| Eng. Unit | – | % | Label of the engineering unit |
| Response Time | s | 0 | Physical lag of the sensor |
| Damping | s | 0 | Filter configured in the transmitter |
| Bias | EU | 0 | Zero error added to the measurement |
| Noise | % span | 0 | Random noise of the measurement |
| Saturation | – | Hard 0–100 % | Behaviour outside the range |
Range Low and Range High (LRV / URV)
The values that correspond to 4 mA and 20 mA. They set the transmitter gain: 100 % divided by the span. A narrower span gives a higher gain, so the same change in the process produces a bigger change in the signal. Range High must be greater than Range Low, or 0..100 is used. The controller shows the signal using its own PV range (Ranges & PID page), so both ranges must match. If they do not, the loop has a gain error (different spans) or a zero error (different low values); the simulator shows a message under the Instrument panel. Use Sync controller to copy the transmitter range and unit to the controller.
Eng. Unit
A text label such as %, °C, bar or m³/h. It does not change the calculation, but it must be the same as the controller PV unit, or a warning is shown.
Response Time
The lag of the sensor itself, for example a thermowell or a thermocouple that takes time to follow the process. It is physical and cannot be changed in a real transmitter. It adds delay to the loop and limits how aggressive the tuning can be.
Damping
A filter configured in the transmitter. It reduces the noise of the signal at the cost of adding lag to the loop. Use the minimum that gives a usable signal. Both response time and damping are first-order lags, but only damping also filters the noise.
Bias
A constant zero error added to the measurement, for example from a bad calibration or a drifting sensor. The controller keeps the measured PV at the setpoint, so the true process value will be off by the bias. This is why calibration matters.
Noise
Random measurement noise, expressed as a percentage of the span. It makes the PV and the signal jitter and, if the controller has derivative action, it will be amplified in OUT. Damping reduces it.
Saturation
- Hard 0–100 %: the output stops at 4 mA and 20 mA (0 % and 100 %). It is the ideal case, but if the process goes out of range, you cannot tell how far it is.
- NAMUR NE43: the output may go from 3.8 mA (−1.25 %) to 20.5 mA (103.125 %), so a PV out of range is still visible. Signals below 3.6 mA or above 21 mA are used in real plants to indicate a transmitter failure.
Sync controller
A button that copies the Range Low, Range High and Eng. Unit to the controller PV, SP and RS scaling. Press it each time you change the transmitter range.
Tuning tips
Method
- Put the loop in MANUAL, let it settle, then switch to AUTO with SP Follows PV ON so the transfer is bumpless.
- Start with the integral and derivative actions minimal (long integral time, derivative off) and a low proportional gain.
- Change the setpoint by a small step (5–10 %) and watch PV and OUT on the Charts page.
- Change one parameter at a time and repeat the same step, so you can compare the responses.
What each action does
- Proportional (Kp): increasing it speeds up the response, but too much gives overshoot and sustained oscillation. If the loop oscillates with constant amplitude, you are at the stability limit: reduce Kp by about half.
- Integral (Ti): removes the remaining offset between PV and SP. A shorter integral time removes it faster but increases overshoot. A very short time makes the loop oscillate slowly.
- Derivative (Td): anticipates the trend and reduces overshoot. It also amplifies noise, so use little or none on noisy or fast loops (flow, pressure).
Symptoms and fixes
| Symptom | Likely cause | What to try |
|---|---|---|
| Fast oscillation around SP | Kp too high | Reduce Kp |
| Slow oscillation, long overshoot | Integral too strong | Increase Ti |
| PV never reaches SP | Integral too weak | Decrease Ti |
| Very slow response, no overshoot | Kp too low | Increase Kp |
| OUT jumps and looks noisy | Derivative with noise | Reduce Td, or add damping in the transmitter |
| Loop gets worse after adding delay or dead band | Tuning too aggressive for the process | Lower Kp and increase Ti |
Rules of thumb
- The more dead time compared with the process time constant, the more cautious the tuning must be: lower Kp and longer Ti.
- Flow and pressure loops are fast and usually need PI with low gain. Temperature loops are slow and may use derivative action.
- Check that OUT is not stuck at a limit icon: a saturated output cannot be fixed by tuning.
- If the ACTION setting is wrong (REVERSE or DIRECT), the loop runs away to a limit instead of oscillating.
- Use the Statistics page to compare a tuning with the baseline instead of judging only by eye.
Exercise
- On the P&ID page, watch the loop with the controller in AUTO.
- On the Keypad page, change the local setpoint and go to the Charts page. The PV should move towards the SP at a speed set by the process time constant and the PID settings.
- On Ranges & PID, change the proportional gain, integral time and derivative time one at a time. Observe overshoot, settling time and oscillation after each SP change.
- On the Parameters page, add stroke time, dead band, lag, delay, noise or bias. Retune the loop to see how each imperfection limits the achievable performance.
- Switch to MANUAL and back to AUTO with SP Follows PV OFF and ON, and compare the bump in OUT.
- On Statistics, set a baseline while the loop works well. Then make it worse and watch the indicators change.