Пример #1
0
def localizeByTrilateration(nSensor,nAnchor,locX,conX,posX,disX,noiseLevel):
    n = nSensor + nAnchor
    nPreLocNode = 0
    nCurLocNode = np.sum(locX)
    while(nPreLocNode<nCurLocNode):
        nPreLocNode = nCurLocNode
        for i in range(nSensor):
            if (localizability.isLocalizable(locX,conX,i) and locX[i]==0):
                locX[i] = 1
                anchorIndexes = helper.getNeighborAnhors(n,i,locX,conX)
                anchorIndexes = helper.getSortedReliableNodes(noiseLevel,anchorIndexes)
                localize.inicialLocalize(i,anchorIndexes[0],anchorIndexes[1],anchorIndexes[2],posX,disX)
                noiseLevel[i] = 3
        nCurLocNode = np.sum(locX)
Пример #2
0
def localizeByMultilateration(nSensor,nAnchor,sigma,radiorange,locX,conX,posX,disX,cLevel,typeW,typeC):
    n = nSensor + nAnchor
    nPreLocNode = 0
    nCurLocNode = np.sum(locX)
    while(nPreLocNode<nCurLocNode):
        nPreLocNode = nCurLocNode
        for i in range(nSensor):
            if locX[i] == 0 and helper.isLocalizable(locX,conX,i):
                locX[i] = 1
                anchorIndexes = helper.getNeighborAnhors(n,i,locX,conX)
                nAnchor_neighbor = len(anchorIndexes)
                posX_neighbor = posX[anchorIndexes]
                disX_neighbor = disX[i][anchorIndexes]
                cLevel_neighbor = cLevel[anchorIndexes]
                [p,credity] = calcPosition(sigma,radiorange,nAnchor_neighbor,posX_neighbor,disX_neighbor,typeW,typeC,cLevel_neighbor)
                if credity == None:cLevel[i]=0
                else : cLevel[i] = credity
                posX[i] = p
                # print i
                # print cLevel
        nCurLocNode = np.sum(locX)
    return 0