AutomatedBuildings.com
Article - May 2000
[Home Page]

Award winning manufacturer of IT-based building automation.
EasyIO

(Click Message to Learn More)

Java and Building Automation Systems

Java and other Internet technologies have the potential to greatly impact control and monitoring systems.

Jim Butler and Keith Corbett

Reprinted with permission
Cimetrics


Introduction

The building automation industry is trying to understand how Java and other Internet technologies can be employed in control and monitoring systems. We at Cimetrics believe that these technologies can be used to provide new functionality to customers, while reducing costs by enabling the use of modern software engineering techniques.

This paper explores ways in which Java can be used in control systems. BACnet and Java are complimentary, and some of the ways in which Java programs could communicate with BACnet devices will be illustrated. As with most new technologies, there are technical challenges associated with Java, and these will also be evaluated.

What is Java?

Reliable Controls Java is an object-oriented programming language created by Sun Microsystems. Some of Java’s special characteristics are as follows:

1. Most Java programs can run on many different platforms without being modified or recompiled.

2. Compiled Java programs (applications and applets) are interpreted by a platform-specific Java Virtual Machine. Java Virtual Machines are available for most popular desktop operating systems and are beginning to appear for real-time operating systems. Most popular web browsers include a built-in Java Virtual Machine.

3. Java includes TCP/IP networking functionality.

These features made Java popular on the World Wide Web, but they are also relevant to distributed control applications such as building automation.

Java in Control and Monitoring Systems

Why should manufacturers of building automation systems care about Java? We believe that Java and the associated Internet technologies will greatly improve user access to these systems. In addition, Java could become a popular standard programming language for controllers.

Java in Operator Workstations
The World Wide Web has revolutionized the Internet by providing a well-defined framework for the dissemination of information, and the same technologies that underlie the World Wide Web will likely have a great impact on building automation systems as well. For the user of building automation systems, these technologies will allow almost any "PC" with a web browser and a communication link to the building automation system to be used as an operator workstation.

Consider the following building automation system: One or more devices (PCs or sophisticated controllers) act as gateways between the system and the outside world. Those gateways would likely be connected to a company intranet or perhaps the Internet. A gateway could be a web server: when an authorized user’s web browser connects to such a gateway, the browser would be able to download a set of web pages, Java applets, and other files which collectively make up the operator workstation software and data files for the building automation system. The Java applets executing in the browser environment could then retrieve information about the status of the building in real time from one of the gateways and display it in a browser window. It would also be possible for the user to modify operating parameters of the building if the Java applets and the software running on the gateway permitted it.

Internet technologies would be of particular benefit to users who need remote access to building automation systems. However, easier access to these systems is a double-edged sword, because unauthorized users will also have easier access. Java offers a number of security features, but these are relatively new features and as such have not yet been widely implemented. There is a great deal of work going on in the IS community to improve network security. In any case, building automation systems will need to be designed in such a way as to allow users to implement effective security policies.

Java in Programmable Controllers
Previously, we mentioned that Java applets could be downloaded from controllers, but we also believe that Java could be used as a programming language for controllers. Controller manufacturers will be understandably reluctant to abandon their current programming languages, but we believe that companies developing new control systems should evaluate Java for use in controllers. Here is why we think that Java is a good candidate.

Today’s controllers are programmed in a variety of languages. Some are fairly standard, such as ladder logic, BASIC, or C, and some are proprietary. Using a standard language has some clear benefits: someone else gets to document and maintain the language specification, sophisticated development tools are often available from third parties, and programmers who already know the language are plentiful if not always affordable! It can also be easier to test programs written in standard languages because it may be possible to run them on platforms that permit easier debugging. Java certainly qualifies as a standard language, albeit a young one.

The use of object-oriented programming languages and design techniques tends to result in code which is easier to reuse and maintain, leading to lower software engineering costs over the long term. Because Java is a relatively new object-oriented language, its design incorporates many of the good features of older object-oriented languages and omits some of the more complex features which add little value.

Control programs transferred to a controller may be an executable binary file that is directly executed by the CPU, or a file that is executed by an interpreter program running on the controller. The main advantage of the former approach is speed of execution; the main advantage of the latter approach is that application programmers do not need to have software tools for creating executable binary files specific to the particular controller platform (hardware and operating system). Compiled Java programs are executed by a Java Virtual Machine, which is a kind of interpreter.

Java was designed so that "pure" Java programs can be platform independent. One reason for the high degree of portability of Java programs is that the Java language provides a standard interface to a wide range of operating system features. For example, Java is a multithreaded language, which makes it relatively easy to build and maintain programs that must perform several independent tasks.

The Java language does not define how a program should directly access hardware or operating system calls, since those operations are inherently platform dependent. Such platform dependent code must be implemented in a language other than Java, but if properly designed it can be used by Java programs; one mechanism for doing this is Java’s Native Method Interface. For example, controllers will need special libraries written in a language other than Java to allow Java programs to access onboard analog and digital control hardware.

Graphical programming tools are becoming increasingly popular, because they allow people to program controllers without using a programming language. In most cases, the output of such tools will be a control program that is executable by the controller. That control program must be coded in some programming language even if it is created by a graphical programming tool, and that programming language could be Java.

Java does have some potential disadvantages for use in controllers. Java is not a particularly simple language, which may discourage some potential users who are not experienced programmers. The code required to implement a Java Virtual Machine is rather large, so it is not practical to run Java programs in controllers with limited resources.

Java in Application-Specific Controllers
Although application-specific controllers are unlikely to have the computing resources necessary to run Java programs today, Java could be of some benefit to these devices.

