Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Much more information is required :
Always tell, which Linux OS ( Ubuntu <version> <name> ),
you are using for the application in question, please.
And the application, <version> : ns-allinone-2.34 ?
The command, that is used. And the location. ( $ pwd will tell.)
Also : If you wrote the file.tcl yourself or used a modified one.
Example : cd ns-allinone-2.34/ns-2.34/tcl/ex
ns wireless-mitf.tcl : No errors.
Or : ns wireless.tcl : Also OK.
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511
Rep:
Post #4, @eyana : Please edit post #4 to use CODE tags :
Write [/code] at code text end, and [code] at text start.
Or use the # button in the Advanced Editor : Edit > Go Advanced. http://www.linuxquestions.org/questi....php?do=bbcode
Quote:
I got the same error.
Same as what ? ? No errors were indicated in post #1.
When I run this code I got the same output as #1 and the simple.tr file was blank. Also nam didn't appear.
Code:
Trace set show_sctphdr_ 1
# ======================================================================
# Define options
# ======================================================================
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 2 ;# number of mobilenodes
set val(rp) DSDV ;# routing protocol
# ======================================================================
# Main Program
# ======================================================================
#
# Initialize Global Variables
#
set ns [new Simulator]
set tr [open simple.tr w]
$ns trace-all $tr
set nf [open simple.nam w]
$ns namtrace-all $nf
# set up topography object
set topo [new Topography]
$topo load_flatgrid 500 500
# Create God
create-god $val(nn)
# Create the specified number of mobilenodes [$val(nn)] and "attach" them
# to the channel.
# Here two nodes are created : node(0) and node(1)
# configure node
$ns node-config -adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channelType $val(chan) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace OFF
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns node]
$node_($i) random-motion 0 ;# disable random motion
}
#
# Provide initial (X,Y, for now Z=0) co-ordinates for mobilenodes
#
$node_(0) set X_ 5.0
$node_(0) set Y_ 2.0
$node_(0) set Z_ 0.0
$node_(1) set X_ 390.0
$node_(1) set Y_ 385.0
$node_(1) set Z_ 0.0
#
# Now produce some simple node movements
# Node_(1) starts to move towards node_(0)
#
$ns at 50.0 "$node_(1) setdest 25.0 20.0 15.0"
$ns at 10.0 "$node_(0) setdest 20.0 18.0 1.0"
# Node_(1) then starts to move away from node_(0)
$ns at 100.0 "$node_(1) setdest 490.0 480.0 15.0"
# Setup traffic flow between nodes
# SCTP connections between node_(0) and node_(1)
set sctp0 [new Agent/SCTP]
$ns attach-agent $node_(0) $sctp0
$sctp0 set fid_ 1
set cbr0 [new Application/Traffic/CBR]
# set traffic class to 1
$cbr0 set class_ 1
$cbr0 attach-agent $sctp0
# Create a Null sink to receive Data
set sinknode1 [new Agent/LossMonitor]
$ns attach-agent $node_(1) $sinknode1
set sctp1 [new Agent/SCTP]
$ns attach-agent $node_(1) $sctp1
$sctp1 set fid_ 2
set cbr1 [new Application/Traffic/CBR]
$cbr1 set class_ 2
$cbr1 attach-agent $sctp1
set sinknode0 [new Agent/LossMonitor]
$ns attach-agent $node_(0) $sinknode0
$ns connect $sctp0 $sctp1
#
# Tell nodes when the simulation ends
#
for {set i 0} {$i < $val(nn) } {incr i} {
$ns at 150.0 "$node_($i) reset";
}
$ns at 15.0 "stop"
$ns at 15.01 "puts \"NS EXITING...\" ; $ns halt"
proc stop {} {
global ns tracefd
$ns flush-trace
close $tracefd
}
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511
Rep:
Post # 4 : Please hit the Edit button : Code tags are required.
A tcl file that 1) generates a trace file ? , 2) starts nam,
can look like this ( Template.tcl )
Code:
# start with these lines :
set ns [new Simulator]
set nf [open out.nam w]
$ns namtrace-all $nf
proc finish {} {
global ns nf
$ns flush-trace
close $nf
exec nam out.nam &
exit 0
}
#######################
#######################
# end with :
$ns at 5.0 "finish"
$ns run
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.