[Tinyos-devel] 4bitle LinkEstimatorP.nc

Omprakash Gnawali gnawali at usc.edu
Thu Mar 12 22:15:50 PDT 2009


On Tue, Dec 2, 2008 at 6:08 PM, Omprakash Gnawali <gnawali at usc.edu> wrote:
> On Tue, Dec 2, 2008 at 11:18 AM, Andreas Köpke <koepke at tkn.tu-berlin.de> wrote:
>>> > void updateEETX(neighbor_table_entry_t *ne, uint16_t newEst) {
>>> >    ne->eetx = (ALPHA * ne->eetx + (10 - ALPHA) * newEst + 5)/10;
>>> > }
>>>
>>> Adding 5 will cause the estimate to veer of the historical value
>>> (eetx) or the new measured value (newEst).
>>
>> The current operation is:
>> floor((9*oldEst + newEst)/10)
>> the new operation is:
>> round((9*oldEst + newEst)/10)
>> or with fewer brackets and not correct in integers:
>> floor(9/10*oldEst + 1/10*newEst + 5/10).
>> since floor(5/10) = 0, adding 5 just changes the round direction: from floor to
>> nearest. Ah, the beauty of integer arithmetic.
>>
>>> In your experience, adding 5 helped?
>> Yes -- the estimator converges smoother.
>>
>
> I was aware of truncation but not aware of eetx fluctuation due to
> this truncation in my experiments, even looking through the eetx trace
> of the neighbors. But I will commit your change because rounding is
> the right thing to do here.
>

Andreas, I just commited this fix which changes trunc to round for the
function you mentioned. I found one other instance of trunc which
should have been round. This is related to computing the in-bound link
quality. I changed that to round as well.

- om_p



More information about the Tinyos-devel mailing list