Example #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  
Example #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
Example #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
Example #4
0
    def setBW(self, sta=None, ap=None, wlan=0, dist=0):
        """set BW

        :param sta: station
        :param ap: access point
        :param wlan: wlan ID
        :param dist: distance between source and destination
        """
        value = deviceDataRate(sta, ap, wlan)
        custombw = value.rate
        rate = eval(self.equationBw)

        if rate <= 0.0:
            rate = 0.1
        return rate
Example #5
0
 def bw(self, node1, node2, dist, staList, wlan):
     systemLoss = 1
     self.rate = 0
     if self.propagModel == '':
         self.propagModel = 'friisPropagationLossModel'
     value = deviceDataRate(node1, node2, wlan)
     custombw = value.rate
     if node2 == None:
         node1.rssi[wlan] = -50 - dist
         self.rate = custombw * (1.1 ** -dist)
     else:
         if dist != 0: 
             value = propagationModel(node1, node2, dist, wlan, self.propagModel, systemLoss)
             node1.rssi[wlan] = value.rssi
             if node2.equipmentModel == None:
                 self.rate = custombw * (1.1 ** -dist)
      
     return self.rate     
    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
Example #7
0
    def bw(self, sta, ap, dist, wlan):
        lF = channelParams.lF
        sl = channelParams.sl
        nFloors = channelParams.nFloors
        gRandom = channelParams.gRandom
        pL = channelParams.pL

        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, sl, lF, pL, nFloors, gRandom)
        sta.params['rssi'][wlan] = value.rssi  # random.uniform(value.rssi-1, value.rssi+1)
        
        value = deviceDataRate(sta, ap, wlan)
        custombw = value.rate
        rate = eval(channelParams.equationBw)
        if rate <= 0.0:
            rate = 0.1
        return rate
Example #8
0
    def bw(self, sta, dist, wlan):
        lF = channelParams.lF
        sl = channelParams.sl
        nFloors = channelParams.nFloors
        gRandom = channelParams.gRandom
        pL = channelParams.pL
  
        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, None, dist, wlan, pT, gT, gR, hT, hR, sl, lF, pL, nFloors, gRandom)
        sta.params['rssi'][wlan] = value.rssi

        value = deviceDataRate(sta, None, wlan)
        custombw = value.rate
        rate = eval(channelParams.equationBw)
        if rate <= 0:
            rate = 0.1
        return rate
Example #9
0
 def bw(self, node1, node2, dist, wlan):
     systemLoss = 1
     self.rate = 0
     if emulationEnvironment.propagation_Model == '':
         emulationEnvironment.propagation_Model = 'friisPropagationLossModel'
     value = deviceDataRate(node1, node2, wlan)
     custombw = value.rate
     self.rate = value.rate
     if node2 == None:
         if self.i != 0:
             dist = self.dist/self.i
         node1.rssi[wlan] = -50 - float(dist)
         self.rate = (custombw * (1.1 ** -dist))/5
     else:
         if dist != 0: 
             value = propagationModel(node1, node2, dist, wlan, emulationEnvironment.propagation_Model, systemLoss)
             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*2
     if self.rate <= 0:
         self.rate = 1
     return self.rate  
Example #10
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