Esempio n. 1
0
        def SDPRSSLocate(self, RN, PL0, d0, RSS, RSSnp, RSSStd, Rest):

                RoA=self.getRange(RN, PL0, d0, RSS, RSSnp, RSSStd, Rest)
                

                RN=cvxm.matrix(RN)
                RSS=cvxm.matrix(RSS)
                RSSnp=cvxm.matrix(RSSnp)
                RSSStd=cvxm.matrix(RSSStd)
                PL0=cvxm.matrix(PL0)
                RoA=cvxm.matrix(RoA)
                mrss,nrss=cvxm.size(RN)
                
                Si = array([(1/d0**2)*10**((RSS[0,0]-PL0[0,0])/(5.0*RSSnp[0,0])),(1/d0**2)*10**((RSS[1,0]-PL0[1,0])/(5.0*RSSnp[1,0])),(1/d0**2)*10**((RSS[2,0]-PL0[2,0])/(5.0*RSSnp[2,0])),(1/d0**2)*10**((RSS[3,0]-PL0[3,0])/(5.0*RSSnp[3,0]))])
                #Si = array([(1/d0**2)*10**(-(RSS[0,0]-PL0[0,0])/(5.0*RSSnp[0,0])),(1/d0**2)*10**(-(RSS[0,1]-PL0[1,0])/(5.0*RSSnp[0,1])),(1/d0**2)*10**(-(RSS[0,2]-PL0[2,0])/(5.0*RSSnp[0,2])),(1/d0**2)*10**(-(RSS[0,3]-PL0[3,0])/(5.0*RSSnp[0,3]))])
                
                Im = cvxm.eye(mrss)
                Y=cvxm.optvar('Y',mrss+1,mrss+1)
                t=cvxm.optvar('t',nrss,1)

                prob=cvxm.problem(cvxm.minimize(cvxm.norm2(t)))
                prob.constr.append(Y>=0)
                prob.constr.append(Y[mrss,mrss]==1)
                for i in range(nrss):
                    X0=cvxm.matrix([[Im, -cvxm.transpose(RN[:,i])],[-RN[:,i], cvxm.transpose(RN[:,i])*RN[:,i]]])
                    prob.constr.append(-RSSStd[i,0]*t[i]<Si[i]*cvxm.trace(X0*Y)-1)
                    prob.constr.append(RSSStd[i,0]*t[i]>Si[i]*cvxm.trace(X0*Y)-1)
               
                prob.solve()
                
                Pval=Y.value
                X_cvx=Pval[:2,-1]
                
                return X_cvx
Esempio n. 2
0
        def SDPTDoALocate(self, RN1, RN2, TDoA, TDoAStd):
                """
                Apply SDP approximation and localization
                """
                RN1 = cvxm.matrix(RN1)
                RN2 = cvxm.matrix(RN2)
                TDoA = cvxm.matrix(TDoA)
                c       = 3e08                                          
                RDoA     = c*TDoA
                RDoAStd=cvxm.matrix(c*TDoAStd)
                mtdoa,ntdoa=cvxm.size(RN1)
                Im = cvxm.eye(mtdoa)
                Y=cvxm.optvar('Y',mtdoa+1,mtdoa+1)
                t=cvxm.optvar('t',ntdoa,1)
                prob=cvxm.problem(cvxm.minimize(cvxm.norm2(t)))
                prob.constr.append(Y>=0)
                prob.constr.append(Y[mtdoa,mtdoa]==1)
                for i in range(ntdoa):
                    X0=cvxm.matrix([[Im, -cvxm.transpose(RN1[:,i])],[-RN1[:,i], cvxm.transpose(RN1[:,i])*RN1[:,i]]])
                    X1=cvxm.matrix([[Im, -cvxm.transpose(RN2[:,i])],[-RN2[:,i], cvxm.transpose(RN2[:,i])*RN2[:,i]]])
                    prob.constr.append(-RDoAStd[i,0]*t[i]<cvxm.trace(X0*Y)+cvxm.trace(X1*Y)-RDoA[i,0]**2)
                    prob.constr.append(RDoAStd[i,0]*t[i]>cvxm.trace(X0*Y)+cvxm.trace(X1*Y)-RDoA[i,0]**2)
                prob.solve()
                Pval=Y.value
                X_cvx=Pval[:2,-1]

                return X_cvx
Esempio n. 3
0
        def SDPToALocate(self, RN, ToA, ToAStd):
                """
                Apply SDP approximation and localization
                """
                RN = cvxm.matrix(RN)
                ToA = cvxm.matrix(ToA)
                
                c       = 3e08                                          # Speed of light
                RoA     = c*ToA
                RoAStd  = c*ToAStd
                RoAStd = cvxm.matrix(RoAStd)
                mtoa,ntoa=cvxm.size(RN)
                Im = cvxm.eye(mtoa)
                Y=cvxm.optvar('Y',mtoa+1,mtoa+1)
                t=cvxm.optvar('t',ntoa,1)
                prob=cvxm.problem(cvxm.minimize(cvxm.norm2(t)))
                prob.constr.append(Y>=0)
                prob.constr.append(Y[mtoa,mtoa]==1)
                for i in range(ntoa):
                    X0=cvxm.matrix([[Im, -cvxm.transpose(RN[:,i])],[-RN[:,i], cvxm.transpose(RN[:,i])*RN[:,i]]])
                    prob.constr.append(-t[i]<(cvxm.trace(X0*Y)-RoA[i]**2)*(1/RoAStd[i]))
                    prob.constr.append(t[i]>(cvxm.trace(X0*Y)-RoA[i]**2)*(1/RoAStd[i]))
                prob.solve()
                Pval=Y.value
                X_cvx=Pval[:2,-1]

                return X_cvx