How To Practice Physical Care For Inwards Ns2
Procedure inward Ns2:
Example of Procedure:
# Define a ‘finish’ procedure
proc complete {} {
global ns tracefile1 namfile
$ns flush-trace
#Close the NAM describe file
#Close the NAM describe file
close $tracefile1
#Close the NAM file
#Close the NAM file
close $namfile
#Execute NAM on the describe file
#Execute NAM on the describe file
exec nam out.nam &
exit 0
}
Program Explanation:
proc complete {} {
The give-and-take “proc” is used to declare physical care for together with “finish” is the mention of the procedure. So nosotros declare a physical care for amongst mention complete without whatsoever arguments. You tin flame likewise declare physical care for amongst arguments. You tin flame encounter the instance below at the cease of the post.
global ns tracefile1 namfile
If y'all convey function uncomplicated ns programs earlier thus y'all must move familiar amongst
Nam-file together with trace-file but if non thus don’t worry y'all tin flame banking concern lucifer it here.
Simple wired together with wireless ns2 Programs code
Here amongst the assistance of give-and-take global, nosotros tell to the physical care for that the variable nosotros using hither is declared exterior the procedure.
$ns flush-trace
“flush-trace” volition dump the traces on the respective files.
close $tracefile1 together with close $namfile
The unopen dominance precisely closes both nam-file together with trace-file that nosotros define at the source of the ns programme code.
exec nam out.nam &
The give-and-take “exec” is used to execute the nam programme for visualization that nosotros created at the source of the program.
exit 0
The dominance conk volition cease the application together with provide the seat out 0 every moment condition to the system. Zero is the default for a build clean exit. Other values tin flame move used to tell that it is an conk because something fails.
$ns at 125.0 "finish"
At the cease of the program, nosotros volition telephone phone the physical care for “finish” that nosotros created early on together with specify at what fourth dimension the result should occur. For example, volition move used to telephone phone “finish" at fourth dimension 125 sec.
1) http://nile.wpi.edu/NS/
2) http://www.ece.ubc.ca/%7Eteerawat/NS2.htm
Sharing is caring ... Don't forget to part it amongst friends
0 Response to "How To Practice Physical Care For Inwards Ns2"
Post a Comment