Programs 269 LD ANI OUT K LD OUT END X404 X405 C460 4 C460 Y433 (*Sixth rung*) (*Four bottles counted.*) (*Seventh rung*) (*End rung*) The Siemens program in instruction list is: A O A AN AN (AN ON ) = AN = A O = A O LKT SR A = AN = A AN CU LKC A R = END 14.4 Control of a process I0.0 Q2.0 I0.1 Q2.2 F0.0 I0.4 I0.5 Q2.0 Q2.0 Q2.1 I0.2 F0.0 F0.0 I0.3 Q2.2 2.2 T0 T0 F0.1 F0.1 Q2.2 I0.4 I0.5 C0 4 I0.5 C0 Q2.3 (*First rung*) (*Second rung*) (*Third rung*) (*Fourth rung*) (*2 s allowed for capping.*) (*Fifth rung*) (*Sixth rung*) (*Four bottles counted.*) (*End rung*) The following is an illustration of the use of a sequential flow chart for programming. The process (Figure 14.20) involves two fluids filling two containers: when full their contents are then emptied into a mixing chamber, from where the mixture is then discharged. The whole process is then repeated. 270 Programmable Logic Controllers Limit switches Pump 1 1 Pump 2 3 Fluid 2 Fluid 1 2 Valve 1 4 Valve 2 Mixer Limit switch 5 Valve 3 Figure 14.20 The mixing operation Figure 14.21 shows the type of valve that might be used in such a process. It is solenoid operated to give flow through the valve and then, when the solenoid is not activated, a spring returns the valve to the closed position. Figure 14.21 Valve Figure 14.22 shows the sequential function chart program. When the start switch is activated, Fill 1 and Fill 2 occur simultaneously as a result of the actions of pumps 1 and 2 being switched on. When limit switch 1 is activated then Fill 1 ceases, likewise when limit switch 3 is activated Fill 2 ceases. We then have the containers for fluid 1 and fluid 2 full. The action that occurs when both limit switch 1 and 3 are activated is that the containers start to empty, the action being the opening of valves 1 and 2. When limit switches 2 and 4 are activated then the containers are empty. The next stage, the mixing of the liquids is then determined when limit switch 2 and limit switch 4 are both activated. After a time of 100 s the moxing ceases and the mixed liquids empty through valve 3. When limit switch 5 is activated the program reaches the end of its cycle and the entire sequence is then repeated. Programs 271 Start Start switch activated Fill 1 Fill 2 Pump 1 Pump 2 Limit switch 3 Limit switch 1 Full 1 Full 2 Limit switch 1 AND 3 Empty 1 Empty 2 Valve 1 Limit switch 2 Valve 1 Limit switch 4 Emptied 1 Emptied 2 Limit switch 2 AND 4 Mix liquids Mixer Time elapsed 100 s Mixed liquids Valve 3 Limit switch 5 End Figure 14.22 The mixing operation program Problems 1 This problem is essentially part of the domestic washing machine program. Devise a ladder program to switch on a pump for 100 s. It is then to be switched off and a heater switched on for 50 s. Then the heater is switched off and another pump is used to empty the water. 2 Devise a ladder program that can be used with a solenoid valve controlled double-acting cylinder, i.e. a cylinder with a piston which can be moved either way by means of solenoids for each of its two positions, and which moves the piston to the right, holds it there for 2 s and then returns it to the left. 272 Programmable Logic Controllers 3 Devise a ladder program that could be used to operate the simplified task shown in Figure 14.23 for the automatic drilling of workpieces. The drill motor and the pump for the air pressure for the pneumatic valves have to be started. The workpiece has to be clamped. The drill has then to be lowered and drilling started to the required depth. Then the drill has to be retracted and the workpiece unclamped. Solenoid 1 Moves drill up or down Motor Solenoid 2 Solenoid 3 Limit switch 3 normally closed, open when piece clamped Limit switch 4 normally open, closed when piece clamped Limit switch 1, open when drill up, closed when down Limit switch 2, normally closed, opened when drill at required depth Clamp Workpiece Figure 14.23 Problem 3 4 What are the principles to be observed in installing a safe emergency stop system with a PLC? 5 The inputs from the limit switches and the start switch and the outputs to the solenoids of the valves shown in Figure 14.24 are connected to a PLC which has the ladder program shown in Figure 14.25. What is the sequence of the cylinders? Programs 273 a– b– a+ B A A– A+ B– B+ c– c+ C –V C+ C– Figure 14.24 Problem 5 Start A+ Start B+ a+ b+ C+ c+ A– c+ B– a– b– END Figure 14.25 Problem 5 C– b+ 274 Programmable Logic Controllers 6 The inputs from the limit switches and the start switch and the outputs to the solenoids of the valves shown in Figure 14.26(a) are connected to a PLC which has the ladder program shown in Figure 14.26(b). What is the sequence of the cylinders? a– IR 1 IR 2 Start A+ IR 1 IR 2 IR 1 IR 2 a+ B+ IR 1 IR 2 IR 1 IR 2 IR 1 IR 2 a– IR 1 IR 2 b+ a+ A– A B– A– A+ b– IR 1 IR 1 b+ IR 1 IR 2 B a+ IR 1 B+ IR 2 b– IR 1 B– (a) IR 2 IR 2 a– END (b) Figure 14.26 Problem 6 IR 2 Programs 275 7 Figure 14.27 shows a ladder program involving a counter C460, inputs X400 and X401, internal relays M100 and M101, and an output Y430. X400 is the start switch. Explain how the output Y430 is switched on. X400 M101 M100 X400 M101 C460 RESET X401 C460 K10 M100 OUT Y430 M100 Y430 C460 END Figure 14.27 Problem 7 Appendix: Symbols The following are the main symbols encountered. Ladder programs Semi-graphic form Full graphic form P P N N S S Reset coil R R Retentive memory coil, the state of the associated variable is retained on PLC power fail M M A horizontal link along which power can flow Interconnection of horizontal and vertical power flows Left-hand power connection of a ladder rung Right-hand power connection of a ladder rung Normally open contact Normally closed contact Positive transition-sensing contact, power flow occurs when associated variable changes from 0 to 1. Negative tranistion-sensing contact, power flow occurs when assoaciated variable changes from 1 to 0 Output coil: if the power flow to it is on then the coil state is on Set coil Appendix: Symbols 277 Function blocks Semi-graphic form Full graphic form AV_WEIGHT AV_WEIGHT Horizontal and vertical lines Interconnection of horizontal and vertical signal flows Crossing horizontal and vertical signal flows Blocks with connections Connectors AV_WEIGHT AV_WEIGHT Commonly encountered blocks: BOOL is Boolean signal, INT is integer, REAL is a floating point number, ANY is any form of signal Up-counter counts the number of rising edges at input CU. PV defines the maximum value of the counter. Each new rising edge at CU increments CV by 1. Output Q occurs after set count. R is the reset. Down-counter counts down the number of rising edges at input CU. PV defines the starting value of the counter. Each new rising edge at CU decrements CV by 1. Output Q occurs when count reaches. zero. Up-down counter. It can be used to count up on one input and down on the other. BOOL CTU CU Q BOOL R INT PV BOOL CTD CD Q BOOL LD INT PV BOOL BOOL BOOL BOOL INT CV CV CTUD CU QU CD QD R LD CV PV BOOL INT BOOL INT BOOL BOOL INT 278 Programmable Logic Controllers On-delay timer. When input IN goes true, the elapsed time at about ET starts to increase and when it reaches the set time, specified by input PT, the output Q goes true. Off-delay timer. When input IN goes true, the output Q follows and remains true for the set time after the input Q goes false. Pulse timer. When input IN goes true, output Q follows and remains true for the pulse duration specified by input PT. BOOL TON IN Q BOOL TIME PT ET TIME BOOL TOF IN Q BOOL TIME PT TIME BOOL TP IN Q BOOL TIME PT TIME ET ET Logic gates A A AND gate & Inputs Output Output Inputs B B A OR gate m 1 Inputs Output B A 1 Input A NAND gate Inputs Output Output & A >1 A Output A Output Inputs B B A XOR Gate Output Inputs B Output Inputs A Input B NOR Gate Output Inputs B Not gate A Inputs B =1 Output A Inputs B Output Appendix: Symbols 279 Sequential function charts Start step. This defines the step which will be activated when the PLC is Cold-started. Start Transition condition. Every transition must have a condition. One that always occurs should be shown with the condition TRUE. Step in a program Every step can have an associated action. An action describes the bahviour that occurs when the step is activated. Each action can have a qualifier: N indicates the action is executed while the step is active. If no qualifier is indicated it is taken to be N. Step Step Action Qualifier D: time delayed action which starts after a given time. Selective branching Parallel branching when the transition occurs Convergence when both transitions occur Simultaneous convergence Instruction List (IEC 1131-3 symbols) LD LDN ST S R AND ANDN OR ORN N Start a rung with an open contact. Start a rung with a closed contact An output Set true Reset false Boolean AND Booleand NAND Boolean OR Boolean NOR