ieee80211_adhoc_tenhost_speed.test 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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. #for validation
  138. **.wlan*.*.dataBitrate = 11Mbps
  139. **.wlan*.*.mgmtBitrate = 11Mbps
  140. **.wlan*.*.multicastBitrate = 11Mbps
  141. **.wlan*.*.controlBitrate = 11Mbps
  142. #for validation
  143. **.mac.address = "auto"
  144. **.mac.maxQueueSize = 14
  145. **.mac.rtsThresholdBytes = 3000B
  146. **.wlan*.mac.retryLimit = 7
  147. **.wlan*.mac.cwMinData = 31
  148. **.wlan*.mac.cwMinBroadcast = 31
  149. **.radio.transmitterPower = 20.0mW
  150. **.radio.thermalNoise = -110dBm
  151. **.radio.sensitivity = -85dBm
  152. **.radio.pathLossAlpha = 2
  153. **.radio.snirThreshold = 4dB
  154. # cli
  155. **.cli.reqLength = 1250B
  156. **.cli.respLength = 0
  157. **.cli.destStation = ""
  158. description = "10 host to 10 host on adhoc"
  159. Throughput.numCli = 10
  160. Throughput.numSrv = 10
  161. **.cli.sendInterval = 10ms
  162. %#--------------------------------------------------------------------------------------------------------------
  163. %postrun-command: Rscript check.r
  164. %#--------------------------------------------------------------------------------------------------------------
  165. %file: check.r
  166. #!/usr/bin/env Rscript
  167. options(echo=FALSE)
  168. options(width=160)
  169. library("omnetpp", warn.conflicts=FALSE)
  170. #TEST parameters
  171. scafile <- 'results/General-#0.sca'
  172. linecount <- 10 # count of client-server pairs
  173. rcvdBytes <- 11000000/8 # bytes
  174. expectedRate <- 52.46 # %
  175. maxDeviation <- 2.0 # % (checking expectedRate +/- maxDeviation)
  176. unbalancedRate <- 20.0 # %
  177. # begin TEST:
  178. expectedRateMin <- expectedRate - maxDeviation
  179. expectedRateMax <- expectedRate + maxDeviation
  180. dataset <- loadDataset(scafile)
  181. cat("\nOMNETPP TEST RESULT:\n")
  182. sink <- dataset$scalars[grep("\\.srvHost\\[\\d\\]\\.sink", dataset$scalars$module),]
  183. #print(sink)
  184. secs <- (sink$value[sink$name == "rcvdPk:count"] / sink$value[sink$name == "packetPerSec"])
  185. sinkRcvd <- sink[sink$name == "rcvdPk:sum(packetBytes)",]
  186. #print(sinkRcvd)
  187. cnt <- length(sinkRcvd$value)
  188. #print(cnt)
  189. cat(" IEEE80211 TEST RESULT:\n")
  190. sinkRcvd$rate <- sinkRcvd$value * 100 / (rcvdBytes * secs)
  191. avgValue <- sum(sinkRcvd$value) / length(sinkRcvd$value)
  192. sinkRcvd$urate <- (sinkRcvd$value - avgValue) * 100 / avgValue
  193. cat(" SPEED ")
  194. rate <- sum(sinkRcvd$value) * 100 / (rcvdBytes * max(secs))
  195. isGood <- (rate >= expectedRateMin) & (rate <= expectedRateMax)
  196. if(length(sinkRcvd$value) == linecount & isGood)
  197. {
  198. cat("OK\n")
  199. } else {
  200. cat("BAD: rate is", rate, "%, expected rate is", expectedRate, "%\n")
  201. print(sinkRcvd)
  202. cat("\n")
  203. }
  204. sinkRcvd$isGood <- (sinkRcvd$urate >= -unbalancedRate) & (sinkRcvd$urate <= unbalancedRate)
  205. #print(sinkRcvd)
  206. cat(" BALANCE ")
  207. if(length(sinkRcvd$value) == linecount & min(sinkRcvd$isGood))
  208. {
  209. cat("OK\n")
  210. } else {
  211. cat("BAD:\n")
  212. # print(sinkRcvd[!sinkRcvd$isGood,])
  213. print(sinkRcvd)
  214. cat("\n")
  215. }
  216. cat("END\n")
  217. %#--------------------------------------------------------------------------------------------------------------
  218. %contains: postrun-command(1).out
  219. OMNETPP TEST RESULT:
  220. IEEE80211 TEST RESULT:
  221. SPEED OK
  222. BALANCE OK
  223. END
  224. %#--------------------------------------------------------------------------------------------------------------