Sie sind auf Seite 1von 46

Prepared by Eng.

Mohammed Mamdouh

Lesson (1) Main points:


An overall look at programmable logic controllers Components of PLC Digital input devices Digital output devices Hardware wiring

--

An overall look at programmable logic controller

A Programmable Logic Controller (PLC) is a user friendly, microprocessor based, specialized computer that carries out control functions of many types and levels of complexity. It can be programmed, controlled, and operated by a person unskilled in operating computers. The PLC's operator essentially draws the lines and devices of ladder diagrams. The resulting drawing in the computer takes the place of much of the external wiring required for control of process. the PLC will operate any system that has output devices that go on and off (digital). It can also operate any system with variable outputs (analog).

Advantages of PLC:
Flexibility Implementing changes and correcting errors Large quantities of contacts Lower cost Visual observation Speed of operation Reliability Ease of changes by reprogramming

--

Component of PLC
A PLC consist of:
Central processing unit(CPU): which is a microprocessor that coordinate the activities of the PLC system. It executes the program, processing I/O signals and communicate with external devices. Memory: the area in which information is stored I/O Modules :the input has terminal into which the user enters outside process electrical signals. The output module has another set of terminals that send action signals to the process Programmer/ Monitor: It is keyboard on which the program instructions are typed by the user. Power supply: the electrical supply that converts AC voltage to operational DC voltage required for the CPU

--

PLC scan cycle


A PLC works by continually scanning a program. We can think of this scan as consisting of three important steps. Step 1 First the plc takes a look at each input to determine if it is on or off. In other words is the sensors connected to the input terminal is on or not. It records this data into the memory to be used in the next step. Step 2 Next the PLC execute your program one instruction at a time depending on the status of the inputs. Then it will store the execution results to be used in the next step. Step 3 Finally the PLC updates the status of the outputs status according to the last two steps. After the third step the PLC goes back to step one and repeats the steps continuously

Check input status

Execute program

Update output status

--

Digital signal
Digital signal is an electrical signal that varies in discrete steps on (24V or 5V) and off(0V). Digital signal is composed only of electrical pulses representing either zero or one so it is non-sequentially changing value written as the number like 0,1,2,3,but it can be written as digital values of 0 or 1.

Digital input devices


Inputs come from sensors that translate physical phenomena into electrical signals. Typical examples of sensors are : Limit switch Inductive proximity Capacitive proximity Photoelectric sensors

These sensors allow a PLC to detect the state of a process being true or false. Now will study each one of them in more details

--

Limit switch
A typical limit switch consists of a switch body and an operating head. The switch body includes electrical contacts to energize and deenergize a circuit. The operating head incorporates some type of lever arm or plunger, referred to as an actuator.

The standard limit switch is a mechanical device that uses physical contact to detect the presence of an object (target).When the target comes in contact with the actuator, theactuator is rotated from its normal position to the operating position. This mechanical operation activates contacts within theswitch body.

Principle of Operation:
A number of terms must be understood to understand how a mechanical limit switch operates. The free position is the position of the actuator when no external force is applied. Pretravel is the distance or angle traveled in moving the actuator from the free position to the operating position. The operating position is where contacts in the limit switchchange from their normal state (NO or NC) to their operated state. Overtravel is the distance the actuator can travel safely beyond the operating point. Differential travel is the distance traveled between the operating position and the release position. The release position is where the contacts change from their operated state to their normal state. Release travel is the distance traveled from the release position to the free position.

--

Momentary Operation One type of actuator operation is momentary. When the target comes in contact with the actuator, it rotates the actuator from the free position, through the pretravel area, to the operating position. At this point the electrical contacts in the switch body change state. A spring returns the actuator lever and electrical contacts to their free position when the actuator is no longer in contact with the target.

Maintained Operation In many applications it is desirable to have the actuator lever and electrical contacts remain in their operated state after the actuator is no longer in contact with the target. This is referred to as maintained operation. With maintained operation the actuator lever and contacts return to their free position when a force is applied to the actuator in the opposite direction. A forkstyle actuator is typically used for this application.

--

Actuators Several types of actuators are available for limit switches, some of which are shown below. The type of actuator selected depends on the application.

Fork

