[Tinyos-help] plzzz replyy..... looping stream buffers inside bufferDone or readDone ??

2009-11-14 Thread Akankshu Dhawan
Hi All
I am trying to loop the readStream interface for a microphone. For this I am
calling the ReadStream.read(period) on a buffer (This is done inside
Boot.booted ()).Once the buffer gets filled it signals bufferDone and since
I am using just one buffer it immediately signals readDone.

Now I want to make this flow continuous... so I tried the following two
things :

1. I called Readstream.read(period) inside a task which was posted inside
readDone. thus it will be executed some time after readDone gets finished.

2.. I created two buffers of half the size and posted the both in
Boot.booted()
while bufferDone gets signaled I keep a flag and keep altering the
postBuffer calls inside bufferDone to switch between the buffers and then
call readStream.read(period) from readStream.bufferDone itself  I am not
sure if this is correct ?

Can someone plzzz help me out here. I want to know if there
is a standard way to do such a thing since I assume similar implementations
would have been done earlier as well.

I look forward to hearing from someone atleast.


Thanks
Akankshu
-- 
First they ignore you, then they laugh at you, then they fight you, then you
win.
- Mahatma Gandhi
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

[Tinyos-help] CollectionC protocol for mobile WSN?

2009-11-14 Thread Vikram vik76
Hello,

Does the CollectionC protocol work for the WSN where the topology of the
network changes ?  the nodes are mobile but the connectivity is always
there.

Thanks
Vikram
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

[Tinyos-help] ReadStream actualPeriod wrong?

2009-11-14 Thread Akankshu Dhawan
Hi All
I have implemented the readstream interface for the microphone but since I
am doing high sampling (10KHz) I decided to check whether I am actually
getting a sampling period close to 100 micro-secs. When I try to printout
the actualPeriod from inside readDone I get the value 370 continuously (I am
looping the calls by posting tasks)
I would be fine with 370 micro-second as the period as well but the problem
is the LED indicators as well as these print statements (instead of coming
at a very fast rate considering my buffer size is only 1000) come at almost
1 per second. Is there a hardware limit that I am reaching ??

I have the following code:
===
  event void ReadStream.readDone(error_t result, uint32_t actualPeriod)
  {
if (result == SUCCESS  streamSuccess)
{ printf(Actuall Period is: %ld\n,actualPeriod);
printfflush();
post sampleData();
}
  }

  task void sampleData(){
  call ReadStream.postBuffer(buf1, BUF_SIZE);
  call ReadStream.read(128);
  }
===

I would be grateful to anyone who replies !!!
-- 
First they ignore you, then they laugh at you, then they fight you, then you
win.
- Mahatma Gandhi
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

[Tinyos-help] how to display the current time in Tinyos2.x

2009-11-14 Thread wafa jaballah
 Hello,

I'd like to display the current time information in  TinyOS2.x.
 I know in TinyOS1.x,such information could be given as below can do this.
   call Sender.generate(0,tos_state.tos_time/1000,packet)

But in TinyOS2.x,I don't known how to access the current time  information
besides using t.time().
  But I hope the current time  information could be a parameter of this
function .Can anybody tell me how can i do this?

Thanks

-- 
Wafa Ben Jaballah
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Re: [Tinyos-help] how to display the current time in Tinyos2.x

2009-11-14 Thread Ittipong Khemapech
Hi,

TEP102 @
http://tinyos.cvs.sourceforge.net/*checkout*/tinyos/tinyos-2.x/doc/html/tep102.htmlwould
help.

Ittipong

2009/11/14 wafa jaballah wafa.jabal...@gmail.com

 Hello,

 I'd like to display the current time information in  TinyOS2.x.
  I know in TinyOS1.x,such information could be given as below can do this.
call Sender.generate(0,tos_state.tos_time/1000,packet)

 But in TinyOS2.x,I don't known how to access the current time  information
 besides using t.time().
   But I hope the current time  information could be a parameter of this
 function .Can anybody tell me how can i do this?

 Thanks


 --
 Wafa Ben Jaballah


 ___
 Tinyos-help mailing list
 Tinyos-help@millennium.berkeley.edu
 https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Re: [Tinyos-help] AMSend.sendDone event isn't signaled...

2009-11-14 Thread mojtaba raznahan
Really need your helps...

Can't anybody help me ??

Does it related to simulation section ??





On Tue, Nov 10, 2009 at 10:09 PM, mojtaba raznahan 
mojtaba.razna...@gmail.com wrote:

 I'm still bickering with this issue...some help plz


 On Tue, Nov 10, 2009 at 7:44 PM, mojtaba raznahan 
 mojtaba.razna...@gmail.com wrote:

 How can i make sure that the message ACK is active or not ? I have not
 worked with ACK yet


 On Tue, Nov 10, 2009 at 7:26 PM, Ricardo . ricardo.mas...@gmail.comwrote:

 I read one of the threads that the cause of the issue might be the ACK
 messages.  ACK will arrive at the event will never be signaled.  If the
 message ACK is active and no ACK is received sendDone is not signaled.


 On Tue, Nov 10, 2009 at 3:37 PM, mojtaba raznahan 
 mojtaba.razna...@gmail.com wrote:

 Hi Ricardo,

 Thanks for reply. I wrote a dbg statement in first of sendDone event but
 ...the sendDone event is not signaled at all!


 event void AMSend.sendDone(message_t* bufPtr, error_t error)
 {
* dbg(Base,sendDone %s .\n,sim_time_string());*

 if (pkt == bufPtr) {
   busy = FALSE;
 }

 }

 There isn'nt any statement to print while simulating

 Really confused! What's your idea ??
 Does it related to Radio configuration of simulation code ?(python code
 ?)




 On Tue, Nov 10, 2009 at 6:43 PM, Ricardo . ricardo.mas...@gmail.comwrote:

 Try print the value of error_t error in sendDone event

 On Mon, Nov 9, 2009 at 3:53 PM, mojtaba raznahan 
 mojtaba.razna...@gmail.com wrote:

 Hi,

 Im writing a simple application to test send and receive of motes
 .AMSend.send command works but AMSend.sendDone event isn't signaled after
 sending so the busy flag does'nt change to false. and in the next time 
 the
 AMSend.send command does not return SUCCESS .
 this is my code :

 event void Boot.booted() {
 dbg(Boot,Booted at time %s .\n,sim_time_string());
 call AMControl.start();
 }

 event void AMControl.startDone(error_t err)
 {
 dbg(Control,AMControl started %s .\n,sim_time_string());
   if(err == SUCCESS) {
if(TOS_NODE_ID == 1 ) {
 dbg(Base,This is the base station...ready for sending packets
 %s.\n,sim_time_string());
 call Timer.startPeriodic(TIMER_DELAY);
 }
 }
   else
call AMControl.start();
 }

 event void AMControl.stopDone(error_t err)
 {

 }

 event void Timer.fired()
 {

if(!busy)
   {


   RbsMsg*  data =  (RbsMsg*) ( call
 Packet.getPayload(pkt,sizeof(RbsMsg)));
   data-count = counter;
if( call AMSend.send(AM_BROADCAST_ADDR,pkt,sizeof(RbsMsg))
 == SUCCESS)
{
  dbg(Base,Packet sent %s.\n,sim_time_string());
  busy= TRUE;
  counter++;
 }
 else
dbg(Base,was not SUCCESSFULL %s .\n,sim_time_string());

 }

 }

 
 event void AMSend.sendDone(message_t* bufPtr, error_t error)
 {

 if (pkt == bufPtr) {
   busy = FALSE;
   dbg(Base,send Done %s .\n,sim_time_string());
 }

 }

 and this is my simulation code with python :

 #! /usr/bin/python

 import sys
 import random
 from TOSSIM import *
 t = Tossim([])
 r = t.radio();

 for i in range (0, 3):
  m = t.getNode(i);
  m.bootAtTime(1000 * i+ 1);

 r.add(1, 0, -54.0);
 r.add(1, 2, -54.0);
 r.add(0, 2, -20.0);
 r.add(2, 0, -20.0);


 t.addChannel(Boot,sys.stdout);
 t.addChannel(Base,sys.stdout);
 t.addChannel(Receive,sys.stdout);
 t.addChannel(Control,sys.stdout);

 for i in range(0, 2):
   t.runNextEvent();


 Would you help me please? i really need your helps.

 Regards,
 --
 Mojtaba Raznahan
 BS of Computer engineering
 TMU university
 www.raznahan.com

 ___
 Tinyos-help mailing list
 Tinyos-help@millennium.berkeley.edu

 https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help





 --
 Mojtaba Raznahan
 BS of Computer engineering
 TMU university
 www.raznahan.com



 ___
 Tinyos-help mailing list
 Tinyos-help@millennium.berkeley.edu
 https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help




 --
 Mojtaba Raznahan
 BS of Computer engineering
 TMU university
 www.raznahan.com




 --
 Mojtaba Raznahan
 BS of Computer engineering
 TMU university
 www.raznahan.com




