Пример #1
0
    def mobilityPositionDefined(self, initial_time, final_time, staMov):
        """ ongoing Mobility """
        t_end = time.time() + final_time
        t_initial = time.time() + initial_time
        currentTime = time.time()
        i = 1
        nodes = self.staList + self.apList

        dic = dict()
        dic['max_x'] = self.MAX_X
        dic['max_y'] = self.MAX_Y

        if self.DRAW == True:
            plot.instantiateGraph(self.MAX_X, self.MAX_Y)
            plot.plotGraph(nodes, mobility.wallList, staMov, **dic)

        try:
            while time.time() < t_end and time.time() > t_initial:
                if self.continue_:
                    if time.time() - currentTime >= i:
                        for sta in staMov:
                            if time.time() - currentTime >= sta.startTime and time.time() - currentTime <= sta.endTime:
                                x = float(sta.params['position'][0]) + float(self.moveFac[sta][0])
                                y = float(sta.params['position'][1]) + float(self.moveFac[sta][1])
                                z = float(sta.params['position'][2]) + float(self.moveFac[sta][2])
                                sta.params['position'] = x, y, z
                            for wlan in range(0, len(sta.params['wlan'])):
                                self.nodeParameter(sta, wlan)
                            if self.DRAW:
                                plot.graphPause()
                                plot.graphUpdate(sta)
                        i += 1
        except:
            print 'Error! Mobility stopped!'
Пример #2
0
def instantiateGraph():
        nodeList = mobility.staList + mobility.apList
        for node in nodeList:
            plot.instantiateGraph(mobility.MAX_X, mobility.MAX_Y)
            plot.instantiateNode(node, mobility.MAX_X, mobility.MAX_Y)
            plot.instantiateAnnotate(node)
            plot.instantiateCircle(node)
            plot.graphUpdate(node)
Пример #3
0
def instantiateGraph():
    nodeList = mobility.staList + mobility.apList
    for node in nodeList:
        plot.instantiateGraph(mobility.MAX_X, mobility.MAX_Y)
        plot.instantiateNode(node, mobility.MAX_X, mobility.MAX_Y)
        plot.instantiateAnnotate(node)
        plot.instantiateCircle(node)
        plot.graphUpdate(node)
Пример #4
0
 def moveStationTo(self, sta, ap, dist, ang):
     x = dist * cos(ang) + int(ap.params['position'][0])
     y = dist * sin(ang) + int(ap.params['position'][1])
     sta.params['position'] = x, y, 0
     mobility.getAPsInRange(sta)
     if mobility.DRAW:
         try:
             plot.graphUpdate(sta)
         except:
             pass
Пример #5
0
 def moveStationTo(self, sta, pos):
     x = pos[0]
     y = pos[1]
     sta.params['position'] = x, y, 0
     # mobility.getAPsInRange(sta)
     if mobility.DRAW:
         try:
             plot.graphUpdate(sta)
         except:
             pass
Пример #6
0
 def moveStationTo(self, sta, ap, dist, ang):
     x = dist * cos(ang) + int(ap.params['position'][0])
     y = dist * sin(ang) + int(ap.params['position'][1])
     sta.params['position'] = x, y, 0
     mobility.getAPsInRange(sta)
     if mobility.DRAW:
         try:
             plot.graphUpdate(sta)
         except:
             pass
Пример #7
0
 def moveStationTo(self, sta, pos):
     x = pos[0]
     y = pos[1]
     sta.params['position'] = x, y, 0
     # mobility.getAPsInRange(sta)
     if mobility.DRAW:
         try:
             plot.graphUpdate(sta)
         except:
             pass
