Interactive

The power and utility of dynamic process simulations can be enhanced by interactive interfaces which allow hands-on control of the model. Using modern software tools one can develop direct manipulation interfaces which attach to existing simulations. An example of such a system, the Interactive Process Control Panel, is presented.


Introduction
Computer simulations of physical systems have become commonplace tools for engineers. Chemical engineers use process simulations for a variety of tasks ranging from process design to relief valve sizing. Simulation has changed significantly over the last two decades, beginning with programs punched on cards and submitted to mainframes, progressing through interactive computing on hardcopy terminals with line editors, and eventually to mini-computers which support graphics terminals and full screen editors. The most recent step in this evolution is the 32-bit desktop workstation which now offers sufficient computational power for many simulation tasks. At each step in this process the user interface has improved and using the computer to solve engineering problems has become easier, faster, and more enjoyable. The move to workstations with mouse based input and bit-mapped graphics screens offers exceptional promise in that it will allow us to redefine the traditional human-simulation interface. Over the next decade we may hope to change simulation in the way that word processing has changed document preparation.
The purpose of this note is to expound the power of hands-on process simulation and to encourage the chemical engineering community to exploit this technology. One good way to take advantage of this technology is to build advanced user interfaces into new simulation systems. An alternative is to develop interactive programs which are capable of serving as interfaces for existing simulations. As an example of this second approach, the interactive process control panel, a software system for hands-on control of dynamic simulations is presented here. This software represents a step towards the user interface of the next decade. I am happy to distribute the source code to the engineering community in the hope that this system, or its derivatives, may grow into a general public domain tool. Parties interested in obtaining this software should contact the author.

Direct Manipulation and Simulations
Much recent research in man-machine interfaces is centered around direct manipulation, a term coined by Schneiderman [1]. With a direct manipulation interface a mouse is used to manipulate icons, windows, menus, etc. The Macintosh! operating system is a familiar example of direct manipulation, as are some of the popular spreadsheet systems. Hutchins et al. [2] provide an excellent discussion of direct manipulation. Readers who are interested in this area of research should also see diSessa [3]. Work by Hollan et al. [4,5] involving the Steamer system, is an impressive example of direct manipulation which will be of interest to chemical engineers. Steamer is a detailed, realistic control panel for a simulated steam propulsion plant.
The idea of an interactive interface for dynamic simulation is not new. Simulators have been used for training for quite some time, perhaps the most sophisticated examples being flight simulators used for pilot training. Many of these systems provide a realistic replica of the plant control room (or cockpit) with actual control hardware connected to a simulation of the process. The PICONS and G.2* systems provide similar capabilities in software and are designed to integrate Artificial Intelligence techniques with conventional process control hardware.

The Interactive Process Control Panel
The interactive proces control panel is not a simulator, but an interface for control of existing dynamic chemical process simulations. It is modeled after control panels found in chemical plant control rooms and is easily connected to sequential modular process simulations. Functioning graphical images of controllers and valves are manipulated using the mouse. The system has the following features: • Images of PI controllers appear on the bit-mapped screen. These objects look and operate like real controllers and can be tuned or operated in manual or automatic mode using the mouse.
• With the mouse, the user can alter the controller parameters while the simulation is running. In addition to tuning parameters, the user can change the range of input and output variables, effectively changing instrumentation or pump and valve capacities.

•
The system is easily integrated with many existing simulations.
• New panels are constructed by selecting icons from a menu. When an object type is selected, a window appears presenting the properties to be filled in. When these properties are assigned, the object is added to the panel.

•
The system is compatible with most procedural languages. Sequential modular simulations written in FORTRAN, C and Pascal have been interfaced using this tool.
The program alternates between calling the simulation and the window manager, and the system is easily integrated with sequential modular simulations in which time monotonically increases. It may be possible to use this system with equation based simulators, although it has not been done. With variable step size integrators the apparent speed of the simulation will change with step size, a minor inconvenience.
This system utilizes SunViewt graphical objects (sliders, buttons, etc.) and thus require* a Sun workstation with the SunView windowing environment. A port of this system to X-Windows [6] may be done in the future. The control panel software is written in C [7] and makes use of data abstraction and computational objects. For an excellent review of object oriented programming see Winston and Horn [8]. Other languages, notably LISP and Smalltalk, offer much better facilities for object oriented programming. C offers some advantages over LISP in speed and ease of interfacing with FORTRAN, which remains a common language used in process simulation. If a major revision of this system is done (e.g. a port to X-Windows), C+ + [9] is a likely choice of language. The object oriented concept of classes (implemented in C+ + ) may become a standard feature of C at some point in the future [10].

Using the Interactive Process Control Panel
This section describes the use of the interactive process control panel. As an example, consider the water-methanol distillation tower shown in Figure 1. The workstation screen in

Building an Interface
This section briefly outlines the methodology for attaching a sequential modular process simulation to the control panel. The model is first partitioned into three subroutines; startrun, endrun, and simulate. Startrun and endrun are called only at the beginning and end of the run and perform whatever initialization and file 10 are desired before and after simulation runs. Simulate makes one integration pass through the simulation and returns. In practice, simulate is usually just the existing batch run code with the statements causing the time loop commented out.
Next, the user must lay out a control panel for the process. For this purpose a mouse based tool called builder is provided. Builder presents the existing panel board (if one exists) along with several icons (valve, controller, indicator, or profile). When the user selects an icon an editor window appears presenting the appropriate attributes to be filled in. When the input is complete the user pushes a button causing the new object to be added to the panel.
The routines startrun, endrun, and simulate are compiled and linked with the panel library. One line of code per object is required to complete the interface. The C versions of the functions are shown below, FORTRAN callable versions exist as well.

C Versions of Control Panel Functions float get_valve(n)
/* returns the current value of valve n */ int n; float pi_controller(n,input,DT) /* returns output for controller n */ int n; float input; /* input variable value */ float DT; /* time step in hours */ set_indicator(n,value) /* set the value of indicator n to value */ int n; float value; /* new value for indicator n */ load_profile_yalues(n,v) /* display the vector v in profile n */ int n; float *v; /* vector of values for profile */

Discussion
Interactive simulation will change the way we interact with our computer models in the next decade. To take full advantage of this powerful concept we must develop tools which provide this type of simulation. Interactive simulation holds particular advantages in the following areas of chemical engineering simulation.

•
Dynamic process simulation development • Control system design • Startup and shutdown procedures, batch processing • Providing hands-on experience for students in process control The software system presented here is useful for a variety of tasks including process simulation development and control system design. At du Pont, we have used it as an aid in control system design for several small processes, (e.g. an extruder system). We also have one complex simulation which is controlled by the panel, consisting of over 50 unit operations and 30 active controllers spread over five panel boards. One area where the present system is clearly useful is providing students with hands-on experience in process control.
Changing tuning parameters and watching a system respond can enhance students' understanding of process and control system behavior.
The software tool described here is greatly lacking in many respects, but provides an example of better things to come. The list of improvements which could be made is long and includes a better indicator (a real dial), and a variety of different controller types and algorithms. Portability to other hardware and software environments (X-windows) would dramatically increase the system's utility. Other obvious improvements include the ability to alter not only the tuning, but control structure without programming changes, and a mouse based strip charting system. The primary reason for offering the software to the engineering community is the hope that it will evolve into, or at least inspire the development of, a general public domain tool.