Software development Save time with reusable code Standardized programming for automation equipment is here to stay. At the forefront is IEC 61131-3-compatible software, which generates standardized code for use on any number of controls.

Kevin Hull IEC 61131-3 standard, particularly Customers invested signifi cant time Senior applications engineer as refi ned by the international or- learning these special programs. Yaskawa Electric America Inc. ganization called PLCopen. IEC Moreover, many programming Waukegan, Ill. 61131-3 is a globally recognized packages specialized in only one standard for industrial automation language. For example, ladder logic ime is money, and for indus- control programming; PLCopen was popular in North America, but trial automation software promotes the use of IEC 61131-3 other industries and regions pre- development, nothing saves T and other standards via a number ferred structured text or a special more time than the ability to reuse of initiatives including training and mnemonic language similar to an programming code. certifi cation. instruction list. Until now, the norm in automa- This presented two major prob- tion has been custom and propri- The dark days lems. First, a new and unique pro- etary software for operating ven- Before IEC 61131-3 and PLCo- gramming software package had to dor-specifi hardware — primarily pen, each industrial automation be mastered each time a different PLCs and motion controllers. But vendor promoted its own closed and controller brand was used. Second, standardized and reusable program- proprietary programming software. it was very diffi cult to reuse code, ming is spreading, thanks to the even when programming different controllers from the same vendor. Even now, proprietary code of- ten drives maintenance costs higher because technical personnel must learn how to use very different soft- ware packages for each controller in a plant. What’s more, proprietary code deters adoption of newer and more cost-effective platforms be- cause designers shy away from the

Á IEC 61131-3 allows programming in fi ve languages. The one shown here is ladder diagram — globally one of the most commonly used languages.

33507_MSD_YASKAWA_new.indd507_MSD_YASKAWA_new.indd 1 55/17/10/17/10 3:143:14 PMPM Software development

The International Electrotechnical Commission (IEC) was founded in 1906 and establishes electrical, electronic, and related codes. Its IEC 61131-3 is the fi rst and only real attempt at creating a global standard for control programming in the industrial automation market.

initial costs associated with learning new programming.

IEC to the rescue IEC 61131-3-adherent controller- programming software is a stan- dardized alternative. It includes a framework that suppliers can follow when creating automation software packages. The closer a supplier ad- heres to the standard, the more fa- miliar its products are to engineers versed in IEC 61131-3. This is creat- ing a virtuous circle as the standard becomes more widespread. How? As more users become familiar with IEC 61131-3, additional ven- dors are compelled to jump on the standards bandwagon. As vendors join in, more users become comfort- able with the standard. The result? Widespread adoption by suppliers and users alike. IEC 61131-3 enables automation programmers to leverage the best of several different programming languages simultaneously within one software-development envi- ronment. It also standardizes the programming interface, reducing the learning curve for individuals with different programming back- grounds and skill levels. MotionWorks IEC development software is based on and fully For these reasons, programmers compliant with IEC 61131-3 — to make controls easier to setup can create different elements of a and update. program during software-develop- ment specifi cation, design, imple- mentation, testing, installation, and

33507_MSD_YASKAWA_new.indd507_MSD_YASKAWA_new.indd 2 55/17/10/17/10 3:143:14 PMPM Software development

IEC 61131-3 also allows programming in instruction list (lower left), structured text (upper left), and sequential function, below.

maintenance. The software pieces ements and Programming Lan- 61131-3 include data typing, variables, adhere to a common structure, so guages. By using the structuring confi guration, and program organiza- they work together harmoniously. tools of both, IEC 61131-3 can be tion units. Data typing is the formal used to create software that’s main- defi nition of parameters, and it’s Under the IEC hood tainable, reusable, understandable, required to standardize data and The IEC 61131-3 standard has and verifi able. prevent errors. IEC 61131-3’s data two different parts: Common El- The Common Elements of IEC types include elementary, generic, The standards champion: PLCopen

Any standard is worthless unless adopted by the and promote the tested level of verifi cation. community it serves. Fortunately, PLCopen is making PLCopen also provides a resource for plain- sure that the IEC 61131-3 standard is used widely and language information about IEC 61131-3 and other correctly. automation standards at www.plcopen.org. The site PLCopen members consist of global automation outlines standards from the user’s point of view and suppliers and learning institutions that aim to lists answers to FAQs, to familiarize users with the reduce variation in industrial controller programming standard’s main concepts. techniques. PLCopen is completely separate from PLCopen also extends the IEC 61131-3 standard IEC — allowing it to independently disseminate and to encompass certain specialty areas of industrial promote IEC 61131-3 and other standards throughout automation: For example, the PLCopen Motion the global automation community. Control Specifi cation provides a standard for motion When a standard is created, suppliers often claim control behavior and functionality. Motion control adherence or conformity without any independent function blocks created with conformance to this third party verifi cation. This leaves the user to standard have the same look and feel, and can determine if the product conforms — often a difficult if therefore be reused and integrated into a variety of not impossible task. To address this issue, PLCopen applications with little or no modifi cation. independently tests programming software. Vendors Together, IEC 61131-3 and PLCopen increase submit products to PLCopen, and the organization commonality from vendor to vendor — but allow each verifi es compatibility. Once verifi ed, the vendor is vendor to customize performance and capabilities. permitted to label its software with the PLCopen logo

33507_MSD_YASKAWA_new.indd507_MSD_YASKAWA_new.indd 3 55/17/10/17/10 3:143:14 PMPM Software development

