Java Reference
In-Depth Information
ControllerInterface
void openPump(String name,
int percent)
MixerInterface
void setColor(int r, int g, int b)
boolean colorReady()
MixerController
Supervisor
ControllerInterface redController
ControllerInterface greenController
ControllerInterface blueController
MixerInterface mixerController
void run()
void openPump(...)
void setColor(...)
boolean colorReady()
Figure 13.12
The interconnection of the supervisory console with the mixer
controller
ControllerInterface
. Accordingly, class
MixerController
should be declared to
implement
MixerInterface
instead of
ControllerInterface
.
The
setColor()
method first closes the input pumps and the spray pump of
the mixture tank. Then it opens the drain pump and evaluates the paint
flows from the colour tanks. When the
run()
method enters the EMPTY state,
the mixer controller requests the colour tank controllers to open their
output pumps to provide the evaluated paint flow. The mixer controller
guarantees that the mixture tank never gets empty until a new
setColor()
request is received.
The
colorReady()
method returns the value “false” only when the drain
pump is open.
package
scada.controller;
import
java.rmi.*;
public interface
MixerInterface
extends
ControllerInterface {
public void
setColor(
int
rc,
int
gc,
int
bc)
throws
java.rmi.RemoteException;
public boolean
colorReady()
throws
java.rmi.RemoteException;
}
import
scada.simulator.*;
public class
MixerController
extends
TankController
implements
Runnable, MixerInterface {