You are on page 1of 18

Ajay Kumar Garg Engineering College, Ghaziabad

ISTE-STTC on Industrial Automation and Robotics, Jan 8-12,2007

FLEXIBLE AUTOMATION
LADDER DIAGRAMS FOR PLCS

Ashiv Shah, Sr. Lecturer


Department of Mechanical Engineering,
AKG Engineering College,Ghaziabad

INTRODUCTION :

Ladder Diagram also referred as schematic or elementary diagram used by the engineers to speed
their understanding of how circuit works .Relay control circuits are generally drawn up using so-
called ladder diagrams. Ladder diagrams differ from conventional wiring diagrams in an
important way. Wiring diagrams show the physical arrangement of the various components (i.e.,
switches, relays, solenoids, motors etc.) and their interconnections and are used by electricians to
do the actual wiring of control panel . Ladder diagrams, on the other hand are more schematic
and show each branch of the control circuit on a separate horizontal row. They are meant to
emphasize the function of each branch and the resulting sequence of operations.
The various ladder-diagram elements can be divided into two groups: electrical contacts
and output elements. The contacts include those of push button switches; limit switches, pressure
and temperature switches , or other sensors; and of course, the relay contacts themselves. The
output elements could be any resistive load, such as relay coils, solenoids (usually actuating
pneumatic or hydraulic valves), lamps, motors or any other electrical device to be actuated by the
circuit. The difference between contacts and output elements is basic: contacts have negligible
contact resistance (unless defective), and the circuit made up of these contacts is intended to
implement is to be actuated. Output elements, on the other hand, always have appreciable
electrical resistance. Ladder diagram based PLC programming is become most common PLC
language used with small or medium sized PLCs. They are convenient for programming
sequence tupe circuits with on-off, using contacts of various kinds, timers and counters.
ELEMENTS OF THE LADDER DIAGRAM
The ladder diagram language, like the function block diagram, represents a graphic programming
language. The elements available in a ladder diagram are contacts and coils in different forms.
These are laid out in rungs within the confines of power rails on the left and on the right.

Fig:1 Basic structure of a rung

Fig.1 illustrates the basic structure of a current rung. In this example, the status of the input M
1.5 is directly assigned to output Q3.5. Table 1contains a list of the most important elements of a
ladder diagram.

178
Ajay Kumar Garg Engineering College, Ghaziabad
ISTE-STTC on Industrial Automation and Robotics, Jan 8-12,2007

Table 1 Element of the ladder diagram

• A normally open contact supplies the value 1, when the corresponding push button switch
is closed. A normally closed contact reacts correspondingly with the value 1, when the
switch or push button is opened.
• Two edge contacts supply the value 1 for the transition from 0 to 1 (positive edge) or
from 1 to 0 (negative edge).
• With a normal coil, the result (resulting logic operation of the contacts) is copied to the
specified variable; in the case of a negating coil, the negation of the result is transferred.
• The setting coil assumes the value 1, if the result is 1, and remains unchanged even if the
result is 0 in between. Similarly the resetting coil, only assumes the value 0, if the result
is 1. The 0 status of the coil is maintained.

