Programmable Logic Controller work

how does a programmable logic controller work