How to change the data packet interval in RPL contiki cooja simulator?

To varying the data packet send interval in RPL using cooja network simulator

+ Description

To varying the data packet send interval in RPL using cooja network simulator

  • Step 1: udp-client.c – handles the data packet sending
    Default interval defined. We can change interval of transmission.
    #define PERIOD 10 // change the interval
    #define START_INTERVAL (15 * CLOCK_SECOND)
    #define SEND_INTERVAL (PERIOD * CLOCK_SECOND)
    #define SEND_TIME (random_rand() % (SEND_INTERVAL))

  • Step 2: code to calling function.
    PROCESS_THREAD(udp_client_process, ev, data)
    {
    etimer_set(&periodic, SEND_INTERVAL);
    while(1) {
    PROCESS_YIELD();
    if(ev == tcpip_event) {
    tcpip_handler();
    }
    if(etimer_expired(&periodic)) {
    etimer_reset(&periodic);
    ctimer_set(&backoff_timer, SEND_TIME, send_packet, NULL);
    }
    }

+ Source code:
  • Step 1: udp-client.c – handles the data packet sending
    Default interval defined. We can change interval of transmission.
    #define PERIOD 10 // change the interval
    #define START_INTERVAL (15 * CLOCK_SECOND)
    #define SEND_INTERVAL (PERIOD * CLOCK_SECOND)
    #define SEND_TIME (random_rand() % (SEND_INTERVAL))

  • Step 2: code to calling function.
    PROCESS_THREAD(udp_client_process, ev, data)
    {
    etimer_set(&periodic, SEND_INTERVAL);
    while(1) {
    PROCESS_YIELD();
    if(ev == tcpip_event) {
    tcpip_handler();
    }
    if(etimer_expired(&periodic)) {
    etimer_reset(&periodic);
    ctimer_set(&backoff_timer, SEND_TIME, send_packet, NULL);
    }
    }

Leave Comment

Your email address will not be published. Required fields are marked *

clear formSubmit