Файл: Programmable logic controllers. Methods and Applications (Hackworth J., Prentice Hall).pdf

ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 15.06.2025

Просмотров: 2112

Скачиваний: 0

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

Chapter 2 - The Programmable Logic Controller

passed, the light (coil) will then be turned on. If not, the light (coil) will be turned off. This is recorded in the output image register. Once the PLC has looked at the left side of the rung it ignores the left side of the rung until the next time it solves that particular rung. Once the light (coil) has been either turned on or off it will remain in that state until the next time the PLC solves that particular rung. After solving a rung, the PLC moves on to solve the next rung in the same manner and so forth until the entire ladder has been executed and solved. One rule that is different from general electrical operation is the direction of current flow in the rung. In a ladder logic, rung current can only flow from left to right and up and down; never from right to left.

As an example, in the ladder shown in Figure 2-7, coil CR1 will energize if any of the following conditions exist:

Figure 2-7 - Illustration of allowed current flow in ladder rung

1.CR7 is off, CR6 is on.

2.CR7 is off, CR2 is on, CR5 is on.

3.CR7 is off, CR2 is on, CR3 is on.

4.CR1 is on, CR4 is on, CR3 is on.

5.CR1 is on, CR4 is on, CR5 is on.

You will notice that the current flow in the circuit in each of the cases listed above is from left to right and up and down. CR1 will not energize in the case listed below:

2-14

Chapter 2 - The Programmable Logic Controller

CR1 is on, CR4 is on, CR2 is on, CR6 is on, CR5 is off, CR3 is off, CR7 is on.

This is because current would have to flow from right to left through the CR2 contact. This is not allowed in ladder logic even though current could flow in this direction if we were to build it with real relays. Remember, we are working in the software world not the hardware world.

To review, after the I/O update, the PLC moves to the first rung of ladder logic. It solves the contact configuration to determine if the coil is to be energized or de-energized.

It then energizes or de-energizes the coil. After this is accomplished, it moves to the left side of the next rung and repeats the procedure. This continues until all rungs have been solved. When this procedure is complete with all rungs solved and all coils in the ladder set up according to the solution of each rung, the PLC proceeds to the next step of it's sequence, the I/O update.

At I/O update, the states of all coils which are designated as outputs are transferred from the output image register to the output unit and the states of all inputs are transferred to the input image register. Note that any input changes that occur during the solution of the ladder are ignored because they are only recorded at I/O update time. The state of each coil is recorded to the output image register as each rung is solved. However, these states are not transferred to the output unit until I/O update time.

Figure 2-8 - Scan Cycle

This procedure of I/O update and solving the ladder diagram and I/O update is referred to as scanning and is represented in Figure 2-8. The period between one I/O update and the next is referred to as one Scan. The amount of time it takes the PLC to get

2-15


Chapter 2 - The Programmable Logic Controller

from one I/O update to the next is referred to as Scan Time. Scan time is typically measured in milliseconds and is related to the speed of the CPU and the length of the ladder diagram that has to be solved. The slower the processor or the longer the ladder diagram, the longer the scan time of the system. The speed at which a PLC scans memory is referred to as Scan Rate. Scan rate units are usually listed in msec/K of memory being utilized for the program. As an example, if a particular PLC has a rated scan rate of

8 msec/K and the program occupies 6K of memory, it will take the PLC 48 msec to complete one scan of the program.

2-9. Summary

Before a study of PLC programming can begin, it is important to gain a fundamental understanding of the various types of PLCs available, the advantages and disadvantages of each, and the way in which a PLC executes a program. The open frame, shoebox, and modular PLCs are each best suited to specific types of applications based on the environmental conditions, number of inputs and outputs, ease of expansion, and method of entering and monitoring the program. Additionally, programming requires a prior knowledge of the manner in which a PLC receives input information, executes a program, and sends output information. With this information, we are now prepared to begin a study of PLC programming techniques.

2-16

Chapter 2 - The Programmable Logic Controller

Chapter 2 Review Questions

1.How were early machines controlled before PLC's were developed?

2.When were the first PLC's developed?

3.What is a shoe box PLC?

4.List four types of I/O modules?

5.List five devices that would be typical inputs to a PLC. List five devices that a PLC might control.

6.What types of memory might a PLC contain?

7.Which type or types of memory would store the program to be executed by the PLC?

8.What is the purpose of the programming unit?.

9.What type of control system did the PLC replace? Why was the PLC better?

10.What industry was primarily responsible for PLC development?

11.What are the two steps the PLC must perform during operation?

12.Describe I/O Update.

13.What is the Output Image Register?

14.Describe the procedure for solving a rung of logic.

15.What are the allowed direction of current flow in a ladder logic rung?

16.Define scan rate.

17.If a PLC program is 7.5K long and the scan rate of the machine is 7.5 msec/K, what will the length of time between I/O updates be?

18.Define scan time.

2-17

Chapter 2 - The Programmable Logic Controller

19.At what time is data transferred to and from the outside world into a PLC system?

