[Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/TestTreeRouting Makefile, NONE, 1.1.4.2 Makefile.driver, NONE, 1.1.4.2 README, NONE, 1.1.4.2 TestTreeRoutingC.nc, NONE, 1.1.4.2 TestTreeRoutingP.nc, NONE, 1.1.4.2 test.cc, NONE, 1.1.4.2 test.py, NONE, 1.1.4.2 topo.txt, NONE, 1.1.4.2

Kevin Klues klueska at users.sourceforge.net
Mon May 15 11:35:27 PDT 2006


Update of /cvsroot/tinyos/tinyos-2.x/apps/tests/TestTreeRouting
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv18756/apps/tests/TestTreeRouting

Added Files:
      Tag: tos-2-resource-pm-eval-cand
	Makefile Makefile.driver README TestTreeRoutingC.nc 
	TestTreeRoutingP.nc test.cc test.py topo.txt 
Log Message:
Merging the development branch with the resource/power management evaluation branch.  After this merge all files except those already commited should be identical.

--- NEW FILE: Makefile ---
COMPONENT=TestTreeRoutingC
CFLAGS += -I$(TOSDIR)/lib/net/collection

include $(MAKERULES)


--- NEW FILE: Makefile.driver ---
all:
	make micaz sim
	g++ -g -c -o test.o test.cc -I$(TOSROOT)/tos/lib/tossim/
	g++ -o test test.o build/micaz/tossim.o build/micaz/sim.o

--- NEW FILE: README ---
This is a simple configuration and test driver to test tree building and link estimation. Currently to be used in simulation, because it does not have any debugging or state output to the radio.

Rodrigo Fonseca


--- NEW FILE: TestTreeRoutingC.nc ---
/* Minimal confiruation to compile TreeRoutingEngine.nc */
configuration TestTreeRoutingC {} 
implementation {
    enum {
        TREE_ROUTING_TABLE_SIZE = 12,
    };

    components MainC;
    components ActiveMessageC;
    components TestTreeRoutingP;

    components new TreeRoutingEngineP(TREE_ROUTING_TABLE_SIZE) as RE;
    components LinkEstimatorP as LE;

    TestTreeRoutingP.Boot -> MainC;
    TestTreeRoutingP.RadioControl -> ActiveMessageC;

    TestTreeRoutingP.Init -> RE;
    TestTreeRoutingP.Init -> LE;
    TestTreeRoutingP.TreeControl -> RE;

    TestTreeRoutingP.RootControl -> RE;
    

    components new AMSenderC(AM_TREE_ROUTING_CONTROL) as SubSender;  

    LE.AMSend -> SubSender;
    LE.SubPacket -> SubSender;
    LE.SubAMPacket -> SubSender;
    
   
    RE.BeaconSend -> LE.Send;
    RE.BeaconReceive -> LE.Receive;
    RE.LinkEstimator -> LE.LinkEstimator;
    RE.LinkSrcPacket -> LE.LinkSrcPacket;
    RE.AMPacket -> SubSender;
    RE.RadioControl -> ActiveMessageC;
    
    components new AMReceiverC(AM_TREE_ROUTING_CONTROL) as SubReceiver;  
    LE.SubReceive -> SubReceiver;
    
    components new TimerMilliC() as LETimer;
    LE.Timer -> LETimer;

    components new TimerMilliC() as BeaconTimer;
    RE.BeaconTimer -> BeaconTimer;

    components RandomC;
    RE.Random -> RandomC;

}

--- NEW FILE: TestTreeRoutingP.nc ---
module TestTreeRoutingP {
    uses interface Boot;
    uses interface Init;
    uses interface StdControl as TreeControl;
    uses interface SplitControl as RadioControl;
    uses interface RootControl;
}
implementation {
    event void Boot.booted() {
        call Init.init();
        call RadioControl.start();
        call TreeControl.start();
        if (TOS_NODE_ID == 0) {
            call RootControl.setRoot();
        }

    }

    event void RadioControl.startDone(error_t error) {
    }
  
    event void RadioControl.stopDone(error_t error) {
    }
}

--- NEW FILE: test.cc ---
#include <tossim.h>
#include <iostream>
#include <string>


int main() {
  Tossim* t = new Tossim(NULL);
  t->init();

  t->addChannel("TreeRouting", stdout);
  t->addChannel("TreeRoutingCtl", stdout);
  t->addChannel("AM", stdout);


  Radio* r = t->radio();

  for (int i = 0; i < 2; i++) {
    printf("Mote %i at %i\n", i, 15000000 * i + 1);
    Mote* m = t->getNode(i);
    m->bootAtTime(15000000 * i + 1);
    r->setNoise(i, -77.0, 3);
    for (int j = 0; j < 2; j++) {
      if (i != j) {
        r->add(i, j, -50.0);
      }
    }
  }

  while (t->time()/t->ticksPerSecond()  < 600) {
    t->runNextEvent();
  }
	
}

--- NEW FILE: test.py ---
# This script is a simple TOSSIM test of tree building
# It builds a 15x15 grid of nodes and just lets the
# tree form. There's currently no routing going on.

import TOSSIM
import sys

t = TOSSIM.Tossim([])
m = t.mac();
r = t.radio();
t.init()

#t.addChannel("LedsC", sys.stdout);
t.addChannel("AM", sys.stdout);
t.addChannel("TreeRouting", sys.stdout);
t.addChannel("TreeRoutingCtl", sys.stdout);
#t.addChannel("LI", sys.stdout);
#t.addChannel("Gain", sys.stdout);
#t.addChannel("TossimPacketModelC", sys.stdout);

print (dir(TOSSIM.Tossim))

f = open("topo.txt", "r")
lines = f.readlines()
for line in lines:
  s = line.split()
  if (len(s) > 0):
    if (s[0] == "gain"):
      r.add(int(s[1]), int(s[2]), float(s[3]))
    elif (s[0] == "noise"):
      r.setNoise(int(s[1]), float(s[2]), float(s[3]))

for i in range(0, 2):
  m = t.getNode(i);
  m.bootAtTime((t.ticksPerSecond() / 50) * i + 43);
 
while (t.time() / t.ticksPerSecond() < 1600):
  t.runNextEvent()
  

--- NEW FILE: topo.txt ---
gain	0	1	-64.71
gain	1	0	-66.06
gain	0	2	-73.89
gain	2	0	-76.19
gain	0	3	-76.00
gain	3	0	-77.08
gain	0	4	-78.29
gain	4	0	-80.34
gain	0	5	-78.62
gain	5	0	-78.56
gain	0	6	-85.98
gain	6	0	-87.32
gain	0	7	-89.50
gain	7	0	-90.94
gain	0	8	-87.98
gain	8	0	-91.27
gain	0	9	-87.39
gain	9	0	-95.08
gain	0	10	-91.14
[...50586 lines suppressed...]
noise	205	-107.32	4.00
noise	206	-103.93	4.00
noise	207	-103.67	4.00
noise	208	-104.88	4.00
noise	209	-103.33	4.00
noise	210	-103.77	4.00
noise	211	-107.35	4.00
noise	212	-104.40	4.00
noise	213	-102.55	4.00
noise	214	-99.68	4.00
noise	215	-102.74	4.00
noise	216	-102.16	4.00
noise	217	-102.66	4.00
noise	218	-107.37	4.00
noise	219	-105.53	4.00
noise	220	-109.69	4.00
noise	221	-104.91	4.00
noise	222	-107.83	4.00
noise	223	-103.71	4.00
noise	224	-102.76	4.00



More information about the Tinyos-2-commits mailing list