PLC Operation

Bama Industrial Automation PLC Operation
plc operation

Programmable Logic Controllers (PLCs) are the backbone of industrial automation, but their true power lies in their versatility and scalability. Here we explore, in detail, how PLCs work, what the operating cycle is, and their different modes.

PLC Operating Cycle

The operation of a PLC is based on a continuous and very fast cycle known as a scan cycle.

The scan cycle of a PLC represents the complete sequence of steps that the controller performs during the execution of its program. This process ranges from reading inputs to updating outputs. It is called a “cycle” because the program execution is repetitive, and “scan” because of the constant review the PLC carries out on the status of inputs, outputs, and intermediate variables. This continuous flow ensures that the system responds in real time to any change in the process and consists of the following stages:

1. Reading inputs

The PLC collects data from devices such as sensors, buttons, or meters. This data informs the system about the status of the process in real time.

  • Example: A proximity sensor detects if an object is on a conveyor belt.

2. Program processing

The CPU executes the program loaded into its memory, processing the input data according to predefined instructions.

  • Example: If the object is present, the program activates a robotic arm to move it.

3. Updating outputs

After processing the data, the PLC sends signals to actuators, such as motors or valves, to execute the necessary actions.

  • Example: The robotic arm moves the object to a different position.

4. Diagnostics and internal tasks

The PLC monitors its own status, checking for errors or faults in the system. If something is wrong, it generates alerts or activates safety mechanisms.

plc operation

PLC scan time: what is it and why is it so important?

The scan cycle time of a PLC refers to the time it takes for the controller to complete a full cycle of its operation: reading inputs, processing the user program, and updating outputs. Simply put, it is the time required for the PLC to perform one complete iteration of its work cycle.

This time is measured in milliseconds (ms), and an acceptable average value is usually between 20 and 40 ms. Ideally, a scan cycle of less than 20 ms is optimal, and if you achieve less than 10 ms, we can speak of an extremely efficient system.

When should you worry about scan time?

If your scan cycle exceeds 70 ms, you should start to worry. And if it reaches or exceeds 100 ms, it is a clear sign that the PLC program is poorly designed. This may be due to unnecessary loops or the constant reading of an excessive number of variables, which unnecessarily slows down the system. While an occasional peak might be acceptable, maintaining a high average scan time indicates that the program needs an urgent review.

PLC Operating Modes

A PLC operates in different modes that determine how it interacts with the user program and the system to which it is connected. These modes are essential to ensure that the controller functions correctly at each stage of an industrial process. The four generic modes are:

  1. RUN (Execution):
    In this mode, the PLC executes the user program continuously. All stages of the scan cycle are completed here: reading inputs, processing the program, and updating outputs. It is the standard operating mode when the system is in production.
  2. STOP (Stop):
    The PLC stops the execution of the user program and, instead, carries out its internal routines. This mode allows the user to monitor and program the PLC without affecting the physical outputs.
  3. ERROR (Fault):
    If the PLC detects a critical error in the hardware or the user program, it stops execution and deactivates the outputs. This mode is designed to prevent system damage and ensure safety. The controller remains in this state until the problem is resolved.
  4. POWER-ON (Startup):
    This mode is activated when the PLC receives power. During this phase, it performs a self-diagnosis to check hardware integrity, connection status, and memory. After completion, the PLC automatically transitions to RUN, STOP, or ERROR mode, depending on the detected conditions.

Variants by Manufacturer

Each manufacturer may offer slight differences in operating modes. For example:

  • OMRON: Includes modes such as Program (standby to send or receive the program) and Monitor (program execution with the option to monitor variables).
  • Allen-Bradley: Adds REM mode, which allows switching between other modes remotely.

These modes ensure that the PLC can adapt to different operational situations, from adjustments and testing to full program execution in a production environment.

We hope you found this article of interest.

If you need any additional information on how PLCs work, please do not hesitate to contact us.