Wednesday, August 19, 2009

PLC Programming

Programming Languages
A program loaded into PLC systems in machine code, a sequence of binary code numbers to represent the program instructions.Assembly language based on the use of mnemonics can be used, and a computer program called an assembler is used to translate the mnemonics into machine code.High level Languages (C, BASIC, etc.) can be used.

Programming Devices
PLC can be reprogrammed through an appropriate programming device:

[1]Programming Console
[2]PC
[3]Hand Programmer
Introduction to Ladder Logic
Ladder logic uses graphic symbols similar to relay schematic circuit diagrams.Ladder diagram consists of two vertical lines representing the power rails. Circuits are connected as horizontal lines between these two verticals.

Ladder diagram features
Power flows from left to right.
Output on right side can not be connected directly with left side.
Contact can not be placed on the right of output.
Each rung contains one output at least.
Each output can be used only once in the program.
A particular input a/o output can appear in more than one rung of a ladder.
The inputs a/o outputs are all identified by their addresses, the notation used depending on the PLC manufacturer.



Introduction to Statement list
Statement list is a programming language using mnemonic abbreviations of Booleanlogic operations. Boolean operations work on combinationof variables that are true or false.A statement is an instruction or directive for the PLC.

Statement List Operations


  • Load (LD) instruction.
  • And (A) instruction.
  • Or (O) instruction.
  • Output (=) instruction.

Function Block DiagramsFunction block is represented as a box with the function name written in.

please note: LD: load
O: or
AN: and not (and a normally closed contact)
ALD: AND the first LD with second LD


PLC Communications

Extension modules
PLC I/O number can be increased through certain additional modules by system extension through extension lines. Each module can contain extension both of input and output lines.
Extension modules can have inputs and outputs of a different nature from those on the PLC controller. When there are many I/O located considerable distances away from the PLC an economic solution is to use I/O modules and use cables to connect these, over the long distances, to the PLC.

Remote I/O connections
When there are many I/O located considerable distances away fromthe PLC an economic solution is to use I/O modules and use cables toconnect these, over the long distances, to the PLC.

Remote PLCs
In some situations a number of PLCs may be linked together with a master PLC unit sending and receiving I/O data from the other units.

Cables
Twisted-pair cabling, often routed through steel conduit. Coaxial cable enables higher data rates to be transmitted and does not require the shielding of steel conduit.Fiber-optic cabling has the advantage of resistance to noise, small size and flexibility.

Parallel communication
Parallel communication is when all the constituent bits of a word aresimultaneously transmitted along parallel cables. This allows data to be transmitted over short distances at high speeds. Might be used when connecting laboratory instruments to the system.

Parallel standards
The standard interface most commonly used for parallel communication is IEEE-488, and now termed as General Purpose Instrument Bus (GPIB).Parallel data communications can take place between listeners , talkers , and controllers.
There are 24 lines: 8 data (bidirectional), 5status & control, 3 handshaking, and 8 ground lines.

Serial communication
Serial communication is when data is transmitted one bit at a time. A data word has to be separated into its constituent bits for transmission and then reassembled into the word when received. Serial communication is used for transmitting data over long distances. Might be used for the connection between a computer and a PLC.

Serial standards
RS-232 communications is the most popular method of plc to external device communications. RS 232 is a communication interface includedunder SCADA applications. Other standards such as RS422 and RS423are similar to RS232 although they permit higher transmission rates and longer cable distances.

There are 2 types of RS-232 devices:
DTE - Data Terminal Equipment and a common example is a computer.
DCE - Data Communications Equipment and a common example is a modem.
PLC may be either a DTE or DCE device.

ASCII
ASCII is a human-readable to computer-readable translation code(each letter/number is translated to 1’s and 0’s). It’s a 7-bit code, so we can translate 128 characters (2^7 is 128).

Protocols
It is necessary to exercise control of the flow of data between two devices so what constitutes the message, and how the communication is to be initiated and terminated, is defined.
This is termed the protocol.One device needs to indicate to the other to start or stop sending data.Interconnecting several devices can present problems because of compatibility problems.
In order to facilitate communications between different devices the International Standard Organization (ISO) in 1979 devised a model to be used for standardization for Open System Interconnection (OSI).

PLC Operation

Input Relays
These are connected to the outside world. They physically exist and receive signals from switches, sensors, etc. Typically they are not relays but rather they are transistors.

Internal Utility Relays
These do not receive signals from the outside world nor do they physically exist. They are simulated relays and are what enables a PLC to eliminate external relays.There are also some special relays that are dedicated to performing onlyone task.

Counters
These do not physically exist. They are simulated counters and they can be programmed to count pulses.Typically these counters can count up, down or both up and down. Since they are simulated they are limited in their counting speed.Some manufacturers also include highspeed counters that are hardware based.

Timers
These also do not physically exist. They come in many varieties and increments.The most common type is an on-delay type.Others include off-delay and both retentive and non-retentive types. Increments vary from 1ms through 1s.

Output Relays
These are connected to the outside world. They physically exist and send on/off signals to solenoids, lights, etc.They can be transistors, relays, or triacs depending upon the model chosen.

Data Storage
Typically there are registers assigned to simply store data. Usually used as temporary storage for math or data manipulation.They can also typically be used to store data when power is removed from thePLC.

