Graphic Interfaces are Programmers' Friends
Programming editors and languages are increasingly loaded with powerful functions. Faster, more powerful controller microprocessors and Microsoft's Windows-based graphic environment have combined to allow programmers to accomplish complex tasks.PLC programming was originally strictly Boolean. A statement would be something like "If (limit switch contact) A closes OR (motor starter contac...
Programming editors and languages are increasingly loaded with powerful functions. Faster, more powerful controller microprocessors and Microsoft's Windows-based graphic environment have combined to allow programmers to accomplish complex tasks.
PLC programming was originally strictly Boolean. A statement would be something like 'If (limit switch contact) A closes OR (motor starter contact)B closes AND (limit switch contact) C is closed THEN energize coil D.' There were, and still are, text-based languages to accomplish this programming. Relay ladder logic (RLL), also called ladder diagrams (LD), were found to be ideal representations of Boolean logic (see diagram). These diagrams looked like relay logic diagrams familiar to electricians, while representing digital logic.
This is fine for some machine functions, but what happens when the programmer needs special functions, wants to do math, has analog inputs and outputs, and wants to communicate? Function blocks solved this problem. RLL program editors began incorporating a library of special function blocks for timers, counters, math, messaging, and increasingly complex functions like PID control.
RLL is the most-used programming language for machine control, but four other languages used today include function block diagram (FBD), structured text, instruction list, and flowcharts. There are also specialized languages for motion control, and C is often used as a control language. Editors for the traditional PLC languages have been developed specifically for particular hardware platforms. Different conventions evolved for handling special functions leading to confusion when changing from one manufacturer to another.
International standard, IEC 61131, was adopted to bring order from the chaos. IEC 61131-3 has two parts common elements and programming languages.
The common elements section defines data types, variables, configuration, resources, tasks, and program organization units. Defining data types prevents such errors as dividing a Date by an Integer. Variables are only assigned to explicit hardware addresses in configurations, resources, or programs to achieve hardware independence from the program. A program is configured for a specific control system, and is considered to be a network of functions and function blocks.
Programs, functions and function blocks are called Program Organization Units. IEC has defined standard functions like ADD(ition), ABS (absolute) and SQRT. User-defined functions are allowed under the standard. Once defined, they can be re-used. Function blocks are equivalent to integrated circuits and represent a specialized control function. They contain data as well as the algorithm and have a well-defined interface. The program can be written in any of the defined programming languages.
The four defined languages have a defined syntax and semantics leaving no room for dialects. There are two textual and two graphical versions. Textual languages are Instruction List, which is similar to assembler code, and Structured Text, which is like Pascal. The graphical languages are Ladder Diagram and Function Block Diagram (FBD). FBD is common to process industries and programs like a set of interconnected graphical blocks similar to electronic circuit diagrams.
Sequential Function Charts
Sequential Function Chart (SFC) is not a language but describes graphically the sequential behavior of a control program. It is an organizing structure for the program utilizing one or more of the four languages depending upon the particular editor chosen. Many editors also allow programming in C and other computer languages.
SFC is organized into Steps, which contain Actions, and Transitions (see example). Each step represents a particular state of the system. A transition is a condition, which, when true, causes the preceding step to be deactivated and the next step to be activated. A step is represented by a rectangle with succeeding steps connected by a line forming a path. A line crossing the connecting line between steps represents a transition. There is one transition following each step. The first step typically initializes the system.
Each action block within a step and each transition can be programmed in any of the IEC standard languages or other languages such as C supported by the editor. Not all editors support all four IEC languages, but they may be IEC-compliant with one or more.
SFCs can be branched in either AND or OR paths. In an OR branch, the transition is before the step in each parallel path. The first path with a true condition will be activated. One transition serves to activate all paths in an AND branch. When it goes true the first step in each parallel path will be scanned.
Eelco van der Wal, executive director of PLCopen (Zaltbommel, The Netherlands), identifies seven steps to success when using structured programming for machine control:
Identification of the external interfaces to the control system,
Definition of the main signals exchanged between the control system and the rest of the plant,
Definition of all operator interactions, overrides, and supervisory data,
Analysis of the control problem from the top levels into logical partitions,
Definition of required POUs,
Definition of scan cycle time requirements, and
Configuration of system by defining resources, linking programs with physical inputs and outputs, and assigning programs and function blocks to tasks.
Mr. van der Wal explains, 'IEC 61131-3 helps you, especially in the four steps, where the translation into software occurs.'
Jim Christensen, Rockwell Automation (Mayfield Heights, O.) senior principal engineer, works with technical committees for both IEC 61131-3 and 61499. The 61499 standard describes the use of function blocks in a distributed control environment like those typically found in large process manufacturing plants. He explains that the function blocks defined by the two standards are not the same, which can cause some confusion. 61499 shows how to put a 61131 function block into a 61499 block to achieve distributed processing. He predicts that there will be increased harmony between the two with future revisions of the standards. The future may also see a definition of XML for manufacturing and development of distributed agents, cooperative distributed agents, and other advances in holonic manufacturing.
Clive Smith, Schneider Electric Automation (North Andover, Mass.) software manager, points out an inherent diagnostic feature of its editor. Each step has automatic timing of durations that can be associated with a tolerance window. If the step activates and deactivates either too quickly or takes too long, an alarm can be annunciated to warn of a problem. Encapsulating blocks and saving in a library saves much programming time in future projects. Proprietary algorithms can be created in C and saved to an .exe file to keep them private.
Jerry Weisenborn, product manager for Versapro at GE Fanuc Automation (Charlottesville, Va.), says that the most important design parameter for a programming editor is to make it easy to use. This function extends to the ability to share the tag database among applications and load variables from Microsoft Excel or Access to the variable reference table. Motion axis control is also integrated.
Flowcharts for programming
There is a graphical system taught to almost every university student as a tool for analysis flowcharting. Flowcharts contain the familiar rectangular action blocks and diamond-shaped decision blocks. Several companies in the United States champion flowcharts as control programming tools including Cutler-Hammer (Westerville, O.), Nematron (Ann Arbor, Mich.), Steeplechase Software (Ann Arbor, Mich.), and Think & Do Software (Ann Arbor, Mich.). These flowcharts use the PC as system controller.
Programming flowcharts have two basic types of elements action and branching. An Action block represents an operation on data in the system. This may include input or output data. An Action block has one entry point (top) and one exit (bottom). The diamond-shaped branching block represents a branch in the control circuit based upon the result of a decision. The decision may compare one variable to another, or a variable to a constant. Branching blocks have one entry point (top) and two exit points (side and bottom).
Just what goes in these blocks? While there are differences in the editors offered by these companies, they are also similar in approach. Typically, the programmer places a box in the workspace, clicks on it with the mouse to activate it, and selects the type of logic or control required. Either logic statements can be edited or parameters are entered, for example, motion moves or PID set points. One of the virtues of flowchart programming is the library of complex control built in. Integrated motion control, PID, and quick data communication through Microsoft Windows NT are offered. It must be noted that Think & Do runs only on NT, while the others use an embedded 'real-time operating system' under NT.
Other available operations include I/O device control over factory networks, Boolean logic functions, high level math, array manipulation, string functions, and moving and copying data. Action blocks can Call a sub-flowchart, perform a Do loop, Wait (timer function), and perform serial communications.
Branching blocks are decision and compare. A decision returns Yes or No to a condition 'Is switch 1 on?' Compare looks at two values to see if they are greater than, less than, or equal and returns a Yes or No. If-Then-Else logic can easily be done with a decision block (If) with each exit going to an Action block. So, if switch 1 is on, Then turn on coil 1, Else turn on pilot light 1. Then tie the two action blocks together to the next action.
If the programmer new to flowcharting is familiar with Ladder Diagram, it is useful to think in terms of a decision block as a contact and action block in terms of a coil. If the contact is on (decision block), then turn on a coil (action block).
This information is largely from a white paper from Think & Do Software (WYSIWID Control Logic what you see is what it does) with additional input from Steeplechase Software's Handbook .
State language cuts complexity
One of the precursors of SFCs is state language. According to Ken Crater, president of Control Technology Corp. (Hopkinton, Mass.), state languages have been around since the early 1970's and are derived from Petri Net theory developed by Carl Adam Petri in the early 1960's. The fundamental tool of state language is the state or step. A step defines the complete status of the machine or process (or a portion) for a finite period of time. There are typically two components: one or more commands to create a motion or change, causing a new physical state; and one or more instructions to limit the duration of the step, specify the condition completing the step, and activating the next.
What is the future of control language? Mr. Crater states that a technique known as encapsulation allows the complexity of detailed control of a machine's actuators to be hidden from view while examining the top-level program flow. This makes the program easier to understand and acts as a navigation aid. Encapsulation involves organizing a state language program in a way that most of a machine's functionality resides in tasks with each task relating to one mechanism or module on the machine.
Another approach to PC-based control programming is LabView from National Instruments (Austin, Tex.). LabView looks and acts similar to function block programming as a graphical language. Originally designed for data acquisition, programs are called virtual instruments. LabView is increasingly used for many kinds of industrial control. A LabView user can not only develop logic, sequencing, and PID control, but also can design a system that manages arrays for frequency analysis. For example, LabView makes applications such as vibration monitoring for predictive maintenance straightforward.
C has been used for various types of control for several years, now. Visual Basic is quite popular but has not migrated into control applications yet. Micro-Design Electronics (Brandon, Miss.) is using it to enhance connections of PCs with PLCs. Its library of VB functions allows construction of operator interface, control system, and data gathering. As more programmers become fluent with the language, expect to see greater use of VB in control.
The benefit to machine control programmers is that competition is driving all companies to make editors easier to use and the languages more powerful. Significantly, it becomes most useful to just refer to control programming rather than PLC or PC-based (or even DCS) programming.
IEC 61131-3 Languages
There are two text-based languages specified in the third section of the international standard for programming PLCs, IEC 61131:
Structured text similar to Pascal, and
Instruction list similar to assembly language.
There are two graphical languages:
Ladder Diagram two vertical 'power' lines with horizontal 'rungs' containing representations for contacts and coils plus special blocks, and
Function block diagram expresses the behavior of functions as a set of interconnected graphical blocks similar to an electronic circuit diagram.
Sequential function charts are specified as a means to describe the sequential behavior of a control program. They are not a language but an aid to structure the internal organization of a program.
Making 'Art to Part' a reality
Increasing pressure on manufacturers to rapidly respond to changing market is driving new manufacturing design and implementation tools. DaimlerChrysler and other automotive manufacturers are taking advantage of some of the newest software technology in their body production systems.
This system allows them to view machine and part designs in a virtual world, before metal is cut and expensive resources are consumed. This technology might be called 'CAD to Controls,' since it focuses on extracting from the CAD (computer assisted design) environment information that can be applied to creating and modifying control programs of plant floor machinery. The same information can be used to verify the process using virtual prototyping.
Virtual manufacturing allows engineers to view a computer-simulated version of how the finished machine should operate on the plant floor. Determining the best way to design a machine in the beginning stages of part development can save thousands of dollars. Engineers at DaimlerChrysler believe they can save millions of dollars on new startup by using virtual prototyping.
CAD technologies are used to design and develop many products some to be manufactured, and some the machinery used for manufacturing. Virtual manufacturing, also known as digital factory, brings CAD to the next level, allowing engineers to develop complete interactive manufacturing systems rather than only standalone components. Three primary technologies allow the concept of virtual manufacturing systems to be realistic and affordable: CAD systems, 3D visualization, and operating systems.
The first generation of CAD to plant floor machine control was built on the 2D technology of the late 1970s and early 1980s where the software represented the part in a single plane. The profile of the part in that plane was then converted to an intermediate set of instruction describing the tool path in code that could be interpreted by the machine controller a computerized numerical controller (CNC) for metal cutting. These systems were heavily used in the aerospace industry where the type of product they were making could absorb the high cost of computers and software.
3D modeling with simulationaids development
The introduction of 3D solid modeling software, first on big UNIX machines and more recently on desktop PC workstations, has created the capability of designing intricate cavities in olds. Electronic surfaces now have walls and thicknesses that can easily be manipulated as part of a single object. Part geometries can be translated into machining of molds that, when the two halves are mated, can precisely mirror the visualization of the part on the designer's screen.. Plastic technology now brings everything from lightweight miniature gears to automobile bumpers because of the designer's ability to visualize a part as a 3D solid model, and the manufacturing engineer's ability to translate that object into a mold.
The most compelling feature of object modeling is that a behavior (that is, instructions to tell the object to do 'something' under certain conditions) can be encapsulated in the object. A designer can build a model in software such that the model can have static and dynamic characteristics. The virtual part can now interact with other objects in the system in a fourth dimension time.
Simulation products have been available for years, but have typically been very expensive. Microsoft's COM (component object model) communication technology significantly reduces the cost of the system by allowing simulation software to interact directly with the original design model.
DaimlerChrysler sponsored a demonstration of object modeling and animation techniques at the IAM show in Detroit in May of 1998. CATIA V5 (in beta release at that time) was used to plan the workcell. A process-planning tool, developed as an add-in to the CATIA architecture, was used to specify the behavior, or sequence, of the non-robotic components such as clamps and fixtures. This sequence also identified the interlocks with the robots in the workcell. All items in the sequence were referenced by their names as objects in the CATIA system. Rockwell Software (Mayfield Heights, O.), using newly developed technology, was able to read the timing diagram and convert it to PLC code. Finally, Deneb used the PLC code executing in a soft controller to drive the robotics in the virtual workcell contained in their IGRIP product.
Today, the transition from part design to process design to mechanical design and then to controls is a paper activity. Each of these activities separately has its own software tools, and of course, a competent set of users. In the future, wiring diagrams, HMI components, diagnostics, and simulation elements can be developed with less effort using this Rockwell Control Assembly concept - organizing tasks around the model, not on which box they execute.As object modeling becomes more prevalent, more detailed models will allow verification of part, process, and controls simultaneously. Distributed COM and other web technology will permit collaborative engineering in a decentralized environment.
Case Study Database
Get more exposure for your case study by uploading it to the Control Engineering case study database, where end-users can identify relevant solutions and explore what the experts are doing to effectively implement a variety of technology and productivity related projects.
These case studies provide examples of how knowledgeable solution providers have used technology, processes and people to create effective and successful implementations in real-world situations. Case studies can be completed by filling out a simple online form where you can outline the project title, abstract, and full story in 1500 words or less; upload photos, videos and a logo.
Click here to visit the Case Study Database and upload your case study.