ieee80211_accesspoint_twohost_speed.test 7.3 KB

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