Introduction

Introduction

Control engineering has evolved over time. In the past humans were the main methods for controlling a system. More recently electricity has been used for control and early electrical control was based on relays. These relays allow power to be switched on and off without a mechanical switch. It is common to use relays to make simple logical control decisions. The development of low cost computer has brought the most recent revolution, the Programmable Logic Controller (PLC). The advent of the PLC began in the 1970s, and has become the most common choice for manufacturing controls. PLCs have been gaining popularity on the factory floor and will probably remain predominant for some time to come. Most of this is because of the advantages they offer.

  • Cost effective for controlling complex systems.
  • Flexible and can be reapplied to control other systems quickly and easily.
  • Computational abilities allow more sophisticated control.
  • Trouble shooting  aids  make  programming  easier  and  reduce downtime.
  • Reliable components make these likely to operate for years before failure.

Hardware

Many PLC configurations are available, even from a single vendor. But, in each of these there are common components and concepts. The most essential components are:



  • Power Supply – This can be built into the PLC or be an external Common voltage levels required by the PLC (with and without the power supply) are 24Vdc, 120Vac, 220Vac.
  • CPU (Central Processing Unit) – This is a computer where ladder logic is stored and processed.
  • I/O (Input/Output) – A number of input/output terminals must be provided so that the PLC can monitor the process and initiate actions.
  • Indicator lights – These indicate the status of the PLC including power on, program running, and a fault. These are essential when diagnosing problems.

The configuration of the PLC refers to the packaging of the components. Typical configurations are listed below from largest to smallest as shown in Figure Typical PLC Configuration.

  • Rack – A rack is often large (up to 18” by 30” by 10”) and can hold multiple cards. When necessary, multiple racks can be connected together. These tend to be the highest cost, but also the most flexible and easy to maintain.
  • Mini – These are similar in function to PLC racks, but about half the size.
  • Shoebox – A compact, all-in-one unit (about the size of a shoebox) that has limited expansion capabilities. Lower cost, and compactness make these ideal for small applications.
  • Micro – These units can be as small as a deck of cards. They tend to have fixed quantities of I/O and limited abilities, but costs will be the lowest.
  • Software – A software based PLC requires a computer with an interface card, but allows the PLC to be connected to sensors and other PLCs across a network.

Typical PLC Configuration

Inputs And Outputs

Inputs to, and outputs from, a PLC are necessary to monitor and control a process. Both inputs and outputs can be categorized into two basic types: logical or continuous. Consider the example of a light bulb. If it can only be turned on or off, it is logical control. If the light can be dimmed to different levels, it is continuous. Continuous values seem more intuitive, but logical values are preferred because they allow more certainty, and simplify control. As a result most controls applications (and PLCs) use logical inputs and outputs for most applications. Hence, we will discuss logical I/O and leave continuous I/O for later.

Outputs to actuators allow a PLC to cause something to happen in a process. A short list of popular actuators is given below in order of relative popularity.

  • Solenoid Valves – logical outputs that can switch a hydraulic or pneumatic flow.
  • Lights – logical outputs that can often be powered directly from PLC output boards.
  • Motor Starters – motors often draw a large amount of current when started, so they require motor starters, which are basically large relays.
  • Servo Motors – a continuous output from the PLC can command a variable speed or position.

Outputs from PLCs are often relays, but they can also be solid state

electronics such as transistors for DC outputs or Triacs for AC outputs. Continuous outputs require special output cards with digital to analog converters.

Inputs come from sensors that translate physical phenomena into electrical signals. Typical examples of sensors are listed below in relative order of popularity.

  • Proximity Switches – use inductance, capacitance or light to detect an object logically.
  • Switches – mechanical mechanisms will open or close electrical contacts for a logical signal.
  • Potentiometer – measures angular positions continuously, using
  • LVDT (linear variable differential transformer) – measures linear displacement continuously using magnetic coupling.

