Java Reference
In-Depth Information
For this purpose the PLCs request a reference to the remote tank objects
using the RMI lookup mechanism. They just need the IP address of the
networked computer that runs the work cell simulator. In correspondence to
predefined threshold values (minimum, medium, maximum paint level) the
PLC updates its current state and sends commands to the remote pump
objects. Here, the colour tank PLCs and the mixture tank PLC have slightly
different behaviours. Thus, we implement class MixerController
as an
extension of TankController .
Class TankController controls the paint level in the remote colour tank by
invoking the setOutputFlow() method of its input pump. In contrast, class
MixerController controls the paint level in the mixture tank by sending
commands to the three colour tank controllers. For this purpose, the tank
controllers are implemented as remote objects that allow the remote invo-
cation of their public methods. In particular, they export the method
openPump() defined in interface ControllerInterface .
Both TankController and MixerController use class LocalConsole to build a
graphical user interface that allows the technician responsible to disable the
PLC and operate the work cell equipment manually.
package scada.controller;
import scada.simulator.*;
import java.rmi.*;
import java.rmi.server.*;
public interface ControllerInterface extends java.rmi.Remote {
public void openPump(String name, int percent)
throws java.rmi.RemoteException;
public class TankController extends UnicastRemoteObject
implements Runnable, ControllerInterface {
protected String name; // name of this controller
protected String tankState; // controller's state
protected final static String FULL # "FULL"; // state values
protected final static String NOTFULL # "NOTFULL";
protected final static String NOTEMPTY # "NOTEMPTY";
protected final static String EMPTY # "EMPTY";
protected int tankLevel # 0; // paint level in the tank
protected final static int MINIMUM # 10000;
// level thresholds
protected final static int MEDIUM # 50000;
protected final static int MAXIMUM # 90000;
protected final static long SAMPLING # 100;
// milliseconds
protected TankInterface tank # null ;
// interface to the tank
protected PumpInterface pumpA # null ;
// interface to the pumps
protected PumpInterface pumpB # null ;
Search WWH ::

Custom Search