- 论坛徽章:
- 0
|
illidan.modeler@gmail.com1.1 scenarioThere are 3 nodes that run DSR, with position (50, 10), (450, 10), (850, 10). The radio range is about 627 meters. The terrain size is set to 900x900m.dsr_3nodes.nodes.conf
0 (50, 10)1 (450, 10)2 (850, 10)
dsr_3nodes.sim.conf
TERRAIN-DIMENSIONS (900, 900)
Node positioning illustrated in the visualization tool after a successful run:
file:///C:/DOCUME%7E1/msc/LOCALS%7E1/Temp/moz-screenshot-4.jpg
1.2 trafficNode0 is sending CBR traffic to Node2, which is out of 1 hop range to Node0. Thus a DSR route discovery and forwarding is mandatory.
dsr_3nodes.app.conf
CBR 0 2 0 64 0.2S 0S 0S
1.3 protocolsThe 3 nodes run DSR as routing protocol, and 802.11 as MAC protocol.
dsr_3nodes.sim.conf
ROUTING-PROTOCOL DSRMAC-PROTOCOL 802.11
1.4 Run and Analysis
Run the simulation:
glomosim dsr_3nodes.sim.conf > sim.log
Analysis the output stat file with awk script:
awk -f dsr_3nodes.awk dsr_3nodes.stat
Results:
+CBR stats:CBR.Total traffic sent (bytes) : 160000CBR.Total traffic sent (bytes/sec) : 320.13CBR.Total traffic received (bytes) : 160000CBR.Total traffic received (bytes/sec) : 320.13CBR.Total traffic dropped (bytes) : 0
+DSR statsDSR.Total control traffic sent (packets) : 5DSR.Total requests sent (packets) : 3DSR.Total replies sent (packets) : 2DSR.Total route errors sent (packets) : 0DSR.Total data packets originated (packets) : 2500DSR.Total data packets received (packets) : 2500DSR.Total packets dropped (packets) : 01.5 ConclusionIt's possible to simulate MANET in GloMoSim. The workflow for discrete event simulation of a simple MANET that runs DSR is presented. The same workflow is able to be applied to MANETs that are more complicated. Appendix
The awk script:
BEGIN { global_dsr_req_sent = 0; global_dsr_rep_sent = 0; global_dsr_error_sent = 0; global_dsr_ctrl_sent = 0; global_dsr_dropped = 0; global_dsr_data_originated = 0; global_dsr_data_recv = 0; global_cbr_pkts_sent = 0; global_cbr_pkts_recv = 0; global_cbr_bytes_sent = 0; global_cbr_bytes_recv = 0; cbr_sent_start_time = 0.0; cbr_sent_end_time = 0.0; cbr_recv_start_time = 0.0; cbr_recv_end_time = 0.0; }/*Begin*/{ if ($4=="RoutingDsr,") { if ($7 == "Requests") { global_dsr_req_sent += $10; } else if ($7 == "Replies") { global_dsr_rep_sent += $10; } else if ($7 == "CTRL") { global_dsr_ctrl_sent += $11; } else if ($7 == "Errors") { global_dsr_error_sent += $10; } else if ($7 == "Dropped") { global_dsr_dropped += $10; } if ($8 == "Originated") { global_dsr_data_originated += $10; } else if ($8 == "Received") { global_dsr_data_recv += $10; } } /* if */}$4~/AppCbr/ { if ($9=="bytes") { if ($10=="sent:") global_cbr_bytes_sent += $11; if ($10=="received:") global_cbr_bytes_recv += $11; } else if ($6=="First") { if($8=="sent" && (cbr_sent_start_time>$11)) { /*Get the network-wide start time for sending CBR */ cbr_sent_start_time = $11; } else if ($8=="received" && (cbr_recv_start_time>$11)) { /*Get the network-wide start time for receiving CBR */ cbr_recv_start_time = $11; } } else if ($6=="Last") { if ($8=="sent" && (cbr_sent_end_time$11)) cbr_sent_end_time = $11; if ($8=="recv" && (cbr_recv_end_time$11)) cbr_recv_end_time = $11; } }/*END*/END { print("+CBR stats:"); printf("CBR.Total traffic sent (bytes) : %d\n", global_cbr_bytes_sent ); printf("CBR.Total traffic sent (bytes/sec) : %.2f\n", global_cbr_bytes_sent/(cbr_sent_end_time-cbr_sent_start_time)); printf("CBR.Total traffic received (bytes) : %d\n", global_cbr_bytes_recv ); printf("CBR.Total traffic received (bytes/sec) : %.2f\n", global_cbr_bytes_recv/(cbr_sent_end_time-cbr_sent_start_time)); printf("CBR.Total traffic dropped (bytes) : %d\n", global_cbr_bytes_sent-global_cbr_bytes_recv); print(""); print("+DSR stats"); printf("DSR.Total control traffic sent (packets) : %d\n", global_dsr_ctrl_sent ); printf("DSR.Total requests sent (packets) : %d\n", global_dsr_req_sent ); printf("DSR.Total replies sent (packets) : %d\n", global_dsr_rep_sent); printf("DSR.Total route errors sent (packets) : %d\n", global_dsr_error_sent); printf("DSR.Total data packets originated (packets) : %d\n", global_dsr_data_originated); printf("DSR.Total data packets received (packets) : %d\n", global_dsr_data_recv); printf("DSR.Total packets dropped (packets) : %d\n", global_dsr_dropped); }
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/22344/showart_333042.html |
|