Sie sind auf Seite 1von 13

PLC: The basics Tutorial

This site exists to provide basic information about Programmable Logic Controllers without a bias toward any particular manufacturer. What is a PLC? NEMA, the National Electrical Manufacturers Association, defines a programmable logic controller (PLC) as: a programmable controller is a digitally operating electronic apparatus which uses a programmable memory for the internal storage of instructions for implementing specific functions, such as logic, sequencing, timing, counting and arithmetic, to control through digital or analog input/output, various types of machines or process. Programmable Logic Controllers, programmable controllers, or PLCs are specialized industrial computers. The PLC accepts inputs from switches and sensors (measures or senses the system), evaluates these based on a program (logic), and changes the state of outputs to control a machine or process.

Initially, programmable logic controllers were used to replace traditional hard-wired relay logic; however, with its ever increasing functionality it is found in many more complex applications. PLCs are used in any industrial application where operating requirements are complex, are constantly changing, or where high reliability is necessary.

A Very Brief History of the PLC


The advent of the PLC began in the 1960's and 1970's to replace traditional "hard-wired" controls, and has since become the predominant choice for industrial controls. Before PLCs, much of machine control relied on contacts and relays providing hard-wired "logic" for machine controls. Changes to the logic were labor intensive and costly. In 1968, GM's Hydramatic division specified the design criteria for what would become the first

programmable logic controller. They requested a solid-state system that would: survive the industrial environment be easily programmed by plant engineers and technicians, and be easily reprogrammed and re-used

The winning proposal came from Bedford Associate - which introduced the MOdular DIgital CONtroller (MODICON). The MODICON is still a popular brand of PLC today, but is owned by Schneider Electric. Other prevalent PLC brands today are: Allen-Bradley, Siemens, Omron, and GE. The Automotive Industry was a major early adopter of programmable logic controllers (PLC). They wanted a programming method that could be easily understood by their existing controls engineers and technicians. The result of this desire was a programming language called Relay Ladder Logic (or "ladder logic"). The layout of Ladder Logic is very similar to reading the diagrams for hard wired relay controls. Ladder Logic is still one of the most popular "language" for programming PLCs, but many others have developed over the years.

Basic PLC Components


Programmable controllers have grown throughout industrial control applications because of the ease they bring to creating a controller: ease of programming, ease of wiring, ease of installation, and ease of changing. PLCs span a wide range of sizes, but all contain six basic components: 1. processor or central processing unit (CPU); 2. rack or mounting; 3. input assembly; 4. output assembly; 5. power supply; 6. programming unit, device, or PC/software

We will start with explaining the physical components you see when looking at a PLC system and then explore what goes on inside each part, and how the components relate to each other. Rack Assembly Most medium to large PLC systems are assembled such that the individual components - CPU, Input/Output, Power Supply - are modules that are held together within a rack. In smaller PLC systems - all of these components may be contained in a single housing or "brick" - these smaller systems are sometimes referred to as "bricks" or "shoebox" PLCs. Power Supply The power supply provides power for the PLC system. The power supply provides internal DC current to operate the processor logic circuitry and input/output assemblies. Common power levels used are 24V DC or 120 VAC. Processor (CPU) The processor, central processing unit, or CPU is the "brain" of the PLC. The size and type of CPU will determine things like: the programming functions available, size of the application logic available, amount of memory available, and processing speed. Understanding the CPU can be a complex subject and we will tackle that in other articles. Input/Output Assembly Inputs carry signals from the process into the controller, they can be input switches, pressure sensors, operator inputs, etc. These are like the senses and sensors of the PLC. Outputs are the devices that the PLC uses to send changes out to the world. These are the actuator the PLC can change to adjust or control the process - motors, lights, relays, pumps, etc. Many types of inputs and outputs can be connected to a PLC, and they can all be divided into two large groups - analog and digital. Digital inputs and outputs are those that operate due to a discrete or binary change - on/off, yes/no. Analog inputs and outputs change continuously over a variable range - pressure, temperature, potentiometer. Programming Device The PLC is programmed using a specialty programmer or software on a computer that can load and change the logic inside. Most modern PLCs are programmed using software on a PC or laptop computer. Older systems used a custom programming device.

