Hi,

Is there a way to show the energy of nodes in a trace file? I know a method to show the number of packets received and lost at a node can be done as below. Is there a similar method which can show the nodal energy?

Thanks in advance,
Michael


set f1          [open node_received_1.tr w]

proc stop {} {
        global ns_ f0 f1 f2 f3 f4 f5 f6 f7 f8
        $ns flush-trace
        close $f0
        close $f1
        close $f2
        close $f3
        close $f4
        close $f5
        close $f6
        close $f7
        close $f8


        exit 0
}

#Write the headers of the files
puts $f1  "received"
puts $f2  "lost"


proc record {} {
        global sink0 ns_ f0 f1 f2

        #Get an instance of the simulator
        set ns_ [Simulator instance]

        #set the time after which to repeat the procedure
        set time 0.05

        #How many Bytes have been received by the traffic sinks?
        set bw0  [$sink0 set npkts_]
        set bw1  [$sink0 set nlost_]

        #Get the current time
        set now [$ns_ now]

        #Save Data to the files
        puts $f1  "[expr $bw0]"
        puts $f2  "[expr $bw1]"


        #Re-schedule the procedure
        $ns_ at [expr $now+$time] "record"
}

_________________________________________________________________
Windows LiveĀ™ Messenger has arrived. Click here to download it for free! http://imagine-msn.com/messenger/launch80/?locale=en-gb

Reply via email to