Is it possible to simulate a mote reboot with TOSSIM ? (reset switch)

Rémi

2009/4/20 Janos Sallai <[email protected]>

> Zahid:
>
> Let me reiterate: you cannot do busy wait in TOSSIM. TOSSIM is a
> discrete event simulator. Because of the fact that it is a discrete
> event simulation, all tasks will take zero (simulated) time to
> execute. Time does not advance during execution of events (tasks), but
> only between the events (tasks).
>
> >          do{
> >                 if(flag){
> >                      var = 1;
> >                 }
> >                 cT = sim_time();
> >          }while(cT < initial_time + PULSE_WIDTH);
>
> What your code is trying to do is waiting for the simulated time to
> advance. Clearly, this won't work, because the (simulated) time does
> not change while executing a task. (Remember? Executing a task is
> instantaneous, i.e. it takes zero (simulated) time.)
>
> Should this be still unclear after reading the TOSSIM paper, I suggest
> that you google for "discrete event simulation".
>
> Janos
>
> On Mon, Apr 20, 2009 at 1:59 PM, zahid iqbal <[email protected]>
> wrote:
> > Many thanks, Janos ...
> >
> > I had a hint from the assembly code that BusyWaitMicroC was meant for the
> > actual hardware. But your comments clarified a lot.
> >
> > I want to introduce the delays of Microseconds. For that, the problem
> with
> > using Timer Interfaces is the following:
> >
> > Though, timer interfaces provide TMilli and TMicro, there is not TimerC
> > available for TMicro precision.
> > I want my code to block until a certain time has elapsed. In this sense,
> > even if I use a timer (Say a micro timer implementation is available), I
> > will do, startOneShot, ... but my program would just continue its way
> after
> > making a call to startOneShot, ... it would not block on that.
> > Imagine another scenario, in which I want to constantly check some
> variable
> > in a finite loop, where loop is indexed by time. That is, the loop should
> > exit after a certain amount of time, but while in loop, I have to check
> and
> > set some variables.  I tried doing the following
> >
> >            #define PULSE_WIDTH 250000   // 25 micro seconds, in terms of
> > simulation ticks
> >           sim_time_t initial_time, current_time;
> >          initial_time = sim_time();
> >          do{
> >                 if(flag){
> >                      var = 1;
> >                 }
> >                 cT = sim_time();
> >          }while(cT < initial_time + PULSE_WIDTH);
> >
> >
> > This solution does not work, since the program gets stuck.....
> >
> > Any idea, what could be nice solution for me, --- Do, I have to use
> threads
> > ??
> >
> > Thanks for your time,
> >
> >
> > Regards,
> > zahid iqbal
> >
> >
> >
> >
> >
> > --- On Mon, 4/20/09, Janos Sallai <[email protected]> wrote:
> >
> > From: Janos Sallai <[email protected]>
> > Subject: Re: [Tinyos-help] Problem using BusyWaitMicroC
> > To: "zahid iqbal" <[email protected]>, "tinyos forum"
> > <[email protected]>
> > Date: Monday, April 20, 2009, 11:50 AM
> >
> > Zahid,
> >
> > TOSSIM is a discrete event simulator, that is, tasks are assumed to
> > execute instantaneously. Having a busy wait in your code will make no
> > difference: you can spin as long as you wish in a loop, the simulated
> > execution time of the task will still be zero. If you don't understand
> > what the above means, make sure that you read the TOSSIM paper (
> > http://www.cs.berkeley.edu/~pal/pubs/nido.pdf<http://www.cs.berkeley.edu/%7Epal/pubs/nido.pdf>).
> >
> > Because of this, there is no BusyWaitMicroC implementation for the sim
> > target. What you try compiling in is for the avr target (with some avr
> > assembly code inlined). Since this assembly code is not for the x86
> > target, the compiler complains.
> >
> > You have two options:
> > - Use timers for waiting. This works well in TOSSIM, and not that hard
> > to implement.
> > - Use a cycle-accurate simulator (e.g. avrora). Be aware that this is
> > much slower than TOSSIM.
> >
> > Janos
> >
> > On Mon, Apr 20, 2009 at 6:35 AM, zahid iqbal <[email protected]>
> wrote:
> >> Hi,
> >>
> >> I am writing a simulation in TOSSIM under tinyos-2.1.0.
> >>
> >> In my application, I have to introduce some delays, in the order of
> >> microseconds. I am using,
> >>
> >> BusyWait.nc
> >> BusyWaitMicroC.nc
> >>
> >> Whenever I compile, I get the following error.
> >>
> >> /opt/tinyos-2.1.0/tos/platforms/micaz/BusyWaitMicroC.nc: In function
> >> ‘BusyWaitMicroC$BusyWait$wait’:
> >> /opt/tinyos-2.1.0/tos/platforms/micaz/BusyWaitMicroC.nc:40: error:
> >> impossible constraint in ‘asm’
> >>
> >> I don't understand this, since I am not much familiar with assembly
> >> coding.
> >> Can this be because of using a wrong BusyWaitMicroC for my interface.
> >> Please
> >> note:
> >>
> >> I use the following width and precision,
> >>
> >> uses  interface BusyWait<TMicro, uint16_t>;
> >>
> >> I am simulating for micaz platform and hence I use "make micaz sim". It
> is
> >> probably because of this reason, that my compiler picks BusyWaitMicroC
> >> from
> >> /tos/platforms/micaz/BusyWaitMicroC.nc
> >>
> >> What can be the problem here,
> >>
> >> Any help will be much appreciated.
> >>
> >> Regards,
> >> zahid iqbal
> >>
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> Tinyos-help mailing list
> >> [email protected]
> >>
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> >>
> >
> >
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to