23.08.2013 Views

Specification of Reactive Hardware/Software Systems - Electronic ...

Specification of Reactive Hardware/Software Systems - Electronic ...

Specification of Reactive Hardware/Software Systems - Electronic ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

394 Case Study<br />

process class<br />

Transporter Image<br />

instance variables<br />

position<br />

speed<br />

pendingWakeups<br />

: Position<br />

: Speed<br />

: WakeupQueue<br />

As indicated by the relations in the Object Class Diagram <strong>of</strong> Figure 12.9, a<br />

Transporter Image controls the Speed <strong>of</strong> the Transporter and keeps track <strong>of</strong> the Position <strong>of</strong><br />

the transport mechanism. Based on the position information a Transporter Image can<br />

wake up processes at requested Positions. To store the identifiers <strong>of</strong> the objects that are<br />

pending to be woken up, the instance variable pendingWakeups <strong>of</strong> type WakeupQueue is<br />

used. A WakeupQueue is a data object that stores for each wakeup Position a collection<br />

<strong>of</strong> object identifiers. The data class WakeupQueue is not further elaborated.<br />

The next part <strong>of</strong> the specification <strong>of</strong> process class Transporter Image directly follows from<br />

Figures 12.8 and 12.6:<br />

communication channels<br />

piti wake titr poti<br />

message interface<br />

piti!productArrived<br />

piti!currentPosition(InitialPosition)<br />

wake?wakeAt(Position,Id)<br />

wake!wakeup(Id)<br />

titr?productArrived<br />

titr!move(Speed)<br />

titr?encoderPulse<br />

poti?stop<br />

poti!start<br />

The Transporter Image class is a class with rather complex behaviour. This is due to the<br />

diverse incoming interrupt flows and an outgoing continuous flow (see Figure 12.6). It<br />

will appear, however, that this complex behaviour is easily and elegantly expressible<br />

in POOSL. The behaviour <strong>of</strong> a Transporter Image starts with a piece <strong>of</strong> initialisation<br />

behaviour expressed in terms <strong>of</strong> method initialise:<br />

initial method call<br />

initialise<br />

instance methods<br />

initialise aPosition:Position anId:Id<br />

position:=new(Position) setToZero;<br />

pendingWakeups:=new(WakeupQueue) makeEmpty;<br />

speed:=new(Speed) setToMaximum;<br />

titre!move(speed);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!