The PID controller has several important functions:it provides feeback ;it has the ability to eliminate steady state offsets through integral action;it can anticipate the future through derivative action.
Proportional Action:
P=K*(b*sp-y) K is proportional gain
b is setpoint weighting
sp is setpoint or desired value
y is process variable
Integral Action:
I(n+1)=I(n)+K*h*e(n+1)/Ti
h is sample time
Ti is integral time
e is deviation equals sp minus y
Derivative Action:
D(n)=Td*D(n-1)/(Td+N*h)-K*Td*N(y(n)-y(n-1))/(Td+N*h)
Td is derivation time
N is derivaton gain
The three equaton are the PID digital implementation used in many computer controllers.For more information,you can refer to document writtern by Astrom.