I' tried to add XY coordinates for wired nodes, but nam doesn't support this facility.
Instead, I achieve the same result by setting the length of the wired links via their delay Pedro Vale Estrela http://tagus.inesc-id.pt/~pestrela/ns2 > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf > Of Javier Chicote > Sent: quarta-feira, 21 de Março de 2007 17:00 > To: ns-users@ISI.EDU > Subject: Re: [ns] ns/nam: respresentation problem when definingposition- > fixed nodes (NEW question) > > > Hi ns-users, > > I learnt that the previous problem can be "solved" by using 'orient' > method at the link definition. However, this solution is not enough when > defining more complex structures. The next figure shows 4 nodes standing > in the imaginary vertexes of a square, which are all of them connected to > a master node like it is shown in the next picture: > > node(1,0) node(1,1) > (0,100) (100,100)__ > \_______ \__ > \_______ \_ > \_______ master > _________/(200,50) > _________/ _____/ > / / > (0,0) (0,100) > node(0,0) node(100,0) > > ---> What I would like to know is if it is possible (or not) to define the > geographic position of the nodes when the coordinates of them are known in > a wired scenario, or other ideas to solve the problem. > > This is the code of the file: > > # Network configuration (x,y):## node(1,0) node(1,1)# (0,100) > (100,100)__# \_______ \__ # \_______ > \_# \_______ master# > _________/(200,50)# _________/ _____/# / > / # (0,0) (0,100)# node(0,0) node(100,0)# > # Create a simulator instanceset ns [new Simulator] > # Open the NAM trace fileset namfile [open position-out.nam w]$ns > namtrace-all $namfile > set rows 2 ;# number of rowsset cols 2 > ;# number of nodes per row > # Define nodesfor {set i 0} {$i < $rows} {incr i} { for {set j 0} > {$j < $cols} { incr j } { set node($i,$j) [$ns node] > }}set master [$ns node] > # Provide initial (X,Y,Z) co-ordinates for nodesfor {set i 0} {$i < $rows} > {incr i} { set xj 0.0 for {set j 0} {$j < $cols} { incr j } > { $node($i,$j) set X_ $xj if {$i == 0} then > { $node($i,$j) set Y_ 0.0 } elseif {$i == 1} then { > $node($i,$j) set Y_ 100.0 } $node($i,$j) set Z_ 0.0 > set xj [expr $xj + 200] }}$master set X_ 200.0$master set Y_ > 50.0$master set Z_ 0.0 > # Define links between nodes$ns duplex-link $node(0,0) $master 1Mb 100ms > DropTail$ns duplex-link $node(0,1) $master 1Mb 100ms DropTail$ns duplex- > link $node(1,0) $master 1Mb 100ms DropTail$ns duplex-link $node(1,1) > $master 1Mb 100ms DropTail > # Define link orientation$ns duplex-link-op $node(0,0) $master orient > rigth-up$ns duplex-link-op $node(0,1) $master orient rigth$ns duplex-link- > op $node(1,0) $master orient rigth$ns duplex-link-op $node(1,1) $master > orient rigth-down > # Define a 'finish' procedureproc finish {} { global ns tracefile > namfile $ns flush-trace close $namfile exec nam > position-out.nam & exit 0} > # Stop the simulation$ns at [expr 5.0 - 0.000001] "puts \"Stopping > Simulation...\" "$ns at 5.0 "finish ; $ns halt" > # Start the simulationputs "Starting Simulation..."$ns run > > > > ----- Mensaje original ---- > De: Javier Chicote <[EMAIL PROTECTED]> > Para: ns-users@isi.edu > Enviado: miércoles, 21 de marzo, 2007 11:36:06 > Asunto: ns/nam: respresentation problem when defining position-fixed nodes > > Hi ns-users, > > I would like to simulate a position-fixed wired network with 2 lines and 3 > nodes per line, like it is shown above. The distance between the nodes > should be 100 units (for example), so the first node of the matrix will be > in (x=0,y=0) and the last node in (x=100, y=200). > > node(1,1) node(1,2) node(1,3) > (100,0)______(100,100)____(100,200) > | | | > | | | > | | | > | | | > (0,0)________(0,100)______(0,200) > node(0,1) node(0,2) node(0,3) > > When I do not define the links, the nodes are shown correctly in NAM > (without lines between them), but when I make some of the link definitions > (lines 46-48 of the above code), the structure of the network changes, and > it is shown as a straight line. > > I know that I > could manually edit the position of the nodes by clicking on the > Edit/View button in NAM, but I would like to build the structure of the > network automatically for future bigger structures, where it is not > affordable to edit them manually. > > How could I solve the problem?? > > Many thanks in advance, > > Regards, > > Javi > > > # Network configuration (x,y):## node(1,1) node(1,2) node(1,3)# > (100,0)______(100,100)____(100,200)# | | > |# | | |# | | > |# | | |# > (0,0)________(0,100)______(0,200)# node(0,1) node(0,2) > node(0,3)# > # Create a simulator instanceset ns [new Simulator] > # Open the NAM trace fileset namfile [open position-out.nam > w]$ns namtrace-all $namfile > set rows 2 ;# number of rowsset cols 3 > ;# number of nodes per row > # Define nodesfor {set i 0} {$i < $rows} {incr i} { for {set j 0} > {$j < $cols} { incr j } { set node($i,$j) [$ns node] }} > # Provide initial (X,Y,Z) co-ordinates for nodesfor {set i 0} {$i < $rows} > {incr > i} { set xj 0.0 for {set j 0} {$j < $cols} { incr j } { > $node($i,$j) set X_ $xj if {$i == 0} then { $node($i,$j) > set Y_ 0.0 } elseif {$i == 1} then { $node($i,$j) set Y_ > 100.0 } $node($i,$j) set Z_ 0.0 set xj > [expr $xj + 100] }} > # Define links between nodes$ns duplex-link $node(0,0) $node(0,1) > 1Mb 100ms DropTail$ns duplex-link $node(0,1) $node(0,2) 1Mb 100ms > DropTail$ns duplex-link $node(0,2) $node(1,2) 1Mb 100ms DropTail#$ns > duplex-link $node(1,2) $node(1,1) 1Mb 100ms DropTail#$ns duplex-link > $node(1,1) $node(1,0) 1Mb 100ms DropTail#$ns duplex-link $node(1,0) > $node(0,0) 1Mb 100ms DropTail$ns duplex-link $node(0,1) $node(1,1) 1Mb > 100ms DropTail > # Define a 'finish' procedureproc finish {} { global ns tracefile > namfile $ns flush-trace close $namfile exec nam > position-out.nam & exit 0} > # Stop the simulation$ns at [expr 5.0 - 0.000001] "puts \"Stopping > Simulation...\" "$ns at 5.0 > "finish ; $ns halt" > # Start the simulationputs "Starting Simulation..."$ns run > > > > > LLama Gratis a cualquier PC del Mundo. > Llamadas a fijos y móviles desde 1 céntimo por minuto. > http://es.voice.yahoo.com > > > > > > > ______________________________________________ > LLama Gratis a cualquier PC del Mundo. > Llamadas a fijos y móviles desde 1 céntimo por minuto. > http://es.voice.yahoo.com