Trickle library

From Contiki
Revision as of 23:31, 8 November 2014 by Subhashi (Talk | contribs) (Created page with " Back to Contiki Tutorials __TOC__ == Introduction == In this tutorial you will get to see what a trickle timer is and what the trickle library file ...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Back to Contiki Tutorials

Introduction

In this tutorial you will get to see what a trickle timer is and what the trickle library file contains. We will also see how we can modify the basic function parameters here according to our needs. The trickle algorithm as stated in the RFC allows nodes in a lossy shared medium to exchange information in a highly robust, energy efficient, simple and scalable manner. The Trickle library contains the functions used to implement the trickle algorithm. Trickle algorithm forms the base on which the trickle timer runs. The trickle timer on the other hand contains the details of the functions which are used in the trickle library. The trickle algorithm is used to check if whether there is any change in the information present in the system. When such a change is detected, sufficient measures are taken to ensure that the inconsistency is resolved.

Objective

The main objective of this tutorial is to explore what a trickle library contains, the algorithm on which the library is based and how a protocol uses this library.

What you will learn

You will get to learn how the code for trickle timer is implemented based on the trickle algorithm, what functions are used in the trickle library to support this algorithm. How the timer interval is set and the parameters can be modified to suit our applications needs.

Details

Description of the trickle algorithm

There are 3 parameters in the trickle algorithm. IMIN, IMAX and k, where IMIN is the min interval size, IMAX is the number of doublings of IMIN and k is the redundancy constant. There are 3 variables I which defines the current interval size, t which states the current time in the interval range, and c which is a counter variable.

Working of the algorithm

Before starting the timer the IMIN value is set from the range [I/2, I]. The counter variable (c) helps keep track of the condition of the system whether it’s inconsistent or consistent. If it’s consistent the counter is incremented, else its reset. This c value must always be less than k (which is called the redundant constant). The trickle is reset to IMIN when the timer expires else it is doubled. Care must be taken to check if the new current interval falls within the range above. The nodes can even be made to suppress the inconsistency when required. This is not recommended but for few applications we might need to disable the suppression by setting k = 0.