Пример #8
0
    def positionDefined(self,
                        init_time=0,
                        final_time=0,
                        stations=None,
                        aps=None,
                        walls=None,
                        staMov=None,
                        dstConn=None,
                        srcConn=None,
                        plotnodes=None,
                        MAX_X=0,
                        MAX_Y=0):
        """ ongoing Mobility """
        t_end = time.time() + final_time
        t_initial = time.time() + init_time
        currentTime = time.time()
        i = 1

        self.staList = stations
        self.apList = aps
        self.wallList = walls
        nodes = self.staList + self.apList + plotnodes

        dic = dict()
        dic['max_x'] = MAX_X
        dic['max_y'] = MAX_Y

        if self.DRAW == True:
            plot.instantiateGraph(MAX_X, MAX_Y)
            plot.plotGraph(nodes, self.wallList, staMov, srcConn, dstConn,
                           **dic)

        try:
            while time.time() < t_end and time.time() > t_initial:
                if self.continue_:
                    if time.time() - currentTime >= i:
                        for sta in staMov:
                            if time.time(
                            ) - currentTime >= sta.startTime and time.time(
                            ) - currentTime <= sta.endTime:
                                x = float(sta.params['position'][0]) + float(
                                    self.moveFac[sta][0])
                                y = float(sta.params['position'][1]) + float(
                                    self.moveFac[sta][1])
                                z = float(sta.params['position'][2]) + float(
                                    self.moveFac[sta][2])
                                sta.params['position'] = x, y, z
                            for wlan in range(0, len(sta.params['wlan'])):
                                self.nodeParameter(sta, wlan)
                            if self.DRAW:
                                plot.graphPause()
                                plot.graphUpdate(sta)
                        i += 1
        except:
            info('Error! Mobility stopped!\n')
Пример #9
0
    def mobilityPositionDefined(self, initial_time, final_time, staMov):
        """ ongoing Mobility """
        t_end = time.time() + final_time
        t_initial = time.time() + initial_time
        currentTime = time.time()
        i = 1

        if self.DRAW == True:
            debug('Enabling Graph...\n')
            plot.instantiateGraph(self.MAX_X, self.MAX_Y)
            for sta in self.staList:
                self.graphInstantiateNodes(sta)
                if sta not in staMov:
                    plot.pltNode[sta].set_data(sta.params['position'][0], sta.params['position'][1])
                    plot.drawTxt(sta)
                    plot.drawCircle(sta)
            for ap in mobility.apList:
                self.graphInstantiateNodes(ap)
                for c in ap.connections:
                    line = plot.plotLine2d([ap.connections[c].params['position'][0], ap.params['position'][0]], \
                                           [ap.connections[c].params['position'][1], ap.params['position'][1]], 'b')
                    plot.plotLine(line)
            for wall in mobility.wallList:
                line = plot.plotLine2d([wall.params['initPos'][0], wall.params['finalPos'][0]], \
                                           [wall.params['initPos'][1], wall.params['finalPos'][1]], 'r', 10)
                plot.plotLine(line)
        try:
            while time.time() < t_end and time.time() > t_initial:
                if self.continue_:
                    if time.time() - currentTime >= i:
                        for sta in staMov:
                            if time.time() - currentTime >= sta.startTime and time.time() - currentTime <= sta.endTime:
                                x = float(sta.params['position'][0]) + float(self.moveFac[sta][0])
                                y = float(sta.params['position'][1]) + float(self.moveFac[sta][1])
                                z = float(sta.params['position'][2]) + float(self.moveFac[sta][2])
                                sta.params['position'] = x, y, z
                            for wlan in range(0, len(sta.params['wlan'])):
                                self.nodeParameter(sta, wlan)
                            if self.DRAW:
                                plot.graphPause()
                                plot.graphUpdate(sta)
                        i+=1
                # have to verify this
                time.sleep(0.01)
        except:
            print 'Error! Mobility stopped!'
