Programmable logic controller
A programmable logic controller or PLC is an electronic appliance designed to replace a bulky cabinet full of relay logic.
It consists of a small computer running a program. The program reads the inputs of the logic controller, calculates a custom logic function, and then produces the outputs.
Unlike general purpose computers, PLCs are designed to be used by electricians who train on the job. They are usually programmed in a language called "ladder logic", which strongly resenbles a blueprint of relay logic.
In ladder logic, a "coil" can open or close any number of "contacts." A PLC enerall number the contacts and coils. The PLC almost always accepts contact closures as inputs, and provides some set of switches as output.
PLCs usually read, calculate and respond in a hundredth of a second or so, which is too slow for some tasks.
PLCs often also include logic for single-variable generic industrial feedback loop, a "proportional, integral, derviative" loop, or "PID loop." A PID loop is the standard solution to many industrial control processes that require proportional control. The basic idea is that the controller reads a sensor. Then it subtracts the read value from a "setpoint" to determine an "error".
The error is then treated in three different ways:
To handle the present, the error is multiplied by a proportion, the "P" of the pid loop.
To handle the past, the error is averaged over a period of time, where that time is the "I" of teh PID loop.
To handle the future, the rate of change of the variable is multipled by another constant.
All these are added to the last output of the PID loop.
To tune a PID loop, first set the I and D values to zero. Increase the P until the output of the loop oscillates. Then increase I until oscillation stops. FInally, adjust D until the loop is acceptably quick to reach its setpoint.