1)您可以从 contiki/core/net/rpl/rpl-conf.h 设置更改目标函数
根据您的要求进行编辑:
/*
* The objective function (OF) used by a RPL root is configurable through
* the RPL_CONF_OF_OCP parameter. This is defined as the objective code
* point (OCP) of the OF, RPL_OCP_OF0 or RPL_OCP_MRHOF. This flag is of
* no relevance to non-root nodes, which run the OF advertised in the
* instance they join.
* Make sure the selected of is inRPL_SUPPORTED_OFS.
*/
#ifdef RPL_CONF_OF_OCP
#define RPL_OF_OCP RPL_CONF_OF_OCP
#else /* RPL_CONF_OF_OCP */
#define RPL_OF_OCP RPL_OCP_MRHOF
#endif /* RPL_CONF_OF_OCP */
/*
* The set of objective functions supported at runtime. Nodes are only
* able to join instances that advertise an OF in this set. To include
* both OF0 and MRHOF, use {&rpl_of0, &rpl_mrhof}.
*/
#ifdef RPL_CONF_SUPPORTED_OFS
#define RPL_SUPPORTED_OFS RPL_CONF_SUPPORTED_OFS
#else /* RPL_CONF_SUPPORTED_OFS */
#define RPL_SUPPORTED_OFS {&rpl_mrhof}
#endif /* RPL_CONF_SUPPORTED_OFS */
/*
* Enable/disable RPL Metric Containers (MC). The actual MC in use
* for a given DODAG is decided at runtime, when joining. Note that
* OF0 (RFC6552) operates without MC, and so does MRHOF (RFC6719) when
* used with ETX as a metric (the rank is the metric). We disable MC
* by default, but note it must be enabled to support joining a DODAG
* that requires MC (e.g., MRHOF with a metric other than ETX).
*/
#ifdef RPL_CONF_WITH_MC
#define RPL_WITH_MC RPL_CONF_WITH_MC
#else /* RPL_CONF_WITH_MC */
#define RPL_WITH_MC 0
#endif /* RPL_CONF_WITH_MC */
2) Contiki 为节点的长期运行提供无线电占空比 (RDC) 机制。默认值为 nullrdc,其中节点始终保持打开状态,因此生命周期较短。设置 ContikiMAC 以最小化节点的功率。转到 contiki/core/contiki-default-conf.h 并根据您的要求进行编辑。
例如
#ifndef NETSTACK_CONF_RDC
/* #define NETSTACK_CONF_RDC nullrdc_driver */
#define NETSTACK_CONF_RDC contikimac_driver
#endif /* NETSTACK_CONF_RDC */
3) Tx/Rx 可以从网络可视化器本身设置。您可以右键单击任何节点并编辑 tx/rx 范围以及成功率。您也可以在 .csc(模拟)文件中进行编辑。
<radiomedium>
org.contikios.cooja.radiomediums.UDGM
<transmitting_range>100.0</transmitting_range>
<interference_range>120.0</interference_range>
<success_ratio_tx>0.9</success_ratio_tx>
<success_ratio_rx>0.9</success_ratio_rx>
</radiomedium>
4)您必须计算各种性能指标。为此,您自己拥有代码脚本文件(困难的部分)。或使用这些链接
https://github.com/iloveyii/contiki_rpl/tree/master/perl
https://pdfs.semanticscholar.org/d319/4d5f43f1cd3995ba7c9e99776ac8f150d445.pdf
5)使用移动插件来模拟各种移动模型。
https://anrg.usc.edu/contiki/index.php/Mobility_of_Nodes_in_Cooja
http://vrajesh2188.blogspot.com/2016/04/mobility-in-contiki-2.html