Ladder Diagram

Programmable logic controllers

A.C. Fischer-Cripps , in Newnes Interfacing Companion, 2002

2.7.5 Ladder logic diagrams

Ladder diagrams can become quite complex. PLC systems generally have the ability to perform math functions on data, apply Boolean operators, and store data in registers or memory locations.

Consider these simple examples:

An output is only energised when there is a continuous true path from the left-hand side to the right-hand side of the ladder.

Output Y400 is energised (true) as long as inputs X000 AND X100 are both closed (true).

Output Y400 is energised (true) as long as input X000 is closed OR X100 is closed (true).

Output Y400 is energised (true) as long as input X000 is closed AND X100 is open (false).

Output Y400 is energised (true) as long as input X000 is closed OR X100 is open (false).

When X000 turns on (true) then timer T300 begins counting down. After 10 seconds, switch contacts for the timer T300 are closed (true) and output Y400 is energised (true).

The example below shows a timer circuit whose output device turns on and remains on for the time period when an input pulse appears at the input. This circuit uses an internal relay. Internal relays are coils and contacts that are simulated by the PLC in memory. Like external relays, they consist of an output coil and a set of contacts that can be used as the input to other objects on a ladder rung.

In this example, when the input X000 is true, there is logic continuity through the normally closed timer contacts T300 to the output Y400. This true state is fed back into the input to the normally closed contacts of the timer. Thus, when the input X000 goes false, the output Y400 remains on, it is latched by its own contacts. Now, when X000 goes false, a true signal is sent to the timer to begin the countdown period. During the countdown period, the output device Y400 remains energised by the latched path through the contacts Y400. When the countdown period has expired, the normally closed contacts of T300 become open, thus interrupting the logic continuity to the output Y400 and so Y400 is de-energised. The ladder logic above acts like a pulse extender. A short pulse on the input X000 can be extended into a longer pulse appearing at the contacts of the output Y400.

Ladder logic diagrams can easily become unwieldy and difficult to maintain unless a certain methodology is followed to give them structure.

All inputs go on the left side.

Read full chapter

URL:

https://www.sciencedirect.com/science/article/pii/B9780750657204501145

Ladder and Functional Block Programming

W. Bolton , in Programmable Logic Controllers (Sixth Edition), 2015

5.4 Multiple Outputs

With ladder diagrams, there can be more than one output connected to a contact. Figure 5.20 shows a ladder program with two output coils. When the input contacts close, both the coils give outputs.

Figure 5.20. Ladder rung with two outputs.

For the ladder rung shown in Figure 5.21, output A occurs when input A occurs. Output B occurs only when both input A and input B occur.

Figure 5.21. Ladder rung with two inputs and two outputs.

Such an arrangement enables a sequence of outputs to be produced, the sequence being in the sequence in which contacts are closed. Figure 5.22 illustrates this idea with the same ladder program in Mitsubishi and Siemens notations. Outputs A, B, and C are switched on as the contacts in the sequence given by the contacts A, B, and C are being closed. Until input A is closed, none of the other outputs can be switched on. When input A is closed, output A is switched on. Then, when input B is closed, output B is switched on. Finally, when input C is closed, output C is switched on.

Figure 5.22. Sequenced outputs.

Read full chapter

URL:

https://www.sciencedirect.com/science/article/pii/B9780128029299000054

Internal Relays

W. Bolton , in Programmable Logic Controllers (Sixth Edition), 2015

7.6 Master Control Relay

When large numbers of outputs have to be controlled, it is sometimes necessary for whole sections of ladder diagrams to be turned on or off when certain criteria are realized. This could be achieved by including the contacts of the same internal relay in each of the rungs so that its operation affects all of them. An alternative is to use a master control relay. Figure 7.22 illustrates the use of such a relay to control a section of a ladder program.

Figure 7.22. Principle of use of a master control relay.

With no input to input In 1, the output internal relay MC 1 is not energized, and so its contacts are open. This means that all the rungs between where it is designated to operate and the rung on which its reset MCR or another master control relay is located are switched off. Assuming that it is designated to operate from its own rung, we can imagine it to be located in the power line in the position shown, and so rungs 2 and 3 are off. When input In 1 contacts close, the master relay MC 1 is energized. When this happens, all the rungs between it and the rung with its reset MCR 1 are switched on. Thus outputs Out 1 and Out 2 cannot be switched on by inputs In 2 and In 3 until the master control relay has been switched on. The master control relay MC 1 acts only over the region between the rung it is designated to operate from and the rung on which MCR 1 is located.