-- 
Mojtaba Raznahan
BS of Computer engineering
TMU university
www.raznahan.com
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

[Tinyos-help] Simple send recieve application

2009-11-14 Thread mojtaba raznahan
Hi all,

Does any body have a simple application that just have some Send and Recieve
between the nodes correctly ?
I want to check out with my application.

sincerely,

-- 
Mojtaba Raznahan
BS of Computer engineering
TMU university
www.raznahan.com
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Re: [Tinyos-help] mac os x 10.6.2 stdlib.h compiling problems...

2009-11-14 Thread Enzeneer
Sorry, doesn't work.
I tried changing the GCC=gcc-4.0 in the null.rules, but no avail.

On Sat, Nov 14, 2009 at 1:55 AM, Razvan Musaloiu-E. razv...@cs.jhu.edu wrote:
 Hi!

 On Sat, 14 Nov 2009, Enzeneer wrote:

 Hi,

 It occurs whenever I try to build a Java program and target=null is
 specified in the Makefile. For example in the Oscilloscope app.


 Can you give another try of the latest CVS? I just committed a fix for the
 null too. :D

 All the best!
 Razvan ME

 Now I found that if I change the target=telosb or target=$(PLATFORM),
 then it builds without problem.

 The errors when target=null is specified are as below:

 make mig -target=null -java-classname=OscilloscopeMsg java
 ../Oscilloscope.h oscilloscope -o OscilloscopeMsg.java In file
 included from /usr/include/string.h:148, from
 /Users/abhay/Developer/Source/tinyos-2.x/tos/system/tos.h:13:
 /usr/include/secure/_string.h: In function `__inline_memcpy_chk':
 /usr/include/secure/_string.h:58: warning: return makes pointer from
 integer without a cast /usr/include/secure/_string.h: In function
 `__inline_memmove_chk': /usr/include/secure/_string.h:69: warning:
 return makes pointer from integer without a cast
 /usr/include/secure/_string.h: In function `__inline_memset_chk':
 /usr/include/secure/_string.h:80: warning: return makes pointer from
 integer without a cast /usr/include/secure/_string.h: In function
 `__inline_strcpy_chk': /usr/include/secure/_string.h:91: warning:
 return makes pointer from integer without a cast
 /usr/include/secure/_string.h: In function `__inline_stpcpy_chk':
 /usr/include/secure/_string.h:103: warning: return makes pointer from
 integer without a cast /usr/include/secure/_string.h: In function
 `__inline_strncpy_chk': /usr/include/secure/_string.h:116: warning:
 return makes pointer from integer without a cast
 /usr/include/secure/_string.h: In function `__inline_strcat_chk':
 /usr/include/secure/_string.h:127: warning: return makes pointer from
 integer without a cast /usr/include/secure/_string.h: In function
 `__inline_strncat_chk': /usr/include/secure/_string.h:139: warning:
 return makes pointer from integer without a cast In file included from
 /Users/abhay/Developer/Source/tinyos-2.x/tos/system/tos.h:14:
 /usr/include/stdlib.h: At top level: /usr/include/stdlib.h:272: syntax
 error before `^' /usr/include/stdlib.h:272: `type name' declared as
 function returning a function /usr/include/stdlib.h:274: syntax error
 before `^' /usr/include/stdlib.h:274: `type name' declared as function
 returning a function /usr/include/stdlib.h:301: syntax error before
 `^' /usr/include/stdlib.h:301: `type name' declared as function
 returning a function /usr/include/stdlib.h:307: syntax error before
 `^' /usr/include/stdlib.h:307: `type name' declared as function
 returning a function /usr/include/stdlib.h:313: syntax error before
 `^' /usr/include/stdlib.h:313: `type name' declared as function
 returning a function /usr/include/stdlib.h:319: syntax error before
 `^' /usr/include/stdlib.h:319: `type name' declared as function
 returning a function In file included from
 /Users/abhay/Developer/Source/tinyos-2.x/tos/system/SchedulerBasicP.nc:41,
 from
 /Users/abhay/Developer/Source/tinyos-2.x/tos/system/TinySchedulerC.nc:40:
 /Users/abhay/Developer/Source/tinyos-2.x/tos/platforms/null/hardware.h:
 In function `__nesc_ntoh_afloat':
 /Users/abhay/Developer/Source/tinyos-2.x/tos/platforms/null/hardware.h:22:
 warning: pointer/integer type mismatch in conditional expression
 /Users/abhay/Developer/Source/tinyos-2.x/tos/platforms/null/hardware.h:
 In function `__nesc_hton_afloat':
 /Users/abhay/Developer/Source/tinyos-2.x/tos/platforms/null/hardware.h:27:
 warning: pointer/integer type mismatch in conditional expression In
 file included from
 /Users/abhay/Developer/Source/tinyos-2.x/tos/system/TinySchedulerC.nc:40:
 In component `SchedulerBasicP':
 /Users/abhay/Developer/Source/tinyos-2.x/tos/system/SchedulerBasicP.nc:
 In function `Scheduler.init':

 /Users/abhay/Developer/Source/tinyos-2.x/tos/system/SchedulerBasicP.nc:117:
 warning: pointer/integer type mismatch in conditional expression
 failed to parse message file ../Oscilloscope.h make: ***
 [OscilloscopeMsg.java] Error 1

 The same thing with target=telosb:

 make
 mig -target=telosb -java-classname=OscilloscopeMsg java
 ../Oscilloscope.h oscilloscope -o OscilloscopeMsg.java
 ncg -target=telosb -java-classname=Constants java ../Oscilloscope.h
 NREADINGS DEFAULT_INTERVAL -o Constants.java
 javac *.java
 jar cf oscilloscope.jar *.class

 Hope this helps.

 Abhay

 On Fri, Nov 13, 2009 at 11:52 PM, Razvan Musaloiu-E. razv...@cs.jhu.edu
 wrote:

 Hi!

 On Fri, 13 Nov 2009, Enzeneer wrote:

 Cool!
 This works, but I still have problems compiling some of the other
 applications that reference stdlib.h.
 Can you point me to some information about mig? How does it select the
 gcc version?

 Can you indicate the steps to reproduce this problem? :P The stuff in
 RadioCountToLeds 

Re: [Tinyos-help] Simple send recieve application

2009-11-14 Thread Till Maas
Hi,

On Sat, Nov 14, 2009 at 04:24:59PM +0330, mojtaba raznahan wrote:

 Does any body have a simple application that just have some Send and Recieve
 between the nodes correctly ?
 I want to check out with my application.

there is one included in the TinyOS collection. It's called
RadioCountToLed iirc. There is also a tutorial about it:

http://docs.tinyos.net/index.php/Mote-mote_radio_communication

Regards
Till

___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] AMSend.sendDone event isn't signaled...

2009-11-14 Thread Paul Johnson

Mojtaba,

Make sure when you are setting up your links in the simulation you set 
up BOTH directions of the link.  For example if you're trying to send 
something from node 1 to node 2, you need to define the gain for link 
1-2 and from 2-1.  Otherwise, 1 will be able to send to 2, but 2 will 
never respond with an ACK.


-Paul

mojtaba raznahan wrote:


Really need your helps...

Can't anybody help me ??

Does it related to simulation section ??





On Tue, Nov 10, 2009 at 10:09 PM, mojtaba raznahan 
mojtaba.razna...@gmail.com mailto:mojtaba.razna...@gmail.com wrote:


I'm still bickering with this issue...some help plz


On Tue, Nov 10, 2009 at 7:44 PM, mojtaba raznahan
mojtaba.razna...@gmail.com mailto:mojtaba.razna...@gmail.com
wrote:

How can i make sure that the message ACK is active or not ? I
have not worked with ACK yet


On Tue, Nov 10, 2009 at 7:26 PM, Ricardo .
ricardo.mas...@gmail.com mailto:ricardo.mas...@gmail.com
wrote:

I read one of the threads that the cause of the issue
might be the ACK messages.  ACK will arrive at the event
will never be signaled.  If the message ACK is active and
no ACK is received sendDone is not signaled. 



