HOw to fix this error

29 views
Skip to first unread message

Burke Geceyatmaz

unread,
Sep 18, 2023, 5:58:57 AM9/18/23
to Network Simulator 2 (NS2)
can't read "agent_addr_": no such variable

knudfl

unread,
Sep 18, 2023, 8:39:32 AM9/18/23
to Network Simulator 2 (NS2)
Another unrelated question .........
You will have to write some context.
Which command was answering with "can't read "agent_addr_": no such variable" ?
And which file is it about ?

Burke Geceyatmaz

unread,
Sep 18, 2023, 9:49:41 AM9/18/23
to Network Simulator 2 (NS2)
# Create a new simulation object
set ns [new Simulator]

# Enable trace file generation
set tracefile [open hybrid_aodv_olsr.tr w]
$ns trace-all $tracefile

# Create nodes
set node0 [$ns node]
set node1 [$ns node]
set node2 [$ns node]

# Create links between nodes
$ns duplex-link $node0 $node1 10Mb 5ms DropTail
$ns duplex-link $node1 $node2 10Mb 5ms DropTail

# Create AODV agent at node0
set aodv [new Agent/AODV]
$ns attach-agent $node0 $aodv
$ns at 0.0 "$aodv start"

# Create OLSR agent at node1
set olsr [new Agent/OLSR]
$ns attach-agent $node1 $olsr
$ns at 0.0 "$olsr start"

# Define a routing protocol for each link
$ns rtproto DV $node0 $aodv
$ns rtproto OLSR $node1 $olsr
$ns rtmodel-at $node2 $ns

# Create CBR traffic source
set udp_cbr [new Agent/UDP]
$ns attach-agent $node0 $udp_cbr
set cbr [new Application/Traffic/CBR]
$cbr attach-agent $udp_cbr
$cbr set rate_ 1Mbps
$cbr set random_ false
$cbr set packetSize_ 1000
$ns connect $udp_cbr $node2
$ns at 1.0 "$cbr start"
$ns at 10.0 "$cbr stop"

# Run the simulation
$ns run

# Close the trace file
$ns flush-trace
close $tracefile

# Exit the simulation
exit 0


18 Eylül 2023 Pazartesi tarihinde saat 15:39:32 UTC+3 itibarıyla knudfl şunları yazdı:

Burke Geceyatmaz

unread,
Sep 18, 2023, 9:49:54 AM9/18/23
to Network Simulator 2 (NS2)
this one

18 Eylül 2023 Pazartesi tarihinde saat 15:39:32 UTC+3 itibarıyla knudfl şunları yazdı:
Another unrelated question .........
Reply all
Reply to author
Forward
0 new messages