ieee80211_accesspoint_twohost_congestion_speed.test 7.0 KB

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