Currently, configuration of the operating parameters of application-specific controllers often requires a proprietary tool. But consider the following scenario: the configuration tool is a laptop computer running a standard browser, and the configuration program is a Java applet that is stored in the controller. Now the only problem is to how to retrieve that configuration program; naturally the controller will need to have some sort of communication port, such as a standard RS-232 serial port, which it can use to transmit the configuration program to the laptop and receive new configuration parameters. In this scenario the proprietary configuration tool is no longer necessary, but some proprietary software (a Java application?) is required in order to retrieve the configuration program from the controller.

Another way of using Java would be to provide a "virtual" front panel for the application-specific controller. A Java applet could be created which would to allow a browser to display operating information about a particular controller in real time. Unless the controller was capable of being a web server (quite unlikely!), a proxy server capable of communicating with the controller would be needed to act as an intermediary between the controller and the browser.

Java and BACnet

BACnet is becoming a popular network protocol for system-to-system communication in building automation applications, so it is natural to expect that some Java programs will need to be able to communicate with BACnet devices. BACnet and Java are complimentary object-oriented technologies, so it should be possible to develop elegant ways of combining them. Java’s built-in TCP/IP networking functionality can be used to assist in the implementation of BACnet capability, but there are some significant limitations.

Web browsers execute Java applets that have been downloaded from a server. A very high degree of portability is usually a requirement for applets, so any protocol stacks used by applets should only use Java’s built-in communication capability. However, if Java’s built-in networking support is used, browser security features usually limit Java applets to communication with the server from which the applet was downloaded.

A Java applet running in a browser environment may also communicate with BACnet devices other than the server from which the applet was downloaded if the server has the ability to send messages to BACnet devices on behalf of the applet. One scheme for accomplishing this is illustrated in FIGURE 1, in which an applet uses Java’s Remote Method Invocation (RMI) capability to make use of a BACnet protocol stack that is running in a server.

For Java applications, which do not run in a browser environment, there are other possibilities. Java applications are not restricted to communication with a single server while using Java’s built-in networking, so it would be possible to implement a portable BACnet protocol stack in Java which would allow a Java application to directly communicate with other BACnet devices using BACnet/IP (a method for BACnet communication over TCP/IP networks which is defined in the proposed Annex J to the BACnet Standard). The interfaces to existing BACnet protocol stacks could be modified so as to allow them to be used by Java applications. One advantage of using existing BACnet protocol stacks is that communication is not limited to TCP/IP networks. FIGURE 2 illustrates a controller running a Java application that is directly communicating with other BACnet devices.

Figure 1 - Accessing BACnet Objects from a Java applet

Figure 2 - Java Applications in a BACnet Programmable Controller

Technical Challenges

Companies contemplating incorporating Java into their control systems should carefully consider the potential technical challenges associated with Java in its current state.

Performance
The speed of execution of Java programs is currently much lower than that of equivalent programs written in C/C++. That is due to the fact that Java programs are interpreted at runtime by a platform-specific Java Virtual Machine, a fact that partially accounts for Java’s high level of portability. To address this problem, some companies are developing "just-in-time" compilers which will generate a platform-optimized executable from a Java program at runtime. Other companies are working on more traditional compilers. Sun Microsystems is developing microprocessors optimized for running Java programs. Note that it is possible for Java programs to access some code libraries written in other languages using Java’s Native Method Interface.

Another issue is real-time performance. Although building automation applications typically have less stringent requirements than some other control applications, certain operations must be performed within limited time periods. The Java language feature that concerns us the most in terms of real-time behavior is the garbage collector, which performs memory management but whose time and duration of execution is not well constrained; however, we believe that appropriate designs can minimize potential problems.

Resource Requirements
Java Virtual Machines are not likely to be able to run on small embedded devices due to their resource requirements. The code required to implement a Java Virtual Machine is quite large, and includes a multi-tasking operating system and a TCP/IP protocol stack. It is possible that a subset of the Java language appropriate for small embedded systems will be developed in the future, but for now the smallest system that could effectively run Java programs will have a 32-bit CPU and more than 1 megabyte of memory.

Portability Limits
Java applets and applications are very portable, but for certain applications they may need special libraries that are not written in Java in order to perform some platform-specific functions. For building automation applications, such libraries will include code for accessing on-board analog and digital control hardware. Those libraries will need to be rewritten or recompiled for each platform that needs to be supported.

Immaturity
Java is still a relatively young technology. Language features are being added quickly. Java Virtual Machine implementations are often behind in implementing the latest features, and the level of stability and conformance to the Java specification will not be high in all cases. Many tools for developing and testing Java programs are now available, and these tools are rapidly being improved, but they do not yet provide the same user comforts as tools for older programming languages such as C/C++.

Conclusions

Java and other Internet technologies have the potential to greatly impact control and monitoring systems. From a user’s standpoint, these technologies will make it much easier for them to access their systems. For control system manufacturers, the primary benefits will come from reduced software engineering costs as they are able to make greater use of commercial software offerings, tools, and modern software engineering practices.

Cimetrics believes that Java is an important technology for our customers, and we will work with them to develop control systems using Java and BACnet.

Cimetrics, Inc. 55 Temple Place Boston, MA 02111-1300 Tel: 617-350-7550 Fax: 617-350-7552 Info Request form

--------------------------------------------------------------------------------

Copyright © 1998 Cimetrics, Inc. All rights reserved. Revised: November 19, 1999.


Lynxspring
[Click Banner To Learn More]

[Home Page]  [The Automator]  [About]  [Subscribe ]  [Contact Us]

Events

Want Ads

Our Sponsors

Resources