• 沒有找到結果。

Implementation of the Supervisor Using Java

Remote Supervision for Human-in-the-Loop Systems

4.3. Implementation of the Supervisor Using Java

This section first describes the agent concept, and then shows the implementation architecture and interactive modeling of the hierarchical supervisory control system.

Finally, the reasons of choosing implementation methods in Java technology are mentioned.

4.3.1 Agent Technology

The agent technology is a new and important technique in recent novel researches of the artificial intelligence. Using agent technology leads to a number of advantages such as scalability, event-driven actions, task-orientation, and adaptivity (Bradshaw, 1997).

The concept of an agent as a computing entity is very dependent on the application domain in which it operates. As a result, there exists many definitions and theories on what actually constitutes an agent and the sufficient and necessary conditions for agency.

Wooldridge and Jennings (1995) depicts an agent as a computer system that is situated in some environment, and that is capable of autonomous actions in this environment in order to meet its design objectives. From a software technology point of view, agents are similar to software objects, which however run upon call by other higher-level objects in a hierarchical structure. On the contrary, in the narrow sense, agents must run continuously and autonomously. In addition, the distributed multiagent coordination system is defined as the agents that share the desired tasks in a cooperative point of view, and they are autonomously executing at different sites. For our purposes, we have adopted the description of an agent as a software program associated to the specific function of remote supervision for the manufacturing system. A supervisory agent is implemented to acquire the system status and then enable and disable associated tasks so as to advise and guide the manager in issuing commands.

4.3.2 Client/Server Architecture

Fig. 4.3 shows the client/server architecture for implementing the remote supervisory control system. On the remote client, the human operator uses a Java-capable web browser, such as Netscape Navigator or Microsoft Internet Explorer, to connect to the web server through the Internet. On the web server side, a Java servlet handles user authentication, while a Java applet is provides a graphical human/machine interface (HMI) and invokes the supervisory agent. In this chapter, we use Java technology to implement the supervisory agent on an industrial PLC, with a built-in Java-capable web

server assigned to handle the client requests.

Remote Client

(with Java-capable Web browser)

Internet

I/O Bus

• Java Servlet:

for user authentication

• Java Applet:

for graphical HMI and to invoke supervisory agent

• Ladder Logic Diagram:

for direct sense and control of I/O devices

Industrial PLC

(with built-in Java-capable Web server)

Controlled System Remote Client

(with Java-capable Web browser)

Internet

I/O Bus

• Java Servlet:

for user authentication

• Java Applet:

for graphical HMI and to invoke supervisory agent

• Ladder Logic Diagram:

for direct sense and control of I/O devices

Industrial PLC

(with built-in Java-capable Web server)

Controlled System

Fig. 4.3. Implementation architecture of the remote supervisory control system.

4.3.3 Interactive Modeling

A sequence diagram of the UML (Booch et al., 1999) is applied to model client/server interaction in the remote control system. Within a sequence diagram, an object is shown as a box at the top of a vertical dashed line, called the object’s lifeline and representing the life of the object during the interaction. Messages are represented by horizontal arrows and are drawn chronologically from the top of the diagram to the bottom.

Fig. 4.4 shows the sequence diagram of the implemented remote supervisory control system. At the first stage, the Remote Client sends a hypertext transfer protocol (HTTP) request to the Web Server. Next, the Web Server sends an HTTP response with an authentication web page, on which the Remote Client can login to the system by sending a request with user/password. The Web Server then invokes a Java servlet to authenticate the user. If the authentication fails, the Java servlet will respond with the authentication web page again. On the other hand, if the authentication succeeds, the Java servlet’s response will be a control web page with a Java applet. The Java applet first builds a graphical HMI and constructs a socket on the specified port to maintain continuous communication with the server. Then, the Java applet acquires the system status through the constructed socket and displays it on the control web page iteratively by invoking the Device Handler to fetch the sensor states of Device objects. Finally, the supervisory agent is called by the Java applet and run to enable/disable associated control buttons on the

HMI according to the current system status so as to meet the required specifications. Thus, the Remote Client can send an action command by pushing an enabled button to control the remote system through the constructed socket.

HTTP request Remote

Client

Time

HTTP response (authentication page)

[Fail] HTTP response (authentication page) HTTP request (Login request)

Check user by Java Servlet

[Success] HTTP response (control page) 1. Build graphic HMI by Java Applet.

2. Build socket-communication.

3. Acquire and display system status via socket iteratively.

4. Run supervisory agent (enable/disable control buttons).

Request via socket (action command)

Device

HTTP response (authentication page)

[Fail] HTTP response (authentication page) HTTP request (Login request)

Check user by Java Servlet

[Success] HTTP response (control page) 1. Build graphic HMI by Java Applet.

2. Build socket-communication.

3. Acquire and display system status via socket iteratively.

4. Run supervisory agent (enable/disable control buttons).

Request via socket (action command)

Device

Fig. 4.4. Interactive modeling with sequence diagram for the remote supervisory control system.

4.3.4 Java Implementation

In this thesis, we have employed the Java servlet for authentication and Java applet for graphical HMI. A Java servlet (Hunter and Crawford, 1998) is a compiled code, dynamically loaded to process requests from a Web server. It does not depend on browser compatibility due to running on the server side. Moreover, a Java server page (JSP) is a script and compiled into Java servlets during its first invocation and may call JavaBeans to perform processing on the server. A JavaBean is a portable, platform-independent component model, developed in collaboration with industry leaders. Since JSP with

JavaBean requires the script translation, Java servlet has been selected for implementation due to its faster performance and easier debugging. On the other hand, a Java applet (Campione and Walrath, 1995) is a widely used program that can be embedded in a Web page. When you use a Java-enabled browser to view a page that contains an applet, the applet’s code is transferred to your system and executed by the browser’s Java virtual machine (JVM).

This thesis has adopted the Java applet for graphical HMI due to its plentiful availability of application programming interfaces (API). Also, most Web browsers (Navigator or Internet Explorer) provide the JVM to support Java applets. Moreover, as shown in Fig. 4.4, the TCP socket communication is used for data transmission due to its easier implementation. For distributed application development, the Java remote method invocation (RMI) or interface definition language (IDL) can be further applied (Hunter and Crawford, 1998). Moreover, Java object-oriented programming is one where each small part of the program is considered as a separate object that can interact with other objects. The advantage of object-oriented software is that blocks of code can easily be reused in different parts of the program, or even in different programs. This reduces development time and therefore costs (Rumbaugh et al, 1991).

相關文件