tuned RPL parameters and improved calculation of path etx

This commit is contained in:
Joakim Eriksson 2012-02-21 19:06:58 +01:00
parent d44396f883
commit 5a65e3cc8b
2 changed files with 7 additions and 8 deletions

View File

@ -66,11 +66,6 @@ rpl_of_t rpl_of_etx = {
1
};
#define NI_ETX_TO_RPL_ETX(etx) \
((etx) * (RPL_DAG_MC_ETX_DIVISOR / NEIGHBOR_INFO_ETX_DIVISOR))
#define RPL_ETX_TO_NI_ETX(etx) \
((etx) / (RPL_DAG_MC_ETX_DIVISOR / NEIGHBOR_INFO_ETX_DIVISOR))
/* Reject parents that have a higher link metric than the following. */
#define MAX_LINK_METRIC 10
@ -90,8 +85,11 @@ calculate_path_metric(rpl_parent_t *p)
{
if(p == NULL || (p->mc.obj.etx == 0 && p->rank > ROOT_RANK(p->dag->instance))) {
return MAX_PATH_COST * RPL_DAG_MC_ETX_DIVISOR;
} else {
long etx = p->link_metric;
etx = (etx * RPL_DAG_MC_ETX_DIVISOR) / NEIGHBOR_INFO_ETX_DIVISOR;
return p->mc.obj.etx + (uint16_t) etx;
}
return p->mc.obj.etx + NI_ETX_TO_RPL_ETX(p->link_metric);
}
static void
@ -116,7 +114,8 @@ calculate_rank(rpl_parent_t *p, rpl_rank_t base_rank)
}
rank_increase = NEIGHBOR_INFO_FIX2ETX(INITIAL_LINK_METRIC) * DEFAULT_MIN_HOPRANKINC;
} else {
rank_increase = NEIGHBOR_INFO_FIX2ETX(p->link_metric) * p->dag->instance->min_hoprankinc;
/* multiply first, then scale down to avoid truncation effects */
rank_increase = NEIGHBOR_INFO_FIX2ETX(p->link_metric * p->dag->instance->min_hoprankinc);
if(base_rank == 0) {
base_rank = p->rank;
}

View File

@ -129,7 +129,7 @@
#else
#define DEFAULT_MIN_HOPRANKINC RPL_CONF_MIN_HOPRANKINC
#endif
#define DEFAULT_MAX_RANKINC (3 * DEFAULT_MIN_HOPRANKINC)
#define DEFAULT_MAX_RANKINC (7 * DEFAULT_MIN_HOPRANKINC)
#define DAG_RANK(fixpt_rank, instance) ((fixpt_rank) / (instance)->min_hoprankinc)