Basic Operation of a PLC system


The operation of the PLC system is simple and straightforward. The Process or CPU completes three processes: (1) scans, or reads, from the input devices (2) executes or "solves" the program logic, and (3) updates, or writes, to the output devices.

PLC Program For the PLC to be useful, it must first have a Program or Logic for the CPU to execute. A system engineer or PLC programmer will first create the program logic in a programming device (these days it is usually software running on a personal computer). This logic can be written in Ladder Logic, Instruction List, Sequential Function Charts, or any of the IEC languages. The programmer will then download the program to the PLC. This is usually done by temporarily connecting the programmer to the PLC. Once the program is installed or downloaded to the CPU - it is usually not necessary for the PC to remain connected. Basic Scan Once the program is in the CPU - the PLC is then set to "run", and the PLC executes the application program repeatedly. In addition to executing the program, the CPU regularly reads the status of the input devices, and sends data to the output devices. The Input system senses the status of the real world inputs (a switch, a level, etc.), translates them to values that can be used by the CPU, and writes those values to the Input table. The application program is executed, and writes values to the Output table. The Output system then converts the output value to a real world change (motor turns on, valve opens, etc.) This process of reading inputs, executing logic, and writing outputs is called the PLC Scan or Sweep.

The CPU continuously Reads Inputs, Solves Logic, and Writes to the outputs (there are other tasks the CPU does - which will be discussed later). It is important to understand the scan because it may dictate how a programmer structures logic. Memory The control program or application program is stored in memory. As the PLC executes logic, it may also read and store values to memory. The values may also be used and refernced by the application program.

PLC Input and Output Devices


The term I/O refers to Input/Output. I/O is information representing the data that is received from sensing devices and the commands that are sent to actuating and indicating devices. The I/O System is the collection of physical elements of the control system that either provide or use I/O data. There are two major types of I/O: 1. Digital - binary devices which must be in one of only two states: on or off. 2. Analog - continuos devices - sense and respond to a range of values.

Digital IO Digital input devices may be either on or off; they may not hold any other values. For example, digital position sensors do not sense how close an object is, they only tell if the object is within a range of positions. Common digital field input devices include pushbuttons, limit switches, and photoeyes. Common digital output devices include relays, motor starters, and solenoid valves. Analog IO Analog input devices sense continuous parameters. The information that they provide is given as a continuous range of values, not just an on or off indicator. Common analog inputs

are pressure, temperature, speed, etc. Analog output devices respond to a range of output values from the controller. Common analog output signals include motor speed, valve position, air pressure, etc. I/O modules connect "real world" field devices to the controller. They convert the electrical signals used in the field devices into electronic signals that can be used by the control system, and translate real world values to IO table values. I/O modules communicate with PLC CPU in one of three ways: Backplane - The I/O modules can be located in the same rack or station. Communications then takes place within the rack or across the backplane. Backplane extension - backplane extension modules allow I/O modules to be located in racks or stations which are separated from the controller. Device network - modules can communicate with a controller over a network. Industrial networks are used to interconnect field level devices with controllers. Common IO networks are FieldBus, Profibus, and DeviceNet. "Point Count" and the Size of the PLC System The number of I/O devices used within a control system is called its point count. Analog device data requires significantly more manipulation and processing than digital device data. Digital and analog point counts are typically considered separately. The total number of digital and analog points is used to give an indication of the size of a control system.

Ladder Logic
Ladder Logic, or Ladder Diagrams is the most common programming language used to program a PLC

Ladder logic was one of the first programming approaches used in PLCs because it borrowed heavily from the Relay Diagrams that plant electricians already knew. The symbols used in Relay Ladder Logic consists of a power rail to the left, a second power rail to the right, and individual circuits that connect the left power rail to the right. The logic of each circuit (or rung) is solved from left to right. The symbols of these diagrams look like a ladder with two side rails and circuits that resemble rungs on a ladder. The picture above has a single circuit or "rung" of ladder. 1. If Input1 is ON (or true) - power (logic) completes the circuit from the left rail to the right rail - and Output1 turns ON (or true). 2. If Output1 is OFF (or false) - then the circuit is not completed and logic does not flow to the right - and Output 1 is OFF.

