By using function blocks, machine and robot builders can speed development time and add more functionality to their solutions.

Many of us can remember when robot and machine builder OEMs developing an automation system only had the choice between relay ladder logic for PLCs, or assembly language for single-board computers and minicomputers. PLC logic was simple and basic, but they were very limited in computing capacity. They couldn’t handle complex control or data handling, so separate controllers and computers were needed for these tasks.
Programmers needed to spend lots of time writing code for everything from real-time operating systems to PID algorithms. Computers often only had 16K memory, and OEMs got little or no support from the computer vendor for real-time control applications, as single board computers and early versions of PCs were primarily designed for commercial use.

Fortunately, those days are gone, but OEM automation systems have also become more advanced, and programmers are now expected to create advanced automation systems with very high-speed control and synchronization, complex motion, vision systems, animated HMIs, multi-touch panels, remote access and communications to higher-level computing systems. They’re also expected to program these advanced machines and robots in mere weeks.

As a result many OEMs spend a considerable amount of time and effort developing software, which can adversely affect delivery schedules and costs. The good news is the introduction of modular software that can simplify code creation, allowing OEMs to quickly program complex systems at a reasonable cost.

Modular Programming Benefits

Modules Make Development Faster

Modular software, with its standard blocks of code, offers a way to simplify the development of controller and HMI programs. It gives OEMs the option to supplement their own internal programming efforts by obtaining specialized blocks of code from suppliers and other sources. Eventually, peripheral components on production lines, such as robots, will come with their own modular software that OEMs can drag and drop into their programming environments. In addition to speeding development time, the solution will be more standardized, thus making modifications and support easier for both OEMs and their customers.

In the Control Design February 2013 cover story “Machine Control: Tightly Woven Function Blocks,” Jason Conner, principal engineer at Concept Systems, a system integrator in Albany, Ore., describes his company’s use of modular software. “It’s less expensive for Concept Systems because code reuse eliminates greenfield programming, which is generally very time-intensive.” He adds that engineers can pick and choose software modules from internal libraries of code, knowing that the programs have already been well-tested and proven within a production environment.

Modular software also helps skid builders improve their solutions. Matt Bothe, senior process controls engineer at MC Polymers, a producer of styrene-butadiene in Charlotte, North Carolina, says he prefers modular programming when his company purchases process skids. In the Control Design cover story, Bothe says modular programming for conventional utility systems benefits his company through reduced installation costs, greater available support, reliable operations, consistent performance and facilitated troubleshooting. He also adds, “Particularly in the batch world, modular programming has proven to be significantly superior in programmability, efficiency, portability and troubleshooting to the alternatives, such as custom algorithms with little if any standardized structure and terminology.”

Application Examples 

Table 1 summarizes some of the benefits of modular programming, and an application example from the cover story illustrates the point. D&V Electronics in Woodbridge, Ontario, Canada, builds test equipment. “We manufacture vehicle starter, alternator or hybrid electric motor/drive testing systems,” says Ciprian Baciou, an engineer at D&V (Image 1). “These systems involve highly automated control and safety systems for actuators, pneumatic systems, and high-speed high-power dynamometer systems.”

Test System

“Revised functional blocks and libraries that are improved and developed can almost immediately be validated and deployed very easily. The customer takes a lot of control of the test system by using modular software,” observes Baciou.

PeakLogix in Midlothian, Virginia designs and installs material handling systems (Image 2). In the cover story, their director of technical services Matt Cummings explains why modular subroutines work well in their applications. “In a distribution center, the picking process may have a Low Unit of Measure picking module,” notes Cummings. “Within the pick module, the conveyor moves totes to various zones within the module where the picking takes place. When the tote gets to a particular divert mechanism within the zone, the control program— which receives its directions from the warehouse management system—will sense the presence of the tote and divert it, using output signals to turn solenoids on or off.”

complex material handling systems

Owens Design in Fremont, California builds custom material handling equipment, primarily for the semiconductor, hard disk drive and solar photovoltaic industries (Image 3). Doug Putnam-Pite, director of software development at Owens Design, explains their use of modular programming in the cover story.

