Search code examples
simulatorcontiki

How to change parameters in Contiki 2.7 simulation?


I started learning on Contiki OS. I am trying to analyze few parameters like energy efficiency, latency, delivery ratio etc with different deployment scenarios. First I should change some parameter like:

  1. Channel check rate to 16/s (I use rpl-sink)
  2. RPL mode of operation to NO_DOWNWARD_ROUTE
  3. Send interval to 5s
  4. UDP application packet size to 100 Bytes

Could you please tell me how to change these parameter in Contiki 2.7?


Solution

  • My answers for reference:

    Channel check rate to 16/s (I use rpl-sink)

    #undef  NETSTACK_RDC_CHANNEL_CHECK_RATE
    #define NETSTACK_RDC_CHANNEL_CHECK_RATE 16
    

    RPL mode of operation to NO_DOWNWARD_ROUTE

    It's called non-storing mode. To enable it:

    #define RPL_CONF_WITH_NON_STORING 1

    Send interval to 5s

    Depends on the application; there is no standard name for this parameter. If we're talking about ipv6/rpl-collect/, you should #define PERIOD 5 in project-conf.h.

    UDP application packet size to 100 Bytes

    The payload is constructed in udp-sender.c:

    uip_udp_packet_sendto(client_conn, &msg, sizeof(msg),
                          &server_ipaddr, UIP_HTONS(UDP_SERVER_PORT));
    

    So in order to change the payload size, you need to change the size of the locally-defined anonymous struct variable called msg. You can add some dummy fields to it, for example.

    struct {
      uint8_t seqno;
      uint8_t for_alignment;
      struct collect_view_data_msg msg;
      char dummy[100 - 2 - sizeof(struct collect_view_data_msg)];
    } msg;