Inputs for a PLC come in a few basic varieties, the simplest are AC and DC inputs. Sourcing and sinking inputs are also popular. This output method dictates that a device does not supply any power. Instead, the device only switches current on or off, like a simple switch.

  • Sinking – When active the output allows current to flow to a common ground. This is best selected when different voltages are supplied.
  • Sourcing – When active, current flows from a supply, through the

output device and to ground. This method is best used when all devices use a single supply voltage.

This is also referred to as NPN (sinking) and PNP (sourcing). PNP is more popular.

Operation Sequence

All PLCs have four basic stages of operations that are repeated many times per second. Initially when turned on the first time it will check its own hardware and software for faults. If there are no problems it will copy all the input and copy their values into memory, this is called the input scan. Using only the memory copy of the inputs the ladder logic program will be solved once, this is called the logic scan. While solving the ladder logic the output values are only changed in temporary memory. When the ladder scan is done the outputs will updated using the temporary values in memory, this is called the output scan. The PLC now restarts the process by starting a self check for faults. This process typically repeats 10 to 100 times per second as is shown in Figure PLC Scan.

PLC Scan

  • Self test – Checks to see if all cards error free, reset watch-dog timer, etc. (A watchdog timer will cause an error, and shut down the PLC if not reset within a short period of time – this would indicate that the ladder logic is not being scanned normally).
  • Input scan – Reads input values from the chips in the input cards, and copies their values to memory. This makes the PLC operation faster, and avoids cases where an input changes from the start to the end of the program (e.g., an emergency stop). There are special PLC functions that read the inputs directly, and avoid the input tables.
  • Logic solve/scan – Based on the input table in memory, the program is executed 1 step at a time, and outputs are updated. This is the focus of the later sections.
  • Output scan – The output table is copied from memory to the output chips. These chips then drive the output devices.

The input and output scans often confuse the beginner, but they are important. The input scan takes a snapshot of the inputs, and solves the logic. This prevents potential problems that might occur if an input that is used in multiple places in the ladder logic program changed while half ways through a ladder scan and thus changing the behaviors of half of the ladder logic program. This problem could have severe effects on complex programs. One side effect of the input scan is that if a change in input is too short in duration, it might fall between input scans and be missed.

When the PLC is initially turned on the normal outputs will be turned off.

This does not affect the values of the inputs.

The Input and Output Scans

When the inputs to the PLC are scanned the physical input values are copied into memory. When the outputs to a PLC are scanned they are copied from memory to the physical outputs. When the ladder logic is scanned it uses the values in memory, not the actual input or output values. The primary reason for doing this is so that if a program uses an input value in multiple places, a change in the input value will not invalidate the logic. Also, if output bits were changed as each bit was changed, instead of all at once at the end of the scan the PLC would operate much slower

The Logic Scan

Ladder logic programs are modeled after relay logic. In relay logic each element in the ladder will switch as quickly as possible. But in a program elements can only be examines one at a time in a fixed sequence. The ladder logic will be interpreted justify-to-right, top-to-bottom. The ladder logic scan begins at the top rung. At the end of the rung it interprets the top output first, and then the output branched below it. On the second rung it solves branches, before moving along the ladder logic rung.

PLC Status

The lack of keyboard and other input-output devices is very noticeable on a PLC. On the front of the PLC there are normally limited status lights. Common lights indicate;

  • Power on – this will be on whenever the PLC has power.
  • Program running – this will often indicate if a program is running, or if no program is running.
  • Fault – this will indicate when the PLC has experienced a major hardware or software problem.

These lights are normally used for debugging. Limited buttons will also be provided for PLC hardware. The most common will be a run/program switch that will be switched to program when maintenance is being conducted, and back to run when in production. This switch normally requires a key to keep unauthorized personnel from altering the PLC program or stopping execution. A PLC will almost never have an on-off switch or reset button on the front. This needs to be designed into the remainder of the system.