I was having a similar problem. I have a queue that I need to drain but
the standard methods of sub-classing the Queue class did not get me
all the way there. The other problem was that after I implemented my
changes I would always get ns: scheduler going backwards in time which abort
the simulation.
This is the way I solved it.
First I changed the scheduler class at this error point to call dumpq.
This show me
what was in the scheduler waiting to run.
Next I added the same info for the current event that was causing the error.
This showed me that the event uid was always zero. Since this seems to be an
implementation error placing events in the queue. I decided to throw out all
uids = 0 as this is not a valid uid. uids will either be positive or
negative. The only time
that you will have a uid of zero is prior to the event being place in
the queue to be scheduled.
void
Scheduler::dispatch(Event* p, double t)
{
if ((t < clock_) && (p->uid_ != 0)) {
fprintf(stderr, "ns: scheduler going backwards in time from %f
to
%f.\n", clock_, t);
printf("Current Event:\n");
printf("t:%f uid: ", p->time_);
printf(UID_PRINTF_FORMAT, p->uid_);
printf(" handler: %p\n", p->handler_);
dumpq();
abort();
}
if (p->uid_ != 0) { // will this kill the sim by not running a handler?
clock_ = t;
p->uid_ = -p->uid_; // being dispatched
p->handler_->handle(p); // dispatch
} else {
fprintf(stderr, "Warning: discarding Event without an a valid
id\n");
}
}
On 8/24/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hello:
>I made some modification on gpsr routing protocol and trying to do
> some simulation on cbr traffic. When I run the tcl script, an error
> occured like this:
> ns: scheduler going backwards in time from from 20.05 to 0.00
>
> Actually I manipulated the GPSR packet and do triangle routing. Each
> path use standard gpsr. I was wondering if it is related that the
> packet is somehow changed(but I didn't change it, all I do is to change
> the source and destination address)?
>
> Does anybody has experience on this error?
>
>
> Thanks
> robin
>
>