May 28, 2018

Cyclical Program Execution

Cyclical Program Execution 

In a Programmable Logic Controller (PLC), the logic written by the programmer does not run randomly or continuously by itself. Instead, the PLC follows a repetitive, continuous cycle known as the scan cycle or cyclical program execution. This cycle ensures that all input signals are read, processed by the logic, and the appropriate outputs are updated in a predictable and deterministic manner.

This concept is fundamental to understanding how PLCs behave and how control logic executes in real-time industrial systems.




What Is Cyclical Program Execution?

Cyclical program execution refers to the method by which a PLC constantly repeats a sequence of operations. The PLC reads all input values, executes the program, updates output signals, performs system tasks, and then starts again—continuously and cyclically.

This loop happens very fast, usually in milliseconds, ensuring the system responds to changes almost instantly.


The PLC Scan Cycle (Step-by-Step)

A standard PLC scan cycle consists of the following stages:

Step 1: Input Scan (Reading Inputs)

  • The PLC reads the status of all input devices connected to digital or analog input modules.

  • These include:

    • Sensors (proximity, limit switches, photoelectric)

    • Push-buttons (Start/Stop)

    • Analog sensors (temperature, pressure, flow)

  • Input values are stored in a memory area called the Input Image Table (or simply Input Memory).

Key point:
PLC uses the stored input memory during the entire scan, not the real-time input state—inputs are locked in for that cycle.


Step 2: Program Execution (Logic Scan)

  • The PLC executes the user program line-by-line, rung-by-rung.

  • It uses the input values stored during the input scan.

  • Instructions such as:

    • Contacts (XIC, XIO)

    • Coils (OTE)

    • Timers, counters, comparison

    • Mathematical and logical operations

  • The results of the logic execution are stored in the Output Image Table (output memory), not directly written to the physical outputs yet.

Key point:
Outputs during execution are still virtual—they are not actuated until the next stage.

Step 3: Output Scan (Updating Physical Outputs)

  • After executing the logic, the PLC updates the actual physical output modules.

  • Output devices include:

    • Motors

    • Valves

    • Relays

    • Indicators

  • The PLC writes the values from the Output Image Table to the output terminals.

Key point:
Only after this step do real devices respond to logic changes.

Step 4: Housekeeping and Communication Tasks

The PLC performs internal tasks such as:

  • Diagnostics (checking module or CPU faults)

  • Communication with HMI, SCADA, PCs

  • Updating internal clock

  • Memory management

  • Background tasks, interruptions, high-priority operations

After completing these tasks, the PLC returns to Step 1 and repeats the cycle.

Why Cyclical Execution Is Important

✔️ Predictability and Determinism

Industrial systems need predictable timing. The scan cycle ensures consistent system behavior.

✔️ Fast Response

Scan times are typically 1–10 ms, ensuring real-time response.

✔️ Simplified Programming

Engineers can assume that logic executes in a consistent loop.

✔️ Reliable Automation

Input → Logic → Output happens in the same order for every scan, ensuring stable and safe operation.

Example of Cyclical Execution (Motor Control)

Consider a Start push-button (I0.0) and Motor (Q0.0):

  1. Input Scan:
    PLC reads Start = 1 (pressed).

  2. Logic Execution:
    Rung evaluates true → Motor coil (Q0.0) = 1.

  3. Output Scan:
    Motor output physically turns ON.

  4. Housekeeping:
    Communications with HMI updated, etc.

Next scan begins; even if Start is released, the latch holds Q0.0.

Factors Affecting Scan Time

  • Program size (number of rungs, function blocks)

  • Number of instructions (math, PID, communication-heavy)

  • Amount of I/O

  • Communication load (Modbus, EtherNet/IP, HMI, SCADA)

  • CPU performance of the PLC

Scan time can be viewed in diagnostics tools in PLC software such as CCW.

Special Cases: Interrupts & Immediate Instructions

While PLCs normally follow cyclical scanning, some operations break this rule:

Immediate Input/Output Instructions

  • Read/write physical I/O directly, bypassing scan tables.

Interrupt Routines

  • Triggered by events such as:

    • High-speed counters

    • Communication triggers

    • Timed interrupts

  • Run outside the normal cyclic scan.

These ensure high-speed or time-critical operations.

Summary

Cyclical program execution is the core method by which PLCs operate. Each scan cycle includes:

  1. Input Scan – Read inputs

  2. Program Execution – Execute logic

  3. Output Scan – Update outputs

  4. Housekeeping – System tasks

This predictable, repetitive cycle makes PLC-based automation stable, reliable, and responsive.

Types of automation topologies & Components of automation


May 27, 2018

Configuration of SITRANS TH300 in SIMATIC Manager

Description:
SITRANS TH 300 with HART protocol is designed to support all common thermocouples, resistance and milli-volt sensors
Setup is quick and easy with SIMATIC PDM
It works on DC voltage sources


