def rssi(self): if mobility.DRAW: instantiateGraph() currentTime = time.time() staList = mobility.staList ang = {} for sta in staList: ang[sta] = random.uniform(0, 360) sta.params['frequency'][0] = channelParameters.frequency(sta, 0) continue_ = True while continue_: continue_ = False time_ = time.time() - currentTime for sta in staList: continue_ = True if time_ >= sta.time[0]: freq = sta.params['frequency'][0] * 1000 # freqency in MHz ap = sta.params['associatedTo'][0] # get AP dist = self.calculateDistance(sta, freq, sta.rssi[0]) if ap != '': self.moveStationTo(sta, ap, dist, ang[sta]) bw = self.calculateRate(sta, ap, dist) channelParameters.tc(sta, 0, bw, 1, 1, 1) sta.params['rssi'] = sta.rssi[0] del sta.rssi[0] del sta.time[0] if len(sta.time) == 0: staList.remove(sta) time.sleep(0.01)
def rssi(self): if mobility.DRAW: instantiateGraph() currentTime = time.time() staList = mobility.staList ang = {} for sta in staList: ang[sta] = random.uniform(0, 360) sta.params['frequency'][0] = channelParameters.frequency(sta, 0) continue_ = True while continue_: continue_ = False time_ = time.time() - currentTime for sta in staList: continue_ = True if time_ >= sta.time[0]: freq = sta.params['frequency'][0] * 1000 # freqency in MHz ap = sta.params['associatedTo'][0] # get AP dist = self.calculateDistance(sta, freq, sta.rssi[0]) if ap != '': self.moveStationTo(sta, ap, dist, ang[sta]) bw = self.calculateRate(sta, ap, dist) channelParameters.tc(sta, 0, bw, 1, 1, 1) sta.params['rssi'] = sta.rssi[0] del sta.rssi[0] del sta.time[0] if len(sta.time) == 0: staList.remove(sta) time.sleep(0.01)
def behavior(self): info('\nReplaying process starting in 20 seconds') time.sleep(20) info('\nReplaying process has been started') currentTime = time.time() staList = mobility.staList for sta in staList: sta.params['frequency'][0] = channelParameters.frequency(sta, 0) continue_ = True while continue_: continue_ = False time_ = time.time() - currentTime for sta in staList: if hasattr(sta, 'time'): continue_ = True if time_ >= sta.time[0]: ap = sta.params['associatedTo'][0] # get AP if ap != '': bw = sta.bw[0] loss = sta.loss[0] delay = sta.delay[0] latency = sta.latency[0] channelParameters.tc(sta, 0, bw, loss, latency, delay) del sta.bw[0] del sta.loss[0] del sta.delay[0] del sta.latency[0] del sta.time[0] if len(sta.time) == 0: staList.remove(sta) time.sleep(0.01) info('Replaying process has finished!')
def rssi(self, propagationModel='', n=0): if mobility.DRAW: instantiateGraph() currentTime = time.time() staList = mobility.staList ang = {} for sta in staList: ang[sta] = random.uniform(0, 360) sta.params['frequency'][0] = channelParameters.frequency(sta, 0) continue_ = True while continue_: continue_ = False time_ = time.time() - currentTime for sta in staList: if hasattr(sta, 'time'): continue_ = True if time_ >= sta.time[0]: ap = sta.params['associatedTo'][0] # get AP sta.params['rssi'][0] = sta.rssi[0] if ap != '': dist = self.calculateDistance(sta, ap, sta.rssi[0], propagationModel, n) self.moveStationTo(sta, ap, dist, ang[sta]) loss = channelParameters.loss(dist) latency = channelParameters.latency(dist) delay = channelParameters.delay(dist, 0) bw = channelParameters.bw(sta, ap, dist, 0, isReplay=True) if self.print_bw or self.print_delay or self.print_distance or \ self.print_latency or self.print_loss: info('station %s:\n' % sta) if self.print_distance: info(' distance(m) to %s: %s\n' % (ap, dist)) if self.print_loss: info(' loss: %s\n' % loss) if self.print_latency: info(' latency(ms): %s\n' % latency) if self.print_delay: info(' delay(ms): %s\n' % delay) if self.print_bw: info(' bandwidth(Mbps): %s\n' % bw) channelParameters.tc(sta, 0, bw, loss, latency, delay) del sta.rssi[0] del sta.time[0] if len(sta.time) == 0: staList.remove(sta) time.sleep(0.01)
def throughput(self): # if mobility.DRAW: # plotGraph() currentTime = time.time() staList = mobility.staList continue_ = True while continue_: continue_ = False time_ = time.time() - currentTime for sta in staList: continue_ = True if time_ >= sta.time[0]: channelParameters.tc(sta, 0, sta.throughput[0], 1, 1, 1) # pos = '%d, %d, %d' % (sta.throughput[0], sta.throughput[0], 0) # self.moveStationTo(sta, pos) del sta.throughput[0] del sta.time[0] if len(sta.time) == 0: staList.remove(sta) time.sleep(0.01)
def throughput(self): # if mobility.DRAW: # plotGraph() currentTime = time.time() staList = mobility.staList continue_ = True while continue_: continue_ = False time_ = time.time() - currentTime for sta in staList: continue_ = True if time_ >= sta.time[0]: channelParameters.tc(sta, 0, sta.throughput[0], 1, 1, 1) # pos = '%d, %d, %d' % (sta.throughput[0], sta.throughput[0], 0) # self.moveStationTo(sta, pos) del sta.throughput[0] del sta.time[0] if len(sta.time) == 0: staList.remove(sta) time.sleep(0.01)
def throughput(self): # if mobility.DRAW: # plotGraph() currentTime = time.time() staList = mobility.staList continue_ = True while continue_: continue_ = False time_ = time.time() - currentTime for sta in staList: if hasattr(sta, 'time'): continue_ = True if time_ >= sta.time[0]: channelParameters.tc(sta, 0, sta.throughput[0], 0, 0, 0) # pos = '%d, %d, %d' % (sta.throughput[0], sta.throughput[0], 0) # self.moveStationTo(sta, pos) del sta.throughput[0] del sta.time[0] info('%s\n' % sta.time[0]) if len(sta.time) == 1: staList.remove(sta) # time.sleep(0.001) info("\nReplaying Process Finished!")
def rssi(self): if mobility.DRAW: instantiateGraph() currentTime = time.time() staList = mobility.staList ang = {} for sta in staList: ang[sta] = random.uniform(0, 360) sta.params['frequency'][0] = channelParameters.frequency(sta, 0) continue_ = True while continue_: continue_ = False time_ = time.time() - currentTime for sta in staList: if hasattr(sta, 'time'): continue_ = True if time_ >= sta.time[0]: ap = sta.params['associatedTo'][0] # get AP sta.params['rssi'][0] = sta.rssi[0] if ap != '': dist = self.calculateDistance(sta, ap, sta.rssi[0]) self.moveStationTo(sta, ap, dist, ang[sta]) loss = channelParameters.loss(dist) latency = channelParameters.latency(dist) delay = channelParameters.delay(dist, 0) bw = channelParameters.bw(sta, ap, dist, 0, isReplay=True) channelParameters.tc(sta, 0, bw, loss, latency, delay) del sta.rssi[0] del sta.time[0] if len(sta.time) == 0: staList.remove(sta) time.sleep(0.01)