There is more to motors than just switching them on or off. The IEC 61131 standard provides for five general methods, some more textual and some more graphical, according to Boris Sedacca.
Text: IEC 61131 specifies the syntax, semantics and display for PLC programming methods: ladder diagram (LD), sequential function charts (SFC), function block diagram (FBD), structured text (ST) and instruction list (IL). IL and ST are text-based, while SFC, LD and FBD uses graphical programming techniques.
Whereas textual languages originate in computer programming, graphical representation of applications is more typical in PLC programming. Of the graphical development environments, ladder is probably the most familiar to electrical engineers, using elements like ‘normally open’ or ‘normally closed’ relay contacts. The engineer can instinctively see two switches in series as providing the logic AND function, while two in parallel provide the OR function. Large scale logic processes lend themselves more readily to FBD, where function blocks correspond to complex logic circuits.
Before the days of programmed logic, motors were controlled by relays or coils that were hardwired into an electrical control circuit. The hand drawn schematics were known as ladder diagrams. Mark Daniels, UK & Ireland field business leader for architecture and software at Rockwell Automation, has seen his company’s traditional strength in LD for PLC development evolve over the years to encompass the other IEC 61131 programming schemes, allowing the company to enter new markets like process industries in addition to its traditional base in discrete manufacturing.
“We started by adding an SFC capability and a little bit of structured text, but now we support all methods and the one which is really taking off is function block,” Daniels states. [Page Break]
“Rockwell Automation now provides multi-disciplinary control on its hardware, from ladder for high speed motion control problems to more complex distributed control systems (DCS) where FBD is very much the configuration of choice, particularly for proportional integral derivative (PID) loop control on analogue systems for flow, pressure and temperature.
“The function block editor is optimised for things like instrumentation readings, and the native format of a drawing in FBD is pretty much based on a process control closed loop. The editing environment maps out the way in which inputs, processes and outputs are connected as blocks in the PID loop, in keeping with the way in which an engineer would conceive the control algorithms for a particular application.”
Daniels claims that Rockwell Automation’s Logix PLC provides a common hardware platform for all operations ranging from high speed canning lines at 2,000 per minute to slower moving processes incorporating multiple PID loops. He argues that most engineers would not want to work on all IEC 61131 development environments, and would want to maintain a skill set on one hardware environment to keep control of cost.
Structured text resembles C programming and is useful if complex algorithms need to be brought into play, so it is quite common to write one or two ST routines inside a function and otherwise mix and match routines. Ladder still has a loot of attraction from and maintenance and troubleshooting point of view, whereas instruction list is similar to machine code for computer processors and very powerful because of its low-level instructions, although it needs a high skills set. [Page Break]
Daniels adds: “Rockwell Automation does not support IL because we do not believe that engineers need to go to so low a level of machine programmability, and that you can achieve everything in IL by using a combination of the other methods.
“SFC is used in pharmaceutical and batching applications where you have small individual chunks of code and you want to interlink them, so you can write small chunks of LD or FBD and then link them together in SFC. This works well with the state change model and makes it easy to write code in a very structured way to meet all the procedures that pharmaceutical operations need to comply to.
“If you have too much prescriptive behaviour around a language, it can stifle innovation so the IEC 61131 standard has specified a minimum set of functions as rules for engineers to play by, but PLC manufacturers offer additional functions over and above those specified. [Page Break]
“Rockwell Automation provides add-on instructions to package up multiple standard-compliant instructions into a chunk of code. Customers are doing this because of productivity and flexibility benefits, for example a in process which involves many pumps that need controlling.
“You can basically build an instruction called ‘pump control’, which might have a couple of PID loops, and which gives you a level of capability beyond the original scope of the IEC 61131 standard. It also provides enhanced security because you can lock down the intellectual property created.”
IEC 61131 covers data structures and types and Daniels says Rockwell Automation provides for user-defined data structures, for example where there may be several process variables associated with a pump. Data types include integers, Boolean and floating point which may be combined into a user-defined data type called ‘pump’.
The online forums provide an interesting insight into the preferences of various engineers for particular IEC 61131 programming methods.
Maurice Daniëls, a control engineer in the Eindhoven Area of the Netherlands, favours ST, “Because it is easy to read. You can create simple programmes, but also more difficult ones with the same language, and some PLC development tools let you build classes, do file handling and string commands - some functions other language do not support.” [Page Break]
Patrick van Eybergen, an Australian industrial automation specialist likes FBD, “to layout the logical components of my project. Inside the function blocks I either use ST or SFC, depending on the complexity of the logical component inside. When I use SFC, I use structured text inside the actions. Again depending on how complex the requirements are, I may use case statements inside my actions, to break the action into even smaller sequential code blocks. I've been programming with IEC61131 for more than 10 years, and am still finding new and better ways to do things.”
Malaysian consultant Zulfakar Aspar says: “For a simple project, I prefer to use LD while SFC helps me to see the whole flow in a larger or complex system. However, the LD variant I am using allows me to add custom function to be written in BASIC language. Therefore, I can still write a large and complex system using LD if I want. I have done this when I developed complete system for injection moulding machine and five-axis robot arm.”
Javier Diaz de Ilarraza, who is involved with control and electrical development in the Bilbao Area of Spain, also favours ST, for example for calculation of a polynomial which may be coded in just one line, whereas with LD this would be much more cumbersome. “Structured text is similar to pascal, and easy to understand,” he adds.
Fig. 1 (. L7 PAC in chassis.jpg) The Allen-Bradley ControlLogix L7 programmable automation controller (PAC) from Rockwell Automation has predefined add-on
Fig. 2. (Mark Daniels CRW_1496.jpg) Mark Daniels: "Function block is really taking off."
Fig. 3. (PR_INT_GEN_INT_PMM_LOG_1756_00009.jpg) ControlLogix systems use a common control engine and development environment.