Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8924221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:21:05+00:00 2026-06-15T07:21:05+00:00

I am unable to run this simulation: set pairs [lindex $argv 0] # ====================================

  • 0

I am unable to run this simulation:

set pairs [lindex $argv 0]

# ====================================
# 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)             $pairs                     ;# pair of mobilenodes
set val(rp)             DSDV                       ;# routing protocol

# ======================================
# Main Program
# ======================================

#
# Initialize Global Variables
#

set ns [new Simulator]
set tracefd [open wl.tr w]

$ns use-newtrace
$ns trace-all $tracefd 

# set up topography object
set topo [new Topography]
#1000x1000m terrain
$topo load_flatgrid 1000 1000

#
# Create General Operations Director
#

set god_ [ create-god $val(nn) ]

Mac/802_11 set RTSThreshold_ 3000

#
#  Create the specified number of mobilenodes [$val(nn)] and "attach" them
#  to the channel. 

# 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) \
             -channel [new $val(chan)] \
             -topoInstance $topo \
             -agentTrace ON \
             -routerTrace ON \
             -macTrace OFF \
             -movementTrace OFF

    for {set i 0} {$i < [expr {2*$val(nn)}] } {incr i} {
        set node_($i) [$ns node]    
        $node_($i) random-motion 0  ;# disable random motion
    }

#
# Provide initial (X,Y, Z=0) co-ordinates for mobilenodes
#
set rng [new RNG]
$rng seed 0

set unit 10.0;
set even_x 50.0;
set even_y 50.0;
set odd_x 50.0;
set odd_y 0.0;
for {set i 0} { $i < [expr {2*$val(nn)}] } {incr i} {
    set residue [expr {$i%2}];
#puts $residue
    set rand [expr [$rng uniform 0 1] + [ns-random 0] % 100];
    if { $residue ==0 } {

        $node_($i) set X_ [expr {$even_x + $rand}];
        $node_($i) set Y_ [expr {$even_y }]
        $node_($i) set Z_ 0.0;
    } else {
        $node_($i) set X_ [expr {$odd_x + $rand}];
        $node_($i) set Y_ [expr {$odd_y}];
        $node_($i) set Z_ 0.0;
    }
}

for {set i 0} { $i < $val(nn) } {incr i} {  
    set null_($i) [new Agent/Null]
    $ns attach-agent $node_([expr {($i*2)+1}]) $null_($i)
    set udp_($i) [new Agent/UDP]
    $ns attach-agent $node_([expr {2*$i}]) $udp_($i)
    set cbr_($i) [new Application/Traffic/CBR]
    $cbr_($i) set packetSize_ 1440  
    $udp_($i) set packetSize_ 1440
    $cbr_($i) set rate_ 500k
    $cbr_($i) attach-agent $udp_($i)
    $ns connect $udp_($i) $null_($i) 
}

for {set i 0} {$i < $val(nn)} {incr i} {
        $ns at 0.0 "$cbr_($i) start"
        $ns at 120.0 "$cbr_($i) stop"
}
$ns at 120.0 "$ns halt"
$ns run
$ns flush-trace
close $tracefd
puts "Starting Simulation..."
$ns run

I get this error
could any one please help me!!!

MAC_802_11: accessing MAC cache_ array out of range (src 33, dst 32, size 20)!
MAC_802_11: accessing MAC cache_ array out of range (src 33, dst 32, size 20)!
MAC_802_11: accessing MAC cache_ array out of range (src 33, dst 32, size 20)!
MAC_802_11: accessing MAC cache_ array out of range (src 32, dst 33, size 20)!
MAC_802_11: accessing MAC cache_ array out of range (src 32, dst 33, size 20)!
MAC_802_11: accessing MAC cache_ array out of range (src 32, dst 33, size 20)!
MAC_802_11: accessing MAC cache_ array out of range (src 32, dst 33, size 20)!
MAC_802_11: accessing MAC cache_ array out of range (src 32, dst 33, size 20)!
MAC_802_11: accessing MAC cache_ array out of range (src 32, dst 33, size 20)!
MAC_802_11: accessing MAC cache_ array out of range (src 32, dst 33, size 20)!
[suppressing additional MAC cache_ warnings]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:21:08+00:00Added an answer on June 15, 2026 at 7:21 am

    The following lines cause the problem:

    set god_ [ create-god $val(nn) ]

    god_ told to prepared for nn nodes. but a couple of lines later:

    for {set i 0} {$i < [expr {2*$val(nn)}] } {incr i} {

    You create 2*nn nodes. Either create-god [expr {2*$val(nn)}] or get rid of the 2* where it appears in the code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm unable to run this query, where can be the error, because it's ok.,
I have this simple for loop but unfortunately I'm unable to run it successfully.
I'm unable to run any selenium tests since I updated Firefox to 3.6. Is
When I run my code, Unable to start activity ComponentInfo: android.database.sqlite.SQLiteException: near /: syntax
I read quite a number of posts of programmers that run into the Unable
Unable to cast object type System.Collections.Generic.List 1[NorthwindMVC3.Models.Product] to the type ofSystem.Collections.Generic.IEnumerator 1[NorthwindMVC3.Models.Product].\ public IEnumerator<Product>
Im unable to start new project in a virtualenv. This is what i did
Although I found many answers and discussions about this question, I am unable to
been trying out this for quite some time but I'm still unable to built
I'm trying to run the Desmo-J simulation sample in Java, NetBeans 7.2 on a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.