and user-defi ned. Its three kinds of variables include symbolic, directly represented, and located. Located refers to a specifi c hardware address. Confi guration aims to solve the problem of hardware arrangement, memory addressing, and processing resources. Within a confi guration or system, various resources can ex- ecute IEC programs. Inside the re- sources are tasks consisting of con- trol programs and function blocks. IEC 61131-3 also allows programming in function block diagrams.

IEC 61131-3 common elements quential and parallel control. guage, originally developed to sim- n Function block diagrams ulate logic schematics. Ladder are suitable for motion control and diagrams are best used for control other complex tasks as they visu- of discrete I/O. Common functions ally display high-level interactions. are relay logic, timing, and count- Variables are connected to the ing. blocks by lines that carry informa- In short, ladder rungs fl ow tion from left to right. The blocks from left to right and may have Program organization units serve (predefi ned or user-created) are eas- a variety of input conditions that as the container for program code. ily reusable on other projects. eventually lead to a single out- These units consist of functions, o Structured text encourages put instruction. The rungs have function blocks, and programs. good programming practices by us- assigned addresses that indicate Functions let program elements ing both structured programming data location. Once programmed extend a confi guration’s instruc- and data structuring. It’s an effi cient conditions are met, output is set tion set. Function blocks are the language, and excels in operations accordingly. basic units from which applications with complex mathematical algo- q Instruction list is the simplest are built. Programs are networks of rithms and assignments. Structured and most basic form of the fi ve lan- functions and function guages, as it resem- blocks. Benefi ts of IEC 61131-3 bles assembly IEC 61131-3 is multi- programming lingual of low-end con- As befi ts a global stan- trollers. This dard, IEC 61131-3 speci- language uses fi es (and speaks) fi ve pro- a stack struc- gramming languages, ture like an HP which can all be used calculator and within the same program as dictated text is composed of predefi ned state- consists of open and closed brackets. by the application and programmer’s ments that dictate program fl ow and Within these stacks are modifi ers — preference. Ladder diagram (LD) assign values to variables. Variables which negate inputs or outputs, nest and function block (FB) are graphi- can be explicitly defi ned values, in- an operation, or put it on a stack to cal programming languages, while ternally stored variables, or inputs be pulled off, and perform checks structured text (ST) and instruc- and outputs. for currently evaluated results at the tion list (IL) are textual. Sequential p Ladder diagram is perhaps top of the stack. Because IL is the function chart (SFC) is a graphical the world’s most widely used indus- most fundamental level of the fi ve tool that organizes programs for se- trial automation programming lan- languages, the fi rst three options

33507_MSD_YASKAWA_new.indd507_MSD_YASKAWA_new.indd 4 55/17/10/17/10 3:143:14 PMPM Software development

The Yaskawa MP2300S system. IEC 61131-3 also lends itself controller  to the creation of reusable functions can be loaded with software developed and libraries. A function block writ- in MotionWorks IEC ten in any language can be stored 61131-3-compliant within a library — the easiest way to software to execute synchronized ensure portability. This allows pro- sequences and grammers to import code developed motion control in one during previous projects instead of integrated platform. starting from scratch. Function blocks can inherit com- plex data structures and functional- ity developed prior to the current project. This quickens the design stage, resulting in lower engineer- described here (FB, ST, ing costs and easier customization. and LD) can all be con- It also allows programmers to em- verted to instruction list. ploy function blocks that have al- In fact, in the early days ready been fi eld-tested on prior of embedded control, IL projects, expediting commissioning was the most common and startup. , lar task, while actions are aspects Although each IEC language because it easily translated into ma- of that task. Steps represent a par- has its own purpose and strengths, chine language codes for any pro- ticular state of the system, and they they all work together seamlessly. In cessor, ensuring effi ciency and fast perform control functions through fact, some of the best designs allow program execution speed. the use of actions. Transitions are interoperation of several languages r Sequential function chart the mechanisms employed to move to command targeted results within organizes programs for sequential from one task to another. A transi- one program. Because the different and parallel control processing for tion is coupled to a condition: When languages can be intermixed in an diagnostic purposes, batch pro- a condition becomes true, it deacti- application, programs are easier to cesses, and business applications. It vates the previous step and activates create and understand. describes the sequential behavior of the next. Sequential function chart Benefi ts aside, the IEC standard a control program by breaking the is used for complex sequential ap- does have limitations: For example, program into manageable parts. plications where multiple operations code written for one vendor’s hard- Sequential function chart is a must be performed simultaneously. ware platform often must be signifi - powerful method of structuring so- cantly modifi ed to run on another phisticated algorithms. It’s not an Why IEC? vendor’s hardware. Even so, IEC independent language, but an or- IEC 61131-3 is spreading because 61131-3 has laid the foundation for ganizing tool — and it resembles a of the many benefi ts for its users. more effi cient engineering. block diagram composed of steps, IEC-compatible software excels at actions, and transition conditions. providing an environment for eas- For more information, Steps are units of programming ily coding all the functionality de- call the author at (847) 887-7029 logic that accomplish a particu- manded of a modern automation or visit yaskawa.com.

Copyright © 2010 by Penton Media, Inc.

33507_MSD_YASKAWA_new.indd507_MSD_YASKAWA_new.indd 5 55/17/10/17/10 3:143:14 PMPM www.yaskawa.com

(800) YASKAWA (927-5292)

PR.MSD.01

33507_MSD_YASKAWA_new.indd507_MSD_YASKAWA_new.indd 6 55/17/10/17/10 3:143:14 PMPM