20.What common devices may be used to understand the operation of coils and contacts in ladder logic?

2-18


Chapter 3 - Fundamental PLC Programming

Chapter 3 - Fundamental PLC Programming

3-1. Objectives

Upon completion of this chapter, you will know

how to convert a simple electrical ladder diagram to a PLC program.

the difference between physical components and program components.

why using a PLC saves on the number of physical components.

how to construct disagreement and majority circuits.

how to construct special purpose logic in a PLC program, such as the oscillator, gated oscillator, sealing contact, and the always-on and always-off contacts.

3-2. Introduction

When writing programs for PLCs, it is beneficial to have a background in ladder diagramming for machine controls. This is basically the material that was covered in Chapter 1 of this text. The reason for this is that at a fundamental level, ladder logic programs for PLCs are very similar to electrical ladder diagrams. This is no coincidence.

The engineers that developed the PLC programming language were sensitive to the fact that most engineers, technicians and electricians who work with electrical machines on a day-to-day basis will be familiar with this method of representing control logic. This would allow someone new to PLCs, but familiar with control diagrams, to be able to adapt very quickly to the programming language. It is likely that PLC programming language is one of the easiest programming languages to learn.

In this chapter, we will take the foundation knowledge learned in Chapter 1 and use it to build an understanding of PLC programming. The programming method used in this chapter will be the graphical method, which uses schematic symbols for relay coils and contacts. In a later chapter we will discuss a second method of programming PLCs which is the mnemonic language method.

3-3. Physical Components vs. Program Components

When learning PLC programming, one of the most difficult concepts to grasp is the difference between physical components and program components. We will be connecting physical components (switches, lights, relays, etc.) to the external terminals on a PLC. Then when we program the PLC, any physical components connected to the PLC will be represented in the program as program components. A programming component

3-1

Chapter 3 - Fundamental PLC Programming

will not have the same reference designator as the physical component, but can have the same name. As an example, consider a N/O pushbutton switch S1 named START. If we connect this to input 001 of a PLC, then when we program the PLC, the START switch will become a N/O relay contact with reference designator IN001 and the name START. As another example, of we connect a RUN lamp L1 to output 003 on the PLC, then in the program, the lamp will be represented by a relay coil with reference designator OUT003 and name RUN (or, if desired, “RUN LAMP”).

As a programming example, consider the simple AND circuit shown in Figure 3-1 consisting of two momentary pushbuttons in series operating a lamp. Although it would be very uneconomical to implement a circuit this simple using a PLC, for this example we will do so.

H1

H3

H2

H4

F1

T1

2

X1

X2

1

SWITCH1

SWITCH2

LAMP1

3

4

PB1

PB2

L1

Figure 3-1 - AND Ladder Diagram

When we convert a circuit to run on a PLC, we first remove the components from the original circuit and wire them to the PLC as shown in Figure 3-2. One major difference in this circuit is that the two switches are no longer wired in series. Instead, each one is wired to a separate input on the PLC. As we will see later, the two switches will be connected in series in the PLC program. By providing each switch with a separate input to the PLC, we gain the maximum amount of flexibility. In other words, by connecting them to the PLC in this fashion, we can “wire” them in software any way we wish.

The two 120V control voltage sources are actually the same source (i.e., the control transformer secondary voltage). They are shown separately in this figure to make it easier to see how the inputs and output are connected to the PLC, and how each is powered.

3-2


Chapter 3 - Fundamental PLC Programming

SWITCH1

PLC

L1

PB1

IN1

OUT1 LAMP1

SWITCH2

PB2

IN2

OUT2

IN3

OUT3

IN4

OUT4

120V

120V

CONTROL

CONTROL

VOLTAGE

VOLTAGE

COM

COM

Figure 3-2 - PLC Wiring Diagram for implementation of Figure 3-1

Once we know how the external components are wired to the PLC, we can then write our program. In this case we need to connect the two switches in series. However, once the signals are inside the PLC, they are assigned new reference designators which are determined by the respective terminal on the PLC. Since SWITCH1 is connected to IN1, it will be called IN1 in our program. Likewise, SWITCH2 will become IN2 in our program. Also, since LAMP1 is connected to OUT1 on the PLC, it will be called relay

OUT1 in our program. Our program to control LAMP1 is shown in Figure 3-3.

|

IN1

IN2

OUT1

1

---| |

-------| |---------------------------------------------------------

(OUT)|

|

|

Figure 3-3 - AND PLC Program

The appearance of the PLC program may look a bit unusual. This is because this ladder rung was drawn by a computer using ASCII characters instead of graphic characters. Notice that the rails are drawn with vertical line characters, the conductors are hyphens, and the coil of OUT1 is made of two parentheses. Also, notice that the right rail is all but missing. Many programs used to write and edit PLC ladder programs leave out the rails. This particular program (TRiLOGI by TRi International Pte. Ltd.) Leaves out the right rail, but puts in the left one with a rung number next to each rung.

3-3