contikienergycooja

How to calculate total energy consumption using Cooja


I'm working with wireless sensor network lead to evaluate its performance in my work. I want to measure the latency and total energy consumption to find the remaining energy in each node. So my problem is that I have some values of tx rx cpu cpu_idle and I don't how to use them to calculate what I need. I found some rules that take the calculation but i don't understand exactly how to apply it in my case.

Energy consumed in communication:

Energy consumed by CPU:

What is the meaning of 32768, and why do we use this number? Is it a standard value?


Solution

  • The powertrace output is printed in timer ticks.

    The elements of the pair tx and rx are exclusive, as are cpu and idle - the system can never be in both modes at the same time. However, other combinations are possible: it can be in cpu and in tx at the same time, for example. The sum of cpu and idle is the total uptime of the system.

    The duration of timer a tick is platform-dependent and defined as the RTIMER_ARCH_SECOND constant. 32768 ticks per second is a typical value of this constant - that's where the number in your equation comes from. For example:

    ticks_in_tx_mode = energest_type_time(ENERGEST_TYPE_TRANSMIT);
    seconds_in_tx_mode = ticks_in_tx_mode / RTIMER_ARCH_SECOND;
    

    To compute the average current consumption (in milliamperes, mA), multiply each of tx, rx, cpu, cpu_idle with the respective current consumption in that mode in mA (obtain the values from the datasheet of the node), sum them up, and divide by RTIMER_ARCH_SECOND:

    current = (tx * current_tx_mode + rx * current_rx_mode + \
              cpu * current_cpu + cpu_idle * current_idle) / RTIMER_ARCH_SECOND
    

    To compute the charge (in millicoulumbs, mC), multiply the average current consumption with the duration of the measurement (node's uptime) in seconds:

    charge = current * (cpu + cpu_idle) / RTIMER_ARCH_SECOND
    

    To compute the power (in milliwats, mW) multiply the average current consumption with the voltage of the system, for exampe, 3 volts if powered from a pair of AA batteries:

    power = current * voltage
    

    Finally, to compute the energy consumption (in millijoules, mJ), multiply the power with the duration in seconds or multiply the charge with the voltage of the system:

    energy = charge * voltage
    

    The first formula above computes the energy consumption for communications; the second one: for computation.

    This site might be helpful to break down the numbers.