Roller Lever: The standard roller is used for most rotary lever applications. It is available in various lengths. When the length of the roller lever is unknown, adjustable length levers are available. Fork: The fork style actuator must be physically reset after each operation and is ideally suited for transverse movement control.

--

Inductive proximity sensor


Inductive proximity sensors is used to detect the presence of an object without coming into physical contact with it. Inductive proximity sensors are available in a variety of sizes and configurations to meet varying applications.

The sensor incorporates an electromagnetic coil which is used to detect the presence of a conductive metal object. The sensor will ignore the presence of an object if it is not metal.

Principle of operation inductive proximity sensors are operated using an Eddy Current Killed Oscillator (ECKO) principle. This type of sensor consists of four elements: coil, oscillator, trigger circuit, and an output. The oscillator is an inductive capacitive tuned circuit that creates a radio frequency. The electromagnetic field produced by the oscillator is emitted from the coil away from the face of the sensor. The circuit has just enough feedback from the field to keep the oscillator going.

When a metal target enters the field, eddy currents circulate within the target. This causes a load on the sensor, decreasing the amplitude of the electromagnetic field. As the target approaches the sensor the eddy currents increase, increasing the load on the oscillator and further decreasing the amplitude of the field. The trigger circuit

- -

monitors the oscillators amplitude and at a predetermined level switches the output state of the sensor from its normal condition (on or off). As the target moves away from the sensor, the oscillators amplitude increases. At a predetermined level the trigger switches the output state of the sensor back to its normal condition (on or off).

Shielding Proximity sensors contain coils that are wound in ferrite cores. They can be shielded or unshielded. Unshielded sensors usually have a greater sensing distance than shielded sensors. The ferrite core concentrates the radiated field in the direction of use. A shielded proximity sensor has a metal ring placed around the core to restrict the lateral radiation of the field.

Note that the sensing distance is affected by the area of the target.The smaller the area of the target the closer it must be to the sensing face to be detected.

- -

Capacitive proximity sensor

Capacitive proximity sensors are similar to inductive proximity sensors. The main difference between the two types is that capacitive proximity sensors produce an electrostatic field instead of an electromagnetic field. Capacitive proximity switches will sense metal as well as nonmetallic materials such as paper, glass, liquids, and cloth.

The sensing surface of a capacitive sensor is formed by two concentrically shaped metal electrodes of an unwound capacitor. When an object nears the sensing surface it enters the electrostatic field of the electrodes and changes the capacitance in an oscillator circuit. As a result, the oscillator begins oscillating. The trigger circuit reads the oscillators amplitude and when it reaches a specific level the output state of the sensor changes. As the target moves away from the sensor the oscillators amplitude decreases, switching the sensor output back to its original state. Capacitive sensors depend on the dielectric constant of the target. The larger the dielectric number of a material the easier it is to detect.

Detection Through Barriers One application for capacitive proximity sensors is level detection through a barrier. For example, water has a much higher dielectric than plastic. This gives the sensor the ability to see through the plastic and detect the water.

- -

Photoelectric sensor
A photoelectric sensor is another type of position sensing device. Photoelectric sensors, use a modulated light beam that is either broken or reflected by the target. The control consists of an emitter (light source), a receiver to detect the emitted light, and associated electronics that evaluate and amplify the detected signal causing the photoelectrics output switch to change state. We are all familiar with the simple application of a photoelectric sensor placed in the entrance of a store to alert the presence of a customer. This, of course, is only one possible application. Principle of operation Optical sensors require both a light source (emitter) and detector. Emitters will produce light beams in the visible and invisible spectrums using LEDs and laser diodes. Detectors are typically built with photodiodes or phototransistors. The emitter and detector are positioned so that an object will block or reflect a beam when present. A basic optical sensor is shown in Figure .

the light beam is generated on the left, focused through a lens. At the detector side the beam is focused on the detector with a second lens. If the beam is broken the detector will indicate an object is present. The oscillating light wave is used so that the sensor can filter out normal light in the room. The light from the emitter is turned on and off at a set frequency. When the detector receives the light it checks to make sure that it is at the same frequency. If light is being received at the right frequency then the beam is not broken. The frequency of oscillation is in the KHz range, and too fast to be noticed.

- -

Digital output devices(actuators)