Пример #10
0
 def mobilityPositionDefined(self, initial_time, final_time, staMov):
     """ ongoing Mobility """        
     t_end = time.time() + final_time
     t_initial = time.time() + initial_time
     currentTime = time.time()
     i=1
     
     if self.DRAW == True:
         debug('Enabling Graph...\n')
         plot.instantiateGraph(self.MAX_X, self.MAX_Y)
         for sta in self.staList:
             self.graphInstantiateNodes(sta)
             if sta not in staMov:
                 plot.pltNode[sta].set_data(sta.params['position'][0],sta.params['position'][1])
                 plot.drawTxt(sta)
                 plot.drawCircle(sta)           
         for ap in mobility.apList:
             self.graphInstantiateNodes(ap)  
             for c in ap.connections:
                 line = plot.plotLine2d([ap.connections[c].params['position'][0],ap.params['position'][0]], \
                                        [ap.connections[c].params['position'][1],ap.params['position'][1]], 'b')
                 plot.plotLine(line)
         for wall in mobility.wallList:
             line = plot.plotLine2d([wall.params['initPos'][0],wall.params['finalPos'][0]], \
                                        [wall.params['initPos'][1],wall.params['finalPos'][1]], 'r', 10)
             plot.plotLine(line)
     try:
         while time.time() < t_end and time.time() > t_initial:
             if self.continue_:
                 if time.time() - currentTime >= i:
                     for sta in staMov:
                         if time.time() - currentTime >= sta.startTime and time.time() - currentTime <= sta.endTime:
                             x = float(sta.params['position'][0]) + float(self.moveFac[sta][0])
                             y = float(sta.params['position'][1]) + float(self.moveFac[sta][1])
                             z = float(sta.params['position'][2]) + float(self.moveFac[sta][2])
                             sta.params['position'] = x, y, z
                         for wlan in range(0, len(sta.params['wlan'])):
                             self.nodeParameter(sta, wlan) 
                         if self.DRAW:
                             time.sleep(0.01)
                             plot.graphUpdate(sta)
                     i+=1
             #have to verify this
             time.sleep(0.01)
     except:
         print 'Error! Mobility stopped!'        
Пример #11
0
 def mobilityPositionDefined(self, initial_time, final_time, staMov):
     """ ongoing Mobility """        
     t_end = time.time() + final_time
     t_initial = time.time() + initial_time
     currentTime = time.time()
     i=1
     
     if emulationEnvironment.DRAW == True:
         debug('Enabling Graph...\n')
         plot.instantiateGraph(self.MAX_X, self.MAX_Y)
         for sta in emulationEnvironment.staList:
             self.instatiateNodes(sta)
             if sta not in staMov:
                 plot.pltNode[sta].set_data(sta.position[0],sta.position[1])
                 plot.drawTxt(sta)
                 plot.drawCircle(sta)   
         for ap in emulationEnvironment.apList:
             self.instatiateNodes(ap)  
             for c in ap.connections:
                 line = plot.plotLine2d([ap.connections[c].position[0],ap.position[0]], \
                                        [ap.connections[c].position[1],ap.position[1]], 'b')
                 plot.plotLine(line)
     try:
         while time.time() < t_end and time.time() > t_initial:
             if emulationEnvironment.continue_:
                 if time.time() - currentTime >= i:
                     for sta in emulationEnvironment.staList:
                         if time.time() - currentTime >= sta.startTime and time.time() - currentTime <= sta.endTime:
                             sta.position[0] = float(sta.position[0]) + float(self.moveFac[sta][0])
                             sta.position[1] = float(sta.position[1]) + float(self.moveFac[sta][1])
                             sta.position[2] = float(sta.position[2]) + float(self.moveFac[sta][2])
                         for wlan in range(0, sta.nWlans):
                             self.nodeParameter(sta, wlan) 
                         if emulationEnvironment.DRAW:
                             plot.graphUpdate(sta)
                     i+=1
     except:
         print 'Error! Mobility stopped!'        
