Exemplo n.º 1
0
    def interference(cls):
        'configure interference model'
        for node in wmediumd.nodes:
            if 'position' not in node.params:
                posX = 0
                posY = 0
                posZ = 0
            else:
                posX = node.params['position'][0]
                posY = node.params['position'][1]
                posZ = node.params['position'][2]
            node.lastpos = [posX, posY, posZ]

            if 'carsta' in node.params:
                wlans = 1
            elif '_4addr' in node.params and node.params['_4addr'] == 'ap':
                wlans = 1
            else:
                wlans = len(node.params['wlan'])

            for wlan in range(0, wlans):
                if wlan == 1:
                    posX+=1
                wmediumd.positions.append(w_pos(node.wmIface[wlan],
                                                [posX, posY, posZ]))
                wmediumd.txpowers.append(w_txpower(
                    node.wmIface[wlan], float(node.params['txpower'][wlan])))
Exemplo n.º 2
0
 def set_pos_wmediumd(self, pos):
     "Set Position for wmediumd"
     if self.lastpos != pos:
         self.lastpos = pos
         for wmIface in self.wmIfaces:
             inc = '%s' % float('0.' + str(self.wmIfaces.index(wmIface)))
             w_server.update_pos(w_pos(wmIface,
                 [(float(pos[0])+float(inc)), float(pos[1]), float(pos[2])]))
Exemplo n.º 3
0
 def set_pos_wmediumd(self, pos):
     "Set Position for wmediumd"
     if self.lastpos != pos:
         self.lastpos = pos
         for id, wmIface in enumerate(self.wmIfaces):
             w_server.update_pos(
                 w_pos(wmIface, [(float(pos[0]) + id),
                                 float(pos[1]),
                                 float(pos[2])]))