Actuators Drive motions in mechanical systems. Most often this is by converting electrical energy into some form of mechanical motion. such as solenoids, valves and motors Solenoids Solenoids are the most common actuator components. The basic principle of operation is there is a moving ferrous core (a piston) that will move inside wire coil as shown in Figure . Normally the piston is held outside the coil by a spring. When a voltage is applied to the coil and current flows, the coil builds up a magnetic field that attracts the piston and pulls it into the center of the coil. The piston can be used to supply a linear force. Well known applications of these include pneumatic values and car door openers.

Valves The flow of fluids and air can be controlled with solenoid controlled valves. An example of a solenoid controlled valve is shown in the following Figure. The solenoid is mounted on the side. When actuated it will drive the central spool left. The top of the valve body has two ports that will be connected to a device such as a hydraulic cylinder. The bottom of the valve body has a single pressure line in the center with two exhausts to the side. In the top drawing the power flows in through the center to the right hand cylinder port. The left hand cylinder port is allowed to exit through an exhaust port. In the bottom drawing the solenoid is in a new position and the pressure is now applied to the left hand port on the top, and the right hand port can exhaust. The symbols to the left of the figure show the schematic equivalent of the actual valve positions. Valves are also available that allow the valves to be blocked when unused.

- -

Motors Motors are common actuators, but for logical control applications their properties are not that important. Typically logical control of motors consists of switching low current motors directly with a PLC, or for more powerful motors using a relay or motor starter.

- -

Hardware wiring
Input wiring

Output wiring

- -

- -

Lesson (2)

Main points:
Ladder logic A systematic approach of control system design using programmable controller Memory mapping Examples

- -

Ladder logic
Ladder logic is the main programming method used for plc nowadays. Experience has shown that when individual learns to program one type of PLC he can easily master other plc system. An example of ladder logic can be seen in Figure. To interpret this diagram imagine that the power is on the vertical line on the left hand side, we call this the hot rail. On the right hand side is the neutral rail. In the figure there are two rungs, and on each rung there are combinations of inputs (two vertical lines) and outputs . If the inputs are opened or closed in the right combination the power can flow from the hot rail, through the inputs, to power the outputs, and finally to the neutral rail. An input can come from a sensor, switch, or any other type of sensor. An output will be some device outside the PLC that is switched on or off, such as lights or motors. In the top rung the contacts are normally open and normally closed. Which means if input A is on and input B is off, then power will flow through the output and activate it. Any other combination of input values will result in the output X being off. Note: When A is pushed, the output B will turn on, and the input B will also turn on and keep B on permanently until power is removed.

The second rung of Figure 2.5 is more complex, there are actually multiple combinations of inputs that will result in the output Y turning on. On the left most part of the rung, power could flow through the top if C is off and D is on. Power could also (and simultaneously) flow through the bottom if both E and F are true. This would get power half way across the rung, and then if G or H is true the power will be delivered to output Y. In later chapters we will examine how to interpret and construct these diagrams. There are other methods for programming PLCs. One of the earliest techniques involved mnemonic instructions. These instructions can be derived directly from the ladder logic diagrams and entered into the PLC through a simple programming terminal.

- -

Normally open, an active input x will close the contact and allow power to flow.

Normally closed, power flows when the input x is not activated

Normally open output, when power is applied (on) the output x is activated

- -

A systematic approach of control system design using programmable controller

The concept of controlling system is a very simple and easy task. It involves a systematic approach by following the operation procedure 1. Determine the machine sequence of operation Firstly, you have to decide what equipment or system you want to control and the sequence of operation you required for completing the process . 2. Assignment of inputs and outputs Secondly, all external input and output devices to be connected to programmable controllers must be determined. The input devices are the various switches, sensors, etc. the out put devices are solenoids, valves, motors, etc.After identifying all the various input and output devices, assign the numbers corresponding to the input and output number of particular programmable controller you will use. 3. Writing of the program Next, write the ladder diagram by following the control system sequence of operation as determined by step one. 4. Programming into memory Now, you can store your program in the memory. After completion of programming you should check for any coding errors by means of diagnostic function. 5. Running the system before the start push-button is pressed, thoroughly ensure that the input and output wiring are correctly connected according to the I/O assignment. Once confirmed, the actual operation of the plc can now be started

- -

- -

Memory mapping

