Java brings opportunities to industrial automation

Like many in the embedded systems industry, industrial automation vendors have watched and waited for the validation of Java in their domain. At the top of the list of concerns are performance problems caused by simplistic implementations of the Java virtual machine (JVM) and garbage collection algorithm.

By Dr. James Lathrop May 1, 2001

Like many in the embedded systems industry, industrial automation vendors have watched and waited for the validation of Java in their domain. At the top of the list of concerns are performance problems caused by simplistic implementations of the Java virtual machine (JVM) and garbage collection algorithm. However, with a new generation of Java virtual machines sporting real-time garbage collection algorithms and throughput speeds approaching that of C++ on many common operations, the time is ripe for industrial automation to reap the benefits of the Java programming language.

What makes Java fit the industrial automation world are the concepts of JVM and class file. A class file is a sequence of machine-independent instructions interpreted by the JVM running on a host computer. Java virtual machines and class files have been used on the Internet for several years to download and execute programs inside web browsers.

Typically, a class file is sent over a network and loaded into the Java virtual machine via a Java classloader, which reads the class file, validates it, and loads it into memory ready for the JVM to execute. Because class files are machine independent, the classloader and JVM combine to load and execute Java files in exactly the same manner, with the same results, on any hardware platform.

Hardware independence

One of Java’s primary advantages is its ability to run programs on different hardware platforms without recompiling source code. For industrial automation, this has several benefits.

First, as hardware is updated and newer controllers replace older controllers, no change in the binary software is required. For example, if a PLC that fully utilizes a 40-MHz Intel processor is upgraded to a 100-MHz Power PC processor, then the same binary class files can be used for both controllers, assuming that hardware ports and external interfaces are programmed for portability.

Second, hardware independence allows developers to “simulate” the run-time environment on a desktop computer, greatly reducing development time. With the simple addition of low-level hardware simulation, the same application class files that run on the target PLC can also execute on a desktop computer for development and debugging.

Easier debugging

Familiar debugging tools and development environments not tied to specific hardware platforms are easier for developers to learn and use, and testing does not require the constant downloading and setup of the target PLC. Another benefit is that debugging is only required on a single version of source code—once for all platforms. This reduces project overhead and maintenance by greatly simplifying project build configurations, reducing coding errors, and simplifying bug tracking and change requests.

In addition to cross-platform compatibility, Java programming language provides the means for seamlessly downloading new or revised code to PLCs without any type of reset of the hardware or JVM. This ability, called dynamic downloading , was designed into the Java language with this idea in mind.

Imagine a factory with PLCs controlling automobile part production and connected via a wireless company intranet. Using a web browser, the production controller can change PLC configuration to produce camshafts for six-cylinder engines instead of four-cylinder engines without intervening with the machine physically. While such behavior could be accomplished using another programming language, Java makes this type of system architecture easy and intuitive to program. Benefits are clear when considering the movement towards just-in-time delivery of products.

Not only can dynamic downloading change hardware’s behavior, it can also be used to “patch” existing code or add more functionality. Ability to change a single source file, recompile it, dynamically download only the changed class file, and link it into a running JVM provides added flexibility for software maintenance.

Essentially, Java brings cross-platform compatibility and dynamic downloading to industrial automation. However, Java also provides software safety, developer productivity, and access to a large set of libraries that provide rapid design and coding of applications. With embedded Java libraries designed to provide pure Java interrupts and input/output functions, developers can write platform-independent device drivers, providing further cross-platform compatibility. Rapid improvements in Java technology and advancements in hardware have made Java a viable solution for industrial automation. The question is not whether Java will be adopted for use in industrial automation, but rather who will be the first to take advantage of what Java offers.

Dr. James Lathrop, director of professional services, NewMonics (Ames, Ia.), jil@newmonics.com , www.newmonics.com

Java’s advantages

1Portable binariesallow seamless deployment across platforms

Object-oriented programming improves productivity two to 10 times

Reuse of code leverages original code investment

Run-time environment enables extensibility

Java compiler and classloader aid security