Insulin Pump


Class SampleTestBed

java.lang.Object
  |
  +--GenericTestBed
        |
        +--SampleTestBed

public class SampleTestBed
extends GenericTestBed

A sample test bed class. This class is based on GenericTestBed. It checks the following safety property: after the insulin reservoir has been removed for at least 20s, the display should not tell the user that some insulin is remaining.

The safety property is implemented in the method safetyPropertyIsRespected(). This method is used in aNewSecondHasPassed() to check that the property is respected after each second.

To test the insulin pump in different configuration, the test bed launches 5 successive experiments (in runTestSet()). In each experiment a fixed amount of insulin is injected 5 second after the start. The reservoir is removed at different time depending on the experiment: 5s, 10s, 15s, 20s, 25s.

You can run this SampleTestBed by using

java SampleTestBed


Field Summary
protected  int durationOfExperience
           
protected  int numberOfFailedExperience
           
protected  int timeSinceReservoirHasBeenRemoved
           
protected  int timeWhenInsulinInjected
           
protected  int timeWhenReservoirIsRemoved
           
 
Fields inherited from class GenericTestBed
display, hardware
 
Constructor Summary
SampleTestBed()
           
 
Method Summary
 void aNewSecondHasPassed()
          This method is called each time the Clock class completes a control loop cycle.
static void main(java.lang.String[] args)
           
 void runTestSet()
           
protected  boolean safetyPropertyIsRespected()
          This method check the safety property targeted by the test bed: "after the insulin reservoir has been removed for at least 20s, the display should not tell the user that some insulin is remaining".
 
Methods inherited from class GenericTestBed
destroyInsulinPump, getActiveTestBedObject, getSimulationTime, launchNewInsulinPump, printMessage, setDurationOfOneSecondInMS
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timeWhenReservoirIsRemoved

protected int timeWhenReservoirIsRemoved

timeWhenInsulinInjected

protected int timeWhenInsulinInjected

durationOfExperience

protected int durationOfExperience

numberOfFailedExperience

protected int numberOfFailedExperience

timeSinceReservoirHasBeenRemoved

protected int timeSinceReservoirHasBeenRemoved
Constructor Detail

SampleTestBed

public SampleTestBed()
Method Detail

aNewSecondHasPassed

public void aNewSecondHasPassed()
Description copied from class: GenericTestBed
This method is called each time the Clock class completes a control loop cycle. In this method you can use the hardware simulation interface GenericTestBed.hardware to simulate failures, the display simulation interface GenericTestBed.display to activate the human computer interface and read the displays.

GenericTestBed provides a number of 'helper' methods (listed below) that you can use inside GenericTestBed.aNewSecondHasPassed() to get information on the simulation, print messages, and to modify some parameters of the execution. Note that the pump will execute until GenericTestBed.destroyInsulinPump() is called. If GenericTestBed.destroyInsulinPump() is not called inside GenericTestBed.aNewSecondHasPassed() the pump never stops.

Overrides:
aNewSecondHasPassed in class GenericTestBed
Following copied from class: GenericTestBed
See Also:
GenericTestBed.getSimulationTime(), GenericTestBed.printMessage(String), GenericTestBed.destroyInsulinPump(), GenericTestBed.setDurationOfOneSecondInMS(int)

safetyPropertyIsRespected

protected boolean safetyPropertyIsRespected()
This method check the safety property targeted by the test bed: "after the insulin reservoir has been removed for at least 20s, the display should not tell the user that some insulin is remaining".

runTestSet

public void runTestSet()

main

public static void main(java.lang.String[] args)

Insulin Pump