• The two edge coils are set, if the result changes from 0 to 1 (positive edge) or from 1 to 0
(negative edge.
The basic functions AND and OR may be realized by means of a corresponding configuration of
contacts in the current rung.

179
Ajay Kumar Garg Engineering College, Ghaziabad
ISTE-STTC on Industrial Automation and Robotics, Jan 8-12,2007

Fig:2 Basic logic connection in ladder diagram

The AND function is represented by means of the serial connection of the two contacts (fig.2a).
Output %02.1 is set only if both input %3 and flag %M3.2 are set. In all other cases, output
%02.1 is reset.
The OR function is obtained via parallel switching of contacts (fig. 2b). Output %02.3 assumes
the value 1, if either input %11.5 or flag %M3.4 assume the value 1, or if both conditions are met
simultaneously.

EVALUATION OF CURRENT RUNGS


Processing within a program organisation unit, is from left to right and from top to bottom.
Equally, the processing sequence may also be changed in LD by using elements for execution
control.

Fig3: Conditional jump in LCD

180
Ajay Kumar Garg Engineering College, Ghaziabad
ISTE-STTC on Industrial Automation and Robotics, Jan 8-12,2007

If the jump condition, in this case the AND operation of input %I1.1 and flag %M2.5, is met, a
jump is executed to the current rung with the identifier Variant_1. Processing is then continued
from this current rung onwards.

FUNCTIONS AND FUNCTION BLOCKS


• Apart from the contact and coil elements, LD provides the unlimited use of functions and
function blocks in so far as this feature is supported by the controller used.

Prerequisite for the incorporation of so-called organization units is the availability of at least one
Boolean input and one Boolean output of the block in question. If this is not the case, a Boolean
input with the formal parameter EN (enable) is added to the corresponding functions or function
modules as well as a Boolean output ENO (enable OK). The Boolean inputs/outputs are required
to permit the power flow through the block.

Fig: 4 Functions and function blocks in ladder diagram

The addition shown in fig. 4(a) is only undertaken, if a 1-signal is applied at the input EN. If this
is the case, the variables Quantity_1 and Quantity_2 are added and the result of these variables
assigned to the variable Filling Level. At the same time, the value of output ENO indicates,
whether the addition has been executed, activated and correct (ENO=1). If the block has not been
processed correctly, the output ENC assumes the value O.

181
Ajay Kumar Garg Engineering College, Ghaziabad
ISTE-STTC on Industrial Automation and Robotics, Jan 8-12,2007

Function modules such as for instance the signal delay shown in fig. 4 (b) can be incorporated in
the ladder diagram without additional EN input and ENO output. The function block is
connected with the elements of the current rung in the usual manner via the Boolean input input
IN the boolean output Q. If input %11.3 in fig. 4 (b) assumes the value 1 the function block copy
T _Startup is processed with the preset time duration of 7 seconds. The value of output Q of T
_Startup is assigned to output %Q2.4.
In Siemens S – 7 200 PLC, apart from various other functions & function blocks following
important functions & blocks are addressed:
• Timer
• Counter

UNDERSTANDING THE S7-200 TIMER INSTRUCTIONS

You can use timers to implement time-based counting functions. The S7-200 instruction set
provides three different types of timers.

· On-Delay Timer (TON) for timing a single interval

· Retentive On-Delay Timer (TONR) for accumulating a number of timed intervals

· Off-Delay Timer (TOF) for extending time past an off (or false condition),such as for
cooling a motor after it is turned off.

(1) The retentive timer current value can be selected for retention through a power cycle. See
Retentive Ranges Tab - System Block Configuration for information about memory retention for
the S7–200 CPU.

Notes:

The Reset (R) instruction can be used to reset any timer. The Reset instruction performs the
following operations:

Timer Bit = OFF and Timer Current = 0

182
Ajay Kumar Garg Engineering College, Ghaziabad
ISTE-STTC on Industrial Automation and Robotics, Jan 8-12,2007

The TONR timer can only be reset by the Reset instruction.

After a reset, TOF timers require the enabling in put to make the transition from ON to OFF in
order to restart.

1-Millisecond Resolution

The 1-ms timers count the number of 1-ms timer intervals that have elapsed since the active 1-ms
timer was enabled. The execution of the timer instruction starts the timing; however, the 1-ms
timers are updated (timer bit and timer current) every millisecond asynchronous to the scan
cycle. In other words, the timer bit and timer current are updated multiple times throughout any
scan that is greater than 1 ms.
The timer instruction is used to turn the timer on, reset the timer, or, in the case of the TONR
timer, to turn the timer off.
Since the timer can be started anywhere within a millisecond, the preset must be set to one time
interval greater than the minimum desired timer interval. For example, to guarantee a timed
interval of at least 56 ms using a 1-ms timer, the preset time value should be set to 57.

10–Millisecond Resolution

The 10-ms timers count the number of 10-ms timer intervals that have elapsed since the active
10-ms timer was enabled. The execution of the timer instruction starts the timing; however the
10-ms timers are updated at the beginning of each scan cycle (in other words, the timer current
and timer bit remain constant throughout the scan), by adding the accumulated number of 10-ms
intervals (since the beginning of the previous scan) to the current value for the active timer.

Since the timer can be started anywhere within a 10-ms interval, the preset must be set to one
time interval greater than the minimum desired timer interval. For example, to guarantee a timed
interval of at least 140 ms using a 10-ms timer, the preset time value should be set to 15.

100–Millisecond Resolution

The 100-ms timers count the number of 100-ms timer intervals that have elapsed since the active
100-ms timer was last updated. These timers are updated by adding the accumulated number of
100-ms intervals (since the previous scan cycle) to the timer’s current value when the timer
instruction is executed.

The current value of a 100-ms timer is updated only if the timer instruction is executed.
Consequently, if a 100-ms timer is enabled but the timer instruction is not executed each scan
cycle, the current value for that timer is not updated and it loses time. Likewise, if the same 100-
ms timer instruction is executed multiple times in a single scan cycle, the number of 100-ms
intervals are added to the timer’s current value multiple times, and it gains time. 100-ms timers
should only be used where the timer instruction is executed exactly once per scan cycle.

Since the timer can be started anywhere within a 100-ms interval, the preset must be set to one
time interval greater than the minimum desired timer interval. For example, to guarantee a timed
interval of at least 2100 ms using a 100-ms timer, the preset time value should be set to 22.

183
Ajay Kumar Garg Engineering College, Ghaziabad
ISTE-STTC on Industrial Automation and Robotics, Jan 8-12,2007

UPDATING THE TIMER CURRENT VALUE

The effect of the various ways in which current time values are updated depends upon how the
timers are used. For example, consider the timer operation shown in the diagram below.

In the case where the 1–ms timer is used, Q0.0 is turned on for one scan whenever the timer’s
current value is updated after the normally closed contact T32 is executed and before the
normally open contact T32 is executed.

In the case where the 10–ms timer is used, Q0.0 is never turned on, because the timer bit T33 is
turned on from the top of the scan to the point where the timer box is executed. Once the timer
box has been executed, the timer’s current value and its T–bit is set to zero. When the normally
open contact T33 is executed, T33 is off and Q0.0 is turned off.

In the case where the 100–ms timer is used, Q0.0 is always turned on for one scan whenever the
timer’s current value reaches the preset value.

By using the normally closed contact Q0.0 instead of the timer bit as the enabling input to the
timer box, the output Q0.0 is guaranteed to be turned on for one scan each time the timer reaches
the preset value.

184
Ajay Kumar Garg Engineering College, Ghaziabad
ISTE-STTC on Industrial Automation and Robotics, Jan 8-12,2007

185
Ajay Kumar Garg Engineering College, Ghaziabad
ISTE-STTC on Industrial Automation and Robotics, Jan 8-12,2007

186
Ajay Kumar Garg Engineering College, Ghaziabad
ISTE-STTC on Industrial Automation and Robotics, Jan 8-12,2007

UNDERSTANDING THE S7-200 COUNTER INSTRUCTIONS

The Up Counter (CTU) counts up from the current value of that counter each time the count-up
input makes the transition from off to on. The counter is reset when the reset input turns on, or
when the Reset instruction is executed. The counter stops upon reaching the maximum value
(32,767).

The Up/Down Counter (CTUD) counts up each time the count-up input makes the transition
from off to on, and counts down each time the count-down input makes the transition from off to
on. The counter is reset when the reset input turns on, or when the Reset instruction is executed.
Upon reaching maximum value (32,767), the next rising edge at the count-up input causes the
current count to wrap around to the minimum value (-32,768). Likewise on reaching the
minimum value (-32,768), the next rising edge at the count-down input causes the current count
to wrap around to the maximum value (32,767).

The Up and Up/Down counters have a current value that maintains the current count. They also
have a preset value (PV) that is compared to the current value whenever the counter instruction is
executed. When the current value is greater than or equal to the preset value, the counter bit (C-
bit) turns on. Otherwise, the C-bit turns off.

187
Ajay Kumar Garg Engineering College, Ghaziabad
ISTE-STTC on Industrial Automation and Robotics, Jan 8-12,2007

The Down Counter (CTD) counts down from the current value of that counter each time the
count-down input makes the transition from off to on. The counter resets the counter bit and
loads the current value with the preset value when the load input turns on. The counter stops
upon reaching zero, and the counter bit (C-bit) turns on.

When you reset a counter using the Reset instruction, the counter bit is reset and the counter
current value is set to zero. Use the counter number to reference both the current value and the
C-bit of that counter.

Note:

Because there is one current value for each counter, do not assign the same counter number to
more than one counter. (Up Counters, Up/Down Counters, and Down Counters with the same
number access the same current value.)

188
Ajay Kumar Garg Engineering College, Ghaziabad
ISTE-STTC on Industrial Automation and Robotics, Jan 8-12,2007

189
Ajay Kumar Garg Engineering College, Ghaziabad
ISTE-STTC on Industrial Automation and Robotics, Jan 8-12,2007

HOW THE CONTROL PROGRAM WORKS

The S7-200 continuously cycles through the control logic in the program, reading and writing
data. When you download a program is downloaded to the PLC and place the PLC in RUN
mode, the central processing unit (CPU) of the PLC executes the program in the following
sequence:

• The S7-200 reads the status of the inputs.

• The program stored in the S7-200 uses these inputs to evaluate (or execute) the control
logic.

• As the program is evaluated, the S7-200 stores the results of the program logic in the
output memory area known as the process-image output register.

• At the end of the program, the S7-200 writes the data from the process-image output
register to the field outputs.

• The cycle of tasks is repeated.

The following illustration shows a simple diagram of how an electrical relay diagram relates to
the S7-200. In this example, the state of the switch for starting the motor is combined with the
states of other inputs. The calculations of these states then determines the state for the output that
goes to the actuator which starts the motor.

The S7-200 executes a series of tasks repetitively. This cyclical execution of tasks is called the
scan cycle. As shown below, the S7-200 performs most or all of the following tasks during a
scan cycle:

190
Ajay Kumar Garg Engineering College, Ghaziabad
ISTE-STTC on Industrial Automation and Robotics, Jan 8-12,2007

Reading the inputs: The S7-200 copies the state of the physical inputs to the process-image input
register.

• Executing the control logic in the program: The S7-200 executes the instructions of the
program and stores the values in the various memory areas.
• Processing any communication requests: The S7-200 performs any tasks required for
point-to-point or network communications.
• Executing the CPU self-test diagnostics: The S7-200 ensures that the firmware, the
program memory, and any expansion modules are working properly.
• Writing to the outputs: The values stored in the process-image output register are written
to the physical outputs.

Note:

The execution of the scan cycle is dependent upon whether the S7-200 is in STOP mode or in
RUN mode. In RUN mode, your program is executed; in STOP mode, your program is not
executed.

191
Ajay Kumar Garg Engineering College, Ghaziabad
ISTE-STTC on Industrial Automation and Robotics, Jan 8-12,2007

EXAMPLE-1: Ladder Logic programme For “LATCHING ”

EXAMPLE-2: Ladder Logic Programme For “LATCHING COUNTDOWN”

192
Ajay Kumar Garg Engineering College, Ghaziabad
ISTE-STTC on Industrial Automation and Robotics, Jan 8-12,2007

EXAMPLE-3: Ladder Logic programme FOR “COUNTER”

EXAMPLE-4: Ladder Logic programme For “TIMER EXAMPLE”

193
Ajay Kumar Garg Engineering College, Ghaziabad
ISTE-STTC on Industrial Automation and Robotics, Jan 8-12,2007

EXAMPLE-5: Ladder Logic programme For “CONVERYOR MOVE”

EXAMPLE-6: Ladder Logic Programme For “CONVEYOR ON & OFF”

194
Ajay Kumar Garg Engineering College, Ghaziabad
ISTE-STTC on Industrial Automation and Robotics, Jan 8-12,2007

EXAMPLE-7: Ladder Logic programme For “HORIZONTAL TRANSFER SYSTEM”

195

You might also like