Dear NS-users,
I need to change the transmission time from a
queue.
As the first step, i want to change it randomly
(with distribution) packet by packet.
Later, i will do it from an input delay
file.
For the random txt_time, i modified delay.cc and
delay.h using delaymodel.* contributed
by Polly Huang. But it makes a core dumped error
in
double txt = ranvar_->value();
Could you let me know what is
wrong?
Thanks in advance.
Tai Suk Kim
my modification was as
follows.
==================================================================
int LinkDelay::command(int argc,
const char*const* argv)
{ Tcl& tcl = Tcl::instance(); if (argc == 3) { if (strcmp(argv[1], "ranvar") == 0) { ranvar_ = (RandomVariable*) TclObject::lookup(argv[2]); return (TCL_OK); } else if (strcmp(argv[1], "bandwidth") == 0) { bandwidth_ = atof(argv[2]); return (TCL_OK); ------------------------------------------------------------- }
class LinkDelay : public Connector
{
public: LinkDelay(); void recv(Packet* p, Handler*); void send(Packet* p, Handler*); void handle(Event* e); double delay() { return delay_; } inline double txtime(Packet* p) { return (8. * hdr_cmn::access(p)->size() / bandwidth_); } inline double txtime2(Packet* p) { double txt = ranvar_->value(); return txt; //return (8. * hdr_cmn::access(p)->size() / bandwidth_); } double bandwidth() const { return bandwidth_; } void pktintran(int src, int group); protected: int command(int argc, const char*const* argv); RandomVariable* ranvar_; void
reset();
double bandwidth_; /* bandwidth of underlying link (bits/sec) */ double delay_; /* line latency */ Event
intr_;
int dynamic_; /* indicates whether or not link is ~ */ PacketQueue*
itq_;
int total_[4]; }; void LinkDelay::recv(Packet* p,
Handler* h)
{ double txt = txtime2(p); ---------------------------------------------------------------------------
}
in a tcl file,
set dm_ [new DelayLink]
set rv [new RandomVariable/Uniform] $rv set min_ 0. $rv set max_ 1. $dm_ ranvar $rv |