Пример #12
0
    def models(self,
               nodes=None,
               model=None,
               min_v=0,
               max_v=0,
               seed=None,
               staMov=None,
               **mobilityparam):

        np.random.seed(seed)

        # simulation area (units)
        MAX_X, MAX_Y = self.MAX_X, self.MAX_Y

        dic = dict()
        dic['max_x'] = MAX_X
        dic['max_y'] = MAX_Y

        # max waiting time
        MAX_WT = 100.

        for node in nodes:
            if node.max_x == 0:
                node.max_x = MAX_X
            if node.max_y == 0:
                node.max_y = MAX_Y
            if node.max_v == 0:
                node.max_v = max_v
            if node.min_v == 0:
                node.min_v = min_v

        debug('Setting the mobility model %s' % model)

        if (model == 'RandomWalk'):  # Random Walk model
            mob = random_walk(staMov)
        elif (model == 'TruncatedLevyWalk'):  # Truncated Levy Walk model
            mob = truncated_levy_walk(staMov)
        elif (model == 'RandomDirection'):  # Random Direction model
            mob = random_direction(staMov, dimensions=(MAX_X, MAX_Y))
        elif (model == 'RandomWayPoint'):  # Random Waypoint model
            mob = random_waypoint(staMov, wt_max=MAX_WT)
        elif (model == 'GaussMarkov'):  # Gauss-Markov model
            mob = gauss_markov(staMov, alpha=0.99)
        elif (model == 'ReferencePoint'):  # Reference Point Group model
            mob = reference_point_group(staMov,
                                        dimensions=(MAX_X, MAX_Y),
                                        aggregation=0.5)
        elif (model == 'TimeVariantCommunity'
              ):  # Time-variant Community Mobility Model
            mob = tvc(staMov,
                      dimensions=(MAX_X, MAX_Y),
                      aggregation=[0.5, 0.],
                      epoch=[100, 100])
        else:
            raise Exception("Model not defined!")

        if self.DRAW:
            plot.instantiateGraph(self.MAX_X, self.MAX_Y)
            plot.plotGraph(nodes, mobility.wallList, staMov, **dic)

        for xy in mob:
            i = 0
            for n in range(0, len(nodes)):
                node = nodes[n]
                if node in staMov:
                    if 'station' == node.type:
                        node.params['position'] = xy[i][0], xy[i][1], 0
                        i += 1
                        if self.DRAW:
                            plot.pltNode[node].set_data(xy[:, 0], xy[:, 1])
                            plot.drawTxt(node)
                            plot.drawCircle(node)
            if self.DRAW:
                plot.graphUpdate(node)
                plot.graphPause()
