Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
659 views

Ladder Logic Diagram Examples - 3

The document provides examples and explanations of ladder logic diagrams: 1. It explains how to draw a ladder logic diagram to turn on an output light based on the states of three inputs, using series contacts. 2. It shows how to draw an equivalent ladder logic diagram for a given digital logic diagram, using both series and parallel contacts. 3. It discusses best practices for ladder logic programming, such as considering the output first, avoiding repeated outputs, and ensuring power only flows left to right.

Uploaded by

BILLY
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
659 views

Ladder Logic Diagram Examples - 3

The document provides examples and explanations of ladder logic diagrams: 1. It explains how to draw a ladder logic diagram to turn on an output light based on the states of three inputs, using series contacts. 2. It shows how to draw an equivalent ladder logic diagram for a given digital logic diagram, using both series and parallel contacts. 3. It discusses best practices for ladder logic programming, such as considering the output first, avoiding repeated outputs, and ensuring power only flows left to right.

Uploaded by

BILLY
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Ladder Logic Diagram Examples

1. Draw a ladder diagram that will cause the output, pilot light PL2, to be ON when
selector switch SS2 is closed, push-button PB4 is closed and limit switch LS3 is open.
(Note: no I/O addresses yet.)
Solution
The first question to answer is “What is the output?” The output is PL2, so the coil labeled as
PL2 is put on the right side of the rung. Secondly, consider the type of connection of contacts
to use. Since all three switches must be in a certain position to turn on the pilot light, a series
connection is needed. Thirdly, the type of contact is determined by the switch position to turn
on the pilot light:

Putting all the pieces together, only one rung of ladder logic is needed as shown below.

Design Tip
The concept of placing the output on the rung first and then “looking back” to determine the
input conditions is very important. Because of the way the diagram is configured, one has a
tendency to consider the input conditions first and then position the output coil as the last step.
As will be shown later, the coil or negated coil instruction referring to a particular output must
only occur once in a ladder program. Considering the output coil first and the conditions for
which it is active (on) will avoid repeating coils.
2. Draw a ladder diagram that is equivalent to the digital logic diagram in the figure below:

Page 1 of 5
Solution
The Boolean logic equation is given by:
𝑌 = 𝐴𝐵𝐶̅ + 𝐷 + 𝐸̅
In words:
Y is ON when (A is ON and B is ON and C is OFF) or D is ON or E is OFF.
First, find out the output. The output is Y, so the coil labeled as Y is put on the right side of the
rung. Secondly, consider the type of connection of contacts to use.
For this problem, there is more than one type of connection. The three inputs within the
parentheses (the AND gate in the figure) are connected with “and,” so a series connection is
required for these three contacts. The other two inputs (D and E) are connected with the three
series contacts by “or” (the OR gate inputs), so a parallel connection is required.
Thirdly, the type of contact is determined by the input state that turns ON the output, Y:

Putting all the parts together, only one rung of ladder logic is needed, as shown in the figure
below.

Suppose one changes the D contact in the above ladder diagram to refer to Y, the output as
shown below.

Is this legitimate?

Page 2 of 5
Yes, it is legitimate, though probably not something one would want to do for this example.
This concept is called sealing or latching an output without using the set (or latch) coil
instruction. In this example, it is not a good idea because once Y is sealed ON, there is no
provision to turn it OFF.
Why?
There are some precautions to observe when programming in ladder logic:
1. DO NOT repeat normal output coils or negated coils that refer to the same tag. To
illustrate what happens when this is done, consider the ladder logic diagram in the figure
below.

Ladder diagram with repeated output


Note that the coils for both the first and second rung refer to Out1. When the first rung of the
ladder is scanned, Out1 is turned on. However, when the second rung is scanned, Out1 is turned
off, overriding the logic in the first rung. If all of these conditions are needed to turn on Out1,
then they all should be placed in parallel, as shown below.

Ladder diagram with repeated output corrected

Page 3 of 5
In this illustration, it was obvious there is a problem. Normally, when this problem occurs, the
rungs are not adjacent, and it is not so obvious.
Compounding the problem, not all PLC programming software checks for this situation.
Therefore, the best way to prevent this problem is to consider the output coil first and then
consider all of the conditions that drive that output.
2. Use the set (latch) coil and reset (unlatch) coils together. If a set coil refers to an output,
there should also be a reset coil for that output. Also, for the same reason that output
coil and negated coils should not be repeated, do not mix the set/reset coils with an
output coil or negated coil that refer to the same output.
3. Be careful when using the set/reset coils to reference PLC physical outputs. If the
system involves safety and a set coil is used for a PLC physical output, simply
interrupting the condition on the set coil rung will not turn off the physical output. All
of the conditions that prevent the device from being turned on must also appear on a
rung with a reset coil output. For this reason, some companies forbid the use of the
set/reset coils.
4. Reverse power flow in the contact matrix is not allowed. When electromechanical
relays implement ladder logic, power can flow either way through the contacts. For
example, consider the ladder logic in figure below.

Reverse power flow in ladder logic

If implemented with electromechanical relays, power may flow right-to-left through the SS2
contact. When solid state relays replaced electromechanical relays for ladder logic, power can
flow only one way (left-to-right) through the contacts. This restriction was carried to PLC
ladder logic.
If the reverse power flow path is truly needed, then insert it as a separate path, where the power
flows from left to right. The reverse power flow path in the above figure is added as a separate
path as shown below.

Page 4 of 5
Reverse power flow in ladder logic corrected

PLC Scan Cycle


Previously, the process that the PLC uses to scan the ladder logic was introduced. Now it will
be discussed in detail. In addition to scanning the ladder logic, the PLC processor must also
read the state of its physical inputs and set the state of the physical outputs. These three major
tasks in a PLC processor scan are executed in the following order:
 Read/evaluate the physical inputs
 Scan the ladder logic program and execute instructions
 Write/update the physical outputs
The processor repeats these tasks as long as it is running, as was shown in the scan cycle
diagram. The time required to complete these three tasks was defined as the scan time and is
typically 1 - 200 milliseconds, depending on the length of the ladder logic program.
For very large ladder logic programs, the scan time can be more than one second. When this
happens, the PLC program may miss transient events, especially if they are shorter than one
second. In this situation, the possible solutions are:
1. Break ladder logic into subroutines that are executed at a slower rate and execute the
logic to detect the transient event on every scan.
2. Lengthen the time of the transient event so that it is longer than the maximum scan
time. If the event is counted, both the on time and off time of the event must be longer
than the scan time. A counter must sense both values to work correctly.
3. Place the logic examining the transient in a ladder logic routine that is executed at a
fixed time interval, smaller than the length of the transient event.
4. Partition long calculations. For example, if calculating the solution to an optimization,
do one iteration per scan cycle rather than execute the entire algorithm every scan.
Depending on the PLC processor, one or more of these solutions may be unavailable. Normally,
during the ladder logic program scan, changes in physical inputs cannot be sensed, nor can
physical outputs be changed at the output module terminals. However, some PLC processors
have an instruction that can read the current state of a physical input and another instruction
that can immediately set the current state of a physical output.

Page 5 of 5

You might also like