145x Filetype PDF File size 0.17 MB Source: egyankosh.ac.in
UNIT 12 PROGRAMMING OF PLC Programming of PLC Structure 12.1 Introduction Objectives 12.2 Relay Circuits and Ladder Diagram 12.3 Sequential Control using Relay Circuits 12.4 Sequential Control using PLCs 12.5 Sequential Control Charts and GRAFCET 12.6 Advanced PLC Programming 12.7 Summary 12.8 Key Words 12.9 Answers to SAQs 12.1 INTRODUCTION The programming language for PLCs was a carryover from the diagrams used by factory technicians for wiring and trouble shooting hard-wired cabinet. The basic form of programming commonly used with PLCs is Ladder Programming. This involves each program task being specified as though a rung of a ladder. There are some graphical methods also used for PLC programming. In this method of programming what is required is a structured approach for specifying the control program. This is called as graphical programming language (GPL) approach. This is analogous to a flow chart in high-level language. Objectives After studying of this unit, you should be able to • get familiar with Ladder logic, sequential control charts and GRAFCET, • prepare control programs using Ladder logic, and • get familiar with advanced PLC programming techniques. 12.2 RELAY CIRCUITS AND LADDER DIAGRAMS The relay is a low-power device that changes state when voltage is applied to the coil. Figure 12.1 shows the symbolic representation of the relay. With the application of voltage to the relay coil, current flows and magnetic motive force (mmf) is created to energize the magnetic circuit. Once mmf is present in the magnetic circuit, flux flows and the air gap between the steel armature and the steel core is forced closed, changing the state of the set(s) of contacts, i.e. when the relay coil is recognized, the set(s) of contacts change state – the Normally Open (NO) contacts are closed and the Normally Closed (NC) contacts are opened. 23 Mechatronics Figure 12.1 : Symbolic Representation of a Relay Figure 12.2 is a circuit diagram for lighting on and off a lamp using momentary contact push button (PB) switches. PB1 and PB2 are normally closed and normally open push button switches respectively. When PB1 is pressed, an open circuit is created at PB1; when PB1 is released, the circuit closes again. When PB2 is pressed, the circuit is closed at that point; when PB2 is released, the circuit reopens again. Coil C and contact C operate together. Figure 12.2 : Circuit Diagram of On/Off Control of a Lamp When the power source is initially turned ON, the lamp remains OFF because no closed path exists around the circuit. In order to light the lamp, PB2 must be pressed. When PB2 is momentarily pressed, a closed circuit exist through PB1 and PB2, lighting the lamp and energizing coil C. Coil C is also referred to as a control relay. When coil C is energized, contact C closes. Coil C ‘controls’ contact C. When PB2 is released, the lamp continues to operate because continuity around the circuit now exists through PB1 and contact C, which is now closed. The lamp can be switched off by pressing contact PB1 momentarily. This action opens the circuit, de-energizing coil C and, consequently, opens contact C. The lamp remains off until restarted using PB2. Figure 12.2 is a circuit diagram. However, factory control diagrams follow a different format called ladder logic diagram. The ladder diagram involves writing a program in a similar manner to drawing a switching circuit. The ladder diagram consists of two vertical lines representing the powder rails. Circuits are connected as horizontal lines, i.e. the rungs of the ladder, between these two verticals. In drawing the circuit line for a rung, inputs must always precede outputs and there must be at least one output on each line. Each rung must start with an input or a series of inputs and end with an output. The correspondence between a circuit and a ladder diagram can be seen in Figure 12.3. The Boolean logic for circuit is shown to the right of each rung. Using the two ladder rungs of Figure 12.3, the logic for lighting the lamp is complete. This brings us to the function of programmable logic controller. 24 Programming of PLC Figure 12.3 : Ladder Diagram of Figure 12.2 If Figure 12.3 represents a hard-wired circuit, then there are three hard-wire components necessary to operate the motor : two push button switches (PB1 and PB2) and one control relay (C). But, when considering PLC we can eliminate the coil and contact by programming the Boolean equations internally using certain logic steps. Figure 12.4 is a block diagram showing the equivalent operation on a PLC. Figure 12.4 : PLC Input/Output Writing and Program to Perform Function of Relay Circuit of Figure 12.2 The two push button contacts are wired as inputs to the PLC and the motor is wired as an output. The program consists of two Boolean equations, which come from the ladder diagram of Figure 12.3. The PLC operates by continuously looping through the program, evaluating each equation sequentially. If the conditions on the right-hand side of the Boolean equations are true, the memory location of the binary variable on the left hand side is set (1) accordingly. If the argument is not true, the binary variable is reset (0). The execution sequence for lighting the lamp on and off is shown in Table 12.1. This corresponds to the logic given in Figure 12.4. Table 12.1 : State Table for Figure 12.4 PB1 PB2 C Lamp 1 0 0 0 1 1 1 1 1 0 1 1 0 0 0 0 SAQ 1 Draw the relay ladder rung for the following problems : (i) Two push button switches are normally open and both have to be closed for a motor to be operated. (ii) Either of the two normally open switches has to be closed for a coil to be energized and operate an actuator. 25 Mechatronics 12.3 SEQUENTIAL CONTROL USING RELAY CIRCUITS When sequential control systems were hard-wired, a standard set of symbols was developed to document the control logic. The most commonly used of these symbols are shown in Figure 12.5. For the purpose of description, these symbols are grouped as follows : coils and their contacts, external contact devices, and activated devices. Figure 12.5 : Relay Ladder Logic Symbols Contacts that are coil-operated are typically part of the internal electrical control logic. There are other contacts that are mechanical closures operated by forces outside the internal electrical control logic. The push button momentary contact switch is used primarily for initiating or terminating system operation. The control circuit is used to drive actuators, or activated devices. The motor starter symbol indicates a motor as an activated device. It is also typical to have lamps being activated during system operation. The use of these symbols documenting a control circuit is illustrated in the following example. Figure 12.6 shows an example of a latching (self-holding) circuit. 26
no reviews yet
Please Login to review.