Пример #13
0
    def models(self, nodes=None, model=None, min_v=None, max_v=None, seed=None,
               staMov=None, **mobilityparam):

        np.random.seed(seed)

        # simulation area (units)
        MAX_X, MAX_Y = self.MAX_X, self.MAX_Y

        # max waiting time
        MAX_WT = 100.

        for node in nodes:
            if node.max_x == 0:
                node.max_x = MAX_X
            if node.max_y == 0:
                node.max_y = MAX_Y
            if node.max_v == 0:
                node.max_v = max_v
            if node.min_v == 0:
                node.min_v = min_v

        debug('Chossing the mobility model %s' % model)

        if(model == 'RandomWalk'):  # Random Walk model
            mob = random_walk(staMov)
        elif(model == 'TruncatedLevyWalk'):  # Truncated Levy Walk model
            mob = truncated_levy_walk(staMov)
        elif(model == 'RandomDirection'):  # Random Direction model
            mob = random_direction(staMov, dimensions=(MAX_X, MAX_Y))
        elif(model == 'RandomWayPoint'):  # Random Waypoint model
            mob = random_waypoint(staMov, wt_max=MAX_WT)
        elif(model == 'GaussMarkov'):  # Gauss-Markov model
            mob = gauss_markov(staMov, alpha=0.99)
        elif(model == 'ReferencePoint'):  # Reference Point Group model
            mob = reference_point_group(staMov, dimensions=(MAX_X, MAX_Y), aggregation=0.5)
        elif(model == 'TimeVariantCommunity'):  # Time-variant Community Mobility Model
            mob = tvc(staMov, dimensions=(MAX_X, MAX_Y), aggregation=[0.5, 0.], epoch=[100, 100])
        else:
            raise Exception("'Model not defined!")

        if self.DRAW:
            debug('Enabling Graph...\n')
            plot.instantiateGraph(self.MAX_X, self.MAX_Y)
            for node in nodes:
                self.graphInstantiateNodes(node)
                if node not in staMov or 'accessPoint' == node.type:
                    plot.pltNode[node].set_data(node.params['position'][0], node.params['position'][1])
                    plot.drawTxt(node)
                    plot.drawCircle(node)
                    if node.type == 'accessPoint':
                        for c in node.connections:
                            line = plot.plotLine2d([node.connections[c].params['position'][0], node.params['position'][0]], \
                                                   [node.connections[c].params['position'][1], node.params['position'][1]], 'b')
                            plot.plotLine(line)

        for xy in mob:
            i = 0
            for n in range (0, len(nodes)):
                node = nodes[n]
                if node in staMov:
                    if 'station' == node.type:
                        node.params['position'] = xy[i][0], xy[i][1], 0
                        i += 1
                        if self.DRAW:
                            plot.pltNode[node].set_data(xy[:, 0], xy[:, 1])
                            plot.drawTxt(node)
                            plot.drawCircle(node)
            if self.DRAW:
                plot.graphPause()
                plot.graphUpdate(node)
Пример #14
0
 def graphInstantiateNodes(self, node):
     plot.instantiateAnnotate(node)
     plot.instantiateCircle(node)
     plot.instantiateNode(node, self.MAX_X, self.MAX_Y)
     plot.graphUpdate(node)
Пример #15
0
    def models(self, nodes=None, model=None, max_x=None, max_y=None, min_v=None,
               max_v=None, seed=None, staMov=None, **mobilityparam):

        self.modelName = model
        np.random.seed(seed)

        # number of nodes
        nr_nodes = staMov

        # simulation area (units)
        MAX_X, MAX_Y = max_x, max_y

        # max and min velocity
        MIN_V, MAX_V = min_v, max_v

        # max waiting time
        MAX_WT = 100.

        for node in nodes:
            if node.max_x == 0:
                node.max_x = MAX_X
            if node.max_y == 0:
                node.max_y = MAX_Y

        if(self.modelName == 'RandomWalk'):  # # Random Walk model
            mob = random_walk(nr_nodes)
        elif(self.modelName == 'TruncatedLevyWalk'):  # # Truncated Levy Walk model
            mob = truncated_levy_walk(nr_nodes)
        elif(self.modelName == 'RandomDirection'):  # # Random Direction model
            mob = random_direction(nr_nodes, dimensions=(MAX_X, MAX_Y), velocity=(MIN_V, MAX_V))
        elif(self.modelName == 'RandomWayPoint'):  # # Random Waypoint model
            mob = random_waypoint(nr_nodes, dimensions=(MAX_X, MAX_Y), velocity=(MIN_V, MAX_V), wt_max=MAX_WT)
        elif(self.modelName == 'GaussMarkov'):  # # Gauss-Markov model
            mob = gauss_markov(nr_nodes, alpha=0.99)
        elif(self.modelName == 'ReferencePoint'):  # # Reference Point Group model
            mob = reference_point_group(nr_nodes, dimensions=(MAX_X, MAX_Y), aggregation=0.5)
        elif(self.modelName == 'TimeVariantCommunity'):  # # Time-variant Community Mobility Model
            mob = tvc(nr_nodes, dimensions=(MAX_X, MAX_Y), aggregation=[0.5, 0.], epoch=[100, 100])
        else:
            print 'Model not defined!'

        if self.DRAW:
            debug('Enabling Graph...\n')
            plot.instantiateGraph(self.MAX_X, self.MAX_Y)
            for node in nodes:
                self.graphInstantiateNodes(node)
                if node not in staMov or 'accessPoint' == node.type:
                    plot.pltNode[node].set_data(node.params['position'][0], node.params['position'][1])
                    plot.drawTxt(node)
                    plot.drawCircle(node)
                    if node.type == 'accessPoint':
                        for c in node.connections:
                            line = plot.plotLine2d([node.connections[c].params['position'][0], node.params['position'][0]], \
                                                   [node.connections[c].params['position'][1], node.params['position'][1]], 'b')
                            plot.plotLine(line)

        # Sometimes getting the error: Failed to connect to generic netlink.
        try:
            if model != '':
                for xy in mob:
                    i = 0
                    for n in range (0, len(nodes)):
                        node = nodes[n]
                        if node in staMov:
                            if 'station' == node.type:
                                node.params['position'] = xy[i][0], xy[i][1], 0
                                i += 1
                                if self.DRAW:
                                    plot.pltNode[node].set_data(xy[:, 0], xy[:, 1])
                                    plot.drawTxt(node)
                                    plot.drawCircle(node)
                    if self.DRAW:
                        plot.graphPause()
                        plot.graphUpdate(node)
        except:
            pass
