Elevator Simulation Project

Fault Tolerance Facility Simulator Addendum

18-649 Distributed Embedded Systems


General Information:

These extensions to the simulator interface should be all you need to implement fault tolerance for the failures we will inject for the final project demo.  Also note that if you have an object that sends and receives a message of the same type (for example a control object that listens for a particular atfloor message on the network, and sends its own atfloor message of the same type as well), then that object will not receive its own messages as inputs.


Computer Network Interface (CNI)(simulator.framework.CNI) and Public Framework Interface (PFI)(simulator.framework.PFI)

Additional Method:

public void CancelTimeTriggered(int whichMessageType)

Parameters:

Description:
Stops sending a message that was previously being sent using the SendTimeTriggered method.  This method applies to both the CNI and PFI classes.

Example:

myCNI.SendTimeTriggered(localCarCall.getType(), localCarCall); // Register to send a car call message on the network
.
.
myCNI.CancelTimeTriggered(localCarCall.getType()); // Stop sending the car call message


Harness class (simulator.framework.Harness)

Additional Method:

public long GetSimTime()

Description:
Returns current simulation time in nanoseconds.  (See the example below for a demonstration on how it is used).


MessagePayload class (simulator.payloads.MessagePayload)

All MessagePayload objects now have two additional members:

public static final long MESSAGE_NEVER_RECEIVED
long timeStamp

Description:
Records the last time a time-triggered message was received in its mailbox.  This variable is automatically set for time-triggered messages, but it is NOT set for event-triggered messages.  If the message has not yet been received at least once, the default timeStamp value will be set to MessagePayload.MESSAGE_NEVER_RECEIVED.

Example:

myPFI.RegisterTimeTriggered(localCarCall.getType(), localCarCall);  // Register to receive car call messages
myCNI.RegisterTimeTriggered(localAtFloor.getType(), localAtFloor);  // Register to receive atfloor messages
.
.
.
long currentTime = myHarness.GetSimTime();  // Get current time in simulation

if (currentTime - localCarCall.timeStamp > 3*100*Timer.MILLI_SECONDS) {
// do fault tolerance because we haven't received a car call in three message periods
}

if (currentTime - localAtFloor.timeStamp > 3*100*Timer.MILLI_SECONDS) {
// do fault tolerance because we haven't received an atfloor in 3 message periods
}


Return to Final Project Demo home
Back to Course home page