With a Mitsubishi PLC, an internal relay can be designated as a master control relay by programming it accordingly. Thus to program an internal relay M100 to act as a master control relay, the program instruction is:

MC M 100

To program the resetting of that relay, the program instruction is:

MCR M 100

Thus for the ladder diagram shown in Figure 7.23, which is Figure 7.22 with Mitsubishi addresses, the program instructions are:

Figure 7.23. MCR with Mitsubishi PLC.

LD X400
OUT M100
MC M100
LD X401
OUT Y430
LD X402
OUT Y431
MC M100

Figure 7.24 shows the format used by Allen-Bradley. To end the control of one master control relay (MCR), a second master control relay (MCR) is used with no contacts or logic preceding it. It is said to be programmed unconditionally.

Figure 7.24. An MCR with Allen-Bradley PLC.

The representation used for MCRs in Siemens ladder programs is shown in Figure 7.25. An area in which an MCR is to operate is defined by the activate master control area and deactivate master control relay functions. Within that area, the MCR is enabled when the MCR> coil is activated and disabled when the MCR< coil is enabled.

Figure 7.25. Siemens representation of master control relays.

A program might use a number of MCRs, enabling various sections of a ladder program to be switched in or out. Figure 7.26 shows a ladder program in Mitsubishi format involving two MCRs. With M100 switched on but M101 off, the sequence is: rungs 1, 3, 4, 6, and so on. The end of the M100 controlled section is indicated by the occurrence of the other MCR, M101. With M101 switched on but M100 off, the sequence is: rungs 2, 4, 5, 6, and so on. The end of this section is indicated by the presence of the reset. This reset has to be used since the rung is not followed immediately by another MCR. Such an arrangement could be used to switch on one set of ladder rungs if one type of input occurs and another set of ladder rungs if a different input occurs.

Figure 7.26. Example showing more than one master control relay.

7.6.1 Examples of Programs

The following looks at a program that illustrates the uses of MCRs. The program is being developed for use with a pneumatic valve system involving the movement of pistons in cylinders to give a particular sequence of piston actions. First, however, we show how latching might be used with such systems to maintain actions.

Consider a pneumatic system with single-solenoid controlled valves and involving two cylinders A and B with limit switches a–, a+, b–, b+ detecting the limits of the piston rod movements (Figure 7.27), with the requirement to give the sequence A+, B+, A–, B–. Figure 7.28 shows the ladder diagram that can be used.

Figure 7.27. A valve system.

Figure 7.28. A ladder program.

The solenoid A+ is energized when the start switch and limit switch b– are closed. This provides latching to keep A+ energized as long as the normally closed contacts for limit switch b+ are not activated. When limit switch a+ is activated, solenoid B+ is energized. This provides latching that keeps B+ energized as long as the normally closed contacts for limit switch a– are not activated. When cylinder B extends, the limit switch b+ opens its normally closed contacts and unlatches the solenoid A+. Solenoid A thus retracts. When it has retracted and opened the normally closed contacts a–, solenoid B+ becomes unlatched and cylinder B retracts.

Now consider the ladder program that could be used with the pair of single-solenoid-controlled cylinders in Figure 7.27 to give, when and only when the start switch is momentarily triggered, the sequence A+, B+, A–, then a 10   s time delay, B–, and stop at that point until the start switch is triggered again. Figure 7.29 shows how such a program can be devised using a MCR. The MCR is activated by the start switch and remains on until switched off by the rung containing just MCR. (See Chapter 9 for a discussion of timers.)

Figure 7.29. A ladder program.

Read full chapter

URL:

https://www.sciencedirect.com/science/article/pii/B9780128029299000078

Introduction to Industrial Control Systems and Operations

Eric D. Knapp , Joel Thomas Langill , in Industrial Network Security (Second Edition), 2015

Ladder diagrams

