ieee80211_adhoc_tenhost_congestion_speed.test 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. %description:
  2. Testing TCP communication speed
  3. TCP
  4. TCP_NSC
  5. %#--------------------------------------------------------------------------------------------------------------
  6. %testprog: opp_run
  7. %#--------------------------------------------------------------------------------------------------------------
  8. %file: test.ned
  9. import inet.applications.ethernet.EtherAppCli;
  10. import inet.common.queue.Sink;
  11. import inet.linklayer.ieee80211.Ieee80211Nic;
  12. import inet.mobility.single.CircleMobility;
  13. import inet.mobility.static.StationaryMobility;
  14. import inet.node.wireless.AccessPoint;
  15. import inet.physicallayer.ieee80211.packetlevel.Ieee80211ScalarRadioMedium;
  16. module Ieee80211NicAdhoc extends Ieee80211Nic
  17. {
  18. parameters:
  19. mgmtType = "Ieee80211MgmtAdhoc";
  20. }
  21. module ThroughputClient
  22. {
  23. parameters:
  24. int idx;
  25. int maxCli;
  26. int maxSrv;
  27. @networkNode();
  28. @display("i=device/wifilaptop");
  29. **.interfaceTableModule = "";
  30. gates:
  31. input radioIn @directIn;
  32. submodules:
  33. cli: EtherAppCli {
  34. parameters:
  35. registerSAP = false;
  36. destAddress = "20:00:00:00:00:0"+string(idx % maxSrv);
  37. @display("b=40,24;p=180,60,col");
  38. }
  39. wlan: Ieee80211NicAdhoc {
  40. parameters:
  41. @display("p=112,134;q=queue");
  42. }
  43. mobility: CircleMobility {
  44. parameters:
  45. startAngle = 360deg * idx / maxCli;
  46. @display("p=50,141");
  47. }
  48. connections allowunconnected:
  49. wlan.radioIn <-- radioIn;
  50. cli.out --> wlan.upperLayerIn;
  51. }
  52. module ThroughputServer
  53. {
  54. parameters:
  55. int idx;
  56. int maxSrv;
  57. @networkNode();
  58. @display("i=device/wifilaptop");
  59. **.interfaceTableModule = "";
  60. gates:
  61. input radioIn @directIn;
  62. submodules:
  63. sink: Sink {
  64. parameters:
  65. @display("p=210,68,col");
  66. }
  67. wlan: Ieee80211NicAdhoc {
  68. parameters:
  69. @display("p=120,158;q=queue");
  70. }
  71. mobility: StationaryMobility {
  72. parameters:
  73. initialX = 350m * (idx+1) / maxSrv;
  74. @display("p=50,141");
  75. }
  76. connections allowunconnected:
  77. wlan.radioIn <-- radioIn;
  78. sink.in++ <-- wlan.upperLayerOut;
  79. }
  80. network Throughput
  81. {
  82. parameters:
  83. int numCli;
  84. int numSrv;
  85. @display("b=297,203");
  86. submodules:
  87. cliHost[numCli]: ThroughputClient {
  88. parameters:
  89. idx = index;
  90. maxCli = numCli;
  91. maxSrv = numSrv;
  92. wlan.mac.address = "auto";
  93. @display("r=,,#707070");
  94. }
  95. srvHost[numSrv]: ThroughputServer {
  96. parameters:
  97. idx = index;
  98. maxSrv = numSrv;
  99. wlan.mac.address = "20:00:00:00:00:0"+string(index);
  100. @display("p=350,350;r=,,#707070");
  101. }
  102. radioMedium: Ieee80211ScalarRadioMedium {
  103. parameters:
  104. @display("p=61,46");
  105. }
  106. }
  107. %#--------------------------------------------------------------------------------------------------------------
  108. %inifile: omnetpp.ini
  109. [General]
  110. network = Throughput
  111. #cmdenv-output-file = omnetpp.log
  112. #debug-on-errors = true
  113. tkenv-plugin-path = ../../../etc/plugins
  114. sim-time-limit = 50s
  115. **.vector-recording = false
  116. **.constraintAreaMinX = 0m
  117. **.constraintAreaMinY = 0m
  118. **.constraintAreaMinZ = 0m
  119. **.constraintAreaMaxX = 400m
  120. **.constraintAreaMaxY = 400m
  121. **.constraintAreaMaxZ = 0m
  122. **.debug = true
  123. **.coreDebug = false
  124. **.channelNumber = 0
  125. **.mgmt.numChannels = 1
  126. # positions
  127. **.mobility.cx = 200m
  128. **.mobility.cy = 200m
  129. **.mobility.r = 100m
  130. **.mobility.speed = 1 mps
  131. **.mobility.updateInterval = 100ms
  132. # channel physical parameters
  133. *.radioMedium.mediumLimitCache.carrierFrequency = 2.4GHz
  134. *.radioMedium.mediumLimitCache.maxTransmissionPower = 20mW
  135. # access point
  136. # nic settings
  137. **.wlan*.*.dataBitrate = 11Mbps
  138. **.wlan*.*.mgmtBitrate = 11Mbps
  139. **.wlan*.*.multicastBitrate = 11Mbps
  140. **.wlan*.*.controlBitrate = 11Mbps
  141. **.mac.address = "auto"
  142. **.mac.maxQueueSize = 14
  143. **.mac.rtsThresholdBytes = 3000B
  144. **.wlan*.mac.retryLimit = 7
  145. **.wlan*.mac.cwMinData = 31
  146. **.wlan*.mac.cwMinBroadcast = 31
  147. **.radio.transmitterPower = 20.0mW
  148. **.radio.thermalNoise = -110dBm
  149. **.radio.sensitivity = -85dBm
  150. **.radio.pathLossAlpha = 2
  151. **.radio.snirThreshold = 4dB
  152. # cli
  153. **.cli.reqLength = 1250B
  154. **.cli.respLength = 0
  155. **.cli.destStation = ""
  156. description = "10 host to 10 host on adhoc"
  157. Throughput.numCli = 10
  158. Throughput.numSrv = 10
  159. **.cli.sendInterval = 1ms
  160. %#--------------------------------------------------------------------------------------------------------------
  161. %postrun-command: Rscript check.r
  162. %#--------------------------------------------------------------------------------------------------------------
  163. %file: check.r
  164. #!/usr/bin/env Rscript
  165. options(echo=FALSE)
  166. options(width=160)
  167. library("omnetpp", warn.conflicts=FALSE)
  168. #TEST parameters
  169. scafile <- 'results/General-#0.sca'
  170. linecount <- 10 # count of client-server pairs
  171. rcvdBytes <- 11000000/8 # bytes
  172. expectedRate <- 52.46 # %
  173. maxDeviation <- 2.0 # % (checking expectedRate +/- maxDeviation)
  174. unbalancedRate <- 15.0 # %
  175. # begin TEST:
  176. expectedRateMin <- expectedRate - maxDeviation
  177. expectedRateMax <- expectedRate + maxDeviation
  178. dataset <- loadDataset(scafile)
  179. cat("\nOMNETPP TEST RESULT:\n")
  180. sink <- dataset$scalars[grep("\\.srvHost\\[\\d\\]\\.sink", dataset$scalars$module),]
  181. #print(sink)
  182. secs <- (sink$value[sink$name == "rcvdPk:count"] / sink$value[sink$name == "packetPerSec"])
  183. sinkRcvd <- sink[sink$name == "rcvdPk:sum(packetBytes)",]
  184. #print(sinkRcvd)
  185. cnt <- length(sinkRcvd$value)
  186. #print(cnt)
  187. cat(" IEEE80211 TEST RESULT:\n")
  188. sinkRcvd$rate <- sinkRcvd$value * 100 / (rcvdBytes * secs)
  189. avgValue <- sum(sinkRcvd$value) / length(sinkRcvd$value)
  190. sinkRcvd$urate <- (sinkRcvd$value - avgValue) * 100 / avgValue
  191. cat(" SPEED ")
  192. rate <- sum(sinkRcvd$value) * 100 / (rcvdBytes * max(secs))
  193. isGood <- (rate >= expectedRateMin) & (rate <= expectedRateMax)
  194. if(length(sinkRcvd$value) == linecount & isGood)
  195. {
  196. cat("OK\n")
  197. } else {
  198. cat("BAD: rate is", rate, "%, expected rate is", expectedRate, "%\n")
  199. print(sinkRcvd)
  200. cat("\n")
  201. }
  202. sinkRcvd$isGood <- (sinkRcvd$urate >= -unbalancedRate) & (sinkRcvd$urate <= unbalancedRate)
  203. #print(sinkRcvd)
  204. cat(" BALANCE ")
  205. if(length(sinkRcvd$value) == linecount & min(sinkRcvd$isGood))
  206. {
  207. cat("OK\n")
  208. } else {
  209. cat("BAD:\n")
  210. # print(sinkRcvd[!sinkRcvd$isGood,])
  211. print(sinkRcvd)
  212. cat("\n")
  213. }
  214. cat("END\n")
  215. %#--------------------------------------------------------------------------------------------------------------
  216. %contains: postrun-command(1).out
  217. OMNETPP TEST RESULT:
  218. IEEE80211 TEST RESULT:
  219. SPEED OK
  220. BALANCE OK
  221. END
  222. %#--------------------------------------------------------------------------------------------------------------