Пример #1
0
 def bw(self, sta, ap, dist, wlan):
     self.rate = 0
     if propagationModel_.model == '':
         propagationModel_.model = 'friisPropagationLossModel'
     value = deviceDataRate(sta, ap, wlan)
     custombw = value.rate
     self.rate = value.rate / 2.5
     if ap == None:
         gT = 0
         hT = 0
         pT = sta.params['txpower'][wlan]
         gR = sta.params['antennaGain'][wlan]
         hR = sta.params['antennaHeight'][wlan]
         if self.i != 0:
             dist = self.dist / self.i
         value = propagationModel_(sta, ap, dist, wlan, pT, gT, gR, hT, hR)
         sta.params['rssi'][
             wlan] = value.rssi  # random.uniform(value.rssi-1, value.rssi+1)
         self.rate = (custombw * (1.1**-dist)) / 5
     else:
         pT = ap.params['txpower'][0]
         gT = ap.params['antennaGain'][0]
         hT = ap.params['antennaHeight'][0]
         gR = sta.params['antennaGain'][wlan]
         hR = sta.params['antennaHeight'][wlan]
         value = propagationModel_(sta, ap, dist, wlan, pT, gT, gR, hT, hR)
         sta.params['rssi'][
             wlan] = value.rssi  #random.uniform(value.rssi-1, value.rssi+1)
         if ap.equipmentModel == None:
             self.rate = custombw * (1.1**-dist)
     self.rate = self.rate - self.loss * 3
     if self.rate <= 0:
         self.rate = 1
     return self.rate
Пример #2
0
 def bw(self, sta, ap, dist, wlan):
     self.rate = 0
     if propagationModel_.model == '':
         propagationModel_.model = 'friisPropagationLossModel'
     value = deviceDataRate(sta, ap, wlan)
     custombw = value.rate
     self.rate = value.rate/2.5
     if ap == None:
         gT = 0
         hT = 0
         pT = sta.params['txpower'][wlan]
         gR = sta.params['antennaGain'][wlan]
         hR = sta.params['antennaHeight'][wlan]            
         if self.i != 0:
             dist = self.dist/self.i
         value = propagationModel_( sta, ap, dist, wlan, pT, gT, gR, hT, hR )
         sta.params['rssi'][wlan] = value.rssi # random.uniform(value.rssi-1, value.rssi+1)
         self.rate = (custombw * (1.1 ** -dist))/5
     else:            
         pT = ap.params['txpower'][0]
         gT = ap.params['antennaGain'][0]
         hT = ap.params['antennaHeight'][0]
         gR = sta.params['antennaGain'][wlan]
         hR = sta.params['antennaHeight'][wlan]       
         value = propagationModel_( sta, ap, dist, wlan, pT, gT, gR, hT, hR )
         sta.params['rssi'][wlan] = value.rssi #random.uniform(value.rssi-1, value.rssi+1)
         if ap.equipmentModel == None:
             self.rate = custombw * (1.1 ** -dist)
     self.rate = self.rate - self.loss*3
     if self.rate <= 0:
         self.rate = 1
     return self.rate  
Пример #3
0
 def bw(self, node1, node2, dist, wlan):
     self.rate = 0
     if propagationModel_.model == '':
         propagationModel_.model = 'friisPropagationLossModel'
     value = deviceDataRate(node1, node2, wlan)
     custombw = value.rate
     self.rate = value.rate / 2.5
     if node2 == None:
         if self.i != 0:
             dist = self.dist / self.i
         value = propagationModel_(node1, node2, dist, wlan)
         node1.params['rssi'][wlan] = random.uniform(
             value.rssi - 1, value.rssi + 1)
         self.rate = (custombw * (1.1**-dist)) / 5
     else:
         if dist != 0:
             value = propagationModel_(node1, node2, dist, wlan)
             node1.params['rssi'][wlan] = random.uniform(
                 value.rssi - 1, value.rssi + 1)
             if node2.equipmentModel == None:
                 self.rate = custombw * (1.1**-dist)
     self.rate = self.rate - self.loss * 3
     if self.rate <= 0:
         self.rate = 1
     return self.rate
Пример #4
0
 def calculateNoise(self, sta, station, signalPower, wlan):
     dist = self.getDistance(sta, station)
     totalRange = sta.range + station.range
     if dist < totalRange:
         value = propagationModel_(sta, station, dist, wlan)
         n = value.rssi + signalPower
         self.noise += n
         self.i += 1
         self.dist += dist
Пример #5
0
 def calculateNoise(self, sta, station, signalPower, wlan):
     dist = self.getDistance(sta, station)
     totalRange = sta.range + station.range
     if dist < totalRange:
         value = propagationModel_(sta, station, dist, wlan)
         n =  value.rssi + signalPower
         self.noise += n
         self.i+=1    
         self.dist += dist  
Пример #6
0
    def bw(self, sta, ap, dist, wlan, isReplay=False):
        self.rate = 0
        if propagationModel_.model == '':
            propagationModel_.model = 'friisPropagationLossModel'
        value = deviceDataRate(sta, ap, wlan)
        custombw = value.rate
        self.rate = value.rate / 2.5
        lF = self.lF
        sl = self.sl
        nFloors = self.nFloors
        gRandom = self.gRandom
        pL = self.pL
        if ap == None:
            gT = 0
            hT = 0
            pT = sta.params['txpower'][wlan]
            gR = sta.params['antennaGain'][wlan]
            hR = sta.params['antennaHeight'][wlan]
            if self.i != 0:
                dist = self.dist / self.i
            value = propagationModel_(sta, ap, dist, wlan, pT, gT, gR, hT, hR,
                                      sl, lF, pL, nFloors, gRandom)
            sta.params['rssi'][
                wlan] = value.rssi  # random.uniform(value.rssi-1, value.rssi+1)
            self.rate = (custombw * (1.1**-dist)) / 5
        else:
            pT = ap.params['txpower'][0]
            gT = ap.params['antennaGain'][0]
            hT = ap.params['antennaHeight'][0]
            gR = sta.params['antennaGain'][wlan]
            hR = sta.params['antennaHeight'][wlan]
            if isReplay == False:
                value = propagationModel_(sta, ap, dist, wlan, pT, gT, gR, hT,
                                          hR, sl, lF, pL, nFloors, gRandom)
                sta.params['rssi'][
                    wlan] = value.rssi  # random.uniform(value.rssi-1, value.rssi+1)
            if ap.equipmentModel == None:
                self.rate = custombw * (1.1**-dist)
        self.rate = self.rate - dist**2 / 10

        if self.rate <= 0:
            self.rate = 1
        return self.rate
Пример #7
0
 def bw(self, node1, node2, dist, wlan):
     self.rate = 0
     if propagationModel_.model == '':
         propagationModel_.model = 'friisPropagationLossModel'
     value = deviceDataRate(node1, node2, wlan)
     custombw = value.rate
     self.rate = value.rate/2.5
     #print node1
     if node2 == None:
         if self.i != 0:
             dist = self.dist/self.i
         value = propagationModel_(node1, node2, dist, wlan)
         node1.rssi[wlan] = random.uniform(value.rssi-1, value.rssi+1)
         self.rate = (custombw * (1.1 ** -dist))/5
     else:
         if dist != 0: 
             value = propagationModel_(node1, node2, dist, wlan)
             node1.rssi[wlan] = random.uniform(value.rssi-1, value.rssi+1)
             if node2.equipmentModel == None:
                 self.rate = custombw * (1.1 ** -dist)
     self.rate = self.rate - self.loss*3
     if self.rate <= 0:
         self.rate = 1
     return self.rate