On Tue, Nov 10, 2009 at 3:37 PM, mojtaba raznahan
mojtaba.razna...@gmail.com
mailto:mojtaba.razna...@gmail.com wrote:

Hi Ricardo,

Thanks for reply. I wrote a dbg statement in first of
sendDone event but ...the sendDone event is not
signaled at all!


event void AMSend.sendDone(message_t* bufPtr, error_t
error)
{
   * dbg(Base,sendDone %s .\n,sim_time_string());*

if (pkt == bufPtr) {
  busy = FALSE;
}

}

There isn'nt any statement to print while simulating

Really confused! What's your idea ??
Does it related to Radio configuration of simulation
code ?(python code ?)




On Tue, Nov 10, 2009 at 6:43 PM, Ricardo .
ricardo.mas...@gmail.com
mailto:ricardo.mas...@gmail.com wrote:

Try print the value of error_t error in sendDone event

On Mon, Nov 9, 2009 at 3:53 PM, mojtaba raznahan
mojtaba.razna...@gmail.com
mailto:mojtaba.razna...@gmail.com wrote:

Hi,

Im writing a simple application to test send
and receive of motes .AMSend.send command
works but AMSend.sendDone event isn't signaled
after sending so the busy flag does'nt change
to false. and in the next time the AMSend.send
command does not return SUCCESS .
this is my code :

event void Boot.booted() {
dbg(Boot,Booted at time %s
.\n,sim_time_string());
call AMControl.start();
}

event void AMControl.startDone(error_t err)
{
dbg(Control,AMControl started %s
.\n,sim_time_string());
  if(err == SUCCESS) {
   if(TOS_NODE_ID == 1 ) {
dbg(Base,This is the base
station...ready for sending packets
%s.\n,sim_time_string());
call Timer.startPeriodic(TIMER_DELAY);
}
}
  else
   call AMControl.start();
}

event void AMControl.stopDone(error_t err)
{
  
}


