{"id":77,"date":"2017-08-30T13:26:23","date_gmt":"2017-08-30T17:26:23","guid":{"rendered":"https:\/\/sites.bu.edu\/nislab\/?page_id=77"},"modified":"2017-10-23T13:52:00","modified_gmt":"2017-10-23T17:52:00","slug":"teacp-a-toolkit-for-evaluation-and-analysis-of-collection-protocols-in-wireless-sensor-networks","status":"publish","type":"page","link":"https:\/\/sites.bu.edu\/nislab\/projects\/teacp-a-toolkit-for-evaluation-and-analysis-of-collection-protocols-in-wireless-sensor-networks\/","title":{"rendered":"TeaCP: a Toolkit for Evaluation and Analysis of Collection Protocols in Wireless Sensor Networks"},"content":{"rendered":"<h3>About TeaCP<\/h3>\n<hr \/>\n<p>TeaCP (pronounced as teacup) is a prototype Toolkit for the\u00a0evaluation and analysis of Collection Protocols in both simulation\u00a0and experimental environments running on TinyOS. The\u00a0toolkit\u00a0consists of a testing system, which runs a collection protocol of\u00a0choice, and an optional SD card-based logging system, which\u00a0stores the logs generated by the testing system. The SD card datalogger allows a wireless sensor network (WSN) to be deployed\u00a0flexibly in various environments, especially where wired transfer\u00a0of data is difficult. Using the saved logs, TeaCP evaluates a wide\u00a0range of performance metrics, such as reliability, throughput, and\u00a0delay. TeaCP further allows visualization of packet routes and the\u00a0topology evolution of the network, under both static and dynamic\u00a0conditions, even in the face of transient disconnections.<\/p>\n<p>TeaCP has the following features:<\/p>\n<ul>\n<li><em>Generality \u2014\u00a0<\/em>TeaCP is a general toolkit designed to plug in various collection protocols and analyze their performance through post-experiment analysis.<\/li>\n<li><em>Configurability \u2014\u00a0<\/em>With TeaCP, one can easily configure tests for evaluating a data collection protocol, run the tests and analyze the underlying performance (e.g., reliability, throughput, and delay) via both real experiments and simulations.<\/li>\n<li><em>Visualization \u2014\u00a0<\/em>TeaCP provides visualization of packet routes, network topology and other statistics, that can be used for understanding, analyzing and diagnosing the behavior of collection protocols.<\/li>\n<li><em>Flexibility \u2014\u00a0<\/em>The SD card datalogger provides the convenience to test the collection protocol in various environments.<\/li>\n<\/ul>\n<h3>Downloading TeaCP<\/h3>\n<hr \/>\n<p><strong>TeaCP is available<span>\u00a0<\/span><a href=\"https:\/\/github.com\/weisiCeltics\/teacp\">on GitHub<\/a>.<\/strong><\/p>\n<p>TeaCP has been tested under the following system conditions:<\/p>\n<ul>\n<li>Ubuntu 12.04<\/li>\n<li>TinyOS 2.0.1<\/li>\n<li>Python 2.7<\/li>\n<\/ul>\n<p>TeaCP also resorts to the following Python packages for statistics calculation and visualization:<\/p>\n<ul>\n<li>Numpy<\/li>\n<li>Matplotlib<\/li>\n<li>PyDot<\/li>\n<\/ul>\n<h3>TeaCP structure<\/h3>\n<hr \/>\n<p><a href=\"https:\/\/web.archive.org\/web\/20150313184205\/http:\/\/nislab.bu.edu\/wp-content\/uploads\/2015\/02\/TeaCP_structure.png\"><img loading=\"lazy\" class=\"wp-image-550 size-full\" src=\"https:\/\/web.archive.org\/web\/20150313184205im_\/http:\/\/nislab.bu.edu\/wp-content\/uploads\/2015\/02\/TeaCP_structure.png\" alt=\"\" width=\"1047\" height=\"586\" data-id=\"550\" \/><\/a><\/p>\n<p>TeaCP operates at the application layer, and consists of the test configuration component, the application layer component for generating and handling packets, and the post-experiment analysis component. The test configuration component and the application layer component run on sensor motes. The post-experiment analysis component runs on a PC.<\/p>\n<p>The configurable test parameters include the packet generation interval, the radio power and the channel for the network. The radio power and channel settings are applied to the radio component of the hardware. The packet generation interval is applied to a periodic timer. The firing signal of the timer (i) increments the packet counter by one, (ii) invokes the packet generator to generate a data message (encapsulated in a packet) with packet ID equal to the packet counter, (iii) drives the log generator to output a log message, and (iv) transfers the packet to the network layer, which moves it towards the root using a collection protocol. Since the collection protocol may use multihop routing to accomplish the delivery, the packet may be received by intermediate nodes and the root. No matter whether the node is a relay or the root, the network layer will notify the packet reception handler when it receives a packet from other sensors. The packet reception handler prepares the information needed by the log generator, which outputs log message to storage through serial communication. Finally, post-experiment analysis is done based on the data saved in storage (e.g., the SD card datalogger).<\/p>\n<p>In the following, we show how to use TeaCP to obtain logs from experiments and simulations and analyze the performance of collection protocols using the TeaCP analysis component.<\/p>\n<h3>Using\u00a0TeaCP in experiments<\/h3>\n<hr \/>\n<p>TeaCP can be used in experiments to evaluate and analyze the performance of collection protocols. In an experiment, a number of sensor nodes are deployed in the testing environment. TeaCP utilizes an activator to send out a broadcast message, which contains the test parameters and establishes clock synchronization. Once the sensors have received the broadcast message, they apply the test parameters to their system. Then they start to generate data packets and the whole data collection network starts to run. While the data packets are routed around in the network, each node will generate log messages, recording information about events happening in the network, such as when a packet is generated or received. These log messages are stored by the data logging system as log files. Finally, TeaCP analysis component can calculate the test statistics based on the log files.<\/p>\n<h4>1. Configuring\u00a0a test<\/h4>\n<p>The test parameters are configured in the header file<span>\u00a0<\/span><code>test_config.h<\/code>\u00a0under the directory<span>\u00a0<\/span><code>exp\/nesc\/<\/code>:<\/p>\n<div>\n<div id=\"highlighter_963943\" class=\"syntaxhighlighter cpp\">\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"930\" height=\"285\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<div class=\"line number4 index3 alt1\">4<\/div>\n<div class=\"line number5 index4 alt2\">5<\/div>\n<div class=\"line number6 index5 alt1\">6<\/div>\n<div class=\"line number7 index6 alt2\">7<\/div>\n<div class=\"line number8 index7 alt1\">8<\/div>\n<div class=\"line number9 index8 alt2\">9<\/div>\n<div class=\"line number10 index9 alt1\">10<\/div>\n<div class=\"line number11 index10 alt2\">11<\/div>\n<div class=\"line number12 index11 alt1\">12<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"line number1 index0 alt2\"><code class=\"cpp comments\">\/\/ teacp\/exp\/nesc\/test_config.h<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"cpp comments\">\/\/ Options: PERIODIC_TIMER | EXPONENTIAL_TIMER<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"cpp preprocessor\">#define PERIODIC_TIMER<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"cpp keyword bold\">enum<\/code><code class=\"cpp plain\">{<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"cpp spaces\">\u00a0\u00a0<\/code><code class=\"cpp plain\">NODE_ID = ALL_NODES,<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><code class=\"cpp spaces\">\u00a0\u00a0<\/code><code class=\"cpp plain\">COMMAND = START,<\/code><\/div>\n<div class=\"line number9 index8 alt2\"><code class=\"cpp spaces\">\u00a0\u00a0<\/code><code class=\"cpp plain\">PACKET_INTERVAL = 512,<\/code><\/div>\n<div class=\"line number10 index9 alt1\"><code class=\"cpp spaces\">\u00a0\u00a0<\/code><code class=\"cpp plain\">RADIO_POWER = 3,<\/code><\/div>\n<div class=\"line number11 index10 alt2\"><code class=\"cpp spaces\">\u00a0\u00a0<\/code><code class=\"cpp plain\">RADIO_CHANNEL = 26<\/code><\/div>\n<div class=\"line number12 index11 alt1\"><code class=\"cpp plain\">};<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>TeaCP provides the following configurable test parameters:<\/p>\n<ul>\n<ul>\n<li>Traffic type &#8212; the traffic pattern in which the packets are generated at each source node. The current version of TeaCP has implemented two kinds of traffic types: one is periodic packet generation (<code>#define PERIODIC_TIEMR<\/code>) and the other is emulating Poisson packet arrival process (<code>#define EXPONENTIAL_TIMER<\/code>).<\/li>\n<li>Packet generation interval &#8212; the time interval between two consecutive packet generations at each source node. If the traffic type is periodic packet generation, then the packet generation interval is a constant with value PACKET_INTERVAL. If the traffic type is Poisson packet generation, then the packet generation interval is an exponential random variable with expectation equal to PACKET_INTERVAL.<\/li>\n<li>Radio power &#8212;\u00a0the transmission power when a node\u00a0transmits a packet or a beacon message. For the CC2420\u00a0chip, radio power ranges from -25 dBm to 0 dBm.<\/li>\n<li>Radio channel &#8212;\u00a0the IEEE 802.15.4 radio channel on which the\u00a0collection network operates. The 2.4GHz ISM band is\u00a0divided into 16 non-overlapping ZigBee channels, with\u00a0channel ID from 11 to 26.<\/li>\n<\/ul>\n<\/ul>\n<p>After we have configured the parameters for a test, compile and install the TinyOS program onto the activator:<\/p>\n<div>\n<div id=\"highlighter_839803\" class=\"syntaxhighlighter nogutter bash\">\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2 highlighted\"><code class=\"bash plain\">$ <\/code><code class=\"bash functions\">cd<\/code> <code class=\"bash plain\">exp<\/code><code class=\"bash plain\">\/nesc\/activator\/<\/code><\/div>\n<div class=\"line number2 index1 alt1 highlighted\"><code class=\"bash plain\">$ <\/code><code class=\"bash functions\">make<\/code> <code class=\"bash plain\">telosb bsl,<\/code><code class=\"bash plain\">\/dev\/ttyUSB0<\/code> <code class=\"bash functions\">install<\/code><code class=\"bash plain\">.50<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h4>2. Installing TeaCP application layer component<\/h4>\n<p>Next we compile the TeaCP application layer component and the collection protocol and install onto the nodes.<\/p>\n<div>\n<div id=\"highlighter_589541\" class=\"syntaxhighlighter nogutter bash\">\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2 highlighted\"><code class=\"bash plain\">$ <\/code><code class=\"bash functions\">cd<\/code> <code class=\"bash plain\">exp<\/code><code class=\"bash plain\">\/nesc\/ctp<\/code><\/div>\n<div class=\"line number2 index1 alt1 highlighted\"><code class=\"bash plain\">$ <\/code><code class=\"bash functions\">make<\/code> <code class=\"bash plain\">telosb<\/code><\/div>\n<div class=\"line number3 index2 alt2 highlighted\"><code class=\"bash plain\">$ <\/code><code class=\"bash functions\">make<\/code> <code class=\"bash plain\">telosb bsl,<\/code><code class=\"bash plain\">\/dev\/ttyUSB0<\/code> <code class=\"bash plain\">reinstall.1<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>The last command should be repeated to install the code onto the\u00a0sensors with different node IDs (by specifying<span>\u00a0<\/span><code>reinstall.[TOS_NODE_ID]<\/code>)<\/p>\n<h4>3. Attaching\u00a0the data logging system<\/h4>\n<p>We then attach the data logging system to each node and deploy the nodes in the testing environment. For the data logging system, you can either use our implemented SD card datalogger or connect each node to a PC through USB port for data logging. If you use the USB datalogging system, you need to run the serial listener to receive the serial messages from the sensors:<\/p>\n<div>\n<div id=\"highlighter_608110\" class=\"syntaxhighlighter nogutter bash\">\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2 highlighted\"><code class=\"bash plain\">$ java net.tinyos.tools.Listen -<\/code><code class=\"bash functions\">comm<\/code> <code class=\"bash plain\">serial@<\/code><code class=\"bash plain\">\/dev\/ttyUSB0<\/code><code class=\"bash plain\">:telosb &gt; node_1.log<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>Here we save the received serial messages into the file with extension .log. This is intentional because our TeaCP analysis component identifies a file as a log file by looking at the file extension.<\/p>\n<h4>4. Starting and finishing a test<\/h4>\n<p>Press the user button on the activator node to send out a broadcast signal and the experiment starts.<\/p>\n<p>When the experiment finishes, press the user button on the activator node for five more times and the activator will send out a broadcast signal to tell the sensors to reset. Then collect the log files from the dataloggers for post-experiment analysis. If you are using\u00a0the USB logging system, you need to press\u00a0CTRL+C on the keyboard to terminate the serial listener.<\/p>\n<p>A log file consists of a list of received serial messages, which contains a log message recording information with regard to network events:<\/p>\n<div>\n<div id=\"highlighter_425332\" class=\"syntaxhighlighter plain\">\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<div class=\"line number4 index3 alt1\">4<\/div>\n<div class=\"line number5 index4 alt2\">5<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"plain plain\">00 ff ff 00 00 10 00 af 01 00 03 00 04 00 08 00 00 0a 79 00 14 76 53 02<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"plain plain\">00 ff ff 00 00 10 00 af 01 00 03 00 08 00 08 00 00 0a 79 00 14 76 91 01<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"plain plain\">00 ff ff 00 00 10 00 af 01 00 03 00 06 00 08 00 00 0a 79 00 14 76 aa 03<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"plain plain\">00 ff ff 00 00 10 00 af 00 00 03 00 03 00 03 00 00 0a 7a 00 14 78 3c 00<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"plain plain\">00 ff ff 00 00 10 00 af 01 00 03 00 04 00 08 00 00 0a 7a 00 14 78 8a 02<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>The format of the received serial message is explained in the figure:<\/p>\n<div id=\"attachment_496\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/web.archive.org\/web\/20150313184205\/http:\/\/nislab.bu.edu\/wp-content\/uploads\/2015\/02\/serial_message_format2.png\"><img loading=\"lazy\" class=\"wp-image-496 size-full\" src=\"https:\/\/web.archive.org\/web\/20150313184205im_\/http:\/\/nislab.bu.edu\/wp-content\/uploads\/2015\/02\/serial_message_format2.png\" alt=\"\" width=\"1164\" height=\"172\" data-id=\"485\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Format of received serial messages in log files.<\/p>\n<\/div>\n<p>The first few bytes of the received serial message are the header added by the TinyOS serial communication protocol. The rest of the serial message is the log message generated by a sensor recording information about a network event. For example, the log message in the figure tells us that the packet (with ID 0x00000a79 generated by source node 6) arrives at node 3 in three hops and the last hop is node 8.<\/p>\n<h3><span>Using\u00a0TeaCP in simulations<\/span><\/h3>\n<hr \/>\n<p>The procedure of using TeaCP to run TOSSIM simulations is basically the same as in experiments. The only difference is that the activator is not needed in the simulation to send out a broadcast message configuring the network. In simulations, the configured test parameters are applied by compiling them into the code of sensors.<\/p>\n<h4>1. Configuring a test<\/h4>\n<p>The same as experiments, we configure the packet generation interval in<span>\u00a0<\/span><code>test_config.h<\/code><span>\u00a0<\/span>under<span>\u00a0<\/span><code>sim\/nesc\/<\/code>. However, the configurations of radio power and radio channel in the header file are not applicable any more. Instead, the TOSSIM simulation uses a different way to configure the link conditions between nodes. TeaCP includes the configurations in the simulation script, e.g.,<span>\u00a0<\/span><code>static.py<\/code><span>\u00a0<\/span>under the directory<span>\u00a0<\/span><code>sim\/test_scripts\/<\/code>:<\/p>\n<div>\n<div id=\"highlighter_807638\" class=\"syntaxhighlighter python\">\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<div class=\"line number4 index3 alt1\">4<\/div>\n<div class=\"line number5 index4 alt2\">5<\/div>\n<div class=\"line number6 index5 alt1\">6<\/div>\n<div class=\"line number7 index6 alt2\">7<\/div>\n<div class=\"line number8 index7 alt1\">8<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"python plain\">default_arg <\/code><code class=\"python keyword\">=<\/code> <code class=\"python plain\">{<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"python spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"python string\">'protocol'<\/code><code class=\"python plain\">: <\/code><code class=\"python string\">'ctp'<\/code><code class=\"python plain\">,<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"python spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"python string\">'log_filename'<\/code><code class=\"python plain\">: <\/code><code class=\"python string\">'log\/temp\/simulation.log'<\/code><code class=\"python plain\">,<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"python spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"python string\">'noise_filename'<\/code><code class=\"python plain\">: <\/code><code class=\"python string\">'noise-100dBm.txt'<\/code><code class=\"python plain\">,<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"python spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"python string\">'link_filename'<\/code><code class=\"python plain\">: <\/code><code class=\"python string\">'static\/perfect-grid-25nodes.txt'<\/code><code class=\"python plain\">,<\/code><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"python spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"python string\">'finish_time'<\/code><code class=\"python plain\">: <\/code><code class=\"python value\">500<\/code><code class=\"python plain\">,<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"python spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"python string\">'link_gain_adjust'<\/code><code class=\"python plain\">: <\/code><code class=\"python value\">0<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><code class=\"python spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"python plain\">}<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>The file<span>\u00a0<\/span><code>link_filename<\/code><span>\u00a0<\/span>specifies the link gains between nodes in the network. The file<span>\u00a0<\/span><code>noise_filename<\/code>specifies the noise trace at each node.<\/p>\n<h4>2. Compiling TeaCP application layer component<\/h4>\n<p>After we finish the configuration, compile the TeaCP\u00a0application layer component:<\/p>\n<div>\n<div id=\"highlighter_695949\" class=\"syntaxhighlighter nogutter bash\">\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2 highlighted\"><code class=\"bash plain\">$ <\/code><code class=\"bash functions\">cd<\/code> <code class=\"bash plain\">sim<\/code><code class=\"bash plain\">\/nesc\/ctp<\/code><\/div>\n<div class=\"line number2 index1 alt1 highlighted\"><code class=\"bash plain\">$ <\/code><code class=\"bash functions\">make<\/code> <code class=\"bash plain\">micaz sim<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>This compilation generates the Python code of\u00a0the TOSSIM simulator,<span>\u00a0<\/span><code>Tossim.py<\/code>.<\/p>\n<h4>3. Running a test<\/h4>\n<p>Before running the test, let me explain another two parameters in the configuration list. The parameter<span>\u00a0<\/span><code>protocol<\/code><span>\u00a0<\/span>denotes the collection protocol that the simulation runs on and is actually the folder name where the script can find the TOSSIM simulator (<code>Tossim.py<\/code>). By modifying the parameter<span>\u00a0<\/span><code>finish_time<\/code>, you can specify the total simulated duration of the test in units of seconds.<\/p>\n<p>Now we can run the simulation by:<\/p>\n<div>\n<div id=\"highlighter_920498\" class=\"syntaxhighlighter nogutter bash\">\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2 highlighted\"><code class=\"bash plain\">$ <\/code><code class=\"bash functions\">cd<\/code> <code class=\"bash plain\">sim<\/code><code class=\"bash plain\">\/test_scripts<\/code><\/div>\n<div class=\"line number2 index1 alt1 highlighted\"><code class=\"bash plain\">$ python static.py<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>There are two simulation scripts under<span>\u00a0<\/span><code>sim\/test_scripts\/<\/code>:<span>\u00a0<\/span><code>static.py<\/code><span>\u00a0<\/span>and<span>\u00a0<\/span><code>dynamic.py<\/code>. The difference between these two scripts is that<span>\u00a0<\/span><code>static.py<\/code><span>\u00a0<\/span>runs simulations on static link gains while<span>\u00a0<\/span><code>dynamic.py<\/code><span>\u00a0<\/span>runs simulations on time-varying link gains. For more details, please take a look at the example traces under the directory<span>\u00a0<\/span><code>sim\/config\/linkgain\/<\/code>.<\/p>\n<p>When the simulation is done, the log file (as specified by<span>\u00a0<\/span><code>log_filename<\/code><span>\u00a0<\/span>in the parameter list) is generated:<\/p>\n<div>\n<div id=\"highlighter_18187\" class=\"syntaxhighlighter plain\">\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<div class=\"line number4 index3 alt1\">4<\/div>\n<div class=\"line number5 index4 alt2\">5<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"plain plain\">0:0:3.199219760 DEBUG (2): 0,2,2,2,5,3276,0<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"plain plain\">0:0:3.202454614 DEBUG (0): 2,0,2,2,5,3279,1<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"plain plain\">0:0:3.429688510 DEBUG (3): 0,3,3,3,5,3512,0<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"plain plain\">0:0:3.438614859 DEBUG (0): 2,0,3,3,5,3521,1<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"plain plain\">0:0:3.468751010 DEBUG (1): 0,1,1,1,4,3552,0<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>The log messages from simulations have the same fields as the log messages from experiments.<\/p>\n<h3>Using\u00a0TeaCP with the SD card datalogger<\/h3>\n<hr \/>\n<p>We have implemented a SD card datalogger using the Arduino Pro Mini board. The Arduino Pro Mini board plays the role of SPI adapter for transferring the serial messages to the SD card.<\/p>\n<p><a href=\"https:\/\/web.archive.org\/web\/20150313184205\/http:\/\/nislab.bu.edu\/wp-content\/uploads\/2015\/02\/telosb-sd.png\"><img loading=\"lazy\" class=\"wp-image-390 aligncenter\" src=\"https:\/\/web.archive.org\/web\/20150313184205im_\/http:\/\/nislab.bu.edu\/wp-content\/uploads\/2015\/02\/telosb-sd.png\" alt=\"telosb-sd\" width=\"296\" height=\"222\" data-id=\"390\" \/><\/a><\/p>\n<p>The wiring between the TelosB mote and the Arduino board is shown in the figure:<\/p>\n<p><a href=\"https:\/\/web.archive.org\/web\/20150313184205\/http:\/\/nislab.bu.edu\/wp-content\/uploads\/2015\/02\/wiring_telosb_arduino1.png\"><img loading=\"lazy\" class=\"aligncenter wp-image-595\" src=\"https:\/\/web.archive.org\/web\/20150313184205im_\/http:\/\/nislab.bu.edu\/wp-content\/uploads\/2015\/02\/wiring_telosb_arduino1.png\" alt=\"wiring_telosb_arduino\" width=\"286\" height=\"140\" data-id=\"595\" \/><\/a><\/p>\n<p>The code that runs on the Arduino board is<span>\u00a0<\/span><code>sd_card_datalogger.ino<\/code><span>\u00a0<\/span>under the directory<span>\u00a0<\/span><code>exp\/arduino<\/code>. It can be installed onto the Arduino board through IDE.<\/p>\n<h3>Using the\u00a0TeaCP\u00a0analysis component<\/h3>\n<hr \/>\n<p>Once you have obtained log files from experiments and simulations, you can use the TeaCP analysis component to evaluate collection protocols. The TeaCP analysis component provides a comprehensive set of functions to analyze the performance of collection protocols. These functions include analysis of delay performance, throughput performance and reliability performance. The TeaCP analysis component can also visualize packet routes and network topology.<\/p>\n<p>The TeaCP analysis component is packaged in<span>\u00a0<\/span><code>TeacpAnalysis.py<\/code>, under both the directories<span>\u00a0<\/span><code>exp\/tools\/<\/code>and<span>\u00a0<\/span><code>sim\/tools\/<\/code>. Under the directories, you can also find a script,<span>\u00a0<\/span><code>run-analysis.py<\/code>, which is a simple example using the<span>\u00a0<\/span><code>TeacpAnalysis<\/code><span>\u00a0<\/span>package.<\/p>\n<p>In<span>\u00a0<\/span><code>run-analysis.py<\/code>, first we import all the log files (with file name extension .log) from the specified directory:<\/p>\n<div>\n<div id=\"highlighter_693477\" class=\"syntaxhighlighter python\">\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"python keyword\">from<\/code> <code class=\"python plain\">TeacpAnalysis <\/code><code class=\"python keyword\">import<\/code> <code class=\"python keyword\">*<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"python plain\">analysis <\/code><code class=\"python keyword\">=<\/code> <code class=\"python plain\">TeacpAnalysis(<\/code><code class=\"python string\">'..\/log\/example\/ctp\/'<\/code><code class=\"python plain\">, <\/code><code class=\"python string\">'exp'<\/code><code class=\"python plain\">)<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>The second argument specifies whether the log files are obtained from experiments or simulations (since their log file formats are different).<\/p>\n<p>Then we calculate all the statistics and save the results into a file:<\/p>\n<pre class=\"brush: python; collapse: false; first-line: 4; title: ; wrap-lines: false; notranslate\" title=\"\"> \r\nanalysis.calc_all()\r\nanalysis.print_result_to_file()\r\n<\/pre>\n<p>You can find the results in the file<span>\u00a0<\/span><code>result.txt<\/code><span>\u00a0<\/span>under the directory<span>\u00a0<\/span><code>..\/log\/example\/ctp\/output\/<\/code>:<\/p>\n<div>\n<div id=\"highlighter_273102\" class=\"syntaxhighlighter nogutter plain\">\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"plain plain\">--------------------Mon Feb 23 10:46:32 2015--------------------<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"plain plain\">Test duration: 883 seconds<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"plain plain\">Number of sensor (source) nodes: 9<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"plain plain\">Packet ID range: 0 -&gt; 1810<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"plain plain\">-----Node statistics-----<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"plain spaces\">\u00a0\u00a0<\/code><code class=\"plain plain\">NodeID\u00a0\u00a0 #Generated\u00a0\u00a0 #Delivered\u00a0\u00a0 AvgHops\u00a0\u00a0 AvgDelay\u00a0\u00a0 Delivery%\u00a0\u00a0 Throughput\u00a0\u00a0 Goodput<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1810\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1792\u00a0\u00a0\u00a0\u00a0\u00a0 1.00\u00a0\u00a0\u00a0\u00a0\u00a0 32.39\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 99.01\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2.32\u00a0\u00a0\u00a0\u00a0\u00a0 2.03<\/code><\/div>\n<div class=\"line number9 index8 alt2\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1810\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1807\u00a0\u00a0\u00a0\u00a0\u00a0 1.00\u00a0\u00a0\u00a0\u00a0\u00a0 32.35\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 99.83\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2.23\u00a0\u00a0\u00a0\u00a0\u00a0 2.05<\/code><\/div>\n<div class=\"line number10 index9 alt1\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">3\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1810\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1806\u00a0\u00a0\u00a0\u00a0\u00a0 1.00\u00a0\u00a0\u00a0\u00a0\u00a0 19.62\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 99.78\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2.33\u00a0\u00a0\u00a0\u00a0\u00a0 2.04<\/code><\/div>\n<div class=\"line number11 index10 alt2\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">4\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1810\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1806\u00a0\u00a0\u00a0\u00a0\u00a0 1.98\u00a0\u00a0\u00a0\u00a0\u00a0 54.36\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 99.78\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2.13\u00a0\u00a0\u00a0\u00a0\u00a0 2.04<\/code><\/div>\n<div class=\"line number12 index11 alt1\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">5\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1810\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1796\u00a0\u00a0\u00a0\u00a0\u00a0 1.90\u00a0\u00a0\u00a0\u00a0\u00a0 76.31\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 99.23\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2.06\u00a0\u00a0\u00a0\u00a0\u00a0 2.03<\/code><\/div>\n<div class=\"line number13 index12 alt2\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">6\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1810\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1792\u00a0\u00a0\u00a0\u00a0\u00a0 2.32\u00a0\u00a0\u00a0\u00a0\u00a0 76.39\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 99.01\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2.10\u00a0\u00a0\u00a0\u00a0\u00a0 2.03<\/code><\/div>\n<div class=\"line number14 index13 alt1\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">7\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1810\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1800\u00a0\u00a0\u00a0\u00a0\u00a0 1.70\u00a0\u00a0\u00a0\u00a0\u00a0 63.90\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 99.45\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2.12\u00a0\u00a0\u00a0\u00a0\u00a0 2.04<\/code><\/div>\n<div class=\"line number15 index14 alt2\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">8\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1810\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1803\u00a0\u00a0\u00a0\u00a0\u00a0 1.00\u00a0\u00a0\u00a0\u00a0\u00a0 42.68\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 99.61\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2.18\u00a0\u00a0\u00a0\u00a0\u00a0 2.04<\/code><\/div>\n<div class=\"line number16 index15 alt1\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">9\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1810\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1804\u00a0\u00a0\u00a0\u00a0\u00a0 1.00\u00a0\u00a0\u00a0\u00a0\u00a0 34.49\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 99.67\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2.25\u00a0\u00a0\u00a0\u00a0\u00a0 2.04<\/code><\/div>\n<div class=\"line number17 index16 alt2\"><\/div>\n<div class=\"line number18 index17 alt1\"><code class=\"plain plain\">-----Network statistics-----<\/code><\/div>\n<div class=\"line number19 index18 alt2\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">#Generated\u00a0\u00a0 #Delivered\u00a0\u00a0 AvgHops\u00a0\u00a0 AvgDelay\u00a0\u00a0 Delivery%\u00a0\u00a0 Throughput\u00a0\u00a0 Goodput<\/code><\/div>\n<div class=\"line number20 index19 alt1\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">16290\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 16206\u00a0\u00a0\u00a0\u00a0\u00a0 1.43\u00a0\u00a0\u00a0\u00a0\u00a0 48.02\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 99.48\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 19.71\u00a0\u00a0\u00a0\u00a0 18.34<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>We generate the delay histograms and visualization of network topology by the last two functions:<\/p>\n<div>\n<div id=\"highlighter_39138\" class=\"syntaxhighlighter plain\">\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number6 index0 alt1\">6<\/div>\n<div class=\"line number7 index1 alt2\">7<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number6 index0 alt1\"><code class=\"plain plain\">analysis.draw_delay_histogram()<\/code><\/div>\n<div class=\"line number7 index1 alt2\"><code class=\"plain plain\">analysis.create_topology_animation()<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>The output are shown as follows:<\/p>\n<div id=\"attachment_544\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/web.archive.org\/web\/20150313184205\/http:\/\/nislab.bu.edu\/wp-content\/uploads\/2015\/02\/delay_hist3.png\"><img loading=\"lazy\" class=\"wp-image-544 size-full\" src=\"https:\/\/web.archive.org\/web\/20150313184205im_\/http:\/\/nislab.bu.edu\/wp-content\/uploads\/2015\/02\/delay_hist3.png\" alt=\"\" width=\"2046\" height=\"1602\" data-id=\"539\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Delay histograms generated by the TeaCP analysis component<\/p>\n<\/div>\n<p><iframe loading=\"lazy\" width=\"640\" height=\"480\" src=\"https:\/\/www.youtube.com\/embed\/mCvYMKyd5Zg?feature=oembed\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\" data-mce-fragment=\"1\"><\/iframe><\/p>\n<p>TeaCP uses the pydot package to generate the images of network topology. In the network topology images, the locations and colors of the nodes are configured by reading a file named<span>\u00a0<\/span><code>animation_config<\/code><span>\u00a0<\/span>in the same directory as the log files. If the file<span>\u00a0<\/span><code>animation_config<\/code><span>\u00a0<\/span>is not found, the TeaCP analysis component will assign values to the locations and colors randomly.<\/p>\n<p>In addition to the statistics and output shown above, the TeaCP analysis component also provides other functionalities such as calculating median delays and analyzing packet paths (even when duplicates of packets exist in the network).<\/p>\n<h3>Running a collection of simulations<\/h3>\n<hr \/>\n<p>We have described how to use TeaCP to run a test in simulations step by step. We also provide a script to conveniently run a collection of simulations. For example, you might want to run the simulation with a parameter set to a list of different values. The script is<span>\u00a0<\/span><code>run-simulation.py<\/code><span>\u00a0<\/span>under the directory<span>\u00a0<\/span><code>sim\/<\/code>.<\/p>\n<p>It provides the following configurations:<\/p>\n<div>\n<div id=\"highlighter_738656\" class=\"syntaxhighlighter python\">\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<div class=\"line number4 index3 alt1\">4<\/div>\n<div class=\"line number5 index4 alt2\">5<\/div>\n<div class=\"line number6 index5 alt1\">6<\/div>\n<div class=\"line number7 index6 alt2\">7<\/div>\n<div class=\"line number8 index7 alt1\">8<\/div>\n<div class=\"line number9 index8 alt2\">9<\/div>\n<div class=\"line number10 index9 alt1\">10<\/div>\n<div class=\"line number11 index10 alt2\">11<\/div>\n<div class=\"line number12 index11 alt1\">12<\/div>\n<div class=\"line number13 index12 alt2\">13<\/div>\n<div class=\"line number14 index13 alt1\">14<\/div>\n<div class=\"line number15 index14 alt2\">15<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"python plain\">protocol\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code class=\"python keyword\">=<\/code> <code class=\"python string\">'ctp'<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"python plain\">queue_type\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code class=\"python keyword\">=<\/code> <code class=\"python string\">'LIFO'<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"python plain\">noise_filename\u00a0\u00a0 <\/code><code class=\"python keyword\">=<\/code> <code class=\"python string\">'meyer-heavy.txt'<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"python plain\">link_filename\u00a0\u00a0\u00a0 <\/code><code class=\"python keyword\">=<\/code> <code class=\"python string\">'dynamic\/intra_car_5nodes.txt'<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"python plain\">log_dir\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code class=\"python keyword\">=<\/code> <code class=\"python string\">'log\/temp\/'<\/code><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"python plain\">log_filename\u00a0\u00a0\u00a0\u00a0 <\/code><code class=\"python keyword\">=<\/code> <code class=\"python string\">'simulation.log'<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"python plain\">result_filename\u00a0 <\/code><code class=\"python keyword\">=<\/code> <code class=\"python string\">'result.txt'<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><code class=\"python plain\">test_script\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code class=\"python keyword\">=<\/code> <code class=\"python string\">'dynamic.py'<\/code><\/div>\n<div class=\"line number9 index8 alt2\"><code class=\"python plain\">num_packets\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code class=\"python keyword\">=<\/code> <code class=\"python value\">3000<\/code><\/div>\n<div class=\"line number10 index9 alt1\"><code class=\"python plain\">pkt_id_range\u00a0\u00a0\u00a0\u00a0 <\/code><code class=\"python keyword\">=<\/code> <code class=\"python plain\">[<\/code><code class=\"python value\">100<\/code><code class=\"python plain\">, num_packets<\/code><code class=\"python keyword\">-<\/code><code class=\"python value\">100<\/code><code class=\"python plain\">]<\/code><\/div>\n<div class=\"line number11 index10 alt2\"><code class=\"python plain\">simulation_times <\/code><code class=\"python keyword\">=<\/code> <code class=\"python value\">5<\/code><\/div>\n<div class=\"line number12 index11 alt1\"><code class=\"python plain\">pkt_timer_type\u00a0\u00a0 <\/code><code class=\"python keyword\">=<\/code> <code class=\"python string\">'periodic'<\/code><\/div>\n<div class=\"line number13 index12 alt2\"><code class=\"python plain\">link_gain_shift\u00a0 <\/code><code class=\"python keyword\">=<\/code> <code class=\"python value\">0<\/code><\/div>\n<div class=\"line number14 index13 alt1\"><code class=\"python plain\">rng_seed\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code class=\"python keyword\">=<\/code> <code class=\"python value\">0<\/code><\/div>\n<div class=\"line number15 index14 alt2\"><code class=\"python plain\">pkt_rate_list\u00a0\u00a0\u00a0 <\/code><code class=\"python keyword\">=<\/code> <code class=\"python plain\">[<\/code><code class=\"python value\">1<\/code><code class=\"python plain\">, <\/code><code class=\"python value\">2<\/code><code class=\"python plain\">, <\/code><code class=\"python value\">3<\/code><code class=\"python plain\">, <\/code><code class=\"python value\">4<\/code><code class=\"python plain\">, <\/code><code class=\"python value\">5<\/code><code class=\"python plain\">, <\/code><code class=\"python value\">6<\/code><code class=\"python plain\">, <\/code><code class=\"python value\">7<\/code><code class=\"python plain\">, <\/code><code class=\"python value\">8<\/code><code class=\"python plain\">, <\/code><code class=\"python value\">10<\/code><code class=\"python plain\">, <\/code><code class=\"python value\">20<\/code><code class=\"python plain\">, <\/code><code class=\"python value\">50<\/code><code class=\"python plain\">]<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>The script will iterate over the packet rates in<span>\u00a0<\/span><code>pkt_rate_list<\/code>. For each packet rate, the script will run the simulation for five times (as specified by<span>\u00a0<\/span><code>simulation_times<\/code>). This can be useful for obtaining confidence intervals on the statistics. To run the script:<\/p>\n<div>\n<div class=\"syntaxhighlighter nogutter bash\"><\/div>\n<div id=\"highlighter_133875\" class=\"syntaxhighlighter nogutter bash\">\n<p>After the collection of simulations are done, you can find the summary of results in the file\u00a0<code>result.txt<\/code>\u00a0under the directory\u00a0<code>log\/temp\/output\/<\/code>:<\/p>\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2 highlighted\"><code class=\"bash plain\">$ <\/code><code class=\"bash functions\">cd<\/code> <code class=\"bash plain\">sim\/<\/code><\/div>\n<div class=\"line number2 index1 alt1 highlighted\"><code class=\"bash plain\">$ python run-simulation.py<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<div>\n<div id=\"highlighter_782571\" class=\"syntaxhighlighter nogutter plain\">\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"plain plain\">--------------------Sun Feb 22 21:30:50 2015--------------------<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"plain plain\">protocol: ctp<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"plain plain\">queue_type: N\/A<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"plain plain\">noise_trace: meyer-heavy.txt<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"plain plain\">rssi_trace: dynamic\/intra_car_5nodes.txt<\/code><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"plain plain\">simulation_times: 5<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">PktRate\u00a0\u00a0 %Delivery\u00a0\u00a0\u00a0\u00a0\u00a0 Std\u00a0\u00a0 AvgDelay\u00a0\u00a0\u00a0\u00a0\u00a0 Std\u00a0\u00a0 Goodput\u00a0\u00a0\u00a0\u00a0\u00a0 Std<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">1.00\u00a0\u00a0\u00a0\u00a0\u00a0 0.9191\u00a0\u00a0 0.0532\u00a0\u00a0\u00a0\u00a0\u00a0 57.08\u00a0\u00a0\u00a0 19.37\u00a0\u00a0\u00a0\u00a0\u00a0 3.66\u00a0\u00a0\u00a0\u00a0 0.23<\/code><\/div>\n<div class=\"line number9 index8 alt2\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">2.00\u00a0\u00a0\u00a0\u00a0\u00a0 0.9797\u00a0\u00a0 0.0180\u00a0\u00a0\u00a0\u00a0\u00a0 51.09\u00a0\u00a0\u00a0 23.87\u00a0\u00a0\u00a0\u00a0\u00a0 7.79\u00a0\u00a0\u00a0\u00a0 0.17<\/code><\/div>\n<div class=\"line number10 index9 alt1\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">3.00\u00a0\u00a0\u00a0\u00a0\u00a0 0.9237\u00a0\u00a0 0.1139\u00a0\u00a0\u00a0\u00a0 222.88\u00a0\u00a0 376.85\u00a0\u00a0\u00a0\u00a0 11.03\u00a0\u00a0\u00a0\u00a0 1.35<\/code><\/div>\n<div class=\"line number11 index10 alt2\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">4.00\u00a0\u00a0\u00a0\u00a0\u00a0 0.9081\u00a0\u00a0 0.0566\u00a0\u00a0\u00a0\u00a0 148.97\u00a0\u00a0 139.64\u00a0\u00a0\u00a0\u00a0 14.44\u00a0\u00a0\u00a0\u00a0 0.91<\/code><\/div>\n<div class=\"line number12 index11 alt1\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">5.00\u00a0\u00a0\u00a0\u00a0\u00a0 0.7590\u00a0\u00a0 0.1463\u00a0\u00a0\u00a0\u00a0 424.13\u00a0\u00a0 316.95\u00a0\u00a0\u00a0\u00a0 15.15\u00a0\u00a0\u00a0\u00a0 2.90<\/code><\/div>\n<div class=\"line number13 index12 alt2\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">6.00\u00a0\u00a0\u00a0\u00a0\u00a0 0.8103\u00a0\u00a0 0.1531\u00a0\u00a0\u00a0\u00a0 258.39\u00a0\u00a0 267.79\u00a0\u00a0\u00a0\u00a0 19.38\u00a0\u00a0\u00a0\u00a0 3.63<\/code><\/div>\n<div class=\"line number14 index13 alt1\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">7.00\u00a0\u00a0\u00a0\u00a0\u00a0 0.8270\u00a0\u00a0 0.0929\u00a0\u00a0\u00a0\u00a0 140.35\u00a0\u00a0 134.49\u00a0\u00a0\u00a0\u00a0 22.92\u00a0\u00a0\u00a0\u00a0 2.62<\/code><\/div>\n<div class=\"line number15 index14 alt2\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">8.00\u00a0\u00a0\u00a0\u00a0\u00a0 0.7963\u00a0\u00a0 0.1311\u00a0\u00a0\u00a0\u00a0 184.52\u00a0\u00a0 185.13\u00a0\u00a0\u00a0\u00a0 25.23\u00a0\u00a0\u00a0\u00a0 4.10<\/code><\/div>\n<div class=\"line number16 index15 alt1\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">10.00\u00a0\u00a0\u00a0\u00a0\u00a0 0.8229\u00a0\u00a0 0.0941\u00a0\u00a0\u00a0\u00a0\u00a0 75.82\u00a0\u00a0\u00a0 92.31\u00a0\u00a0\u00a0\u00a0 32.62\u00a0\u00a0\u00a0\u00a0 3.72<\/code><\/div>\n<div class=\"line number17 index16 alt2\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">20.00\u00a0\u00a0\u00a0\u00a0\u00a0 0.6492\u00a0\u00a0 0.1028\u00a0\u00a0\u00a0\u00a0\u00a0 76.95\u00a0\u00a0\u00a0 71.71\u00a0\u00a0\u00a0\u00a0 51.03\u00a0\u00a0\u00a0\u00a0 8.42<\/code><\/div>\n<div class=\"line number18 index17 alt1\"><code class=\"plain spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain plain\">50.00\u00a0\u00a0\u00a0\u00a0\u00a0 0.4348\u00a0\u00a0 0.0155\u00a0\u00a0\u00a0\u00a0\u00a0 47.95\u00a0\u00a0\u00a0 19.96\u00a0\u00a0\u00a0\u00a0 83.91\u00a0\u00a0\u00a0\u00a0 3.15<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>Conclusion<\/h3>\n<hr \/>\n<p>In this tutorial we have shown how to use TeaCP in both experiment and simulations to evaluate performance of collection protocols. The ultimate goal of TeaCP is to let users conveniently compare multiple collection protocols in the same testing environment. If you are a collection protocol developer and you have implemented a collection protocol, you can simply include your library path into the makefile of the TinyOS program and compile. However, TeaCP does require your collection protocol provide the three necessary interfaces: the<span>\u00a0<\/span><code>Send<\/code><span>\u00a0<\/span>interface, the<span>\u00a0<\/span><code>Receive<\/code><span>\u00a0<\/span>and the<span>\u00a0<\/span><code>Intercept<\/code><span>\u00a0<\/span>interface.<\/p>\n<p>The TeaCP analysis component relies on the clock accuracy of sensors to provide accurate statistics. It has been shown that for the same type of sensors, the clock drift is negligible for a short duration of test. However, it would be useful to incorporate a clock synchronization protocol to more accurately record the log messages. This would be our future work to extend the toolkit.<\/p>\n<h3>References<\/h3>\n<hr \/>\n<ul>\n<li><a href=\"https:\/\/web.archive.org\/web\/20150313184205\/http:\/\/www.tinyos.net\/\">TinyOS Home Page<\/a><\/li>\n<li><a href=\"https:\/\/web.archive.org\/web\/20150313184205\/http:\/\/tinyos.stanford.edu\/tinyos-wiki\/index.php\/TinyOS_Documentation_Wiki\"><span dir=\"auto\">TinyOS Documentation Wiki<\/span><\/a><\/li>\n<li><a href=\"https:\/\/web.archive.org\/web\/20150313184205\/http:\/\/www.eecs.harvard.edu\/~konrad\/projects\/shimmer\/references\/tmote-sky-datasheet.pdf\">Tmote Sky datasheet<\/a><\/li>\n<li><a href=\"https:\/\/web.archive.org\/web\/20150313184205\/http:\/\/arduino.cc\/en\/uploads\/Main\/Arduino-Pro-Mini-schematic.pdf\">Arduino Pro Mini schematic<\/a><\/li>\n<li><a href=\"https:\/\/web.archive.org\/web\/20150313184205\/http:\/\/www.graphviz.org\/\">Graphviz &#8211; Graph Visualization Software<\/a><\/li>\n<li><a href=\"https:\/\/web.archive.org\/web\/20150313184205\/http:\/\/matplotlib.org\/\">matplotlib: python plotting &#8212; Matplotlib 1.4.3 documentation<\/a><\/li>\n<li>Wei Si, Morteza Hashemi, Idan Warsawski, Moshe Laifenfeld, David Starobinski, and Ari Trachtenberg, &#8220;<a href=\"https:\/\/web.archive.org\/web\/20150313184205\/http:\/\/people.bu.edu\/staro\/comcas-wei.pdf\">TeaCP: a Toolkit for Evaluation and Analysis of Collection Protocols in Wireless Sensor Networks<\/a>,&#8221;\u00a0<i>IEEE COMCAS 2013<\/i>.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>About TeaCP TeaCP (pronounced as teacup) is a prototype Toolkit for the\u00a0evaluation and analysis of Collection Protocols in both simulation\u00a0and experimental environments running on TinyOS. The\u00a0toolkit\u00a0consists of a testing system, which runs a collection protocol of\u00a0choice, and an optional SD card-based logging system, which\u00a0stores the logs generated by the testing system. The SD card datalogger [&hellip;]<\/p>\n","protected":false},"author":13841,"featured_media":0,"parent":18,"menu_order":2,"comment_status":"closed","ping_status":"closed","template":"page-templates\/no-sidebars.php","meta":[],"_links":{"self":[{"href":"https:\/\/sites.bu.edu\/nislab\/wp-json\/wp\/v2\/pages\/77"}],"collection":[{"href":"https:\/\/sites.bu.edu\/nislab\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sites.bu.edu\/nislab\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sites.bu.edu\/nislab\/wp-json\/wp\/v2\/users\/13841"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.bu.edu\/nislab\/wp-json\/wp\/v2\/comments?post=77"}],"version-history":[{"count":50,"href":"https:\/\/sites.bu.edu\/nislab\/wp-json\/wp\/v2\/pages\/77\/revisions"}],"predecessor-version":[{"id":510,"href":"https:\/\/sites.bu.edu\/nislab\/wp-json\/wp\/v2\/pages\/77\/revisions\/510"}],"up":[{"embeddable":true,"href":"https:\/\/sites.bu.edu\/nislab\/wp-json\/wp\/v2\/pages\/18"}],"wp:attachment":[{"href":"https:\/\/sites.bu.edu\/nislab\/wp-json\/wp\/v2\/media?parent=77"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}