Programmable logic controllers: Hardware, software architecture
Editor's Note: This is the first part of a two-part article on the main distinguishing characteristics of the PLC: its basic hardware and software architecture. The second part will cover how the program and input/output (I/O) modules are scanned, and it will be available as a web exclusive in December (www.isa.org/link/Basics_main).
In many respects, the architecture of the programmable logic controller (PLC) resembles a general-purpose computer with specialized input/output (I/O) modules. However, some important characteristics distinguish a PLC from a general-purpose computer. Most important, a PLC is much more reliable, designed for a mean time between failures measured in years. Second, a PLC can be placed in an industrial environment with its substantial amount of electrical noise, vibration, extreme temperatures, and humidity. Third, PLCs are easily maintained by plant technicians.
Basic PLC hardware architecture
The basic architecture of a PLC consists of main components-the processor module, the power supply, and the I/O modules. The processor module consists of the central processing unit (CPU) and memory. In addition to a microprocessor, the CPU also contains at least an interface to a programming device and may contain interfaces to remote I/O and other communication networks. The power supply is usually a separate module, and the I/O modules are separate from the processor. The types of I/O modules include discrete (on/off), analog (continuous variable), and special modules like motion control or high-speed counters. The field devices are connected to the I/O modules.
Depending on the amount of I/O and the particular PLC processor, the I/O modules may be in the same chassis as the processor and/or in one or more other chassis. Up until the late 1980s, the I/O modules in a typical PLC system were in chassis separate from the PLC processor. In the more typical present-day PLC, some of the I/O modules are present in the chassis that contains the processor. Some PLC systems allow more than one processor in the same chassis. Smaller PLCs are often mounted on a DIN rail. The smallest PLCs (often called micro-PLCs or nano-PLCs) include the power supply, processor, and all of the I/Os in one package. Some micro-PLCs contain a built-in operator interface panel. For many micro-PLCs, the amount of I/O is limited and not expandable.
Basic software, memory architecture (IEC 61131-3)
The IEC 61131-3 standard defines a memory and program model that follows modern software engineering concepts. This model incorporates such features as top-down design, structured programming, hierarchical organization, formal software interfaces, and program encapsulation. Fortunately, extensive training in software engineering techniques is not necessary to become a proficient programmer. If fully implemented, the model is reasonably complicated. The main disadvantages of the model are its complexity and its contrast to the simplicity of the early PLCs.
The overall IEC 61131-3 memory program and memory model are described. (For various implementations of the standard, visit www.isa.org/link/Erickson_PLC.) The IEC 61131-3 memory model (what the standard calls the software model) is layered-each layer hides many of the features of the layers beneath. Each of the main elements is now described.
The configuration is the entire body of software (program and data) that corresponds to a PLC system. Generally, a configuration equates with the program and data for one PLC. In large complex systems that require multiple cooperating PLCs, each PLC has a separate configuration. A configuration communicates with other IEC configurations within the control system through defined interfaces, called access paths. The choice of the term configuration conflicts with the historic use of this term in the controls industry. Generally, configuration refers to the process of specifying items such as the PLC processor model, communication interfaces, remote I/O connections, memory allocation, and so on. Therefore, the vendors producing IEC-compliant PLCs that use the term configuration in the historic sense refer to the entire body of software with some other term, such as project.
A resource provides the support functions for the execution of programs. One or more resources constitute a configuration. Normally, a resource exists within a PLC, but it may exist within a personal computer to support program testing. One of the main functions of a resource is to provide an interface between a program and the physical I/O of the PLC.
A program generally consists of an interconnection of function blocks, each of which may be written in any of the IEC languages. A function block or program is also called a program organization unit. In addition to the function blocks, the program contains declarations of physical inputs/outputs and any variables local to the program. A program can read and write to I/O channels, global variables, and communicate with other programs. Access paths provide the means to transfer information between configurations. Tasks control the execution of the program or parts of a program.
A task controls one or more programs and/or function blocks to execute. The execution of a program implies that all of the function blocks in the program are processed once. The execution of a function block implies that all of the software elements of the function block are processed once. There are no implied mechanisms for program execution. In order for a program to be executed, it must be assigned to a task, and the task must be configured to execute continuously, periodically, or with a trigger.
Variables are declared within the different software elements of the model. A local variable is defined at the software element and can only be accessed by the software element. Local variables can be defined for the function block, program, resource, or configuration.
A global variable defined for a configuration, resource, or program is accessible to all elements contained in it. For example, a global configuration variable is accessible to all software elements in the configuration. A global program variable is accessible to all function blocks in the program.
Directly represented variables are memory and I/O locations in the PLC. IEC 61131-3 defines formats for references to such data. However, many implementers of the standard use their own formats, which are not consistent with the IEC standard.
ABOUT THE AUTHOR
Dr. Kelvin T. Erickson is a professor of Electrical & Computer Engineering at the Missouri University of Science and Technology (formerly the University of Missouri-Rolla, UMR) in Rolla. His primary areas of interest are in manufacturing automation and process control. He is a registered Professional Engineer (Control Systems) in Missouri. He is a member of ISA and senior member of IEEE.