我通过站lte模拟adhoc网络,我的代码和错误如下
Mac/802_11Ext set CWMin_ 15
Mac/802_11Ext set CWMax_ 1023
Mac/802_11Ext set SlotTime_ 0.000009
Mac/802_11Ext set SIFS_ 0.000016
Mac/802_11Ext set ShortRetryLimit_ 7
Mac/802_11Ext set LongRetryLimit_ 4
Mac/802_11Ext set HeaderDuration_ 0.000020
Mac/802_11Ext set SymbolDuration_ 0.000004
Mac/802_11Ext set BasicModulationScheme_ 0
Mac/802_11Ext set use_802_11a_flag_ true
Mac/802_11Ext set RTSThreshold_ 2000
Mac/802_11Ext set MAC_DBG 0
#=====================================================================
Phy/WirelessPhyExt set CSThresh_ 6.30957e-12
Phy/WirelessPhyExt set Pt_ 0.001
Phy/WirelessPhyExt set freq_ 5.18e9
Phy/WirelessPhyExt set noise_floor_ 2.51189e-13
Phy/WirelessPhyExt set L_ 1.0
Phy/WirelessPhyExt set PowerMonitorThresh_ 2.10319e-12
Phy/WirelessPhyExt set HeaderDuration_ 0.000020
Phy/WirelessPhyExt set BasicModulationScheme_ 0
Phy/WirelessPhyExt set PreambleCaptureSwitch_ 1
Phy/WirelessPhyExt set DataCaptureSwitch_ 0
Phy/WirelessPhyExt set SINR_PreambleCapture_ 2.5118
Phy/WirelessPhyExt set SINR_DataCapture_ 100.0
Phy/WirelessPhyExt set trace_dist_ 1e6
Phy/WirelessPhyExt set PHY_DBG_ 0
Phy/WirelessPhyExt set CPThresh_ 0 ;# not used at the moment
Phy/WirelessPhyExt set RXThresh_ 0 ;# not used at the moment
#=====================================================================
#configure RF model parameters
Antenna/OmniAntenna set Gt_ 1.0
Antenna/OmniAntenna set Gr_ 1.0
Propagation/Nakagami set use_nakagami_dist_ false
Propagation/Nakagami set gamma0_ 2.0
Propagation/Nakagami set gamma1_ 2.0
Propagation/Nakagami set gamma2_ 2.0
Propagation/Nakagami set d0_gamma_ 200
Propagation/Nakagami set d1_gamma_ 500
Propagation/Nakagami set m0_ 1.0
Propagation/Nakagami set m1_ 1.0
Propagation/Nakagami set m2_ 1.0
Propagation/Nakagami set d0_m_ 80
Propagation/Nakagami set d1_m_ 200
set opt(namfile) out.nam
set opt(tracefile) out.tr
set val(chan) Channel/WirelessChannel; #channel type
set val(prop) Propagation/Nakagami; #radio-propagation model
set val(netif) Phy/WirelessPhyExt; #network interface type
set val(mac) Mac/802_11Ext; #MAC type
set val(ifq) Queue/LTEQueue/ULAirQueue; #interface queue type
set val(ifqlen) 100; #max nbr of packets in ifq
set val(ll) LL; #link layer type
set val(ant) Antenna/OmniAntenna; #antenna type
set val(adhocRP) AODV; #routing protocol
set val(x) 1903; #x dimension of the topography
set val(y) 882; #y dimension of the topography
set val(stop) 3607.0; #simulation time
set val(mobility) "mobility.tcl"
set val(start) 1
set val(stop) 3607.0
set val(nn) 38
set val(eNB) 1
#set val(gw_discovery) reactive; #gateway discovery method
#---------------------------
#Initialize Global Variables
#---------------------------
#create a simulator object
set ns_ [new Simulator]
$ns_ color 0 Brown
#----------------------------------------
#Define The Hierachial Topology Structure
#----------------------------------------
$ns_ node-config -addressType hierarchical
AddrParams set domain_num_ 2
lappend clusterNbr 2 2
AddrParams set cluster_num_ $clusterNbr
lappend eilastlevel 2 2 [expr $val(nn)/2+1] [expr $val(nn)/2-5]
AddrParams set nodes_num_ $eilastlevel
#create trace objects for ns and nam
$ns_ use-newtrace
set nstrace [open $opt(tracefile) w]
$ns_ trace-all $nstrace
set namtrace [open $opt(namfile) w]
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)
#--------------------------------------------------------
#create a topology object and define topology
#--------------------------------------------------------
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
#--------------------------------------------------------
# Create GOD
#--------------------------------------------------------
set god [create-god [expr $val(nn)+$val(eNB)]]
set aGW [$ns_ node 0.0.0]
set server [$ns_ node 0.0.1]
#Use hierarchical addresses for GWs and MNs
set chan1 [new $val(chan)]
#configure for gateway
$ns_ node-config -adhocRouting $val(adhocRP) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-topoInstance $topo \
-channel $chan1 \
-agentTrace ON \
-routerTrace ON \
-macTrace ON \
-movementTrace ON
$ns_ node-config -wiredRouting ON
set eNB(0) [$ns_ node 2.0.0]
$eNB(0) random-motion 0
$eNB(0) set X_ 500.0
$eNB(0) set Y_ 100.0
$eNB(0) set Z_ 0.0
$ns_ at 0.00 "$eNB(0) setdest 500 100 0"
$ns_ node-config -wiredRouting OFF
for {set i 0} {$i < $val(nn)} {incr i} {
set node_($i) [$ns_ node 2.0.[expr $i + 1]]
$node_($i) base-station [AddrParams addr2id [ $server node-addr]]
$node_($i) random-motion 0
}
#20 defines the node size in nam, must adjust it according to your scenario
#The function must be called after mobility model is defined
for {set i 0} {$i < $val(nn)} {incr i} {
$ns_ initial_node_pos $node_($i) 20
}
$ns_ simplex-link $eNB(0) $aGW 1000Mb 2ms LTEQueue/ULS1Queue
$ns_ simplex-link $aGW $eNB(0) 1000Mb 2ms LTEQueue/DLS1Queue
#The bandwidth between aGW and server is not the bottleneck.
$ns_ simplex-link $aGW $server 5000Mb 2ms DropTail
$ns_ simplex-link $server $aGW 5000Mb 2ms LTEQueue/DLQueue
$ns_ duplex-link-op $server $aGW orient down
$ns_ duplex-link-op $aGW $eNB(0) orient left-down
#---------------------
#Source Mobility Pattern
#---------------------
source $val(mobility)
#----------------
#Labels & Color
#----------------
$server color blue
$aGW color green
$eNB(0) color red
$ns_ at 0.0 "$server label \"SERVER\""
$ns_ at 0.0 "$aGW label \"GTW\""
$ns_ at 0.0 "$eNB(0) label eNB_0"
for {set i 0} {$i < $val(nn)} {incr i} {
$ns_ at 0.0 "$node_($i) label \"vehicle [expr $i]\""
}
#-----------------------------------
#Define Node Initial Position In Nam
#-----------------------------------
#--------------------- #Setup Traffic
for {set i 0} {$i < $val(nn)} {incr i} {
set udp($i) [new Agent/UDP]
set null($i) [new Agent/Null]
$ns_ attach-agent $node_($i) $udp($i)
$ns_ attach-agent $server $null($i)
$udp($i) set fid_ 0
$ns_ connect $udp($i) $null($i)
set cbr($i) [new Application/Traffic/CBR]
$cbr($i) attach-agent $udp($i)
$cbr($i) set packetSize_ 512
$cbr($i) set interval_ 0.2
$ns_ at $val(start) "$cbr($i) start"
$ns_ at $val(stop) "$cbr($i) stop"
}
#-----------------------------------
#Tell Nodes When The Simulation Ends
#-----------------------------------
for {set i 0} {$i < $val(nn)} {incr i} {
$ns_ at $val(stop).0 "$node_($i) reset";
}
$ns_ at $val(stop).0 "expr $server reset";
#$ns_ at $val(stop).0 "expr $server reset";
$ns_ at $val(stop).0001 "stop"
$ns_ at $val(stop).0002 "puts \"NS EXITING...\" ; $ns_ halt"
proc stop {} {
global ns_ nstrace namtrace
$ns_ flush-trace
close $nstrace
close $namtrace
exec nam out.nam &
exit 0
}
puts "Starting simulation..."
$ns_ run
及其erorr:
madani @ ubuntu:〜/ cluster $ ns map.tcl num_nodes设置为39 初始化列表xListHead 开始模拟...... 分段错误(核心转储)
答案 0 :(得分:0)
可以在模拟中使用Queue/LTEQueue/DLAirQueue
和{Propagation/Nakagami
,Phy/WirelessPhyExt
,Mac/802_11Ext
+建议的&#34; 802.11p设置&#34;} 。示例LTE文件:bicfixdownlink.tcl https://drive.google.com/file/d/0B7S255p3kFXNSmd4Q3h3dXp1QWc/view?usp=sharing
source 802.11p-file
set opt(chan) Channel/WirelessChannel ;# channel type
set opt(prop) Propagation/Nakagami ;# radio-propagation model
set opt(netif) Phy/WirelessPhyExt ;# network interface type
set opt(mac) Mac/802_11Ext ;# MAC type
set opt(ifq) Queue/LTEQueue/DLAirQueue ;# interface queue type
...其中802.11p-file
是您问题的代码。
编辑过的&#34; bicfixdownlink.tcl&#34;通过LTE修补ns
运行正常。 &#39; nam&#39;动画很好。 xgraph输出是可以接受的:
xgraph down0 down1 down2 down3 down4 &
编辑:其他例子,L-guindy-teatinos40A.tcl
+ flowmod-teatinos-M40.tcl + mobmod-teatinos-M40A.tcl,其中L-guindy- *使用来自mobmod-teatinos-M40A.tcl的802.11p设置https://drive.google.com/file/d/0B7S255p3kFXNRkVKVFBuNnFLcG8/view?usp=sharing
Teatinos SUMO文件来自http://neo.lcc.uma.es/staff/jamal/vanet/?q=node/11