The Programmable logic controller functions in four steps.
Input scan
The state of the input is scanned which is connected externally. The inputs include switches, pushbuttons, and proximity sensors, limit switches, pressure switches.
Ideally, they are transformers and not relays.
Program scan
The loaded program is executed to carry out the function appropriately.
Output scan
The input sources have a control over the output ports to energize or de-energize them.
The outputs include solenoids, valves, motors, actuator, and pumps.
Depending on the model of PLC, these relays can be transistors or any other.