event void Timer.fired()
{

   if(!busy)
  {

 
  RbsMsg*  data =  (RbsMsg*) ( call

Packet.getPayload(pkt,sizeof(RbsMsg)));
  data-count = counter;
   if( call
AMSend.send(AM_BROADCAST_ADDR,pkt,sizeof(RbsMsg))
== SUCCESS)
   {
 dbg(Base,Packet sent
%s.\n,sim_time_string());
 busy= TRUE;
 counter++;
}
else
  

[Tinyos-help] different nodes in tossim

2009-11-14 Thread Viktor Zsoldos
Hi list!

Is that possible to simulate nodes with different programs in TOSSIM?
For example one node as a base station, and other nodes as simple
sensing nodes.
I can do this now in one file with separating the usage of different
functions with if-else, but that's not too pretty.

Thanks in advance,
Viktor
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] AMSend.sendDone event isn't signaled...

2009-11-14 Thread mojtaba raznahan
Hi Paul,

Thank you very much for answer.
I checked out this problem,but still doen't work!!
This is my simulation code and node 1 is the sender node  :(Is it correct ?)

#! /usr/bin/python

import TOSSIM
import sys
import random

from TOSSIM import *

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

for i in range(0, 3):
  m = t.getNode(i);
  m.bootAtTime(503 * i + 1);

r.add(1,0,-50.0);
r.add(0,1,-50.0);
r.add(1,2,-50.0);
r.add(2,1,-50.0);
r.add(2,0,-50.0);
r.add(0,2,-50.0);



t.addChannel(Boot,sys.stdout);
t.addChannel(Base,sys.stdout);
t.addChannel(Receive,sys.stdout);
t.addChannel(Control,sys.stdout);

for i in range(0, 1000):
  t.runNextEvent();

sincerley,
Mojtaba


On Sat, Nov 14, 2009 at 8:11 PM, Paul Johnson oewyn...@gmail.com wrote:

  Mojtaba,

 Make sure when you are setting up your links in the simulation you set up
 BOTH directions of the link.  For example if you're trying to send something
 from node 1 to node 2, you need to define the gain for link 1-2 and from
 2-1.  Otherwise, 1 will be able to send to 2, but 2 will never respond with
 an ACK.

 -Paul

 mojtaba raznahan wrote:


 Really need your helps...

 Can't anybody help me ??

 Does it related to simulation section ??





 On Tue, Nov 10, 2009 at 10:09 PM, mojtaba raznahan 
 mojtaba.razna...@gmail.com wrote:

 I'm still bickering with this issue...some help plz


 On Tue, Nov 10, 2009 at 7:44 PM, mojtaba raznahan 
 mojtaba.razna...@gmail.com wrote:

 How can i make sure that the message ACK is active or not ? I have not
 worked with ACK yet


 On Tue, Nov 10, 2009 at 7:26 PM, Ricardo . ricardo.mas...@gmail.comwrote:

 I read one of the threads that the cause of the issue might be the ACK
 messages.  ACK will arrive at the event will never be signaled.  If the
 message ACK is active and no ACK is received sendDone is not signaled.


 On Tue, Nov 10, 2009 at 3:37 PM, mojtaba raznahan 
 mojtaba.razna...@gmail.com wrote:

 Hi Ricardo,

 Thanks for reply. I wrote a dbg statement in first of sendDone event
 but ...the sendDone event is not signaled at all!


 event void AMSend.sendDone(message_t* bufPtr, error_t error)
 {
 * dbg(Base,sendDone %s .\n,sim_time_string());*

 if (pkt == bufPtr) {
   busy = FALSE;
 }

 }

 There isn'nt any statement to print while simulating

 Really confused! What's your idea ??
 Does it related to Radio configuration of simulation code ?(python code
 ?)




 On Tue, Nov 10, 2009 at 6:43 PM, Ricardo . 
 ricardo.mas...@gmail.comwrote:

 Try print the value of error_t error in sendDone event

  On Mon, Nov 9, 2009 at 3:53 PM, mojtaba raznahan 
 mojtaba.razna...@gmail.com wrote:

  Hi,

 Im writing a simple application to test send and receive of motes
 .AMSend.send command works but AMSend.sendDone event isn't signaled 
 after
 sending so the busy flag does'nt change to false. and in the next time 
 the
 AMSend.send command does not return SUCCESS .
 this is my code :

 event void Boot.booted() {
 dbg(Boot,Booted at time %s .\n,sim_time_string());
 call AMControl.start();
 }

 event void AMControl.startDone(error_t err)
 {
 dbg(Control,AMControl started %s .\n,sim_time_string());
   if(err == SUCCESS) {
if(TOS_NODE_ID == 1 ) {
 dbg(Base,This is the base station...ready for sending packets
 %s.\n,sim_time_string());
 call Timer.startPeriodic(TIMER_DELAY);
 }
 }
   else
call AMControl.start();
 }

 event void AMControl.stopDone(error_t err)
 {

 }

 event void Timer.fired()
 {

if(!busy)
   {


   RbsMsg*  data =  (RbsMsg*) ( call
 Packet.getPayload(pkt,sizeof(RbsMsg)));
   data-count = counter;
if( call
 AMSend.send(AM_BROADCAST_ADDR,pkt,sizeof(RbsMsg)) == SUCCESS)
{
  dbg(Base,Packet sent %s.\n,sim_time_string());
  busy= TRUE;
  counter++;
 }
 else
dbg(Base,was not SUCCESSFULL %s .\n,sim_time_string());

 }

 }

 
 event void AMSend.sendDone(message_t* bufPtr, error_t error)
 {

 if (pkt == bufPtr) {
   busy = FALSE;
   dbg(Base,send Done %s .\n,sim_time_string());
 }

 }

 and this is my simulation code with python :

 #! /usr/bin/python

 import sys
 import random
 from TOSSIM import *
 t = Tossim([])
 r = t.radio();

 for i in range (0, 3):
  m = t.getNode(i);
  m.bootAtTime(1000 * i+ 1);

 r.add(1, 0, -54.0);
 r.add(1, 2, -54.0);
 r.add(0, 2, -20.0);
 r.add(2, 0, -20.0);


 t.addChannel(Boot,sys.stdout);
 t.addChannel(Base,sys.stdout);
 t.addChannel(Receive,sys.stdout);
 t.addChannel(Control,sys.stdout);

 for i in range(0, 2):
   t.runNextEvent();


 Would you help me please? i really need your helps.

 Regards,
 --
 Mojtaba Raznahan
 BS of Computer engineering
 TMU university
 www.raznahan.com

  ___
 Tinyos-help mailing list
 Tinyos-help@millennium.berkeley.edu

 https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help





 --
 Mojtaba Raznahan
 BS of Computer 

Re: [Tinyos-help] AMSend.sendDone event isn't signaled...

2009-11-14 Thread Paul Johnson

Mojtaba,

Which node is 1 sending to and when???  I see that the node boot times 
are pretty far spaced apart.  It could be that if you're sending from 1 
to 2, node 2 is not booted up when node 1 sends, thus, it will never 
receive an ACK and sendDone will never be called.


-Paul

mojtaba raznahan wrote:

Hi Paul,

Thank you very much for answer.
I checked out this problem,but still doen't work!!
This is my simulation code and node 1 is the sender node  :(Is it 
correct ?)


#! /usr/bin/python

import TOSSIM
import sys
import random

from TOSSIM import *

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

for i in range(0, 3):
  m = t.getNode(i);
  m.bootAtTime(503 * i + 1);

r.add(1,0,-50.0);
r.add(0,1,-50.0);
r.add(1,2,-50.0);
r.add(2,1,-50.0);
r.add(2,0,-50.0);
r.add(0,2,-50.0);



t.addChannel(Boot,sys.stdout);
t.addChannel(Base,sys.stdout);
t.addChannel(Receive,sys.stdout);
t.addChannel(Control,sys.stdout);

for i in range(0, 1000):
  t.runNextEvent();

sincerley,
Mojtaba


On Sat, Nov 14, 2009 at 8:11 PM, Paul Johnson oewyn...@gmail.com 
mailto:oewyn...@gmail.com wrote:


Mojtaba,

Make sure when you are setting up your links in the simulation you
set up BOTH directions of the link.  For example if you're trying
to send something from node 1 to node 2, you need to define the
gain for link 1-2 and from 2-1.  Otherwise, 1 will be able to
send to 2, but 2 will never respond with an ACK.

-Paul

mojtaba raznahan wrote:


Really need your helps...

Can't anybody help me ??

Does it related to simulation section ??





On Tue, Nov 10, 2009 at 10:09 PM, mojtaba raznahan
mojtaba.razna...@gmail.com mailto:mojtaba.razna...@gmail.com
wrote:

I'm still bickering with this issue...some help plz


On Tue, Nov 10, 2009 at 7:44 PM, mojtaba raznahan
mojtaba.razna...@gmail.com
mailto:mojtaba.razna...@gmail.com wrote:

How can i make sure that the message ACK is active or not
? I have not worked with ACK yet


On Tue, Nov 10, 2009 at 7:26 PM, Ricardo .
ricardo.mas...@gmail.com
mailto:ricardo.mas...@gmail.com wrote:

I read one of the threads that the cause of the issue
might be the ACK messages.  ACK will arrive at the
event will never be signaled.  If the message ACK is
active and no ACK is received sendDone is not signaled. 



On Tue, Nov 10, 2009 at 3:37 PM, mojtaba raznahan
mojtaba.razna...@gmail.com
mailto:mojtaba.razna...@gmail.com wrote:

Hi Ricardo,

Thanks for reply. I wrote a dbg statement in
first of sendDone event but ...the sendDone event
is not signaled at all!


event void AMSend.sendDone(message_t* bufPtr,
error_t error)
{
   * dbg(Base,sendDone %s
.\n,sim_time_string());*

if (pkt == bufPtr) {
  busy = FALSE;
}

}

There isn'nt any statement to print while
simulating

Really confused! What's your idea ??
Does it related to Radio configuration of
simulation code ?(python code ?)




On Tue, Nov 10, 2009 at 6:43 PM, Ricardo .
ricardo.mas...@gmail.com
mailto:ricardo.mas...@gmail.com wrote:

Try print the value of error_t error in
sendDone event

On Mon, Nov 9, 2009 at 3:53 PM, mojtaba
raznahan mojtaba.razna...@gmail.com
mailto:mojtaba.razna...@gmail.com wrote:

Hi,

Im writing a simple application to test
send and receive of motes .AMSend.send
command works but AMSend.sendDone event
isn't signaled after sending so the busy
flag does'nt change to false. and in the
next time the AMSend.send command does
not return SUCCESS .
this is my code :

event void Boot.booted() {
dbg(Boot,Booted at time %s
.\n,sim_time_string());
call AMControl.start();
}

event void AMControl.startDone(error_t err)
{
dbg(Control,AMControl started %s
.\n,sim_time_string());
  if(err == SUCCESS) {

Re: [Tinyos-help] different nodes in tossim

2009-11-14 Thread Razvan Musaloiu-E.
Hi!

On Sat, 14 Nov 2009, Viktor Zsoldos wrote:

 Hi list!

 Is that possible to simulate nodes with different programs in TOSSIM?
 For example one node as a base station, and other nodes as simple
 sensing nodes.
 I can do this now in one file with separating the usage of different
 functions with if-else, but that's not too pretty.


Unfortunately, this ugly way is the only way for now. :-(

--
Razvan ME
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] mac os x 10.6.2 stdlib.h compiling problems...

2009-11-14 Thread Razvan Musaloiu-E.
Hi!

On Sat, 14 Nov 2009, Enzeneer wrote:

 Sorry, doesn't work.
 I tried changing the GCC=gcc-4.0 in the null.rules, but no avail.

Yes, you need to set change the 'export GCC=gcc' to 'export GCC=gcc-4.0' 
in support/make/null/null.rules. Sorry for forgeting to indicate this.

How does it fail? With the same error as before? On my machine the 'make 
null' in Oscilloscope shows something like this:

$ make null
mkdir -p build/null
 compiling OscilloscopeAppC to a null binary
ncc -o build/null/main.exe -Os -finline-limit=10 -Wall -Wshadow 
-fnesc-gcc=gcc-4.0 -Wnesc-all -target=null -fnesc-cfile=build/null/app.c 
-DDEFINED_TOS_AM_GROUP=0x22 -DIDENT_APPNAME=\OscilloscopeApp\ 
-DIDENT_USERNAME=\raz\ -DIDENT_HOSTNAME=\lorien.local\ 
-DIDENT_USERHASH=0xfcd5d9bcL -DIDENT_TIMESTAMP=0x4afeeff3L 
-DIDENT_UIDHASH=0xc4745865L -D_FORTIFY_SOURCE=0 OscilloscopeAppC.nc -lm
/Users/raz/local/src/tinyos-2.x/tos/interfaces/TaskBasic.nc: In function 'main':
/Users/raz/local/src/tinyos-2.x/tos/interfaces/TaskBasic.nc:56: warning: 
control may reach end of non-void function 
'SchedulerBasicP$TaskBasic$postTask' being inlined
 compiled OscilloscopeAppC to build/null/main.exe
0 bytes in ROM
0 bytes in RAM

--
Razvan ME

 On Sat, Nov 14, 2009 at 1:55 AM, Razvan Musaloiu-E. razv...@cs.jhu.edu 
 wrote:
 Hi!

 On Sat, 14 Nov 2009, Enzeneer wrote:

 Hi,

 It occurs whenever I try to build a Java program and target=null is
 specified in the Makefile. For example in the Oscilloscope app.


 Can you give another try of the latest CVS? I just committed a fix for the
 null too. :D

 All the best!
 Razvan ME

 Now I found that if I change the target=telosb or target=$(PLATFORM),
 then it builds without problem.

 The errors when target=null is specified are as below:

 make mig -target=null -java-classname=OscilloscopeMsg java
 ../Oscilloscope.h oscilloscope -o OscilloscopeMsg.java In file
 included from /usr/include/string.h:148, from
 /Users/abhay/Developer/Source/tinyos-2.x/tos/system/tos.h:13:
 /usr/include/secure/_string.h: In function `__inline_memcpy_chk':
 /usr/include/secure/_string.h:58: warning: return makes pointer from
 integer without a cast /usr/include/secure/_string.h: In function
 `__inline_memmove_chk': /usr/include/secure/_string.h:69: warning:
 return makes pointer from integer without a cast
 /usr/include/secure/_string.h: In function `__inline_memset_chk':
 /usr/include/secure/_string.h:80: warning: return makes pointer from
 integer without a cast /usr/include/secure/_string.h: In function
 `__inline_strcpy_chk': /usr/include/secure/_string.h:91: warning:
 return makes pointer from integer without a cast
 /usr/include/secure/_string.h: In function `__inline_stpcpy_chk':
 /usr/include/secure/_string.h:103: warning: return makes pointer from
 integer without a cast /usr/include/secure/_string.h: In function
 `__inline_strncpy_chk': /usr/include/secure/_string.h:116: warning:
 return makes pointer from integer without a cast
 /usr/include/secure/_string.h: In function `__inline_strcat_chk':
 /usr/include/secure/_string.h:127: warning: return makes pointer from
 integer without a cast /usr/include/secure/_string.h: In function
 `__inline_strncat_chk': /usr/include/secure/_string.h:139: warning:
 return makes pointer from integer without a cast In file included from
 /Users/abhay/Developer/Source/tinyos-2.x/tos/system/tos.h:14:
 /usr/include/stdlib.h: At top level: /usr/include/stdlib.h:272: syntax
 error before `^' /usr/include/stdlib.h:272: `type name' declared as
 function returning a function /usr/include/stdlib.h:274: syntax error
 before `^' /usr/include/stdlib.h:274: `type name' declared as function
 returning a function /usr/include/stdlib.h:301: syntax error before
 `^' /usr/include/stdlib.h:301: `type name' declared as function
 returning a function /usr/include/stdlib.h:307: syntax error before
 `^' /usr/include/stdlib.h:307: `type name' declared as function
 returning a function /usr/include/stdlib.h:313: syntax error before
 `^' /usr/include/stdlib.h:313: `type name' declared as function
 returning a function /usr/include/stdlib.h:319: syntax error before
 `^' /usr/include/stdlib.h:319: `type name' declared as function
 returning a function In file included from
 /Users/abhay/Developer/Source/tinyos-2.x/tos/system/SchedulerBasicP.nc:41,
 from
 /Users/abhay/Developer/Source/tinyos-2.x/tos/system/TinySchedulerC.nc:40:
 /Users/abhay/Developer/Source/tinyos-2.x/tos/platforms/null/hardware.h:
 In function `__nesc_ntoh_afloat':
 /Users/abhay/Developer/Source/tinyos-2.x/tos/platforms/null/hardware.h:22:
 warning: pointer/integer type mismatch in conditional expression
 /Users/abhay/Developer/Source/tinyos-2.x/tos/platforms/null/hardware.h:
 In function `__nesc_hton_afloat':
 /Users/abhay/Developer/Source/tinyos-2.x/tos/platforms/null/hardware.h:27:
 warning: pointer/integer type mismatch in conditional expression In
 file included from
 

[Tinyos-help] stm25p volume always valid

2009-11-14 Thread Christian Skalka
I am trying to store a small value in stm25p flash memory
on a telosb mote, using ConfigStorage in TOS2.  However,
After mounting, ConfigStorage.valid() always returns TRUE,
even after imaging and mount and before fist commit.  Thus,
I am unable to discern the first boot and seed that storage
position.  Is this a known bug?  I mean, the specification says
that after imaging ConfigStorage.valid() should return FALSE
after mounting but before first commitafter imaging, right?
For example, the following code should cause the led0 to
turn on after imaging, and led1 to turn on after reboot:

event void Mount.mountDone(error_t e)
{
   if ConfigStorage.valid() { call Led.led1On(); }
   else { all Led.led0On; }
}

For me, led1 always turns on even after imaging.

Thanks,

-chris
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

[Tinyos-help] correlation between ADC sampling and radio communication

2009-11-14 Thread Akankshu Dhawan
Hi All
I am doing high sampling from the ADC on the MICAZ motes. and continously
keeping count of values above a threshold. When I have 1000 values above a
threshold I want to send a broadcast message using the radio ?

1. I want to know will the mote be sampling simultaneously while
transmitting and receiving ? (are the radio and ADC on the same stack ??

If No.. then I think I should be able to do it seamlessly... in case
not...can someone tell me how long a transmission period is for MICAZ  for a
standard packet size of 29 BYtes ??? and similarly about the receive periods
??

2. Also, if the stack is the same and I have to actually loose some sampling
while Transmitting and receiving.. (since I want my nodes to be snooping
more or less all the time) that might be a problem...  can someone guide me
here...

Thanks
Akankshu

-- 
First they ignore you, then they laugh at you, then they fight you, then you
win.
- Mahatma Gandhi
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Re: [Tinyos-help] correlation between ADC sampling and radio communication

2009-11-14 Thread Akankshu Dhawan
Hi Zainul
Thanks a lot for replying.
Actually I am giving the ADC a free run with prescalar set to 32. So I am
expecting a sampling rate of 32 Khz so that even with the added delay of
radio communication I should be getting 10Khz (which is my minimum
requirement).


Also, I need some guidance on clustering... I want switch clusterheads once
energy levels goes below a threshold. I think this is same as the LEACH
protocol. Can you guide me with this ?

Thanks a lot

Akankshu
On Sat, Nov 14, 2009 at 4:44 PM, Zainul M Charbiwala zai...@ee.ucla.eduwrote:

 On Sat, Nov 14, 2009 at 12:29 PM, Akankshu Dhawan akank...@gmail.com
 wrote:
  Hi All
  I am doing high sampling from the ADC on the MICAZ motes. and continously
  keeping count of values above a threshold. When I have 1000 values above
 a
  threshold I want to send a broadcast message using the radio ?
  1. I want to know will the mote be sampling simultaneously while
  transmitting and receiving ? (are the radio and ADC on the same stack ??
  If No.. then I think I should be able to do it seamlessly... in case
  not...can someone tell me how long a transmission period is for MICAZ
  for a
  standard packet size of 29 BYtes ??? and similarly about the receive
 periods
  ??

 A default sized packet on the MicaZ takes about 1ms (give or take a
 little) to transmit, when the channel is available.

 The ADC is internal to the ATMEGA and the radio uses the SPI bus. The
 number of samples you miss will depend on how your interrupt routines
 are set up and how rapidly you are sampling the ADC. With low rate
 rate sampling (100Hz), you will not notice missed samples. Above
 100Hz, you will start missing interrupts during radio transmissions.
 If you get to really high rate sampling (~500Hz), you will probably be
 limited by the computation you can perform in real-time on the stream
 of data.

 Zainul.

  2. Also, if the stack is the same and I have to actually loose some
 sampling
  while Transmitting and receiving.. (since I want my nodes to be snooping
  more or less all the time) that might be a problem...  can someone guide
 me
  here...
  Thanks
  Akankshu
 
  --
  First they ignore you, then they laugh at you, then they fight you, then
 you
  win.
  - Mahatma Gandhi
 
  ___
  Tinyos-help mailing list
  Tinyos-help@millennium.berkeley.edu
  https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
 




-- 
First they ignore you, then they laugh at you, then they fight you, then you
win.
- Mahatma Gandhi
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Re: [Tinyos-help] CollectionC protocol for mobile WSN?

2009-11-14 Thread Omprakash Gnawali
On Sat, Nov 14, 2009 at 12:32 AM, Vikram vik76 vi...@sify.com wrote:
 Hello,

 Does the CollectionC protocol work for the WSN where the topology of the
 network changes ?  the nodes are mobile but the connectivity is always
 there.

It should still work but if the nodes move too fast it will break down
because it cannot update the topology fast enough. How fast do your
nodes move?

- om_p

___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] mac os x 10.6.2 stdlib.h compiling problems...

2009-11-14 Thread Razvan Musaloiu-E.

Hi!

On Sat, 14 Nov 2009, Enzeneer wrote:


Hey thats great!
Could you tell me what that means? What does it do?


We need the '-D_FORTIFY_SOURCE=0' to avoid one set of errors (you can take 
if you want to see :P). The 'export GCC=gcc-4.0' will ask the nesc to use 
the gcc-4.0. If you run mig with the -v flag and look for gcc you'll how 
this is propagated.


Note: and sending this to the list too, in case some other people need 
the info from below.


All the best!
Razvan ME


Abhay

On Sat, Nov 14, 2009 at 3:05 PM, Razvan Musaloiu-E. razv...@cs.jhu.edu wrote:

Hi!

On Sat, 14 Nov 2009, Enzeneer wrote:


I did change the GCC to gcc-4.0 in the null.rules. The error is
exactly as before.

Just one thing, the error I am referring to occurs in the java
subdirectory of Oscilloscope. The oscilloscope application compiles
fine.


Good point. A fix for that is the following: you need to add 'export
GCC=gcc-4.0' in the Makefile and '-D_FORTIFY_SOURCE=0' to the calls for mig
and ncg.

--
Razvan ME


Thanks,

Abhay

On Sat, Nov 14, 2009 at 1:01 PM, Razvan Musaloiu-E. razv...@cs.jhu.edu wrote:


Hi!

On Sat, 14 Nov 2009, Enzeneer wrote:


Sorry, doesn't work.
I tried changing the GCC=gcc-4.0 in the null.rules, but no avail.


Yes, you need to set change the 'export GCC=gcc' to 'export GCC=gcc-4.0' in
support/make/null/null.rules. Sorry for forgeting to indicate this.

How does it fail? With the same error as before? On my machine the 'make
null' in Oscilloscope shows something like this:

$ make null
mkdir -p build/null
   compiling OscilloscopeAppC to a null binary
ncc -o build/null/main.exe -Os -finline-limit=10 -Wall -Wshadow
-fnesc-gcc=gcc-4.0 -Wnesc-all -target=null -fnesc-cfile=build/null/app.c
-DDEFINED_TOS_AM_GROUP=0x22 -DIDENT_APPNAME=\OscilloscopeApp\
-DIDENT_USERNAME=\raz\ -DIDENT_HOSTNAME=\lorien.local\
-DIDENT_USERHASH=0xfcd5d9bcL -DIDENT_TIMESTAMP=0x4afeeff3L
-DIDENT_UIDHASH=0xc4745865L -D_FORTIFY_SOURCE=0 OscilloscopeAppC.nc -lm
/Users/raz/local/src/tinyos-2.x/tos/interfaces/TaskBasic.nc: In function
'main':
/Users/raz/local/src/tinyos-2.x/tos/interfaces/TaskBasic.nc:56: warning:
control may reach end of non-void function
'SchedulerBasicP$TaskBasic$postTask' being inlined
   compiled OscilloscopeAppC to build/null/main.exe
              0 bytes in ROM
              0 bytes in RAM

--
Razvan ME


On Sat, Nov 14, 2009 at 1:55 AM, Razvan Musaloiu-E. razv...@cs.jhu.edu
wrote:


Hi!

On Sat, 14 Nov 2009, Enzeneer wrote:


Hi,

It occurs whenever I try to build a Java program and target=null is
specified in the Makefile. For example in the Oscilloscope app.



Can you give another try of the latest CVS? I just committed a fix for
the
null too. :D

All the best!
Razvan ME


Now I found that if I change the target=telosb or target=$(PLATFORM),
then it builds without problem.

The errors when target=null is specified are as below:

make mig -target=null -java-classname=OscilloscopeMsg java
../Oscilloscope.h oscilloscope -o OscilloscopeMsg.java In file
included from /usr/include/string.h:148, from
/Users/abhay/Developer/Source/tinyos-2.x/tos/system/tos.h:13:
/usr/include/secure/_string.h: In function `__inline_memcpy_chk':
/usr/include/secure/_string.h:58: warning: return makes pointer from
integer without a cast /usr/include/secure/_string.h: In function
`__inline_memmove_chk': /usr/include/secure/_string.h:69: warning:
return makes pointer from integer without a cast
/usr/include/secure/_string.h: In function `__inline_memset_chk':
/usr/include/secure/_string.h:80: warning: return makes pointer from
integer without a cast /usr/include/secure/_string.h: In function
`__inline_strcpy_chk': /usr/include/secure/_string.h:91: warning:
return makes pointer from integer without a cast
/usr/include/secure/_string.h: In function `__inline_stpcpy_chk':
/usr/include/secure/_string.h:103: warning: return makes pointer from
integer without a cast /usr/include/secure/_string.h: In function
`__inline_strncpy_chk': /usr/include/secure/_string.h:116: warning:
return makes pointer from integer without a cast
/usr/include/secure/_string.h: In function `__inline_strcat_chk':
/usr/include/secure/_string.h:127: warning: return makes pointer from
integer without a cast /usr/include/secure/_string.h: In function
`__inline_strncat_chk': /usr/include/secure/_string.h:139: warning:
return makes pointer from integer without a cast In file included from
/Users/abhay/Developer/Source/tinyos-2.x/tos/system/tos.h:14:
/usr/include/stdlib.h: At top level: /usr/include/stdlib.h:272: syntax
error before `^' /usr/include/stdlib.h:272: `type name' declared as
function returning a function /usr/include/stdlib.h:274: syntax error
before `^' /usr/include/stdlib.h:274: `type name' declared as function
returning a function /usr/include/stdlib.h:301: syntax error before
`^' /usr/include/stdlib.h:301: `type name' declared as function
returning a function /usr/include/stdlib.h:307: syntax error before
`^' /usr/include/stdlib.h:307: `type name' 

[Tinyos-help] Timer accuracy in MicaZ

2009-11-14 Thread Mohammad S. Hashemian
Hi all,

In the application I'm working on, I need to know the exact time of a
specific event, so I recorded the time turned on the mote, and I programmed
the mote to put the time value in the packet as well (using Time.getLow32()
and Time.getHigh32, Time is SimpleTime.Time interface), using this value and
adding it to the base time (the time I turned the mote on) I should be able
to compute the time which event occured.
The problem is that this time increases faster than it should. For example
suppose the event is firing a timer in code which occur every 4 seconds, and
in the timer event handler, I put the time value and send it to the server
PC. In such a test, the difference between time that server receives the
packet and the computed time (time value in the packet + base time which I
turned the mote on) is zero, but after 15 minutes the reported time is 20
seconds ahead of the current time, and this value increases that for example
in 2 days, the reported time by mote is 64 minutes ahead of the current
time.

The procedure of computing time (recording the mote start time and adding
the reported time to it) seems straight forward and correct, so the only
problem I can think about is inaccuracy of clock in the mote. I tested this
on couple of motes but all of them had the same problem, so do you think if
the problem is in the way I implemented my test or it's just some inaccuracy
in mote's clock?
 BTW I use MicaZ motes with TOS 1.1
Thanks all,
Mohammad
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Re: [Tinyos-help] Timer accuracy in MicaZ

2009-11-14 Thread Paul Johnson
I'm not exactly sure of that particular interface in TOS 1.x but, i 
remember that in TOS, the milli counter ticks 1024 times per second not 
1000, so this might account for some of the time difference.


-Paul
Mohammad S. Hashemian wrote:

Hi all,
 
In the application I'm working on, I need to know the exact time of a 
specific event, so I recorded the time turned on the mote, and I 
programmed the mote to put the time value in the packet as well (using 
Time.getLow32() and Time.getHigh32, Time is SimpleTime.Time 
interface), using this value and adding it to the base time (the time 
I turned the mote on) I should be able to compute the time which event 
occured.
The problem is that this time increases faster than it should. For 
example suppose the event is firing a timer in code which occur every 
4 seconds, and in the timer event handler, I put the time value and 
send it to the server PC. In such a test, the difference between time 
that server receives the packet and the computed time (time value in 
the packet + base time which I turned the mote on) is zero, but after 
15 minutes the reported time is 20 seconds ahead of the current time, 
and this value increases that for example in 2 days, the reported time 
by mote is 64 minutes ahead of the current time.
 
The procedure of computing time (recording the mote start time and 
adding the reported time to it) seems straight forward and correct, so 
the only problem I can think about is inaccuracy of clock in the mote. 
I tested this on couple of motes but all of them had the same problem, 
so do you think if the problem is in the way I implemented my test or 
it's just some inaccuracy in mote's clock?

BTW I use MicaZ motes with TOS 1.1
Thanks all,
Mohammad


___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

[Tinyos-help] uniform energy cluster formation in tinyos-2.x ?

2009-11-14 Thread Akankshu Dhawan
Hi all
I am trying to do uniform energy distribution in Tinyos-2.x amongst my
cluster members, so after time interval t nodes keep changing and becoming
clusterheads. Can you guide me with this ? I think this is the LEACH
protocol but I am not too familiar with tinyos network protocols. I have
implemented the collection protocol example.

I am using MICAZ motes and mts310 sensorboard.

Thanks a lot.

I look forward to hearing from you.
Akankshu
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Re: [Tinyos-help] AMSend.sendDone event isn't signaled...

2009-11-14 Thread mojtaba raznahan
Paul,

Really thanks for your responses.I changed the boot times to 1000,each node
is booted at 1000.
And Node 1 is a sender and every 2000MilliSec sends a packet to
AM_BROADCAST_ADDR  (I also changed it to the numbers ,like 2 or 0).But
still does'nt worked.In the first time AMSend.send returns a SUCCESS But the
AMSend.sendDone event is not signaled to change the busy flag for later
sends.I also chanaged the busy flag to false but next time AMSend.send
doesn't return SUCCESS .
Paul, should i active the ACK manually ? Or It's Automatically?

*for i in range(0, 3):
  m = t.getNode(i);
  m.bootAtTime(1000);*


This is the Timer.fired event :

*ent void Timer.fired()
{

 counter++;

 dbg(Base,Timer fired at %s .\n,sim_time_string());


   if(!busy)
  {

  RbsMsg  *data =   call Packet.getPayload(pkt,sizeof(RbsMsg));

  data-count = counter;

   dbg(Base,data in the packet is : %hhu.\n,data-count);

  flag = call AMSend.send(2,pkt,sizeof(RbsMsg));

   if( flag == SUCCESS)
   {
 dbg(Base,Packet sent %hhu.\n,data-count);
 busy = TRUE;
 counter++;

}
else
   dbg(Base,was not SUCCESSFULL %S.\n,sim_time_string());

   }

   else
   dbg(Control, the busy flag is true.\n,sim_time_string());
   *

And this is my message struct :

*enum {

  TIMER_DELAY = 2000,
  AM_Rbs = 6
};
typedef nx_struct RbsMsg
{

  nx_uint8_t count;

} RbsMsg;

 #endif
 *

On Sat, Nov 14, 2009 at 9:51 PM, Paul Johnson oewyn...@gmail.com wrote:

  Mojtaba,

 Which node is 1 sending to and when???  I see that the node boot times are
 pretty far spaced apart.  It could be that if you're sending from 1 to 2,
 node 2 is not booted up when node 1 sends, thus, it will never receive an
 ACK and sendDone will never be called.

 -Paul


 mojtaba raznahan wrote:

 Hi Paul,

 Thank you very much for answer.
 I checked out this problem,but still doen't work!!
 This is my simulation code and node 1 is the sender node  :(Is it correct
 ?)

 #! /usr/bin/python

 import TOSSIM
 import sys
 import random

 from TOSSIM import *

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

 for i in range(0, 3):
   m = t.getNode(i);
   m.bootAtTime(503 * i + 1);

 r.add(1,0,-50.0);
 r.add(0,1,-50.0);
 r.add(1,2,-50.0);
 r.add(2,1,-50.0);
 r.add(2,0,-50.0);
 r.add(0,2,-50.0);



 t.addChannel(Boot,sys.stdout);
 t.addChannel(Base,sys.stdout);
 t.addChannel(Receive,sys.stdout);
 t.addChannel(Control,sys.stdout);

 for i in range(0, 1000):
   t.runNextEvent();

 sincerley,
 Mojtaba


 On Sat, Nov 14, 2009 at 8:11 PM, Paul Johnson oewyn...@gmail.com wrote:

  Mojtaba,

 Make sure when you are setting up your links in the simulation you set up
 BOTH directions of the link.  For example if you're trying to send something
 from node 1 to node 2, you need to define the gain for link 1-2 and from
 2-1.  Otherwise, 1 will be able to send to 2, but 2 will never respond with
 an ACK.

 -Paul

 mojtaba raznahan wrote:


 Really need your helps...

 Can't anybody help me ??

 Does it related to simulation section ??





 On Tue, Nov 10, 2009 at 10:09 PM, mojtaba raznahan 
 mojtaba.razna...@gmail.com wrote:

 I'm still bickering with this issue...some help plz


 On Tue, Nov 10, 2009 at 7:44 PM, mojtaba raznahan 
 mojtaba.razna...@gmail.com wrote:

 How can i make sure that the message ACK is active or not ? I have not
 worked with ACK yet


 On Tue, Nov 10, 2009 at 7:26 PM, Ricardo . ricardo.mas...@gmail.comwrote:

 I read one of the threads that the cause of the issue might be the ACK
 messages.  ACK will arrive at the event will never be signaled.  If the
 message ACK is active and no ACK is received sendDone is not signaled.


 On Tue, Nov 10, 2009 at 3:37 PM, mojtaba raznahan 
 mojtaba.razna...@gmail.com wrote:

 Hi Ricardo,

 Thanks for reply. I wrote a dbg statement in first of sendDone event
 but ...the sendDone event is not signaled at all!


 event void AMSend.sendDone(message_t* bufPtr, error_t error)
 {
 * dbg(Base,sendDone %s .\n,sim_time_string());*

 if (pkt == bufPtr) {
   busy = FALSE;
 }

 }

 There isn'nt any statement to print while simulating

 Really confused! What's your idea ??
 Does it related to Radio configuration of simulation code ?(python
 code ?)




 On Tue, Nov 10, 2009 at 6:43 PM, Ricardo . 
 ricardo.mas...@gmail.comwrote:

 Try print the value of error_t error in sendDone event

  On Mon, Nov 9, 2009 at 3:53 PM, mojtaba raznahan 
 mojtaba.razna...@gmail.com wrote:

  Hi,

 Im writing a simple application to test send and receive of motes
 .AMSend.send command works but AMSend.sendDone event isn't signaled 
 after
 sending so the busy flag does'nt change to false. and in the next time 
 the
 AMSend.send command does not return SUCCESS .
 this is my code :

 event void Boot.booted() {
 dbg(Boot,Booted at time %s .\n,sim_time_string());
 call AMControl.start();
 }

 event void AMControl.startDone(error_t err)
 {
 

Re: [Tinyos-help] Simple send recieve application

2009-11-14 Thread mojtaba raznahan
Till,
Thanks for your attention.
I'm still looking for.

By the way,Thanks

Mojtaba

On Sat, Nov 14, 2009 at 10:38 PM, Till Maas opensou...@till.name wrote:

 Hi Mojtaba,

 On Sat, Nov 14, 2009 at 07:45:03PM +0330, mojtaba raznahan wrote:

  I know that,but unfortunately the AMSend.sendDone event doesn't work in
 my
  system. really ,I dont know where the problem is.
  Would you give me an application that you've run it in your system and it
  was successful?
  I dont have the harwares ,I use TOSSIM as a simulator.

 I just started working with TinyOS and the sample application work for
 me. But I only tried running them on real motes (TelosB) and I do not
 have my system setup to run TOSSIM, yet.

 Regards
 Till




-- 
Mojtaba Raznahan
BS of Computer engineering
TMU university
www.raznahan.com
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Re: [Tinyos-help] AMSend.sendDone event isn't signaled...

2009-11-14 Thread Paul Johnson

Mojtaba,

If you are sending messages to AM_BROADCAST_ADDR, then there are no 
acks, so sendDone should be fired as soon as the radio successfully 
sends the packet.  If sendDone isn't firing then this must mean the 
radio isn't able to send the packet.  The only reason that I can think 
of that could cause TOSSIM to fail sending a packet is if CCA always 
thinks that there is a packet being transmitted.


I would recommend you closely follow the .py example file given in:

http://docs.tinyos.net/index.php/TOSSIM#Configuring_a_Network

Especially the part that deals with the Noise Model.  I seem to remember 
having problems with my applications when i tried to skip using the 
noise model.  This may be what is causing your problems.  I'm not very 
familiar with TOSSIM, but i believe it uses the noise model to run the 
CCA check.  If no model is created, then i'm not sure how it determines 
what energy level the simulated radio is sensing during CCA, and what 
threshold it would use in that case.


Let me know if this solves your problem.

-Paul

mojtaba raznahan wrote:

Paul,

Really thanks for your responses.I changed the boot times to 1000,each 
node is booted at 1000.
And Node 1 is a sender and every 2000MilliSec sends a packet to 
AM_BROADCAST_ADDR  (I also changed it to the numbers ,like 2 or 
0).But still does'nt worked.In the first time AMSend.send returns a 
SUCCESS But the AMSend.sendDone event is not signaled to change the 
busy flag for later sends.I also chanaged the busy flag to false but 
next time AMSend.send doesn't return SUCCESS .

Paul, should i active the ACK manually ? Or It's Automatically?

*for i in range(0, 3):
  m = t.getNode(i);
  m.bootAtTime(1000);*


This is the Timer.fired event :

*ent void Timer.fired()
{

 counter++;

 dbg(Base,Timer fired at %s .\n,sim_time_string());
 
 
   if(!busy)

  {
 
  RbsMsg  *data =   call Packet.getPayload(pkt,sizeof(RbsMsg));
 
  data-count = counter;
  
   dbg(Base,data in the packet is : %hhu.\n,data-count);
 
  flag = call AMSend.send(2,pkt,sizeof(RbsMsg));
 
   if( flag == SUCCESS)

   {
 dbg(Base,Packet sent %hhu.\n,data-count);
 busy = TRUE;
 counter++;

}

else
   dbg(Base,was not SUCCESSFULL %S.\n,sim_time_string());
  
   }
  
   else

   dbg(Control, the busy flag is true.\n,sim_time_string());
   *

And this is my message struct :

*enum {

  TIMER_DELAY = 2000,
  AM_Rbs = 6
};
typedef nx_struct RbsMsg
{

  nx_uint8_t count;

} RbsMsg;
 
 #endif

 *

On Sat, Nov 14, 2009 at 9:51 PM, Paul Johnson oewyn...@gmail.com 
mailto:oewyn...@gmail.com wrote:


Mojtaba,

Which node is 1 sending to and when???  I see that the node boot
times are pretty far spaced apart.  It could be that if you're
sending from 1 to 2, node 2 is not booted up when node 1 sends,
thus, it will never receive an ACK and sendDone will never be called.

-Paul


mojtaba raznahan wrote:

Hi Paul,

Thank you very much for answer.
I checked out this problem,but still doen't work!!
This is my simulation code and node 1 is the sender node  :(Is it
correct ?)

#! /usr/bin/python

import TOSSIM
import sys
import random

from TOSSIM import *

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

for i in range(0, 3):
  m = t.getNode(i);
  m.bootAtTime(503 * i + 1);

r.add(1,0,-50.0);
r.add(0,1,-50.0);
r.add(1,2,-50.0);
r.add(2,1,-50.0);
r.add(2,0,-50.0);
r.add(0,2,-50.0);



t.addChannel(Boot,sys.stdout);
t.addChannel(Base,sys.stdout);
t.addChannel(Receive,sys.stdout);
t.addChannel(Control,sys.stdout);

for i in range(0, 1000):
  t.runNextEvent();

sincerley,
Mojtaba


On Sat, Nov 14, 2009 at 8:11 PM, Paul Johnson oewyn...@gmail.com
mailto:oewyn...@gmail.com wrote:

Mojtaba,

Make sure when you are setting up your links in the
simulation you set up BOTH directions of the link.  For
example if you're trying to send something from node 1 to
node 2, you need to define the gain for link 1-2 and from
2-1.  Otherwise, 1 will be able to send to 2, but 2 will
never respond with an ACK.

-Paul

mojtaba raznahan wrote:


Really need your helps...

Can't anybody help me ??

Does it related to simulation section ??





On Tue, Nov 10, 2009 at 10:09 PM, mojtaba raznahan
mojtaba.razna...@gmail.com
mailto:mojtaba.razna...@gmail.com wrote:

I'm still bickering with this issue...some help plz


On Tue, Nov 10, 2009 at 7:44 PM, mojtaba raznahan
mojtaba.razna...@gmail.com
mailto:mojtaba.razna...@gmail.com wrote:

How can i make sure that the message ACK is active
or not ? I have 

Re: [Tinyos-help] AMSend.sendDone event isn't signaled...

2009-11-14 Thread mojtaba raznahan
Paul,

Thank you veryyy much!!!.It worked!
I had seen this page several times but i wasn't accurate enough and so i
didn't used the noise model at all.
Really you gave me a big help! Thank you.
But what is this numbers ? It claimed that you should use at least 100 entry
of this numbers so the CPM can create the statistical model.Have you any
sources to read more about this topic and it's usage ?

your sincerley,
Mojtaba


On Sun, Nov 15, 2009 at 9:18 AM, Paul Johnson oewyn...@gmail.com wrote:

  Mojtaba,

 If you are sending messages to AM_BROADCAST_ADDR, then there are no acks,
 so sendDone should be fired as soon as the radio successfully sends the
 packet.  If sendDone isn't firing then this must mean the radio isn't able
 to send the packet.  The only reason that I can think of that could cause
 TOSSIM to fail sending a packet is if CCA always thinks that there is a
 packet being transmitted.

 I would recommend you closely follow the .py example file given in:

 http://docs.tinyos.net/index.php/TOSSIM#Configuring_a_Network

 Especially the part that deals with the Noise Model.  I seem to remember
 having problems with my applications when i tried to skip using the noise
 model.  This may be what is causing your problems.  I'm not very familiar
 with TOSSIM, but i believe it uses the noise model to run the CCA check.  If
 no model is created, then i'm not sure how it determines what energy level
 the simulated radio is sensing during CCA, and what threshold it would use
 in that case.

 Let me know if this solves your problem.

 -Paul


 mojtaba raznahan wrote:

 Paul,

 Really thanks for your responses.I changed the boot times to 1000,each node
 is booted at 1000.
 And Node 1 is a sender and every 2000MilliSec sends a packet to
 AM_BROADCAST_ADDR  (I also changed it to the numbers ,like 2 or 0).But
 still does'nt worked.In the first time AMSend.send returns a SUCCESS But the
 AMSend.sendDone event is not signaled to change the busy flag for later
 sends.I also chanaged the busy flag to false but next time AMSend.send
 doesn't return SUCCESS .
 Paul, should i active the ACK manually ? Or It's Automatically?

 *for i in range(0, 3):
   m = t.getNode(i);
   m.bootAtTime(1000);*


 This is the Timer.fired event :

 *ent void Timer.fired()
 {

  counter++;

  dbg(Base,Timer fired at %s .\n,sim_time_string());


if(!busy)
   {

   RbsMsg  *data =   call Packet.getPayload(pkt,sizeof(RbsMsg));

   data-count = counter;

dbg(Base,data in the packet is : %hhu.\n,data-count);

   flag = call AMSend.send(2,pkt,sizeof(RbsMsg));

if( flag == SUCCESS)
{
  dbg(Base,Packet sent %hhu.\n,data-count);
  busy = TRUE;
  counter++;

 }
 else
dbg(Base,was not SUCCESSFULL %S.\n,sim_time_string());

}

else
dbg(Control, the busy flag is true.\n,sim_time_string());
*
 
 And this is my message struct :

 *enum {

   TIMER_DELAY = 2000,
   AM_Rbs = 6
 };
 typedef nx_struct RbsMsg
 {

   nx_uint8_t count;

 } RbsMsg;

  #endif
  *

 On Sat, Nov 14, 2009 at 9:51 PM, Paul Johnson oewyn...@gmail.com wrote:

 Mojtaba,

 Which node is 1 sending to and when???  I see that the node boot times are
 pretty far spaced apart.  It could be that if you're sending from 1 to 2,
 node 2 is not booted up when node 1 sends, thus, it will never receive an
 ACK and sendDone will never be called.

 -Paul


 mojtaba raznahan wrote:

 Hi Paul,

 Thank you very much for answer.
 I checked out this problem,but still doen't work!!
 This is my simulation code and node 1 is the sender node  :(Is it correct
 ?)

 #! /usr/bin/python

 import TOSSIM
 import sys
 import random

 from TOSSIM import *

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

 for i in range(0, 3):
   m = t.getNode(i);
   m.bootAtTime(503 * i + 1);

 r.add(1,0,-50.0);
 r.add(0,1,-50.0);
 r.add(1,2,-50.0);
 r.add(2,1,-50.0);
 r.add(2,0,-50.0);
 r.add(0,2,-50.0);



 t.addChannel(Boot,sys.stdout);
 t.addChannel(Base,sys.stdout);
 t.addChannel(Receive,sys.stdout);
 t.addChannel(Control,sys.stdout);

 for i in range(0, 1000):
   t.runNextEvent();

 sincerley,
 Mojtaba


 On Sat, Nov 14, 2009 at 8:11 PM, Paul Johnson oewyn...@gmail.com wrote:

 Mojtaba,

 Make sure when you are setting up your links in the simulation you set up
 BOTH directions of the link.  For example if you're trying to send something
 from node 1 to node 2, you need to define the gain for link 1-2 and from
 2-1.  Otherwise, 1 will be able to send to 2, but 2 will never respond with
 an ACK.

 -Paul

 mojtaba raznahan wrote:


 Really need your helps...

 Can't anybody help me ??

 Does it related to simulation section ??





 On Tue, Nov 10, 2009 at 10:09 PM, mojtaba raznahan 
 mojtaba.razna...@gmail.com wrote:

 I'm still bickering with this issue...some help plz


 On Tue, Nov 10, 2009 at 7:44 PM, mojtaba raznahan 
 mojtaba.razna...@gmail.com wrote:

 How can