Пример #16
0
    def models(self,
               model=None,
               staMov=None,
               min_v=0,
               max_v=0,
               seed=None,
               stations=None,
               aps=None,
               dstConn=None,
               srcConn=None,
               walls=None,
               plotNodes=None,
               MAX_X=0,
               MAX_Y=0):

        np.random.seed(seed)

        self.staList = stations
        self.apList = aps
        self.wallList = walls
        nodes = self.staList + self.apList + plotNodes

        dic = dict()
        dic['max_x'] = MAX_X
        dic['max_y'] = MAX_Y

        # max waiting time
        MAX_WT = 100.

        for sta in self.staList:
            if sta.max_x == 0:
                sta.max_x = MAX_X
            if sta.max_y == 0:
                sta.max_y = MAX_Y
            if sta.max_v == 0:
                sta.max_v = max_v
            if sta.min_v == 0:
                sta.min_v = min_v

        debug('Configuring the mobility model %s' % model)

        if (model == 'RandomWalk'):  # Random Walk model
            mob = random_walk(staMov)
        elif (model == 'TruncatedLevyWalk'):  # Truncated Levy Walk model
            mob = truncated_levy_walk(staMov)
        elif (model == 'RandomDirection'):  # Random Direction model
            mob = random_direction(staMov, dimensions=(MAX_X, MAX_Y))
        elif (model == 'RandomWayPoint'):  # Random Waypoint model
            mob = random_waypoint(staMov, wt_max=MAX_WT)
        elif (model == 'GaussMarkov'):  # Gauss-Markov model
            mob = gauss_markov(staMov, alpha=0.99)
        elif (model == 'ReferencePoint'):  # Reference Point Group model
            mob = reference_point_group(staMov,
                                        dimensions=(MAX_X, MAX_Y),
                                        aggregation=0.5)
        elif (model == 'TimeVariantCommunity'
              ):  # Time-variant Community Mobility Model
            mob = tvc(staMov,
                      dimensions=(MAX_X, MAX_Y),
                      aggregation=[0.5, 0.],
                      epoch=[100, 100])
        else:
            raise Exception("Model not defined!")

        if self.DRAW:
            plot.instantiateGraph(MAX_X, MAX_Y)
            plot.plotGraph(nodes, self.wallList, staMov, srcConn, dstConn,
                           **dic)

        for xy in mob:
            i = 0
            for node in staMov:
                node.params['position'] = xy[i][0], xy[i][1], 0
                i += 1
                if self.DRAW:
                    plot.pltNode[node].set_data(xy[:, 0], xy[:, 1])
                    plot.drawTxt(node)
                    plot.drawCircle(node)
            if self.DRAW:
                plot.graphUpdate(node)
                plot.graphPause()