Programmable logic controllers can use "ladder logic" or "ladder diagrams (LD)," which is a simplistic programming language included within the IEC-61131-3 standard that is well suited for industrial applications. Ladder logic gets its name from the legacy method of implementing discrete logic via electromechanical relays and was initially referenced as "relay ladder logic." Ladder logic can be thought of as a set of connections between inputs (relay contacts) and outputs (relay coils). Ladder logic follows a relay function diagram, as shown in Figure 4.2. A path is traced on the left side, across "rungs" consisting of various inputs. If an input relay is "true" the path continues, and if it is "false" it does not. If the path to the right side completes (there is a complete "true" path across the ladder), the ladder is complete and the output coil will be set to "true" or "energized." If no path can be traced, then the output remains "false," and the relay remains "de-energized." 1 This was implemented before PLCs, with a (+) bus on the left-hand side and a (−) bus on the right-hand side. The "path" just described represented electrical current flow through the logic.

Figure 4.2. Example of simple ladder logic with both complete and incomplete conditions.

The PLC applies this ladder logic by looking at inputs from discrete devices that are connected to the manufacturing equipment, and performing a desired output function based on the "state" of these inputs. These outputs are also connected to manufacturing equipment, such as actuators, motor drives, or other mechanical equipment. PLCs can use a variety of digital and analog communications methods, but typically use a fieldbus protocol, such as Modbus, ControlNet, EtherNet/IP, PROFIBUS, PROFINET or similar (see Chapter 6, "Industrial Network Protocols"). A switch is used to convert an analog or "continuous" value from a sensor to a "discrete" on or off value by comparing the input to a set point. If a set point is satisfied, the input is considered "true," and if it is not it is considered "false." Processes defined by ladder logic can be simple or very complex. For example, an "or" condition can allow the rung to complete based on an alternate input condition, as shown in Figure 4.3.

Figure 4.3. Example of simple ladder logic containing an "OR" condition.

When an output coil is finally reached it becomes "true," and the PLC activates the output. This allows the PLC to automate a function (e.g. turning a pump on or off) based on set point parameters (e.g. high and low water levels within a tank). 2

Internal relays may also be used within a PLC; these relays, unlike input relays, do not use inputs from the physical plant, but rather are used by the ladder logic to lock an input on (true) or off (false) depending upon other conditions of the program. PLCs also use a variety of other function "blocks" including counters, timers, flip-flops, shift registers, comparators, mathematical expressions/functions, and many others allowing PLCs to act in defined cycles or pulses, as well as storage. 3

Read full chapter

URL:

https://www.sciencedirect.com/science/article/pii/B9780124201149000046

Timers

W. Bolton , in Programmable Logic Controllers (Sixth Edition), 2015

9.2 On-Delay Timers

All PLCs generally have on-delay timers; small PLCs possibly have only this type of timer. Figure 9.4a shows a ladder rung diagram involving a on-delay timer. Figure 9.4a is typical of Mitsubishi. The timer is like a relay with a coil that is energized when input In 1 occurs (rung 1). It then closes, after some preset time delay, its contacts on rung 2. Thus the output occurs some preset time after input In 1 occurs. Figure 9.4b, an example of a possible Siemens setup, shows the timer to be a delay item in a rung, rather than a relay. When the signal at the timer's start input changes from 0 to 1, the timer starts and runs for the programmed duration, giving its output then to the output coil. The time value (TV) output can be used to ascertain the amount of time remaining at any instant. A signal input of 1 at the reset input resets the timer whether it is running or not. Techniques for the entry of preset time values vary. Often it requires the entry of a constant K command followed by the time interval in multiples of the time base used. Figures 9.4c, 9.4d, and 9.4e show ladder diagrams for Telemecanique, Toshiba, and Allen-Bradley, respectively. The Allen-Bradley timer symbol shows the type of timer concerned, the timer address, and the time base that indicates the increments by which the timer moves to the preset value, such as 0.001  s, 0.01   s, 0.1   s or 1   s. The preset value (PRE) is the number of time increments that the timer must accumulate to reach the required time delay, and the accumulator (ACC) indicates the number of increments that the timer has accumulated while the timer is active and is reset to zero when the timer is reset (useful if a program needs to record how long a particular operation took). The Allen-Bradley timers have three Boolean bits for ladder logic control: a timer enable bit (EN), which goes on when the timer accumulator is incrementing, a timer done bit (DN), which goes on after the set time delay, and a timer timing bit (TT) that is on when the accumulator is incrementing and remains on until the accumulator reaches the preset value.

