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.

12.3 The Essential <strong>Specification</strong> 391<br />

immediately starts executing the initial loopForever method:<br />

initial method call<br />

loopForever<br />

The loopForever method is defined as follows:<br />

loopForever<br />

acceptProduct;<br />

storeProductInfo;<br />

scheduleServices;<br />

waitTilNextProductArrivalIsSafe;<br />

loopForever<br />

"Enter new product information and physical product."<br />

"Fill a free Product Info Keeper with the accepted PI."<br />

"Notify scheduler <strong>of</strong> product entrance and initial position."<br />

"Arrange a wake up for a new arrival based<br />

on the appropriate packet distance."<br />

The loopForever method repeatedly executes the sequence <strong>of</strong> methods acceptProduct,<br />

storeProductInfo, scheduleServices and waitTilNextProductArrivalIsSafe. These methods,<br />

their names and their internal behaviour are derived from the narrative description <strong>of</strong> the<br />

Product Flow Scenario (Subsection 12.3.3). After the waitTilNextProductArrivalIsSafe has<br />

terminated, the loopForever method calls itself in a tail recursive manner. In the following<br />

the acceptProduct, storeProductInfo, scheduleServices and waitTilNextProductArrivalIsSafe<br />

methods are defined. The method behaviours are explained by comment listed between<br />

quotes.<br />

acceptProduct<br />

i?accept(productInfo);<br />

piti?productArrived;<br />

piti?currentPosition<br />

(initialPosition)<br />

"Accept next product information."<br />

"Wait until corresponding mailing product arrives."<br />

"Read the initial position <strong>of</strong> the arrived product."<br />

storeProductInfo<br />

pihp?free(piKeeperId); "Read identification <strong>of</strong> free Product Info Keeper."<br />

pihp!store<br />

"Store product info in free Product Info Keeper."<br />

(piKeeperId,productInfo)<br />

scheduleServices<br />

pihs!schedule<br />

(piKeeperId,initialPosition)<br />

waitTilNextProductArrivalIsSafe<br />

id : ProductInputHandlerId<br />

wake!wakeAt(initialPosition<br />

+productDistance,myId);<br />

wake?wakeup(id ¡ id = myId)<br />

"Send schedule message to Service Scheduler."<br />

"Declare local variable id."<br />

"Ask Transporter Image to get woken when<br />

the previous product has been transported<br />

over a productDistance <strong>of</strong> distance."<br />

Notice that the condition id=myId in the conditional receive statement wake?wakeup(id<br />

id=myId) makes sure that the wakeup message is only accepted if it carries the correct<br />

object identifier.

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

Saved successfully!

Ooh no, something went wrong!