“For our PLC code base, we have created a set of re-usable modular state-based ladder logic code libraries,” he explains. “We have a library of re-usable PLC code modules for servo motors, stepper motors, XY pick and place, and other commonly used control components. We have a PLC design cookbook that our PLC engineers follow to ensure consistent coding and software design standards.”

state-of-the-art wafer handling systems

As with other machine builders, modular software reduces their software development costs. “When using re-usable components, we often save 30% to 40% on software costs, as new software technologies always take much longer than expected,” adds Putnam-Pite.

Working with Modular Code

The myriad solutions available in today’s automation software market means programmers deal with new terminology on a regular basis: object-oriented programming (OOP), layers of abstraction, encapsulation, function blocks, inheritance, class deviation, polymorphism and modeling. OEMs must be familiar with these new methods, and modular programming helps them stay on top of the latest technologies.

“Concept Systems uses a wide range of software for providing solutions to our customers,” Conner notes in the cover story. The solutions use many different software platforms, ranging from simple ladder logic to more-complex, object-oriented C++. He adds, “Each platform has its own breadth of modularity, but we always use whatever capabilities are available within the software package to implement modular and reusable code.” For example, with PLC-based applications, user-defined types and device-specific routines make Concept Systems’ PLC code capable of being constructed as building blocks. For custom software development, object-oriented techniques enable reuse and unit testing, as well as clean structured code.

As opposed to modular programming, traditional custom coding increases the chances of errors. Programmers typically start at the top when programming and execute all the code one line or one rung at a time, then start over. The more extensive the code gets, the more unstable it becomes. Object-oriented, modular programming improves upon traditional monolithic programming methods by breaking code into objects, and then defining the interface between the objects. It also helps keep code isolated, which defines the concept of abstraction.
OOP seems to be widely accepted among vendors. It enables users to keep track of where their data is during program execution. Encapsulation and abstraction reduce complex code to simple blocks with inputs and outputs. For example, an advanced programmer creating a custom PID loop or a complex math function block can pass code between modules without fear of making a mistake in the rewrite of the software.
Machine builders’ customers also benefit by being able to add and subtract features as required to meet their own changing production demands. Combined with a well-built version control system for their code, modular software becomes a powerful tool.

Vendor-supplied Code

Many vendors now supply modular software code, such as device drivers, communications interfaces, and software support packages that help OEMs build code libraries. An OEM often becomes familiar with a vendor’s software modules, and then chooses to use the particular vendor for future applications, creating a powerful incentive for vendors to supply free modular code to their customers.

By using modular design techniques, OEMs and their customers enjoy cumulative benefits from the efforts of an international standards organization, an automation vendor, and a solution provider.

InduSoft supplies HMI software to machine builders, providing them with modular software for applications in which machines and robots need to communicate with higher-level software applications. Fabio Terezinho, vice president of consulting services for InduSoft explains in the cover story that InduSoft Web Studio is designed with the concept of layers of abstraction.

“The idea is to allow the user to build an HMI solution in blocks or modules that can be integrated and reused in a simple and timely manner. OEMs can build applications with InduSoft Web Studio and run them on any Microsoft platform, from Windows CE to Windows 8, without having to recompile or redesign the application. They can configure ERP integration rules, transactions and even redundancy regardless of the specific database engine used, including MS SQL Server, Oracle, Sybase and OSIsoft PI,” explains Terezinho.

While programming is more advanced than it was in the days of assembly language and ladder logic, it doesn’t necessarily have to be more difficult. Thanks to modular programming and vendor-supplied code, OEMs can create better solutions faster and more efficiently. This benefits both OEMs and their customers, who can more easily modify and add features, making modular code a win-win technology.

Christine Lesher

Disclaimer: AutomationDirect does not guarantee the products described in this article are suitable for your particular application, nor do we assume any responsibility for your product/system design, installation, or operation.

Originally Posted: Sept. 9, 2013