# PID Loop Simulator: How it works

Description| How it works| Derivative on PV| Process Model| Robustness| PID Tuning| PID EquationsThe calculations required for the simulation are done on Sheet2. Defined Formulae are used in the computation.

The first order process is calculated using a difference equation, given by:

Process Value = b x (Output at time offset by delay time) - a x Last PV; where

a = - exp ( -1 / Process Time Constant) and

b = Process Gain x (1 + a)

(Thanks to Hannu Lehmuskuja for pointing out an error in the documentation on this page.)

The error is calculated by taking the difference between the PV and SP values. The error values are accumulated in column F for the integral term calculation and the derivative term is calculated by taking the difference between the current error and the last error. The PID calculation determines the next output value. The PID calculation is:

Next output = Controller Gain x error + Accumulated error / Integral time + Derivative x (Current error - Previous error)

Note that this app simulates an "academic" version of the PID controller. PID controllers used in industry are different from this version (see the PID Equations page). A tool that simulates PID controllers suitable for use in the industry is available in the store, see Advanced PID Loop Simulator.