Open tommasogiannoni opened 4 years ago
The main files that modified is contiki-2.7/core/net/rpl/rpl-mrhof.c My solution is very simple as code below
#elif RPL_DAG_MC == RPL_DAG_MC_TOTALENERGY
return p->mc.obj.total_energy + get_total_energy_consumption();
You must set RPL_DAG_MC value to RPL_DAG_MC_TOTALENERGY mode
I added RPL_DAG_MC_TOTALENERGY
but cooja don't find it.
What file i need to change to add a new metrics ? i changed:
rpl-mrhof.c
by adding:
#elif RPL_DAG_MC == RPL_DAG_MC_TOTALENERGY
printf("TOTAL ENERGY METRIC LOADED");
return p->mc.obj.total_energy + get_total_energy_consumption();
rpl.h
by adding
#define RPL_DAG_MC_TOTALENERGY 9 /* Node Total Energy Comsumption */
and set the file: rpl-conf.h
with this parameters:
#define RPL_CONF_DAG_MC 9
that is the TOTAL ENERGY METRICS in rpl.h
#ifdef RPL_CONF_DAG_MC
#define RPL_DAG_MC RPL_CONF_DAG_MC
#else
#define RPL_DAG_MC RPL_DAG_MC_TOTALENERGY // <--- THIS
#endif /* RPL_CONF_DAG_MC */
But when i run simulation the code
printf("TOTAL ENERGY METRIC LOADED");
it is never executed.
Why ?
What is the files modified for use rpl total energy metrics and hou to include this metric in project simulation ?
Thanks