Файл: Programmable logic controllers. Methods and Applications (Hackworth J., Prentice Hall).pdf
ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 15.06.2025
Просмотров: 2114
Скачиваний: 0
Chapter 3 - Fundamental PLC Programming
When the program shown in Figure 3-3 is run, the PLC first updates the input image register by storing the values of the inputs on terminals IN1 and IN2 (it stores a one if an input is on, and a zero if it is off). Then it solves the ladder diagram according to the way it is drawn and based on the contents of the input image register. For our program, if both
IN1 and IN2 are on, it turns on OUT1 in the output image register (careful, it does NOT turn on the output terminal yet!). Then, when it is completed solving the entire program, it performs another update. This update transfers the contents of the output image register (the most recent results of solving the ladder program) to the output terminals. This turns on terminal OUT1 which turns on the lamp LAMP1. At the same time that it transfers the contents of the output image register to the output terminals, it also transfers the logical values on the input terminals to the input image register. Now it is ready to solve the ladder again.
For an operation this simple, this is a lot of trouble and expense. However, as we add to our program, we will begin to see how a PLC can economize not only on wiring, but on the complexity (and cost) of external components.
Next, we will add another lamp that switches on when either SWITCH1 or SWITCH2 are on. If we were to add this circuit to our electrical diagram in Figure 3-1, we would have the circuit shown in Figure 3-4
H1 |
H3 |
H2 |
H4 |
|
F1 |
T1 |
|||
2 |
X1 |
X2 |
1 |
|
SWITCH1 |
SWITCH2 |
LAMP1 |
||
3 |
4 |
|||
PB1 |
PB2 |
L1 |
||
SWITCH1 |
LAMP2 |
|||
5 |
||||
PB1 |
||||
SWITCH2 |
L2 |
|||
PB2 |
||||
Figure 3-4 - OR Circuit |
||||
3-4
Chapter 3 - Fundamental PLC Programming
Notice that to add this circuit to our existing circuit, we had to add additional contacts to the switches PB1 and PB2. Obviously, this raises the cost of the switches. However, when doing this on a PLC, it is much easier and less costly.
The PLC wiring diagram to implement both the AND and OR circuits is shown in Figure 3-5. Notice here that the only change we’ve made to the circuit is to add LAMP2 to the PLC output OUT2. Since the SWTICH1 and SWITCH2 signals are already available inside the PLC via inputs IN1 and IN2, it is not necessary to bring them into the PLC again.
This is because of one unique and very economical feature of PLC programming. Once an input signal is brought into the PLC for use by the program, you may use as many contacts of the input as you wish, and the contacts may be of either N/O or N/C polarity. This reduces the cost because, even though our program will require more than one contact of IN1 and IN2, each of the actual switches that generate these inputs, PB1 and PB2, only need to have a single N/O contact.
SWITCH1 |
PLC |
||
L1 |
|||
PB1 |
IN1 |
OUT1 LAMP1 |
|
SWITCH2 |
|||
IN2 |
LAMP2 |
L2 |
|
PB2 |
OUT2 |
||
IN3 |
OUT3 |
||
IN4 |
OUT4 |
||
120V |
120V |
||
CONTROL |
CONTROL |
||
VOLTAGE |
VOLTAGE |
||
COM |
COM |
||
Figure 3-5 - PLC Wiring Diagram to Add
SWITCH2 and LAMP2
Now that we have the inputs and outputs connected, we can write the program. We do this by simply adding to the program the additional rung that we need to perform the OR operation. This is shown in Figure 3-6. Keep in mind that other than the additional lamp and the time it takes to add the additional program, this additional OR feature costs nothing.
3-5
Chapter 3 - Fundamental PLC Programming |
||||
| |
IN1 |
IN2 |
OUT1 |
|
1--- |
| | |
-------| |--------------------------------------------------------- |
(OUT)| |
|
| |
||||
| |
||||
| |
IN1 |
OUT2 |
||
| |
||||
2--- |
| | |
-------------------------------------------------------------------| |
(OUT)| |
|
| |
IN2 |
|||
|--- |
| |--- |
+ |
||
| |
||||
| |
||||
Figure 3-6 - PLC Program with Added OR Rung |
||||
Next, we will add AND-OR and OR-AND functions to out PLC. For this, we will need two more switches, SWITCH3 and SWITCH4, and two more lamps, LAMP3 and LAMP4. Figure 3-7 shows the addition of these switches and lamps.
SWITCH1 |
PLC |
||
L1 |
|||
PB1 |
IN1 |
OUT1 LAMP1 |
|
SWITCH2 |
|||
IN2 |
LAMP2 |
L2 |
|
PB2 |
OUT2 |
||
SWITCH3 |
|||
LAMP3 |
L3 |
||
PB3 |
IN3 |
OUT3 |
|
SWITCH4 |
|||
IN4 |
LAMP4 |
L4 |
|
PB4 |
OUT4 |
||
120V |
120V |
||
CONTROL |
CONTROL |
||
VOLTAGE |
VOLTAGE |
||
COM |
COM |
||
Figure 3-7 - PLC Wiring Diagram Adding
Switches PB3 and PB4 and Lamps L3 & L4.
Once the connection scheme for these components is known, we can add the additional programming required to implement the AND-OR and OR-AND functions. This is shown in Figure 3-8.
3-6
Chapter 3 - Fundamental PLC Programming |
||||
| |
IN1 |
IN2 |
OUT1 |
|
1--- |
| | |
------- | | --------------------------------------------------------- |
(OUT)| |
|
| |
||||
| |
||||
| |
IN1 |
OUT2 |
||
| |
||||
2--- |
| | |
------------------------------------------------------------------- | |
(OUT)| |
|
| |
IN2 |
|||
|--- |
| |--- |
+ |
||
| |
||||
| |
||||
| |
IN1 |
IN2 |
OUT3 |
|
| |
||||
3--- |
| |------- --------------------------------------------------------- |
| | |
(OUT)| |
|
| |
IN3 |
IN4 |
| |
|
|--- |
| |------- --- |
| | |
+ |
|
| |
||||
| |
||||
| |
IN1 |
IN3 |
OUT4 |
|
| |
||||
4--- |
| |------- --------------------------------------------------------- |
| | |
(OUT)| |
|
| |
IN2 |
| IN4 |
| |
|
|--- |
| |------- --- |
| | |
+ |
|
| |
||||
Figure 3-8 - PLC Program with AND-OR and OR-AND Added
3-4. Example Problem 1
A lighting control system is to be developed. The system will be controlled by four switches, SWITCH1, SWITCH2, SWITCH3, and SWITCH4. These switches will control the lighting in a room based on the following criteria:
1.Any of three of the switches SWITCH1, SWITCH2, and SWITCH3, if turned ON can turn the lighting on, but all three switches must be OFF before the lighting will turn OFF.
2.The fourth switch SWITCH4 is a Master Control Switch. If this switch is in the ON position, the lights will be OFF and none of the other three switches have any control.
Problem: |
Design the wiring diagram for the controller connections, assign the inputs |
and outputs and develop the ladder diagram which will accomplish the task. |
The first item we may accomplish is the drawing of the controller wiring diagram. All we need do is connect all switches to inputs and the lighting to an output and note the numbers of the inputs and output associated with these connections. The remainder of the task becomes developing the ladder diagram. The wiring diagram is shown in Figure 3-9.
3-7