PLC Hardware

Hardware Components of a PLC System



Processor unit (CPU),
Memory,
Input/Output,
Power supply unit,
Programming device,
other devices.

Central Processing Unit (CPU)

CPU - Microprocessor based, may allow arithmetic operations, logic operators, block memory moves, computer interface, local area network, functions, etc.CPU makes a great number of check-ups of the PLC controller itself so eventual errors would be discovered early.


System Busses

The internal paths along which the digital signals flow within the PLC are calledbusses.



The system has four busses:
  • The CPU uses the data bus for sending data between the different elements,

  • The address bus to send the addresses of locations for accessing stored data,

  • The control bus for signals relating to internal control actions,

  • The system bus is used for communications between the I/O ports and the I/O unit.
Memory
System (ROM) to give permanent storage for the operating system and the fixed data used by the CPU.
RAM for data. This is where information is stored on the status of input and output devices and the values of timers and counters and other internal devices. EPROM for ROM’s that can be programmed and then the program made permanent.

I/O Sections
Inputs monitor field devices, such as switches and sensors.
Outputs control other devices, such as motors, pumps, solenoid valves, and lights.

Power Supply
Most PLC controllers work either at 24 VDC or 220 VAC.
Some PLC controllers have electrical supply as a separate module, while small and medium series already contain the supply module.

Programming Device
The programming device is used to enter the required program into the memory of the processor.The program is developed in the programming device and then transferred to the memory unit of the PLC.

PLC History

"PLC development began in 1968 in response to a request from an US car manufacturer (GE). The first PLCs were installed in industry in 1969. "
The Hydramatic Division of the General Motors Corporation specified the design criteria for the first programmable controller in 1968. Their primary goal was to eliminate the high costs associated with inflexible, relaycontrolled systems.

The specifications required a solid-state system with computer flexibility able to
(1) survive in an industrial environment,
(2) be easily programmed and maintained by plant engineers and technicians, and
(3) be reusable. Such a control system would reduce machine downtime and provide expandability for the future.

Some of the initial specifications included the following:
• The new control system had to be price competitive with the use of relay systems.
• The system had to be capable of sustaining an industrial environment.
• The input and output interfaces had to be easily replaceable.
• The controller had to be designed in modular form, so that subassemblies could be removed easily for replacement or repair.
• The control system needed the capability to pass data collection to a central system.
• The system had to be reusable.
• The method used to program the controller had to be simple, so that
it could be easily understood by plant personnel.

Communications abilities began to appear in approximately 1973. They could also be used in the 70’s to send and receive varying voltages to allow them to enter the analog world.

The 80’s saw an attempt to:
standardize communications with manufacturing automation protocol (MAP), reduce the size of the PLC, and making them software programmable through symbolic programming on personal computers instead of dedicated programming terminals or handheld programmers.

The 90’s have seen a gradual reduction in the introduction of new protocols, and the modernization of the physical layers of some of the more popular protocols that survived the 1980’s.

The latest standard “IEC 1131-3″ has tried to merge plc programming languages under one international standard. We now have PLCs that are programmable in function block diagrams, instruction lists, C and structured text all at the same time.

Introduction to PLC

Programmable logic controllers, also called programmable controllers orPLCs, are solid-state members of the computer family, using integratedcircuits instead of electromechanical devices to implement control functions.
They are capable of storing instructions, such as sequencing, timing,counting, arithmetic, data manipulation, and communication, to controlindustrial machines and processes.What Does PLC means?
A PLC (Programmable Logic Controllers) is an industrial computer used to monitor inputs, and depending upon their state make decisions based on its program or logic, to control (turn on/off) its outputs to automate a machine or a process.
Programmable controllers have many definitions. However, PLCs can be
thought of in simple terms as industrial computers with specially designed architecture in both their central units (the PLC itself) and their interfacing circuitry to field devices (input/output connections to the real world).
Advantages of PLC control
  • Faster scan times are being achieved using new, advanced microprocessor and electronic technology.
  • Small, low-cost PLCs (see Figure 1-2), which can replace four to ten
    relays, now have more power than their predecessor, the simple relay
    replacer.
  • High-density input/output (I/O) systems (see Figure 1-3) provide
    space-efficient interfaces at low cost.
  • Intelligent, microprocessor-based I/O interfaces have expanded distributed processing. Typical interfaces include PID (proportional
    integral-derivative), network, CANbus, fieldbus, ASCII communication, positioning, host computer, and language modules (e.g., BASIC, Pascal).
  • Mechanical design improvements have included rugged input/output enclosures and input/output systems that have made the terminal an integral unit.
  • Special interfaces have allowed certain devices to be connected
    directly to the controller. Typical interfaces include thermocouples,
    strain gauges, and fast-response inputs.
  • Peripheral equipment has improved operator interface techniques,
    and system documentation is now a standard part of the system.

Traditional PLC Applications

  • In automated system, PLC controller is usually the central part of a process control system.
  • To run more complex processes it is possible to connect more PLC controllers to a central computer.

Disadvantages of PLC control
- Too much work required in connecting wires.
- Difficulty with changes or replacements.
- Difficulty in finding errors; requiring skillful work force.
- When a problem occurs, hold-up time is indefinite, usually long.