There are many logic symbols available in Ladder Logic - including Timers, Counters, Math, and Data Moves - such that any logical condition or control loop can be represented in Ladder Logic. With just a handful of basic symbols - a Normally Open Contact, Normally Closed Contact, Normally Open Coil, Normally Closed Coil, Timer, Counter - most logical conditions can be represented. Ladder Logic Basics: Contacts & Coils Part 1 - Normally Open

With just the Normally Open Contact and Normally Open Coil - a surprising array of basic logical conditions can be represented.

Normally Open Contact. This can be used to represent any input to the control logic - a switch or sensor, a contact from an output, or an internal output. When "solved" the referenced input is examined for an ON (logical 1) condition. If it is ON, the contact will close and allow power (logic) to flow from left to right. If the status is OFF (logical 0), the contact is Open, power (logic) will NOT flow from left to right.

Normally Open Coil. This can be used to represent any discrete output from the control logic. When "solved" if the logic to the left of the coil is TRUE, the refrenced output is ON (logical 1). Solving a Single Rung

Suppose a switch is wired to Input1, and a light bulb is wired through Output1 in such a way that the light is OFF when Output1 is OFF, and ON when Output1 is ON. When Input1 is OFF (logical 0) the contact remains open and power cannot flow from left to right. Therefore, Output1 remains OFF (logical 0). When Input1 is ON (logical 1) then the contact closes, power flows from left to right, and Output1 becomes ON (the light turns ON).

Ladder Logic Basics: Contacts & Coils Part 2 - Normally Closed

Another set of basic contacts and coils that can be used in Ladder Logic are the Normally Closed Contact and the Normally Closed Coil. These work just like their normally open counterparts only in the opposite

When "solved" the referenced input is examined for an OFF condition. If the status is OFF (logical 0) power (logic) will flow from left to right. If the status is ON, power will not flow.

When "solved" if the coil is a logical 0, power will be turned on to the device. If logical 1, power will be OFF. Ladder Logic Basics : The AND rung, the OR rung The AND Rung The AND is a basic fundamental logic condition that is easy to directly represent in Ladder Logic.

Suppose a switch is wired to Switch1, a second switch is wired to Switch2, and a light bulb is wired through Light1 in such a way that the light is OFF when Light1 is OFF, and ON when Light1 is ON. This might be very similar to a hallway light in a house where two switches at either end of the hallway can turn the light off or on. In order for Light1 to turn ON, Switch1 must be ON, AND Switch2 must be ON. If Switch1 is OFF, power (logic) flow from the left rail, but stops at Switch1. Light1 will be OFF regardless of the state of Switch2. If Switch1 is ON, power makes it to Switch2. If Switch2 is OFF, power cannot flow any further to the right, and Light1 is OFF. If Switch1 is ON, AND Switch2 is ON - power flows to Light1 solving its state to ON. The OR Rung The OR is a logical condition that is easy to represent in Ladder Logic.

Suppose a switch is wired to Switch1, a second switch is wired to Switch2, and a light bulb is wired through Light1 in such a way that the light is OFF when Light1 is OFF, and ON when Light1 is ON. In this instance, we want to the light to turn ON if either Switch1 OR Switch2 is ON. If Switch1 is ON - power flows to Light1 turning it ON. If Switch2 is ON - power flows through the Switch2 contact, and up the rail to Light1 - turning it ON. If Switch1 AND Switch 2 are ON - Light1 is ON. The only way Light1 is OFF is if Switch1 AND Switch2 are OFF.

Basic Timers & Counters


Many times we will want to take action in a control program based on more than the states of discrete inputs and outputs. Sometimes, we will want to turn something on after a delay, or count the number of times a switch is hit. To do these simple tasks, we will need Timers & Counters. Simple Timers A timer is simply a control block that takes an input and changes an output based on time. There are two basic timer types we will deal with initially (there are other advanced timers, but we will start with the basics first) - On-Delay Timer and the Off-Delay Timer. 1. On-Delay Timer - this timer takes an input, waits a specific amount of time, then turns ON an output (or allows logic to flow after the delay). 2. Off-Delay Timer - this timer takes turns ON an output (or allows logic to flow) and keeps that output ON until the set amount of time has passed, then turns it OFF (hence off-delay) Simple Counter A counter simply counts the number of events that occur on an input. There are two basic types of counters - Up counter and a Down counter. 1. Up Counter - as its name implies, whenever a triggering event occurs, an up counter increments the counter. 2. Down Counter - whenever a triggering event occurs, a down counter decrements the counter.

