The time taken by PLC to read the input, execute the program, and output the logic is called PLC scan time.
Programmable Logic Controller which we commonly call PLC is widely used in every industry. Every computer system takes time to execute the program. The PLC has three main sections-input modules, CPU, and output module. It reads data of the input module, processes data as per logic in its CPU, and outputs the signal to final control elements like control valves, motor control feeders, etc. The total time taken by the PLC to do all these jobs is termed as PLC scan time.
We can better understand the PLC scan time by learning the PLC scan cycle.
What is PLC Scan Cycle?
Every PLC has a scan cycle. The Scan cycle of a PLC is the cycle in which PLC gathers the input information from various inputs, runs the PLC program for received inputs, and then updates the outputs as per programming. This scan cycle of a PLC is continuously running.
One scan cycle after another scan cycle keeps on running until there is an interruption from a human or any failure in the PLC. The scan cycle is divided into 3 main parts. Input Scan, Program Scan, and Output Scan.
One other scan called internal scan is there in PLC’s scan cycle.
- Input Scan: In this step of the scan, the PLC scans all the inputs connected to its input cards. The PLC then updates its memory registers with the input from the input cards like Analog Input and Digital Input. Devices like transmitters, proxy switches, vibration systems, etc. are used as input devices for input cards.
- Program Scan: In program scan, the updated values in memory registers are evaluated in the program written in the PLC controller. The controller runs the whole program after updating all the inputs received from input cards.
- Output Scan: In the output scan, the outputs generated by the program scan are updated. The commands are given through the analog output cards as well as digital output cards. These cards drive various devices like control valves, solenoid valves, motors, and many more types of equipment.
- Internal Scan: The internal scan is a very important scan for the proper functioning of the PLC. In this step, the controller does internal checking that includes controller redundancy, memory flushing, and card healthiness. This step keeps watching on the PLC’s condition and healthiness.
Generally, the PLC takes a few milliseconds (20 milliseconds) to a few hundred milliseconds (100 milliseconds – 500 milliseconds) for completing this whole scan cycle. This time is termed the PLC Scan Time. The scan time depends on the type of PLC i.e. Safety PLC or Process Control PLC. Safety PLC has fast scan cycles. Hence the scan time for the safety PLC is very less (20 milliseconds). Process Control PLC has a bit of slow scan cycles. Therefore, the scan time for the Process Control PLC is a bit high (a few hundred milliseconds).
There are various types of Scan Time
Types of Scan Time
Let us see some types of scan times widely used in PLC.
1. Cyclic Time
A cyclic time is always assigned a fixed interval time. Every PLC has defined functions to be done. The PLC will internally divide the maximum allotted time for each of the functions discussed. This means that the PLC will complete all the defined functions in the time provided for the cyclic time. The Cyclic Time is a periodic type of timer.
2. Freewheeling Time
The PLC executes some functions after the completion of other tasks only. This is totally dependent on other tasks’ completion. This time is termed freewheeling time. As this is dependent on other functions for completion, this time is conditional in nature.
3. Event Task
An event task is a task that is executed on the trigger of any event. This event is hence dependent on other events. The event tasks are always executed in a single scan. The event gets triggered after a certain event only; hence this is conditional in nature.
4. External Event Task
The external event task is executed when the PLC receives any configured input from an external device or system. Thus this task is only executed when the PLC receives an input trigger from any external device or system. The trigger can be a digital trigger like a trip signal from any external system. This external event task is also a type of conditional in nature.
Important Points Related to Scan Time
1. Selection of Scan Time
The scan time is defined by the software for any written program in PLC logic. We already discussed two major types of scan time. One is for safety PLCs and the other is for process control PLCs. The safety PLCs are a critical asset of any plant.
Hence scan time of these PLCs is very low and the scan cycle is very fast. For process control PLCs the scan cycle is a bit slow because of many Inputs and Outputs also. The program is also a bit lengthy for process control PLCs. This is the reason the cost of these PLCs is a bit low as compared to the safety PLCs.
Watchdog as its name suggests keeps watching something. Here something is about the PLCs’ working conditions. Basically, the watchdog timer is used to detect any faults in PLC. The working of a watchdog timer is very simple. At some defined interval, the watchdog timer resets using the program.
If the watchdog timer does not get reset in a defined period then the watchdog timer will generate a bit. This bit can be used as an alarm. When the watchdog generated this bit, it means that there is some issue in the program or the PLC hardware.
Suppose the scan cycle of the PLC is having a time of 200 milliseconds. The time of watchdog can be set as 800 milliseconds or 1000 milliseconds. For 4 cycles or 5 cycles respectively, if the program does not reset this watchdog, then the bit will be activated.
PLC scans the program from left to right and top to bottom in a single section. This cycle repeats itself. In between this cycle if any function is called out, then the program goes to that function for further execution. Depending on the function type, the program ends there only and starts the scan cycle again or returns to the program line where the function call was generated.