indexpreviousnext

file name: algfti.hpp, algfti.cpp
author: Klaus Schossmaier
classification: simulation
contents: class CFti, derived from class ACClockSyncAlgorithm
use: provides a convergence function that uses the Fault-Tolerant Intersection (FTI) function to compute a new clock value and a new accuracy interval; no extra parameters are needed for this function
 

global items used by CFti:


member functions of CFti:

CFti (CClockSync *cs): This constructor function calls ClockChanged() to initialize the deterioration and accuracy interval maintained by the local clock. If cs is NULL, an assert fails.

virtual void ClockChanged (): Initializes the deterioration and the accuracy interval maintained by the local clock. The function first calls ClockChanged() of the base class to initialize the estimated rate. Then it calls GetClock() to get a pointer to the local clock. If GetClock() returns NULL, the function returns at this point. Otherwise, it computes the accuracy deterioration and the accuracy interval and sets the clock accordingly.
Note: When initializing the clock, set the deterioration of the accuracy intervals before their length.

virtual EBool ConvergenceFunction (): The function gets first the associated network calling GetAssociatedNetwork(). If it exists, Fti() is called with this network. If the function returns True, the resulting interval is stored in newClockValue, and timeValid is set to True. If there is no associated network, or if Fti() returns False, timeValid is set to False. The function returns True if a new timestamp could be computed (in that case, inherited function ReportInterval() is called with the resulting interval of the CV), False if no associated network exists or if Fti() has failed.
Note: If no associated network exists, Fti() is not called and the database remains unchanged. If Fti() is called and fails, all time intervals stored for the associated network are discarded.

static ACClockSyncAlgorithm *CreateFti (CClockSync *cs): Creates a new object of type
CFti (passes cs to the ctor) and returns a pointer to it.

EBool Fti (CNtpTime& point, double& alpha_minus, double& alpha_plus, SINT32 networkID): Computes the new clock interval for the network, uses the time intervals that are stored in database. All interval entries of the given network are then deleted. The function returns True if the computation was successful, in that case the parameters point, alpha_minus, alpha_plus are set to the resulting accuracy interval. If the computation has failed, False is returned.
Algorithm FTI: The pre-processed accuracy intervals accuracyIntervals[] are calculated from database. The FTI function is applied on the accuracy intervals, where the reference point is set to the midpoint, leading to accIntResult. At last, the parameters point, alpha_minus, alpha_plus are set to handback the result.
Note: The debugging code to output the intervals on gnuplot-files can be (de)activated by (un)defining the according macro. In this case, the function writes its accuracy intervals (input intervals and result) to a file. Since the file only contains the data of the last call to Fti(), you have to set a breakpoint at the end of Fti() and check the file output for the calls to Fti() that you are interested in.
 

local items of the implementation file:

GNU_ACC_FTI: Macro to produce debugging code for the output of accuracy intervals onto file acc.dat.
 

local (static) functions of the implementation file:

EBool FTIntersection (SAsymInterval* input, SAsymInterval& output, INT32 size,
int f): Implements the FTI function, where size gives the number of input interval and f the maximum
number of faulty ones in input. When the computation is successful, it returns True and hands back
the FTI interval (reference point = midpoint) in output, otherwise it returns False and output remains
unchanged.
 


last modified: Fri Feb 5 18:55:56 1999