Java Reference
In-Depth Information
package scada.simulator;
import java.rmi.*;
import java.rmi.server.*;
public interface TankInterface extends java.rmi.Remote{
public int getLevel() throws java.rmi.RemoteException;
}
public class Tank extends UnicastRemoteObject
implements TankInterface {
public Tank( int color[], int percentLevel)
throws RemoteException { . . . }
. . .
}
public interface PumpInterface
extends java.rmi.Remote {
public void setOutputFlow( int percent)
throws java.rmi.RemoteException;
}
public class Pump extends UnicastRemoteObject
implements PumpInterface {
public Pump(Tank upstream, Tank downstream)
throws RemoteException { . . . }
. . .
}
public class Simulator extends JFrame
implements Runnable{
public Simulator() {
try {
// Registers the tanks and the pumps
Naming.rebind("RedTank", redTank);
Naming.rebind("GreenTank", greenTank);
Naming.rebind("BlueTank", blueTank);
Naming.rebind("MixerTank", mixerTank);
Naming.rebind("RedPumpA", redInputPump);
Naming.rebind("RedPumpB", redOutputPump);
Naming.rebind("GreenPumpA", greenInputPump);
Naming.rebind("GreenPumpB", greenOutputPump);
Naming.rebind("BluePumpA", blueInputPump);
Naming.rebind("BluePumpB", blueOutputPump);
Naming.rebind("MixerPumpA", sprayPump);
Naming.rebind("MixerPumpB", drainPump);
} catch (Exception e) { e.printStackTrace(); }
. . .
}
}
The PLCs are implemented as finite state automata (see Figure 13.10)
with class TankController . Every 100 milliseconds (this is the default sam-
pling time) each PLC measures the current paint level in the controlled tank.
Search WWH ::




Custom Search