programmable controllers theory and implementation