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>&nbsp;</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>&nbsp;</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_-&gt;value();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Tai Suk Kim</FONT></DIV>
<DIV>&nbsp;</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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
Tcl&amp; tcl =3D =
Tcl::instance();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if=20
(argc =3D=3D 3)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
if (strcmp(argv[1], &quot;ranvar&quot;) =3D=3D 0)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
ranvar_ =3D (RandomVariable*)=20
TclObject::lookup(argv[2]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;=20
return=20
(TCL_OK);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
} else if (strcmp(argv[1], &quot;bandwidth&quot;) =3D=3D 0)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
bandwidth_ =3D=20
atof(argv[2]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;=20
return=20
(TCL_OK);<BR>------------------------------------------------------------=
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;=20
</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT>&nbsp;</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>&nbsp;public:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
LinkDelay();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void =
recv(Packet* p,=20
Handler*);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void =
send(Packet* p,=20
Handler*);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void =
handle(Event*=20
e);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double delay() { =
return=20
delay_; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inline double=20
txtime(Packet* p)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
return (8. * hdr_cmn::access(p)-&gt;size() /=20
bandwidth_);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inline double =
txtime2(Packet* p)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
double txt =3D=20
ranvar_-&gt;value();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
return=20
txt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
<A href=3D"file://return">//return</A> (8. * =
hdr_cmn::access(p)-&gt;size() /=20
bandwidth_);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double bandwidth() const =
{=20
return bandwidth_; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void=20
pktintran(int src, int=20
group);<BR>&nbsp;protected:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 int=20
command(int argc, const char*const*=20
argv);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RandomVariable*=20
ranvar_;</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void=20
reset();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double=20
bandwidth_;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* bandwidth of underlying =
link=20
(bits/sec) */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double=20
delay_;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* line =
latency=20
*/</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Event=20
intr_;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int=20
dynamic_;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* =

indicates whether or not link is ~ */</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 face=3DArial=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PacketQueue*=20
itq_;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int=20
total_[4];<BR>};</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2>void =
LinkDelay::recv(Packet* p,=20
Handler* h)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double =
txt =3D=20
txtime2(p);<BR></FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial=20
size=3D2>----------------------------------------------------------------=
-----------&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2>}</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2>set dm_ [new =
DelayLink]<BR>set rv=20
[new RandomVariable/Uniform]<BR>$rv&nbsp;&nbsp;&nbsp;&nbsp;=20
set&nbsp;&nbsp;&nbsp;&nbsp; min_ 0.<BR>$rv&nbsp;&nbsp;&nbsp;&nbsp;=20
set&nbsp;&nbsp;&nbsp;&nbsp; max_ 1.<BR>$dm_ ranvar $rv</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0026_01BF6A7E.3115A970--