PLC principle and application