Random txt_time paket by packet in the link
Tai Suk Kim
kts@gigabitwireless.com
Sat, 29 Jan 2000 17:28:01 -0800
This is a multi-part message in MIME format.
------=_NextPart_000_0026_01BF6A7E.3115A970
Content-Type: text/plain;
charset="euc-kr"
Content-Transfer-Encoding: quoted-printable
Dear NS-users,
I need to change the transmission time from a queue.=20
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 =3D ranvar_->value();
Could you let me know what is wrong?
Thanks in advance.
Tai Suk Kim
my modification was as follows.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
int LinkDelay::command(int argc, const char*const* argv)
{
Tcl& tcl =3D Tcl::instance();
if (argc =3D=3D 3) {
if (strcmp(argv[1], "ranvar") =3D=3D 0) {
ranvar_ =3D (RandomVariable*) =
TclObject::lookup(argv[2]);
return (TCL_OK);
} else if (strcmp(argv[1], "bandwidth") =3D=3D 0) {
bandwidth_ =3D atof(argv[2]);
return (TCL_OK);
------------------------------------------------------------- =
=20
}
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 =3D 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 =3D txtime2(p);
-------------------------------------------------------------------------=
-- =20
}
in a tcl file,
set dm_ [new DelayLink]
set rv [new RandomVariable/Uniform]
$rv set min_ 0.
$rv set max_ 1.
$dm_ ranvar $rv
------=_NextPart_000_0026_01BF6A7E.3115A970
Content-Type: text/html;
charset="euc-kr"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>
<META content=3D"text/html; charset=3Dks_c_5601-1987" =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Dear NS-users,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I need to change the transmission time =
from a=20
queue. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>As the first step, i want to change it =
randomly=20
(with distribution) packet by packet.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Later, i will do it from an input delay =
file.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>For the random txt_time, i modified =
delay.cc and=20
delay.h using delaymodel.* contributed</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>by Polly Huang. But it makes a core =
dumped error=20
in</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>double txt =3D =
ranvar_->value();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Could you let me know what is=20
wrong?<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2>Thanks in =
advance.</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Tai Suk Kim</FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2>my modification was as=20
follows.</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial=20
size=3D2>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2>int =
LinkDelay::command(int argc,=20
const char*const* =
argv)<BR>{<BR> =20
Tcl& tcl =3D =
Tcl::instance();<BR> if=20
(argc =3D=3D 3)=20
{<BR> &n=
bsp; =20
if (strcmp(argv[1], "ranvar") =3D=3D 0)=20
{<BR> &n=
bsp; =20
ranvar_ =3D (RandomVariable*)=20
TclObject::lookup(argv[2]);<BR> =
&=
nbsp; =20
return=20
(TCL_OK);<BR> =
=20
} else if (strcmp(argv[1], "bandwidth") =3D=3D 0)=20
{<BR> &n=
bsp; =20
bandwidth_ =3D=20
atof(argv[2]);<BR> &=
nbsp; &n=
bsp; =20
return=20
(TCL_OK);<BR>------------------------------------------------------------=
- =
=20
</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2>}<BR></FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2>class LinkDelay : =
public Connector=20
{<BR> public:<BR> =20
LinkDelay();<BR> void =
recv(Packet* p,=20
Handler*);<BR> void =
send(Packet* p,=20
Handler*);<BR> void =
handle(Event*=20
e);<BR> double delay() { =
return=20
delay_; }<BR> inline double=20
txtime(Packet* p)=20
{<BR> &n=
bsp; =20
return (8. * hdr_cmn::access(p)->size() /=20
bandwidth_);<BR> =20
}<BR> inline double =
txtime2(Packet* p)=20
{<BR> &n=
bsp; =20
double txt =3D=20
ranvar_->value();<BR> &=
nbsp; =20
return=20
txt;<BR>  =
; =20
<A href=3D"file://return">//return</A> (8. * =
hdr_cmn::access(p)->size() /=20
bandwidth_);<BR> =20
}<BR> double bandwidth() const =
{=20
return bandwidth_; }<BR> void=20
pktintran(int src, int=20
group);<BR> protected:<BR> =
int=20
command(int argc, const char*const*=20
argv);<BR> RandomVariable*=20
ranvar_;</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial=20
size=3D2> void=20
reset();<BR> double=20
bandwidth_; /* bandwidth of underlying =
link=20
(bits/sec) */<BR> double=20
delay_; /* line =
latency=20
*/</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial=20
size=3D2> Event=20
intr_;<BR> int=20
dynamic_; /* =
indicates whether or not link is ~ */</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 face=3DArial=20
size=3D2> PacketQueue*=20
itq_;<BR> int=20
total_[4];<BR>};</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2>void =
LinkDelay::recv(Packet* p,=20
Handler* h)<BR>{<BR> double =
txt =3D=20
txtime2(p);<BR></FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial=20
size=3D2>----------------------------------------------------------------=
----------- =20
</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2>}</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2>in a tcl =
file,</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2>set dm_ [new =
DelayLink]<BR>set rv=20
[new RandomVariable/Uniform]<BR>$rv =20
set min_ 0.<BR>$rv =20
set max_ 1.<BR>$dm_ ranvar $rv</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV></BODY></HTML>
------=_NextPart_000_0026_01BF6A7E.3115A970--