PLC Communications

To control a machine or process, many times multiple controllers or intelligent devices must work together to accomplish the task. In order to work together, these devices must communicate. In order to program a PLC, communications must take place - becasue the Programming device (computer) must communicate with the PLC CPU in order to transfer the configuration and control logic before the PLC can even begin to run. For these reasons, it is important for anyon in automation to have a basic understanding of PLC communications. Types of Communications There are three basic levels/categories of communications that we are usually concerned with in industrial control: serial communications, industrial communications networks, and industrial I/O networks. The most basic form of communication is a direct, one way, connection between two devices where data is transmitted one bit at a time. We call this serial communication.

Industrial Network Communications


An Industrial Network is a system of electronic devices that are connected in order to share information. The network can consist of PLC Controllers, I/O Devices, Operator Interfaces, HMI/SCADA computers, and many other elements. Each element is uniquely addressable giving each component (controllers, I/O devices, Operator interfaces, etc) a unique name or label. Industrial networks provide bi-directional, real-time, (sometimes deterministic)communication. Each element has specific electronic components to allow the transfer of data between the elements, on a shared media, and according to a protocol. Industrial Network Protocols Network protocols establish the rules that must be followed for two or more devices to share data. They describe how devices establish and maintain communications. Examples of network communication protocols include DeviceNet, Profibus-DP, and Ethernet. Deterministic Network Many industrial networks are deterministic. If a network is deterministic, it means that communication occurs within a predetermined time span. Industrial networks value determinism because many control systems require predictable, real-time response to data. (You would not want to miss a critical alarm because of someone sending a 10Mg e-mail) source: http://www.plctutor.com Last Updated ( Wednesday, 25 November 2009 12:13 ) Comments

#6 2011-02-21 14:45 more details Quote

#5 2010-12-28 16:50 PLC demystified! Quote

#4 2010-12-03 09:12 cdgd Quote

#3 2010-07-24 08:51 I am marine engineer in sri lanka navy and need more details referance Quote

#2 2010-07-24 08:49 i am naval officer sri lanka navy and need more details with example pse temna Quote

#1 2010-07-19 11:39 I am Mechatronics lecturer and I need additional refence. Quote Refresh comments list RSS feed for comments to this post. Add comment Name (required) E-mail (required)

1000 symbols left Notify me of follow-up comments

Refresh

Send JComments

More Tutorials

PLC MEGAPACK PLC MEGAPACK Learn programming PLC the easy way. PLC Fundamentals - THE NUMBER SYSTEM

Boat Lift Controller with Remote - PLC Programming: Relay logic


PLC Ladder Logic Simulator

Ladder Logic Fundamentals and Programming Examples - PLC Tutorial

How to connect S7-300 PLC to a computer?

How to diagnose PLC errors?

Practical real life examples on how to program PLC - advanced examples for PLC.

General PLC Questions


PC PLC Communication PLC Software Type of PLC as per... project idea send a ladder diagramme of... Ask a Question

Siemens PLC Questions


logo! 230rc someone please please please help... Best internet tablet for around... SCADA: WinCC or LabView? I want free ebook Automating... has the pin up look... Please tell me everything about... I am working with SIEMENS... where i can download siemens... what is the latest version...

Allen Bradley PLC Questions


Looking for a new or... Allen Bradley PLC Programming software? Rate and Comment: Caylee Sophia... sources of contamination for allen... how do i program an... can anyboddy use the allen... PLC Allen bradley SLC 500... does anybody know from where... What is Allen-Bradley 1784-PKTX/A? How many digital i/os does...

PLC Books - sometimes you just need a good book.

Das könnte Ihnen auch gefallen