Hi Bruce, Read chapeter 13 in ns-manual.. I think you are looking for Error Model instead of Loss Model. The commands you are using are for wired networks only, if I am not mistaken.
Bruce Who wrote: >hi, Ahmad: > >======= 2006-04-03 02:05:24 Ahmad Khayyat wrote: ======= > > > >>Hi Bruce, >> >>If you enable AGT and RTR tracing (in node-config command in the tcl >>file), you will see that when a tcp packet is sent out of the RTR layer, >>its size is larger than its size when sent by the AGT layer. This >>reflects the fact that the RTR layer adds some headers that contribute >>to the packet size. The same thing happens when the packet is sent by >>the MAC layer; it gets a little bigger due to MAC headers. >> >>For the inconsistent packet size in the MAC layer between send time and >>recv time, my guess is that the packet size is measured in the receive >>event after removing the MAC headers. You will see that the received >>packet size in the MAC is equal to the packet size sent by RTR, which is >>the size before adding the MAC headers. Having that said, my guess is >>that the packet size reported in the send event is the correct size sent >>out of the MAC layer. In that case, the packet size in the receive event >>is the size that the MAC layer reports to higher layers. >> >> > >I agree with you. I find that all beacon/ack packets are exactly 7 bytes. >I guess this is a bug of ns2? > >And I still cannot apply lossmodel to wpan. I modified >ns-2.29\tcl\ex\wpan\wpan_demo2.tcl this way: > >============================================================= >proc seterrmodel { src dst } { > global ns_ val node_ > set errmodel [new ErrorModel] > $errmodel set rate_ $val(per) > $errmodel set unit_ $val(errUnit) > eval $ns_ lossmodel $errmodel \$node_($src) \$node_($dst) >} > >... > >seterrmodel 0 1 >============================================================= > >I added above code into wpan_demo2.tcl, and got the following traceback: > >$ ns wpan_demo2.tcl >num_nodes is set 7 >INITIALIZE THE LIST xListHead > >Traffic: ftp >Acknowledgement for data: on >invalid command name "" > while executing >"$link errormodule $lossobj" > (procedure "_o3" line 3) > (Simulator lossmodel line 3) > invoked from within >"_o3 lossmodel _o158 $node_(0) $node_(1)" > ("eval" body line 1) > invoked from within >"eval $ns_ lossmodel $errmodel \$node_($src) \$node_($dst)" > (procedure "seterrmodel" line 7) > invoked from within >"seterrmodel 0 1" > invoked from within >"if { "$val(traffic)" == "ftp" } { > puts "\nTraffic: ftp" > #Mac/802_15_4 wpanCmd ack4data off > puts [format "Acknowledgement for data: %s" [Mac/8..." > (file "wpan_demo2.tcl" line 231) > >Could anyone give me any clue? > > > >>Bruce Who wrote: >> >> >> >>>hi, Ahmad: >>> >>>======= 2006-03-31 23:40:43 Ahmad Khayyat wrote: ======= >>> >>> >>> >>> >>> >>>>2) assoPermit means whether the node should permit other nodes to >>>>associate with it so that it becomes their coordinator. Look at the >>>>802.15.4-2003 standard for details. >>>> >>>>5) This is not how LossModel is used. Consult ns-manual for the correct >>>>usage. It still applies for wpan. >>>> >>>> >>>> >>>> >>>Thanks, I'll look into the document. >>> >>>And I have another question. This is a snippet from wpan_demo2.tr, I find >>>that all tcp packets sent out is always 7 bytes bigger than the received >>>packets. Why do they not have the same size? Then which one(97 or 90) is the >>>real size of the tcp packets? >>> >>>s 11.928192000 _0_ MAC --- 255 tcp 97 [0 5 0 800] ------- [0:2 5:0 30 5] >>>[133 0] 0 0 >>>s 11.931712033 _5_ MAC --- 255 ACK 5 [0 0 5 0] >>>r 11.932064067 _0_ MAC --- 255 ACK 5 [0 0 5 0] >>>r 11.932704033 _5_ MAC --- 255 tcp 90 [0 5 0 800] ------- [0:2 5:0 30 5] >>>[133 0] 1 0 >>> >>> >>> >>> >>> >>>>Bruce Who wrote: >>>> >>>> >>>> >>>> >>>> >>>>>------------------------------------------------------------------------ >>>>> >>>>>Hi, all: >>>>> >>>>>Recently I begin to learn how to use ns2 to run wpan simulations, and >>>>>stumbled >>>>>by some problems, hope someone could help me out. >>>>> >>>>>1)I found there are some commands like this: >>>>>eval $ns_ attach-agent \$node_($src) \$udp_($src) >>>>> >>>>>why don't we just use this command? >>>>> >>>>>$ns_ attach-agent $node_($src) $udp_($src) >>>>> >>>>>2) for this command >>>>>$node sscs startCTDevice <isFFD = 1> <assoPermit = 1> <txBeacon = 0> >>>>><beaconOrder = 3> <SuperframeOrder = 3> >>>>> >>>>>what does assoPermit mean? >>>>> >>>>>3) I ran wpan_demo2.tcl and found that all extended addresses of nodes are >>>>> [0]. Is it necessary to set the address to different values by ourselves? >>>>> >>>>>4) I ran "nam wpan_demo2.nam" and found that data stream is only seem >>>>>between >>>>> PANCoor(node0) and node1. But we have such statements in the >>>>> wpan_demo2.tcl >>>>> script: >>>>> >>>>> ftptraffic 0 1 $appTime1 >>>>> ftptraffic 0 3 $appTime3 >>>>> ftptraffic 0 5 $appTime5 >>>>> >>>>>So why could no communications be seen between node0 and node3/node5? >>>>> >>>>>5) And how to set lossmodel for nodes in wpan? I tried following code, but >>>>>it >>>>> doesn't work: >>>>> >>>>>set loss_module [new ErrorModel] >>>>>$loss_module set rate_ 0.01 >>>>>$loss_module unit pkt >>>>>$loss_module ranvar [new RandomVariable/Uniform] >>>>>$loss_module drop-target [new Agent/Null] >>>>>eval $ns lossmodel $loss_module \$node_($src) \$node_($dst) >>>>> >>>>>Any help would be appreciated! Thanks in advance! >>>>> >>>>> >>>>> >>>>>Best regards, >>>>> >>>>>Bruce Who >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>= = = = = = = = = = = = = = = = = = = = >>> >>>Best regards, >>> >>> Bruce Who >>> 2006-04-02 >>> >>> >>> >>> >>> > >= = = = = = = = = = = = = = = = = = = = > >Best regards, > > Bruce Who > 2006-04-03 > > >