To study PLC you must know the memory mapping of the data memory of this PLC, the PLC data memory is divided into several parts , every part have a name and specification, these parts called devices. MK 120S data memory divided to: 1. P area (input and output image) This device is used for real inputs and real outputs only, you can change these device status using hardware. If you put 24V on P0 input and the bit of P0 is high(on). Note : number of this devices is limited to PLC model 2. M area (auxiliary relay 'markers') This device is used for not real input and not real outputs, you can only write in these bits using software instruction Note : number of this devices is limited to PLC model 3. K area (keep relay) These devices are the same like m devices but it can keep its value even if power is off and on again. Note : number of this devices is limited to PLC model 4. F area (special relay 'flags') These special relays are predetermined flags each one make one predetermined job and cannot be changed Example : F10 always on flag F11 always off flag F93 give pulse every second

- -

Examples
1) Write a program to control motor through push button but motor should not stop after releasing the button but it should stop only if by bushing another button. By following the approach mentioned earlier: 1. Determine the machine sequence of operation Starting and stopping a motor by using different start and stop push button 2. Assignment of inputs and outputs inputs start stop outputs P40 Motor run

P0 P1

3. Writing of the program

- -

2) Write a program to control two motor each one has its start and stop buttons. The two motor must not operate simultaneously. 1. Determine the machine sequence of operation Starting and stopping the two motors by using different start and stop push buttons using interlock to ensure that they will not operate 2. Assignment of inputs and outputs P0 P1 P2 P3 inputs Start first motor Stop first motor Start second motor Stop second motor P40 P41 outputs Run first motor Run second motor

3. Writing of the program

- -

3)

For the robot shown in the figure it is require to transfer the piece of work from a conveyor A to a conveyor B.

1. Determine the machine sequence of operation when the start button is pressed the robot rotate its arm clock clockwise when the robot arm has moved to the position of work in conveyor A, the arm grasps the work when the arm has grasped the work , it rotates counterclockwise when the arm has rotated to the position of conveyor B, it release the work stop button is used to stop the operation and another reset button can be used to reset the operation 2. Assignment of inputs and outputs inputs P0 P1 P2 P3 P4 P5 P6 start Ls1 Ls2 Ls3 Photo sensor stop reset P40 P41 P42 P43 outputs Sol 1 Sol 2 Sol 3(grasp) Conveyor A

- -

3. Writing of the program

- -

Lesson (3)

Main points:

Timers Type of timers Examples

- -

Timers
The most commonly used process control device in PLC after coils and contact is the timers. Timer is an instruction that wait a set amount of time before doing an action. This action depend on the type of the timer, for example there are on delay timer and off delay timer and others. On delay timer This type of timer simply delays turning on. In other words, after a sensor (input) turns on we wait a set number of second before activating the output. This is the most common timer. It is called TON Off delay timer This type of timer is the opposite of the on delay timer. This timer delays turning off. After a sensor (input) detects a target we turn on the output. When the sensor no longer detect the target the output is hold on for a certain time before turning off. It is called TOFF . For any type of timers we should determine two things : 1. what will enable the timer? Typically this is one of the inputs (sensors). 2. the amount of time it will delay before taking an action. When the instructions before the timer symbol are true the timer starts ticking. When the setting time elapses the timer will automatically change the status of its contacts. Typically LG MK series offers several different ticks , 10 and 100 ms increments(ticks of the clock). These different increment timers work in the same way but they have different names to show their time base. Timer instruction symbol

Type

Name

Setting value

As shown in the figure the first variable determine the type of the timer, the second variable is the name of the timer and its associated contacts and also it determines the time base of the timer. For example in LG MK 120S (T000 to T191)are 100 ms based timer and (T92 T 250) are 100 ms based timers. The third variable is the setting value. In this example the setting time will equal 100x 100 =10000ms (10sec) this mean that the timer will hold 10 seconds before it react.

- -

On delay timer (TON)


Function: The timer is started on the rising edge at the input condition. The current value increases from 0 to the setting value v. The output of the timer changes to 1 when the current value reaches the setting value. The timer output remains at 1 as long as a falling edge is not detected at input condition. When the falling edge is detected at the input, the timer is stopped, even if the timer has not reached the setting value. Example:

P0040

- -

Off delay timer (TOFF)