Figure 9.4. Timers: (a) Mitsubishi, (b) Siemens, (c) Telemecanique, (d) Toshiba, (e) and Allen-Bradley.

All the programs shown in Figure 9.4 turn on the output device after a set time delay from when there is an input.

9.2.1 Sequencing

As an illustration of the use of a TON timer, consider the ladder diagram shown in Figure 9.5a. When the input In 1 is on, the output Out 1 is switched on. The contacts associated with this output then start the timer. The contacts of the timer will close after the preset time delay, in this case 5.5   s. When this happens, output Out 2 is switched on. Thus, following the input In 1, Out 1 is switched on and followed 5.5   s later by Out 2. This illustrates how a timed sequence of outputs can be achieved. Figure 9.5b shows the same operation with the format used by the PLC manufacturer in which the timer institutes a signal delay. Figure 9.6c shows the timing diagram.

Figure 9.5. Sequenced outputs.

Figure 9.6. Motor sequence.

Figure 9.6 shows two versions of how timers can be used to start three outputs, such as three motors, in sequence following a single start button being pressed. In Figure 9.6a, the timers are programmed as coils, whereas in Figure 9.6b, they are programmed as delays. When the start push button is pressed, there is an output from internal relay IR1. This latches the start input. It also starts both timers, T1 and T2, and motor 1. When the preset time for timer 1 has elapsed, its contacts close and motor 2 starts. When the preset time for timer 2 has elapsed, its contacts close and motor 3 starts. The three motors are all stopped by pressing the stop push button. Since this is seen as a complete program, the end instruction has been used.

9.2.2 Cascaded Timers

Timers can be linked together (the term cascaded is used) to give longer delay times than are possible with just one timer. Figure 9.7a shows the ladder diagram for such an arrangement. Thus we might have timer 1 with a delay time of 999  s. This timer is started when there is an input to In 1. When the 999   s is up, the contacts for timer 1 close. This then starts timer 2. This has a delay of 100   s. When this time is up, the timer 2 contacts close and there is an output from Out 1. Thus the output occurs 1099   s after the input to In 1 started. Figure 9.7b shows the Mitsubishi version of this ladder diagram with TON timers and the program instructions for that ladder.

Figure 9.7. Cascaded TON timers.

9.2.3 On/Off Cycle Timer

Figure 9.8 shows how on-delay timers can be used to produce an on/off cycle timer. The timer is designed to switch on an output for 5   s, then off for 5   s, then on for 5   s, then off for 5   s, and so on. When there is an input to In 1 and its contacts close, timer 1 starts. Timer 1 is set for a delay of 5   s. After 5   s, it switches on timer 2 and the output Out 1. Timer 2 has a delay of 5   s. After 5   s, the contacts for timer 2, which are normally closed, open. This results in timer 1 in the first rung being switched off. This then causes its contacts in the second rung to open and switch off timer 2. This results in the timer 2 contacts resuming their normally closed state, and so the input to In 1 causes the cycle to start all over again.

Figure 9.8. On/off cycle timer.

Figure 9.9 shows how the preceding ladder program would appear in the format used with a timer considered as a delay rather than as a coil. This might be the case, for example, with Siemens or Toshiba. When input In 1 closes, the timer T1 starts. After its preset time, there is an output to Out 1 and timer T2 starts. After its preset time there is an output to the internal relay IR1. This opens its contacts and stops the output from Out 1. This then switches off timer T2. The entire cycle can then repeat itself.

Figure 9.9. On/off cycle timer using TON timers.

Read full chapter

URL:

https://www.sciencedirect.com/science/article/pii/B9780128029299000091

IL, SFC, and ST Programming Methods

W. Bolton , in Programmable Logic Controllers (Sixth Edition), 2015

6.1.4 Programming Examples

The following tasks are intended to illustrate the application of the programming techniques given in this section and are the examples for which ladder diagrams and function block diagrams were derived in Section 5.7. (See that section for an explanation of the ladder diagrams; here we show the instruction lists relating to the programs.)

