The second requirement is the establishment of a local control loop
between the PLCs and the simulated devices and a remote control loop
among the PLCs.
The third requirement is the definition of the PLC behaviours as finite
state automata. The tank controller should measure the current level of
paint in the tank and control the input and output pump in order to main-
tain the paint level between given thresholds. Figure 13.10 shows the finite
state automaton that describes the control logic of the PLC controlling a
colour tank. It is made up of four states: FULL , NOTFULL , NOTEMPTY and
EMPTY . The state transitions fire when the paint level of the tank reaches
the values of predefined thresholds. In correspondence to some state
transitions, the controller opens or closes the input pump.
In Prototype 1 we introduced interfaces TankInterface and PumpInterface .
They define the public methods implemented in class Tank and class Pump
that can be invoked by other components such as the local console. In
Prototype 2 these methods are invoked by the remote PLCs to impose the
desired behaviour on the work cell equipment.
Which distribution mechanism is best suited to the interconnection of the
The choice is between Java Sockets and Java RMI (see Sidebar 13.1).
Since RMI builds on the Sockets mechanism, the rationale of choosing one
technology or the other relies on the opportunity to have a more abstract
view of the communication mechanism or a more fine-grained control of it.
In Prototype 2 we have two different situations that require the use of
distribution mechanisms: the interconnection of the controllers to the work
cell equipment and the interconnection between the mixer controller and
the colour tank controllers. The first type of interconnection is meant to be
completely reimplemented when the simulated devices are replaced by the
real devices. Thus, using Sockets or RMI for the interconnection of the
simulated devices does not seem to matter. The second type of inter-
connection is not affected by the transition from the prototype to the real
application. Thus, the communication mechanism should be selected
Remote controllers basically exchange a low-traffic stream of commands
and signals according to highly specific data formats. Thus, we argue that the
RMI mechanism is more appropriate because the software developer can
take advantage of compile-time type checking of data structures to avoid
data type mismatch in commands and signals. The Socket mechanism