The current value is set to the setting value v on the rising edge at the input condition When the falling edge is detected on the input, the timer is started. The current value decreases from the setting value v. When the current value reaches to 0 , the timer output becomes OFF . Example:

P0040

- -

Monostable timer (TMON)

The current value is set to the setting value v on the rising edge at the input condition. The current value starts to decreases from the setting value v . When the current value reaches to 0 , the output of the timer becomes OFF . During the timer turns to be ON , even if the input condition of the timer is changed to ON/OFF, the timer keeps ON. RST Txxxx Command enables to clear the output of the timer and the current value. This timer can be used to obtain a stabilized signal from a noisy input signal. Example:

P0040

- -

Integral timer (TMR)

In general, its operation is same as on-delay timer. Only the difference is the current value will not be clear when the input condition of TMR instruction is turned off. It keeps the elapsed value and restart to increase when the input condition is turned on again. When the current value reaches preset value, the timer output relay is turned on. The current value can be cleared by the RST instruction only.

- -

Retriggerable timer (TRTG)

The operation of retriggerable timer is same as that of monostable timer. Only difference is that the retriggerable timer is not ignore the input condition of TRTG instruction while the timer is operating (decreasing). The current value of retriggerable timer will be set as preset value whenever the input condition of TRTG instruction is turned on.
REMARK

- -

Examples:

1. write a program to make a lamp flicker for 0.4 second and repeated periodically every 1 second. Assignment of inputs and outputs Inputs P0 Start P40 Outputs lamp

Writing the program

P0000

P040

- -

2. write a program to control a motor such that it will rotate in the forward direction for 10 second then rotate in the reverse direction for 20 second and repeat this until a stop button is pushed Assignment of inputs and outputs Inputs P0 P1 Writing the program Start Stop P40 P41 Outputs Forward rotation Reverse rotation

- -

3. write a program to control three conveyor such that when the start pushbutton is pressed conveyor C runs then B after 10second then A after 10 from B. and when stop pushbutton is pressed A stop first then B after it by 10 second then C after B by 10 second . Assignment of inputs and outputs Inputs P0 P1 Writing the program Start Stop P40 P41 P42 Outputs Conveyor C Conveyor B Conveyor A

- -

Lesson (3)

Main points:
Counters Type pf counters Examples

- -

Counters

The function of the counters is to count the occurrence of a certain action to a predetermined number(setting value) and then react (change the status of its contacts). They have two input one is connected to the pulses which is counted and the other is used to reset the counter. Up counter, down counter, up down counter and ring counter are different examples for counters which will be explain in details.

counter contact number

Count pulse

Reset signal

Setting value

- -

Up counter(CTU)
The counter is started on the rising edge at the input condition (U). The current value increases from 0 to the setting value v by one unit for each pulse. The output of the counter changes to 1 when the current value reaches the setting value and the current value of the counter increases up to the maximum value(65535) continuously Example:

P040

- -

Down counter (CTD)


The counter is started on the rising edge at the input condition (D). The current value decreases from the setting value v by one unit for each pulse. The output of the counter changes to 1 when the current value reaches 0 .

P040

- -

Up down counter
The counter is started on the rising edge at the input condition( Up or Down pulse). The current value increases or decreases by one unit for each pulse. The output of the counter changes to 1 when the current value is equal or greater than to the setting value. If the counter pulse is inputted continuously, the current value of the counter increases up to the maximum value(65535) If these two pulses becomes 1 simultaneously, the current value is not changed.

P040

- -

Ring counter (CTR)


The counter is started on the rising edge at the input condition( U ). The current value increases from 0 to the setting value v by one unit for each pulse. The output of the counter changes to 1 when the current value reaches the setting value. If the counter pulse is inputted after the output of the counter becomes ON, the current value of the counter becomes 0 and the output of the counter gets OFF.

P040

- -

Examples :
1. write a program to control four motor such that when PB1 is pressed number of operating motor is increased by one and when PB2 is pressed number of operating motor decrease by one. If PB1 is pressed and the four motor were operating then all the motor should stop. Inputs P0 P1 PB1 PB2 P40 P41 P42 P43 Outputs Motor 1 Motor 2 Motor 3 Motor 4

- -

- -

2. write a program to close a certain switch after one month Input and output assignment Inputs 1 second cycle flag

Outputs P40 Switch

F093

Writing the program

- -