A signal lamp is required to be switched on if a pump is running and the pressure is satisfactory or if the lamp test switch is closed. Figure 6.8 shows the ladder program and the related instruction list.

Figure 6.8. Signal lamp task.

For a valve that is to be operated to lift a load when a pump is running and either the lift switch operated or a switch operated indicating that the load has not already been lifted and is at the bottom of its lift channel, Figure 6.9 shows the ladder program and the related instruction list.

Figure 6.9. Valve operation program.

For a system in which there has to be no output when any one of four sensors gives an output and otherwise there is to be an output, Figure 6.10 shows the ladder program and the instruction list.

Figure 6.10. Output switched off by any one of four sensors being activated.

Read full chapter

URL:

https://www.sciencedirect.com/science/article/pii/B9780128029299000066

Jump and Call

W. Bolton , in Programmable Logic Controllers (Sixth Edition), 2015

Problems

Problems 1 through 6 have four answer options: A, B, C, or D. Choose the correct answer from the answer options. Problems 1 and 2 refer to Figure 8.10 , which shows a ladder diagram with inputs In 1, In 2, In 3, and In 4; outputs Out 1, Out 2, Out 3, and Out 4; and a jump instruction.

Figure 8.10. Diagram for Problems 1 and 2.

1.

For the ladder diagram shown in Figure 8.10, for output Out 1 to occur:

A.

Only input In 1 must occur

B.

Both inputs In 1 and In 2 must occur

C.

Input In 1 must not occur and input 2 must occur

D.

Both inputs In 1 and In 2 must not occur

2.

Decide whether each of these statements is true (T) or false (F). For the ladder diagram shown in Figure 8.10, following input In 1:

(i)

Output Out 1 occurs.

(ii)

Output Out 3 occurs.

A.

(i) T (ii) T

B.

(i) T (ii) F

C.

(i) F (ii) T

D.

(i) F (ii) F

Problems 3 and 4 refer to Figure 8.11, which shows a ladder diagram with inputs (In 1, In 2, and In 3), outputs (Out 1, Out 2, and Out 3), and a jump-to-subroutine instruction.

Figure 8.11. Diagram for Problems 3 and 4.

3.

Decide whether each of these statements is true (T) or false (F). For the ladder diagram shown in Figure 8.11:

(i)

After input In 1 occurs output Out 2 occurs.

(ii)

After output Out 3 occurs the program waits for input In 2 before proceeding

A.

(i) T (ii) T

B.

(i) T (ii) F

C.

(i) F (ii) T

D.

(i) F (ii) F

4.

Decide whether each of these statements is true (T) or false (F). For the ladder diagram shown in Figure 8.11:

(i)

When input In 2 occurs, outputs Out 1 and Out 2 occur.

(ii)

When input In 3 occurs, output Out 3 occurs.

A.

(i) T (ii) T

B.

(i) T (ii) F

C.

(i) F (ii) T

D.

(i) F (ii) F

5.

Decide whether each of these statements is true (T) or false (F). For the program shown in Figure 8.12, there is an output:

(i)

When input 1 is 1 and input 2 is 0.

(ii)

When input 1 is 1 and input 2 is 1.

A.

(i) T (ii) T

B.

(i) T (ii) F

C.

(i) F (ii) T

D.

(i) F (ii) F

Figure 8.12. Diagram for Problem 5.

6.

Decide whether each of these statements is true (T) or false (F). For the program shown in Figure 8.13, there is an output:

(i)

When input 1 is 1, input 2 is 0 and input 3 is 1.

(ii)

When input 1 is 0, input 2 is 1 and input 3 is 0.

A.

(i) T (ii) T

B.

(i) T (ii) F

C.

(i) F (ii) T

D.

(i) F (ii) F

Figure 8.13. Diagram for Problem 6.

7.

A production plant program requires the following operations to be repeated a number of times: filling a vat, heating the liquid in the vat, and then, when the liquid is at the required temperature, emptying it. Explain how this procedure could be programmed using subroutines.

Read full chapter

URL:

https://www.sciencedirect.com/science/article/pii/B978012802929900008X