Part 1 in this series can be found here.
Part 2 can be found here.
Part 3 can be found here.
Part 4 can be found here.
Part 5 can be found here.
I want to focus on power consumption on this post before I go into the details for networking. It is important to know how your algorithm does on the power consumption side.
Contiki has a software-based power-profiler which can be used for this. Few lines of code have to be added in your program to enable that. But there is also another way.
We will be using MSPSim's power-profiler.
This method wont work on all the mote types, because the tool 'Msp CLI' works for only MSP430 microprocessor series [Reference]
We will be using the Sky Mote Type for this. I used this code for generating a "Multiplication Table of 5" in the Sky Mote for this example.
Right Click on the Mote in the 'Network' window and then 'Mote Tools' & 'Msp CLI'. A Msp CLI dialog box should open.
>duty 1 "MSP430 Core.active" CC2420
The output for my case was:
After reading this and bit of a guess leads me to:
The first column is the percentage of CPU activity. This is generated because of the "MSP430 Core.active" argument.
The second column is the percentage of time for radio power down.
The third column is the percentage of time for radio power up without transmission. (If I am not mistaken)
The fourth column is the percentage of time for radio transmit.
The fifth column is always 0.0 no matter what code I run, so I dont know what that does.
Notice the last 4 should add up to 100.
Here is another example (Source: ...contiki2.6/examples/sky/radio-test.c):
It shows the CPU is active 18.93% of the time.
Radio is off 87.72% of the time.
Radio is on 2.98% without activity
Radio is transmitting 9.3%
Radio shows 0.0 (always; even with a bit of reception).
So how to calculate the power consumption??
Multiply the total simulation time with the % above to get total time for a certain activity.
Then multiply with the standard power consumption which can be obtained from some data sheet.
e.g Data Sheet of Tmote Sky states:
Total_Energy = 19.5 * 3 V * (Activity_Time_in_seconds)
(Remember Power= Voltage x Current)
I dont know why they divide specifically by 4096..They describe it as each second containing 4096 ticks of cycles only. I am still uneducated why, as a Tmote Sky is not 4KHz speed device. May they are just referring to the CC2420 radio. Sigh! Only if things were nicely documented. Not everyone understands English in the same way.
Laters in PART 7