This is the tcl script for simulating a Wireless Sensor Network with some obstacles in the target area.
# ======================================================
# Define options
# ======================================================
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy/802_15_4 ;# network interface type
set val(mac) Mac/802_15_4 ;# 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) 100 ;# max packet in ifq
set val(nn) 47 ;# number of mobilenodes
set val(rp) AODV ;# routing protocol AODV / DSDV
set val(x) 100 ;# X dimension of topography
set val(y) 100 ;# Y dimension of topography
set val(stop) 500 ;# simulation time
set val(energymodel) EnergyModel ;# Energy Model
set val(initialenergy) 100 ;# initial energy
set val(obstacle) “/home/abdusy/ns-allinone-2.35/ns-2.35/mobile/Obstacles.txt”
#============================
# Initialize Global Variables
#============================
set ns [new Simulator]
set tracefd [open trace-wsn2-aodv-46-scen1.tr w]
set namtrace [open nam-wsn2-aodv-46-scen1.nam w]
…..
#========================
# Physical layer setting
# for model TworayGround Receiving threshold
# set RXThresh_ …
#========================
…..
You can download full tcl script here!