Graphic Interfaces are Programmers' Friends
Graphic programming 'languages' like sequential function charts and flow charts help machine control programmers organize programs and perform increasingly complex tasks while Windows-based editors add powerful tools.
Gary A. Mintchell, CONTROL ENGINEERING -- Control Engineering, 11/1/1999
|
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 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.
Structured programmingEelco 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 programmingThere 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.

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.
| For more information... | ||
| For more information, visit www.controleng.com/freeinfo: | ||
| Control Technology Corp. | Cutler-Hammer/Eaton | GE Fanuc Automation |
| Micro-Design Electronics | National Instruments | Nematron |
| PLCopen | Rockwell Automation | Schneider Electric |
| Siemens Energy & Automation | Steeplechase Software | Think & Do Software |
|


















View All Blogs



