PLCs are industrial control computers that operate on the same principles as computers. They are finished by running user programs that reflect the control needs.
Basic PLC working principle
PLC has a microprocessor as its central processing unit and shares many attributes with microcomputers, but it operates fundamentally differently from them.
Most of the time, microcomputers operate in a waiting mode.
Centralized input, output, and periodic cyclic scanning are how the PLC operates. Each cycle of a cyclic scan lasts for a certain amount of time.
The CPU runs each program from the first instruction and then sequentially executes each instruction to periodically search for program loops. The user program is run sequentially from the first instruction to the last if there is no jump instruction. Continue by going back to the first instruction.
The PLC must perform internal processing, input sampling, communication services, program execution, self-diagnosis, and output refresh in addition to running the user program at each scan.
Three components make up the whole PLC work process: power-on processing, scanning procedure, and error management. The operation block diagram displayed may serve as a representation of the whole PLC working process.
After turning on the PLC, the CPU initially carries out internal processing under the direction of the system software, such as hardware initialization, I/O module configuration verification, power failure retention range setting, and other startup processing.
The PLC’s self-diagnosis capability is robust. Every time the PLC does a self-diagnosis check to see if its own actions—such as power supply detection, if the internal hardware is normal, and whether the programme syntax is incorrect—are normal.
If an anomaly is found, the CPU panel’s LED and abnormal relay will turn on, and a specific register will be updated with an error code.
To prevent the PLC from scanning or forcing, the CPU can send a signal based on the kind and severity of the fault and even carry out the necessary error processing. The STOP state is now reached.
PLC Scanning Cycle
Input sampling, program execution, and output refresh are the three processes that make up the PLC program execution process.
Input sampling stage
At this point, the PLC scans all input terminal signals to receive the input signals and then saves each input state in the associated input image register.
The input image register is now cleared. The input picture memory is shut off from the outside world throughout program execution and the output refresh phase. Until the re-read input signal refreshes the input scan phase of the subsequent scan cycle, the content of the input image memory is unaltered.
As can be seen, the PLC utilizes the data supplied into the picture region during this sampling rather than the input signal at the time of the scene when it runs the program and analyses the data.
Generally speaking, the input signal’s width should be larger than one scan period to prevent signal loss.
The program execution stage
The phase of running the application. The PLC scans in accordance with the ladder programme scanning concept while the user programme is running.
In general, the PLC runs each programme one at a time, from top to bottom and left to right. The program jump address is instead chosen based on whether the jump condition is met when a program jump command is encountered.
The PLC will “read in” the corresponding input terminal state from the input image register and “read in” the current state of the corresponding component (“soft relay”) from the output image register during the execution of the program when the input and output states are involved in the instruction.
The relevant operation is then carried out, and the outcome is once more saved in the output image register. Each component (“soft relay”) in the output image register has a state that varies while the program is run.
The output refresh stage
The output picture region stores the operation results of the program’s execution phase rather than sending them to the output port.
The output variables from the output image region are sent by the PLC to the output latch during the output refresh stage, and the latch then creates the control output for this cycle through the output module.
The output relay contact closes and the external load is fed through the output terminal if the internal output relay’s state is “1.” All output devices should remain in their current states for one scan cycle.
Input / output lag problem:
The PLC output requires some time to respond to an input change when the input signal of the PLC input changes. The PLC input / output reaction lag is the name given to this phenomenon.
The research above shows that the program’s duration is the key determinant of the scan cycle’s length. The reaction time slows down as the scan time increases. The PLC only updates the input and output status registers once per scan cycle, which results in input and output delays and slower response times since I/O refresh is only performed once per scan cycle.