Configuration of SITRANS P300 in SIMATIC Manager


Description:
It is a pressure measuring Instrument which is generally use for Absolute pressure measurement.
It can measure with accuracy ≤ 0.075%
It can work within limit of 1.3 bar pressure.
Silicon oil is used in Fluid filling in case in use of food industry edible oil is used because silicon is hazardous to human health.

 

Explanation:
First of all the mounting of instrument is done as per requirement.
When the pressure is applied in the valve of the instrument pressure is applied on Diaphragm so that it bends and piezoelectric plate is mounted on it.
When the piezoelectric plate bends the resistance is decrease in it so that when electric signal transmit on it difference can be shown on display that is measured pressure.
The readings in different units can be found using this instrument.
We can connect the equipment to the computer using PC/PD coupler and CP5711 via Profibus PA and Profibus PD can be analyzed on Simatic PDM. 

Schematic Diagram:


                                                                           
Configuration Steps:
Connect SITRANS P 300 to PC via Profibus and PC\PD Coupler.
Set the parameters of SITRANS P 300 using Mode button
Open SIMATIC PDM
File > New Project
View > Process Device Network View
Options > Set PG\PC interface [Select CP5711 Profibus 1<active>]
Project > Insert new object > Networks
Networks> Insert new object > Communication network > assign device type <Profibus network>
In profibus network Give the address of instrument i.e. 1-126 any number and assign instrument SITRANS P300
Open device > Open Project <upload \download to PG\PC>
Observe the result in process variable.

Conclusion:
Proper Commissioning of Device leads to accurate pressure measurement.
Position and Place of mounting is should be proper to get accurate output.
For Safety of the plant and workers this instrument is necessary.
We can conclude that by using this instrument we can maintain the pressure by setting higher and lower limit in equipment such as boiler, pressure vessel etc. and proper safety measures can be achieved.

                         
                                                                                                                 By Kartik Pandav

May 19, 2018

Latching Cercuit (Controlling The motor by pressing Start Stop Button)

Latching Circuit for Motor Control – Ladder Logic Application

Objective

To control a motor using momentary Start and Stop pushbuttons. Once the motor is turned ON using the Start button, it should remain energized (latched) even after the Start button is released. The motor should turn OFF only when the Stop button is pressed.

 



Working Principle

  • Start Button (I0.0):
    A normally open (N.O.) push-button. When pressed, it energizes the motor.
  • Latching Logic:
    The motor output coil (Q0.0) is fed back into the same rung to maintain the ON state, creating a memory or latching loop.
  • Stop Button (I0.1):
    A normally closed (N.C.) push-button. When pressed, it breaks the circuit and stops the motor by de-energizing Q0.0.

Ladder Logic Program


 Explanation

  • Rung 1 energizes the motor output Q0.0 when all conditions below are true:
    • The Start button (I0.0) is pressed.
    • The Stop button (I0.1) is NOT pressed (i.e., remains closed).
    • The motor output (Q0.0) is used in a parallel branch to maintain the circuit (latching).
  • The latching branch ensures that once Q0.0 turns ON, it holds the rung logic true even if the Start button is released.
  • Pressing the Stop button opens its normally closed contact, breaking the circuit and turning OFF Q0.0, thereby stopping the motor.

 



 


AND & OR Gate Opertion in Ladder language

AND & OR Gate Operation Using Ladder Logic

🎯 Objective:

Control two lamps using four switches through:

  • AND Gate logic (series connection)
  • OR Gate logic (parallel connection)

📘 Application Description

We have four input switches and two output lamps. Two control scenarios are implemented:

Task 1 – AND Gate Logic (Series Connection)

  • Inputs: SW1 (I0.0), SW2 (I0.1)
  • Output: Lamp 1 (Q0.0)
  • Logic: Lamp 1 turns ON only if both SW1 and SW2 are turned ON.
  • Equivalent to: Q0.0 = I0.0 AND I0.1

Task 2 – OR Gate Logic (Parallel Connection)

  • Inputs: SW3 (I0.2), SW4 (I0.3)
  • Output: Lamp 2 (Q0.1)
  • Logic: Lamp 2 turns ON if either SW3 or SW4 is ON.
  • Equivalent to: Q0.1 = I0.2 OR I0.3

🧠 Input/Output Assignment

Device

Address

SW1

I0.0

SW2

I0.1

SW3

I0.2

SW4

I0.3

Lamp 1

Q0.0

Lamp 2

Q0.1

 

Network 1 :-The first rung connects SW1 and SW2 in series—mimicking an AND gate.
https://plcscadaacademy.blogspot.com/

Network 2 :- The second rung connects SW3 and SW4 in parallel—mimicking an OR gate.
https://plcscadaacademy.blogspot.com/