Пример #17
0
 def models(self, nodes=None, model=None, max_x=None, max_y=None, min_v=None, 
            max_v=None, seed=None, staMov=None, **mobilityparam):
     
     self.modelName = model
     np.random.seed(seed)
     
     # number of nodes
     nr_nodes = staMov
     
     # simulation area (units)
     MAX_X, MAX_Y = max_x, max_y
     
     # max and min velocity
     MIN_V, MAX_V = min_v, max_v
     
     # max waiting time
     MAX_WT = 100.
     
     if(self.modelName=='RandomWalk'): ## Random Walk model            
         mob = random_walk(nr_nodes, dimensions=(MAX_X, MAX_Y)) 
     elif(self.modelName=='TruncatedLevyWalk'): ## Truncated Levy Walk model
         mob = truncated_levy_walk(nr_nodes, dimensions=(MAX_X, MAX_Y)) 
     elif(self.modelName=='RandomDirection'): ## Random Direction model            
         mob = random_direction(nr_nodes, dimensions=(MAX_X, MAX_Y), velocity=(MIN_V, MAX_V)) 
     elif(self.modelName=='RandomWayPoint'): ## Random Waypoint model           
         mob = random_waypoint(nr_nodes, dimensions=(MAX_X, MAX_Y), velocity=(MIN_V, MAX_V), wt_max=MAX_WT) 
     elif(self.modelName=='GaussMarkov'): ## Gauss-Markov model           
         mob = gauss_markov(nr_nodes, dimensions=(MAX_X, MAX_Y), alpha=0.99) 
     elif(self.modelName=='ReferencePoint'): ## Reference Point Group model           
         mob = reference_point_group(nr_nodes, dimensions=(MAX_X, MAX_Y), aggregation=0.5) 
     elif(self.modelName=='TimeVariantCommunity'): ## Time-variant Community Mobility Model            
         mob = tvc(nr_nodes, dimensions=(MAX_X, MAX_Y), aggregation=[0.5,0.], epoch=[100,100])        
     else:
         print 'Model not defined!'
     
     if self.DRAW:
         debug('Enabling Graph...\n')
         plot.instantiateGraph(self.MAX_X, self.MAX_Y)
         for node in nodes:
             self.graphInstantiateNodes(node)
             if node not in staMov or 'accessPoint' == node.type:
                 plot.pltNode[node].set_data(node.params['position'][0],node.params['position'][1])
                 plot.drawTxt(node)
                 plot.drawCircle(node)  
                 if node.type == 'accessPoint': 
                     for c in node.connections:
                         line = plot.plotLine2d([node.connections[c].params['position'][0],node.params['position'][0]], \
                                                [node.connections[c].params['position'][1],node.params['position'][1]], 'b')
                         plot.plotLine(line)
                         
     #Sometimes getting the error: Failed to connect to generic netlink.
     try:
         if model!='':
             for xy in mob:              
                 i = 0  
                 for n in range (0,len(nodes)):
                     node = nodes[n]
                     if node in staMov:
                         if 'station' == node.type:
                             node.params['position'] = xy[i][0], xy[i][1], 0
                             i += 1                       
                             if self.DRAW:
                                 plot.pltNode[node].set_data(xy[:,0],xy[:,1])
                                 plot.drawTxt(node)
                                 plot.drawCircle(node)
                 if self.DRAW:
                     time.sleep(0.01)
                     plot.graphUpdate(node) 
     except:
         pass               
Пример #18
0
 def instatiateNodes(self, node):
     plot.instantiateAnnotate(node)
     plot.instantiateCircle(node)
     plot.instantiateNode(node, self.MAX_X, self.MAX_Y)
     plot.graphUpdate(node)