Tuning a Direct-Acting PID Loop with the PID Direct Loop Simulator
Contents
- Direct and reverse action
- The P&ID of this loop
- Using the simulator
- How the simulator is organised
- The faceplate
- Settings panel (left)
- Chart box (right)
- Control Valve parameters
- Plant parameters
- Instrument parameters
- Tuning tips
- What happens with the wrong action
- Exercise
Type: Tutorial Audience: Engineering students and trainees Goal: Understand why some loops need a direct-acting controller, see it in a P&ID and check it in a closed loop.
Direct and reverse action
The action of a controller defines how its output reacts to a change in PV:
- Reverse action: when PV rises, OUT falls. The error is E = SP − PV. It is the usual choice when more OUT gives more PV (for example, heating or an inlet valve).
- Direct action: when PV rises, OUT rises. The error is E = PV − SP. It is needed when more OUT gives less PV (for example, cooling or an outlet valve).
The right action does not depend on the controller alone: it comes from the sign of the whole loop (valve action × process gain). If the sign is wrong, the loop is unstable and runs away to a limit.
The P&ID of this loop
The diagram on the first chart page shows the level loop LIC-101:
- HV-101 is a manual valve on the inlet. It keeps the inlet flow fixed.
- LV-101 is the control valve on the outlet of tank T-101. It is fail closed (FC): more OUT means a more open valve.
- LT-101 measures the level and sends PV to LIC-101, in the control room (DCS).
- LIC-101 sends OUT back to LV-101. The label DIRECT shows the controller action.
If the level rises above SP, the controller must open LV-101 to drain the tank. That is, PV up → OUT up: direct action.
Using the simulator
The simulator is the same as in the PID Reverse Loop Simulator. The sections below describe each part. The differences are:
- The ACTION selector (Ranges & PID page) starts in DIRECT.
- The plant is an integrating tank with a negative gain (−1): above OUT = 50 % the level falls at a constant rate and below it the level rises, up to 100 %. With the outlet valve almost closed, the tank fills in about 10 s.
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). This simulator starts in Direct, because the outlet valve lowers the level when it opens.
- 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 Integrating (tank level) model, because a tank behaves as an integrator: the level changes at a constant rate (a ramp) until the tank is empty or full.
tau · dPV/dt = gain · OUT(t − delay) + offset
The PV is limited to 0–100 %. The level holds only when gain × OUT + offset = 0: here, level = 50 % at OUT = 50 %; below 50 % the level rises, above it falls. The rate of change is (gain × OUT + offset) / tau, so the maximum ramp is about 5 %/s. OUT here is the valve flow in %. The Model selector also offers First Order Delay Time (FOPDT), which tends exponentially to PV = gain × OUT + offset; 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 | Rate of change of PV per 1 % of OUT (sign sets the direction) |
| Time Constant | s | 10.0 | Integration time: the larger it is, the slower the ramp |
| Delay | s | 0.0 | Dead time before the process reacts |
| Offset | – | 50.0 | Sets the OUT at which the level holds |
| 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. In this simulator the gain is negative (−1.25): the more the outlet valve opens, the lower the level, so the controller needs Direct 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.
What happens with the wrong action
- Go to Ranges & PID and set ACTION to REVERSE.
- Put the controller in AUTO and change the setpoint, or wait for a small disturbance.
- Watch the Charts page: PV moves away from SP and OUT goes to a limit. The limit icon on the faceplate lights up.
- Set ACTION back to DIRECT. The loop recovers.
Exercise
- On the P&ID page, follow the signals: PV, OUT and the valve position.
- Raise the setpoint in AUTO. Explain why OUT goes down first, and why the level then rises.
- Change Fail Position of the valve to open (Valve parameters). Now the sign of the loop changes. Which action does the controller need?
- Change the plant gain to +1 with an offset of 0. Which action is required now?
- Tune Kp, Ti and Td as in the reverse-action tutorial and compare the responses.
Key Concepts: Direct and Reverse Action
Controller Action
The action of a controller sets the sign of the error. In reverse action, E = SP − PV: when the PV rises, the output falls. In direct action, E = PV − SP: when the PV rises, the output rises.
Loop Sign
The action required depends on the sign of the loop: the valve action (air-to-open or air-to-close) times the process gain. A valve on the outlet of a tank gives a negative process gain, because more opening means less level. With a fail-closed (air-to-open) valve this needs direct action.
Fail Position
The fail position of the valve is selected for plant safety, not for the controller. If the fail position changes, the loop sign may change, and the controller action must be reviewed.
Wrong Action
If the action is wrong, the feedback becomes positive. The output moves in the direction that increases the error and the loop saturates at one of the limits. This is a typical commissioning mistake.
PID Controller
A PID controller computes its output from the error between the setpoint (SP) and the process variable (PV) using three actions: proportional (reacts to the present error), integral (removes the steady-state offset) and derivative (anticipates the trend of the error).
Control Valve
The control valve is the final control element. Its characteristic (linear, equal percentage, quick opening), stroke time, deadband and fail position determine how the controller output becomes process flow.
Process (Plant)
The process is described here by its gain, time constant, dead time, offset and noise. Dead time relative to the time constant is the main factor that limits how aggressively a loop can be tuned.
Transmitter (Instrument)
The transmitter converts the PV into a standard signal over its calibrated range (LRV to URV). Its lag, bias and noise add to the loop dynamics and must be consistent with the controller scaling.
Closed Loop
In a closed loop, the controller output changes the process, and the measurement returns to the controller. Every element in the loop contributes gain and delay, so tuning must consider the whole chain.
Model limitations
The process, valve and transmitter models are simplified for training. Field tuning requires the dynamics and operating limits of the actual process.
Frequently Asked Questions
How do I know if a loop needs direct or reverse action?
Ask what happens to the PV when OUT increases. If the PV rises, use reverse action. If the PV falls, use direct action. Take the valve action into account (air-to-open or air-to-close).
Why does the level loop in this simulator use direct action?
The control valve is on the outlet of the tank. Opening it lowers the level, so the process gain is negative. To correct a high level the controller must increase OUT: direct action.
Does a cooling loop always need direct action?
In most cases, yes: more OUT means more cooling and less temperature. Check it against the valve action, because an air-to-close valve inverts the loop sign.
Can I use the simulator values for a real plant?
No. The simulator is a simplified training tool. Real tuning must be based on the dynamics of the actual process and on the plant safety procedures.
Why does the PV oscillate when I increase the proportional gain?
A higher gain amplifies the loop response. When the total delay of the valve, process and transmitter is significant, a high gain makes the loop reach the stability limit and the PV oscillates around the SP. Reduce the gain or increase the integral time.
What does the Sync controller button do?
It copies the transmitter range (LRV, URV and unit) to the controller PV, SP and RS scaling so the controller works in the same engineering units as the measurement.
Why is there a permanent offset between PV and SP?
A proportional-only controller leaves an offset. Adding integral action removes it, provided the valve is not saturated or limited by deadband.