diff --git a/testAOATransform.py b/testAOATransform.py index 0acaf54..d0820e1 100644 --- a/testAOATransform.py +++ b/testAOATransform.py @@ -10,19 +10,14 @@ plt.close('all') fig_ctr = 0 -""" Banco de gráficas e tests exclusivo da función fitAOA (e correción de backlobes se corresponde)""" - -# Posicións transmisor e receptor - - +""" Testbench for fitAOA and backlobe correction functions """ phi0 = 0 - -# Selección de escenario - UMi, UMa, RMa, InH-Office-Mixed, InH-Office-Open -sce = "UMi" +# Selección de escenario +sce = "UMa" # Posicións transmisor e receptor tx = (0,0,10) -rx = (45,45,1.5) -#Creación de canle- con largeBW e scenario UMi +rx = (45,20,1.5) +#Creación de canle modelA = mpg.ThreeGPPMultipathChannelModel(scenario = "UMi", bLargeBandwidthOption=True) #Xeramos clusters e subpaths non adaptados: plinfoA,macroA,clustersNAD,subpathsNAD = modelA.create_channel(tx,rx) @@ -31,34 +26,32 @@ clustersAD = modelA.fitAOA(tx,rx,clustersAD) subpathsAD = modelA.fitAOA(tx,rx,subpathsAD) - - -#%% -plinfoA,macroA,clustersA,subpathsA = modelA.create_channel(tx,rx) - #AOAs non correxidos -AOA_cA = clustersA['AOA'].T.to_numpy() * (np.pi/(180.0)) -AOA_sA = subpathsA['AOA'].T.to_numpy() * (np.pi/(180.0)) +AOA_cA = clustersNAD['AOA'].T.to_numpy() * (np.pi/(180.0)) +AOA_sA = subpathsNAD['AOA'].T.to_numpy() * (np.pi/(180.0)) -clustersAD = clustersA.copy() -subpathsAD = subpathsA.copy() +clustersAD = clustersNAD.copy() +subpathsAD = subpathsNAD.copy() # Adaptación canle 1: clustersAD = modelA.fitAOA(tx,rx,clustersAD) subpathsAD = modelA.fitAOA(tx,rx,subpathsAD) -#%% + #Se queremos ademais correxir backlobes: -clustersAD = modelA.deleteBacklobes(clustersAD,phi0) -subpathsAD = modelA.deleteBacklobes(subpathsAD,phi0) +clustersADb = modelA.deleteBacklobes(tx,rx,clustersAD,phi0) +subpathsADb = modelA.deleteBacklobes(tx,rx,subpathsAD,phi0) -#%% #Posición dos rebotes: xc_A,yc_A = [clustersAD['xloc'].T.to_numpy(),clustersAD['yloc'].T.to_numpy()] xs_A,ys_A = [subpathsAD['xloc'].T.to_numpy(),subpathsAD['yloc'].T.to_numpy()] +xc_Ab,yc_Ab = [clustersADb['xloc'].T.to_numpy(),clustersADb['yloc'].T.to_numpy()] +xs_Ab,ys_Ab = [subpathsADb['xloc'].T.to_numpy(),subpathsADb['yloc'].T.to_numpy()] + + #Distancia entre receptor e posición do rebote liRX_cA = np.sqrt((xc_A-rx[0])**2+(yc_A - rx[1])**2) liRX_sA = np.sqrt((xs_A-rx[0])**2+(ys_A - rx[1])**2) @@ -66,6 +59,15 @@ liTX_cA = np.sqrt(xc_A**2+yc_A**2) liTX_sA = np.sqrt(xs_A**2+ys_A**2) +#Distancia entre receptor e posición do rebote +liRX_cAb = np.sqrt((xc_Ab-rx[0])**2+(yc_Ab - rx[1])**2) +liRX_sAb = np.sqrt((xs_Ab-rx[0])**2+(ys_Ab - rx[1])**2) +#Distancia entre transmisor e receptor do rebote +liTX_cAb = np.sqrt(xc_Ab**2+yc_Ab**2) +liTX_sAb = np.sqrt(xs_Ab**2+ys_Ab**2) + +#Caso A: Sen correción de backlobes + #AOAs correxidos AOA_cfA = clustersAD['AOA'].T.to_numpy() * (np.pi/(180.0)) AOA_sfA = subpathsAD['AOA'].T.to_numpy() * (np.pi/(180.0)) @@ -77,79 +79,18 @@ tau_cA = clustersAD['tau'].T.to_numpy() * (np.pi/(180.0)) tau_sA = subpathsAD['tau'].T.to_numpy() * (np.pi/(180.0)) +#Caso B: Correción de backlobes -# ----------------------------- -# ---- Canle B, largeBW = true, adaptrayTX ) = true -# ----------------------------- - -modelB = mpg.ThreeGPPMultipathChannelModel(scenario = sce, bLargeBandwidthOption=False, adaptRaytx = True) -plinfoB,macroB,clustersB,subpathsB = modelB.create_channel(tx,rx) - - -#Posición dos rebotes: -xc_B,yc_B = [clustersB['xloc'].T.to_numpy(),clustersB['yloc'].T.to_numpy()] -xs_B,ys_B = [subpathsB['xloc'].T.to_numpy(),subpathsB['yloc'].T.to_numpy()] +#AOAs correxidos +AOA_cfAb = clustersADb['AOA'].T.to_numpy() * (np.pi/(180.0)) +AOA_sfAb = subpathsADb['AOA'].T.to_numpy() * (np.pi/(180.0)) -#Distancia entre receptor e posición do rebote -liRX_cB = np.sqrt((xc_B-rx[0])**2+(yc_B - rx[1])**2) -liRX_sB = np.sqrt((xs_B-rx[0])**2+(xs_B - rx[1])**2) -#Distancia entre transmisor e receptor do rebote -liTX_cB = np.sqrt(xc_B**2+yc_B**2) -liTX_sB = np.sqrt(xs_B**2+ys_B**2) - -# AOA_cB = clustersB['AOA'].T.to_numpy() * (np.pi/(180.0)) -# AOA_sB = subpathsB['AOA'].T.to_numpy() * (np.pi/(180.0)) - -# AOD_cB = clustersB['AOD'].T.to_numpy() * (np.pi/(180.0)) -# AOD_sB = subpathsB['AOD'].T.to_numpy() * (np.pi/(180.0)) - -# nSubp = subpathsB['tau'].size - -# fig_ctr+=1 -# fig = plt.figure(fig_ctr) -# plt.title("Subpaths correxidos directamente") -# plt.grid(linestyle = '--') -# plt.xlabel('x-location (m)') -# plt.ylabel('y-location (m)') -# plt.plot(tx[0],tx[1],'^g',label='BS',linewidth = '4.5') -# plt.plot(rx[0],rx[1],'^r',label='UE', linewidth='4.5') - -# plt.plot(xs_B,ys_B,'x',label='Rebotes subpaths') -# for i in range(0,AOD_sB.size): -# plt.plot([tx[0],tx[0]+liTX_sB[i]*np.cos(AOD_sB[i])],[tx[1],tx[1]+liTX_sB[i]*np.sin(AOD_sB[i])],color=cm.jet(i/(nSubp-1)),linewidth = '0.5') -# plt.plot([rx[0],rx[0]+liRX_sB[i]*np.cos(AOA_sB[i])],[rx[1],rx[1]+liRX_sB[i]*np.sin(AOA_sB[i])],color=cm.jet(i/(nSubp-1)),linewidth = '0.5') -# legend = plt.legend(shadow=True, fontsize='10') -# ruta_archivo = os.path.join("img", "nombre_archivo") - - -# fig_ctr+=1 -# fig = plt.figure(fig_ctr) -# nClus = clustersB['tau'].size -# plt.subplot(2,2,1, projection='polar',title="AoD") -# for n in range(nClus): -# AOD_1c = subpathsB.loc[n,:].AOD.to_numpy() *np.pi/180 -# pathAmplitudesdBtrunc25_1c = np.maximum(10*np.log10( subpathsB.loc[n,:].P.to_numpy() ),-45) -# Nsp=len(AOD_1c) -# plt.polar(AOD_1c*np.ones((2,1)),np.vstack([-40*np.ones((1,Nsp)),pathAmplitudesdBtrunc25_1c]),':',color=cm.jet(n/(nClus-1)) ) -# plt.scatter(AOD_1c,pathAmplitudesdBtrunc25_1c,color=cm.jet(n/(nClus-1)),marker='<') -# plt.yticks(ticks=[-40,-30,-20,-10],labels=['-40dB','-30dB','-20dB','-10dB'],fontsize = 7) -# plt.subplot(2,2,2, projection='polar') -# for n in range(nClus): -# AOA_1cf = subpathsB.loc[n,:].AOA.to_numpy() *np.pi/180 -# pathAmplitudesdBtrunc25_1c = np.maximum(10*np.log10( subpathsB.loc[n,:].P.to_numpy() ),-45) -# Nsp=len(AOA_1cf) -# plt.polar(AOA_1cf*np.ones((2,1)),np.vstack([-40*np.ones((1,Nsp)),pathAmplitudesdBtrunc25_1c]),':',color=cm.jet(n/(nClus-1)) ) -# plt.scatter(AOA_1cf,pathAmplitudesdBtrunc25_1c,color=cm.jet(n/(nClus-1)),marker='+') -# plt.yticks(ticks=[-40,-30,-20,-10],labels=['-40dB','-30dB','-20dB','-10dB'],fontsize=7) -# plt.subplot(2,1,2) -# plt.ylabel("power [dB]") -# plt.xlabel("TDoA (s)") -# for n in range(nClus): -# markerline, stemlines, baseline = plt.stem( subpathsB.loc[n,:].tau.to_numpy() ,10*np.log10( subpathsB.loc[n,:].P.to_numpy() ),bottom=np.min(10*np.log10(subpathsB.P.to_numpy()))) -# plt.setp(stemlines, color=cm.jet(n/(nClus-1))) -# plt.setp(markerline, color=cm.jet(n/(nClus-1))) -# plt.grid() +#AODs e tau non varían +AOD_cAb = clustersADb['AOD'].T.to_numpy() * (np.pi/(180.0)) +AOD_sAb = subpathsADb['AOD'].T.to_numpy() * (np.pi/(180.0)) +tau_cAb = clustersADb['tau'].T.to_numpy() * (np.pi/(180.0)) +tau_sAb = subpathsADb['tau'].T.to_numpy() * (np.pi/(180.0)) # ---- Gráfica 1, camiños non adaptados: @@ -160,6 +101,7 @@ plt.ylabel('y-location (m)') nClus = tau_cA.size +nClusb = tau_cAb.size nSubp = tau_sA.size plt.plot([tx[0],rx[0]],[tx[1],rx[1]],'--') @@ -193,7 +135,28 @@ plt.plot(rx[0],rx[1],'^r',label='UE', linewidth='4.5') legend = plt.legend(shadow=True, fontsize='10') -ruta = os.path.join("img", "fitAOA_clusAD.png") +ruta = os.path.join("img", "fitAOA_nbclusAD.png") +plt.savefig(ruta) + +#Gráfica 2 - Camiños clusters adaptados con corrección de backlobes + +fig_ctr+=1 +fig = plt.figure(fig_ctr) + +plt.grid(linestyle = '--') +plt.xlabel('x-location (m)') +plt.ylabel('y-location (m)') + +plt.plot([tx[0],rx[0]],[tx[1],rx[1]],'--') +plt.plot(xc_Ab,yc_Ab,'x',label='Rebotes clusters') +for i in range(0,AOD_cAb.size): + plt.plot([tx[0],tx[0]+liTX_cAb[i]*np.cos(AOD_cAb[i])],[tx[1],tx[1]+liTX_cAb[i]*np.sin(AOD_cAb[i])],color='red',linewidth = '0.9') + plt.plot([rx[0],rx[0]+liRX_cAb[i]*np.cos(AOA_cfAb[i])],[rx[1],rx[1]+liRX_cAb[i]*np.sin(AOA_cfAb[i])],color='blue',linewidth = '0.9') +plt.plot(tx[0],tx[1],'^g',label='BS',linewidth = '4.5') +plt.plot(rx[0],rx[1],'^r',label='UE', linewidth='4.5') +legend = plt.legend(shadow=True, fontsize='10') + +ruta = os.path.join("img", "fitAOA_bclusAD.png") plt.savefig(ruta) # Gráfica 3 - Subpaths non adaptados @@ -231,7 +194,25 @@ plt.plot([rx[0],rx[0]+liRX_sA[i]*np.cos(AOA_sfA[i])],[rx[1],rx[1]+liRX_sA[i]*np.sin(AOA_sfA[i])],color=cm.jet(i/(nSubp-1)),linewidth = '0.5') legend = plt.legend(shadow=True, fontsize='10') -ruta = os.path.join("img", "fitAOA_subpAD.png") +ruta = os.path.join("img", "fitAOA_nbsubpAD.png") +plt.savefig(ruta) + +#subpaths con backlobe correction +fig_ctr+=1 +fig = plt.figure(fig_ctr) +plt.grid(linestyle = '--') +plt.xlabel('x-location (m)') +plt.ylabel('y-location (m)') +plt.plot(tx[0],tx[1],'^g',label='BS',linewidth = '4.5') +plt.plot(rx[0],rx[1],'^r',label='UE', linewidth='4.5') + +plt.plot(xs_Ab,ys_Ab,'x',label='Rebotes subpaths') +for i in range(0,AOD_sAb.size): + plt.plot([tx[0],tx[0]+liTX_sAb[i]*np.cos(AOD_sAb[i])],[tx[1],tx[1]+liTX_sAb[i]*np.sin(AOD_sAb[i])],color='red',linewidth = '0.5') + plt.plot([rx[0],rx[0]+liRX_sAb[i]*np.cos(AOA_sfAb[i])],[rx[1],rx[1]+liRX_sAb[i]*np.sin(AOA_sfAb[i])],color='blue',linewidth = '0.5') +legend = plt.legend(shadow=True, fontsize='10') + +ruta = os.path.join("img", "fitAOA_bsubpAD.png") plt.savefig(ruta) @@ -239,19 +220,19 @@ fig_ctr+=1 fig = plt.figure(fig_ctr) -nClus = clustersA['tau'].size +nClus = clustersNAD['tau'].size plt.subplot(2,2,1, projection='polar',title="AoD") for n in range(nClus): - AOD_1c = subpathsA.loc[n,:].AOD.to_numpy() *np.pi/180 - pathAmplitudesdBtrunc25_1c = np.maximum(10*np.log10( subpathsA.loc[n,:].P.to_numpy() ),-45) + AOD_1c = subpathsNAD.loc[n,:].AOD.to_numpy() *np.pi/180 + pathAmplitudesdBtrunc25_1c = np.maximum(10*np.log10( subpathsNAD.loc[n,:].P.to_numpy() ),-45) Nsp=len(AOD_1c) plt.polar(AOD_1c*np.ones((2,1)),np.vstack([-40*np.ones((1,Nsp)),pathAmplitudesdBtrunc25_1c]),':',color=cm.jet(n/(nClus-1)) ) plt.scatter(AOD_1c,pathAmplitudesdBtrunc25_1c,color=cm.jet(n/(nClus-1)),marker='<') plt.yticks(ticks=[-40,-30,-20,-10],labels=['-40dB','-30dB','-20dB','-10dB'],fontsize = 7) plt.subplot(2,2,2, projection='polar') for n in range(nClus): - AOA_1cf = subpathsA.loc[n,:].AOA.to_numpy() *np.pi/180 - pathAmplitudesdBtrunc25_1c = np.maximum(10*np.log10(subpathsA.loc[n,:].P.to_numpy() ),-45) + AOA_1cf = subpathsNAD.loc[n,:].AOA.to_numpy() *np.pi/180 + pathAmplitudesdBtrunc25_1c = np.maximum(10*np.log10(subpathsNAD.loc[n,:].P.to_numpy() ),-45) Nsp=len(AOA_1cf) plt.polar(AOA_1cf*np.ones((2,1)),np.vstack([-40*np.ones((1,Nsp)),pathAmplitudesdBtrunc25_1c]),':',color=cm.jet(n/(nClus-1)) ) plt.scatter(AOA_1cf,pathAmplitudesdBtrunc25_1c,color=cm.jet(n/(nClus-1)),marker='+') @@ -260,7 +241,7 @@ plt.ylabel("power [dB]") plt.xlabel("TDoA (s)") for n in range(nClus): - markerline, stemlines, baseline = plt.stem( subpathsA.loc[n,:].tau.to_numpy() ,10*np.log10( subpathsAD.loc[n,:].P.to_numpy() ),bottom=np.min(10*np.log10(subpathsAD.P.to_numpy()))) + markerline, stemlines, baseline = plt.stem( subpathsNAD.loc[n,:].tau.to_numpy() ,10*np.log10( subpathsAD.loc[n,:].P.to_numpy() ),bottom=np.min(10*np.log10(subpathsAD.P.to_numpy()))) plt.setp(stemlines, color=cm.jet(n/(nClus-1))) plt.setp(markerline, color=cm.jet(n/(nClus-1))) plt.grid() @@ -271,6 +252,41 @@ # Gráfica 6: Deck de subpaths AOD, AOA e delay correxido +fig_ctr+=1 +fig = plt.figure(fig_ctr) +nSubpb = subpathsADb['tau'].size +plt.subplot(2,2,1, projection='polar',title="AoD") + +AOD_1c = subpathsADb['AOD'].to_numpy() *np.pi/180 +pathAmplitudesdBtrunc25_1c = np.maximum(10*np.log10( subpathsADb['P'].to_numpy() ),-45) +Nsp=len(AOD_1c) +plt.polar(AOD_1c,pathAmplitudesdBtrunc25_1c,':',color='red' ) +plt.scatter(AOD_1c,pathAmplitudesdBtrunc25_1c,color='red',marker='<') +plt.yticks(ticks=[-40,-30,-20,-10],labels=['-40dB','-30dB','-20dB','-10dB'],fontsize = 7) +plt.subplot(2,2,2, projection='polar') + + +AOA_1cf = subpathsADb['AOA'].to_numpy() *np.pi/180 +pathAmplitudesdBtrunc25_1c = np.maximum(10*np.log10( subpathsADb['P'].to_numpy() ),-45) +Nsp=len(AOA_1cf) +plt.polar(AOA_1cf,pathAmplitudesdBtrunc25_1c,':',color='blue' ) +plt.scatter(AOA_1cf,pathAmplitudesdBtrunc25_1c,color='blue',marker='+') + +plt.yticks(ticks=[-40,-30,-20,-10],labels=['-40dB','-30dB','-20dB','-10dB'],fontsize=7) +plt.subplot(2,1,2) +plt.ylabel("power [dB]") +plt.xlabel("TDoA (s)") + +markerline, stemlines, baseline = plt.stem( subpathsADb['tau'].to_numpy() ,10*np.log10( subpathsADb['P'].to_numpy() ),bottom=np.min(10*np.log10(subpathsADb['P'].to_numpy()))) +plt.setp(stemlines, color='green') +plt.setp(markerline, color='orange') +plt.grid() + +ruta = os.path.join("img", "fitAOA_bdeckAD.png") +plt.savefig(ruta) + +#Gráfica 7: deck de subpaths con backlobe correction + fig_ctr+=1 fig = plt.figure(fig_ctr) nClus = clustersAD['tau'].size @@ -299,7 +315,7 @@ plt.setp(markerline, color=cm.jet(n/(nClus-1))) plt.grid() -ruta = os.path.join("img", "fitAOA_deckAD.png") +ruta = os.path.join("img", "fitAOA_nbdeckAD.png") plt.savefig(ruta) # %% diff --git a/testAODTransform.py b/testAODTransform.py index 4e5488d..17686b5 100644 --- a/testAODTransform.py +++ b/testAODTransform.py @@ -92,7 +92,7 @@ plt.plot([rx[0],rx[0]+liRX_cA[i]*np.cos(AOA_cA[i])],[rx[1],rx[1]+liRX_cA[i]*np.sin(AOA_cA[i])],color=cm.jet(i/(nClus-1)),linewidth = '0.5') legend = plt.legend(shadow=True, fontsize='10') -ruta = os.path.join("img", "fitAOD_clusNAD.png") +ruta = os.path.join("img", "testNAD.png") plt.savefig(ruta) @@ -115,10 +115,10 @@ plt.plot([rx[0],rx[0]+liRX_cA[i]*np.cos(AOA_cA[i])],[rx[1],rx[1]+liRX_cA[i]*np.sin(AOA_cA[i])],color=cm.jet(i/(nClus-1)),linewidth = '0.5') legend = plt.legend(shadow=True, fontsize='10') -ruta = os.path.join("img", "fitAOD_clusAD.png") +ruta = os.path.join("img", "testAD.png") plt.savefig(ruta) - +#%% # Gráfica 3 - Subpaths non adaptados fig_ctr+=1 @@ -139,7 +139,7 @@ ruta = os.path.join("img", "fitAOD_subpNAD.png") plt.savefig(ruta) - +#%% # Gráfica 4 - Subpaths adaptados fig_ctr+=1 @@ -159,7 +159,7 @@ ruta = os.path.join("img", "fitAOD_subpAD.png") plt.savefig(ruta) - +#%% # Gráfica 5: Deck de subpaths AOD, AOA e delay non correxido diff --git a/testDelayTransform.py b/testDelayTransform.py index d7d138b..0d98c8e 100644 --- a/testDelayTransform.py +++ b/testDelayTransform.py @@ -129,8 +129,7 @@ plt.grid(linestyle = '--') plt.xlabel('x-location (m)') plt.ylabel('y-location (m)') -plt.xlim(-60,60) -plt.ylim(-60,60) + plt.plot(tx[0],tx[1],'^g',label='BS',linewidth = '4.5') plt.plot(rx[0],rx[1],'^r',label='UE', linewidth='4.5') @@ -152,8 +151,7 @@ plt.grid(linestyle = '--') plt.xlabel('x-location (m)') plt.ylabel('y-location (m)') -plt.xlim(-60,60) -plt.ylim(-60,60) + plt.plot(tx[0],tx[1],'^g',label='BS',linewidth = '4.5') plt.plot(rx[0],rx[1],'^r',label='UE', linewidth='4.5') @@ -165,9 +163,8 @@ ruta = os.path.join("img", "fitDelay_subpAD.png") plt.savefig(ruta) - # Gráfica 5: Deck de subpaths AOD, AOA e delay non correxido -#%% + fig_ctr+=1 fig = plt.figure(fig_ctr) nClus = ad_clustersA['tau'].size @@ -196,6 +193,8 @@ plt.setp(stemlines, color=cm.jet(n/(nClus-1))) plt.setp(markerline, color=cm.jet(n/(nClus-1))) plt.grid() +ruta = os.path.join("img", "fitDelay_deckNAD.png") +plt.savefig(ruta) # Gráfica 6: Deck de subpaths AOD, AOA e delay correxido @@ -225,4 +224,7 @@ markerline, stemlines, baseline = plt.stem( ad_subpathsA.loc[n,:].tau.to_numpy() ,10*np.log10( ad_subpathsA.loc[n,:].P.to_numpy() ),bottom=np.min(10*np.log10(ad_subpathsA.P.to_numpy()))) plt.setp(stemlines, color=cm.jet(n/(nClus-1))) plt.setp(markerline, color=cm.jet(n/(nClus-1))) -plt.grid() \ No newline at end of file +plt.grid() + +ruta = os.path.join("img", "fitDelay_deckAD.png") +plt.savefig(ruta) \ No newline at end of file diff --git a/threeGPPMultipathGenerator.py b/threeGPPMultipathGenerator.py index 35f9a1a..9811d00 100644 --- a/threeGPPMultipathGenerator.py +++ b/threeGPPMultipathGenerator.py @@ -396,7 +396,7 @@ def dfTS38900Table756(self,fc): ] #RMa hasta 7GHz y el resto hasta 100GHz - def __init__(self, fc = 28, scenario = "UMi", bLargeBandwidthOption=False, corrDistance = 15.0, avgStreetWidth=20, avgBuildingHeight=5, bandwidth=20e6, arrayWidth=1,arrayHeight=1, maxM=40, adaptRaytx = False): + def __init__(self, fc = 28, scenario = "UMi", bLargeBandwidthOption=False, corrDistance = 15.0, avgStreetWidth=20, avgBuildingHeight=5, bandwidth=20e6, arrayWidth=1,arrayHeight=1, maxM=40, funPostprocess = None, prob = None): self.frecRefGHz = fc self.scenario = scenario self.corrDistance = corrDistance @@ -411,7 +411,8 @@ def __init__(self, fc = 28, scenario = "UMi", bLargeBandwidthOption=False, corrD self.wavelength = 3e8/(fc*1e9) self.allParamTable = self.dfTS38900Table756(fc) - self.adaptRaytx = adaptRaytx + self.funPostprocess = funPostprocess + self.prob = prob self.scenarioLosProb= self.tableFunLOSprob[self.scenario] self.scenarioParams = self.allParamTable[self.scenario] @@ -790,12 +791,15 @@ def create_channel(self, txPos, rxPos): smallStatistics = (los,ds,asa,asd,zsa,zsd,K,czsd,zod_offset_mu) clusters,subpaths = self.create_small_param(LOSangles,smallStatistics,d2D,hut) - if self.adaptRaytx: + if self.funPostprocess: - prob = np.array([0.5,0.5,0]) - #TODO - introducir tanto clusters como subpaths para procesar no mesmo porque así os datos non teñen relación - clusters = self.randomFitParameters(txPos,rxPos,clusters,prob) - subpaths = self.randomFitParameters(txPos,rxPos,subpaths,prob) + if self.prob: + prob = self.prob + clusters = self.funPostprocess(txPos,rxPos,clusters,prob) + subpaths = self.funPostprocess(txPos,rxPos,subpaths,prob) + else: + clusters = self.funPostprocess(txPos,rxPos,clusters) + subpaths = self.funPostprocess(txPos,rxPos,subpaths) keyChannel = (tuple(txPos),tuple(rxPos)) @@ -820,9 +824,7 @@ def fitAOA(self, txPos, rxPos, df): cosdAOD = np.cos(dAOD) sindAOD = np.sin(dAOD) nu = li/l0 - - # Resolvemos: - sol1= -sindAOD # xust.matematica overleaf + sol1= -sindAOD sol2= sindAOD*(nu**2-1) / ( nu**2+1-2*cosdAOD*nu ) sol2[(nu==1)&(cosdAOD==1)] = 0 #LOS path @@ -859,17 +861,15 @@ def fitAOD(self, txPos, rxPos, df): tau = df['tau'].T.to_numpy() aoa = df['AOA'].T.to_numpy() - vLOS = np.array(rxPos) - np.array(txPos) l0 = np.linalg.norm(vLOS[0:-1]) li = l0+tau*3e8 losAOD =(np.mod(np.arctan(vLOS[1]/vLOS[0])+np.pi*(vLOS[0]<0),2*np.pi)) - losAOA = np.mod(np.pi+losAOD,2*np.pi) - #aoa[0] = losAOA*(180.0/np.pi) #necesario para consistencia do primeiro rebote + losAOA = np.pi+losAOD + aoa[0] = losAOA*(180.0/np.pi) #necesario para consistencia do primeiro rebote aoaR = aoa*(np.pi/180.0) - aoaAux = np.mod(-aoaR+losAOA*(vLOS[0]>0),2*np.pi) cosdAOA = np.cos(aoaAux) sindAOA = np.sin(aoaAux) @@ -885,16 +885,11 @@ def fitAOD(self, txPos, rxPos, df): #Posibles solucions: sols = np.zeros((4,aoa.size)) - # sols[0,:] = np.arcsin(sol1) sols[0,:] = np.arcsin(sol1) sols[1,:] = np.arcsin(sol2) sols[2,:] = np.pi - np.arcsin(sol1) sols[3,:] = np.pi - np.arcsin(sol2) - #Ubicacion dos rebotes - - #x=(vLOS[1]-vLOS[0]*np.tan(losAOD+np.pi-aoaAux))/(np.tan(aoaR )-np.tan(losAOD+np.pi-aoaAux)) - x=(vLOS[1]-vLOS[0]*np.tan(aoaR))/(np.tan(losAOD+sols)-np.tan(aoaR)) x[1,(nu==1)&(cosdAOA==1)] = vLOS[0]/2 x[3,(nu==1)&(cosdAOA==1)] = vLOS[0]/2 @@ -986,7 +981,6 @@ def randomFitParameters(self, txPos, rxPos, dataset, prob): dataset2= self.fitAOD(txPos,rxPos,dataset2.reset_index(drop=True)) indx += splitSizes[1] dataset3= dataset.iloc[indx:totalSize] - dataset3= self.fitDelay(txPos,rxPos,dataset3.reset_index(drop=True)) datasetFix = pd.concat([dataset1, dataset2, dataset3], axis=0) @@ -995,9 +989,9 @@ def randomFitParameters(self, txPos, rxPos, dataset, prob): def deleteBacklobes(self,tx,rx,df,phi0): vLOS = np.array(rx) - np.array(tx) - aoa0 =(np.mod(np.arctan(vLOS[1]/vLOS[0])+np.pi*(vLOS[0]<0)+np.pi,2*np.pi))*180.0/np.pi + #aoa0 =(np.mod(np.arctan(vLOS[1]/vLOS[0])+np.pi*(vLOS[0]<0)+np.pi,2*np.pi))*180.0/np.pi - aoalim1 = np.mod(aoa0+90+phi0,360.0) + aoalim1 = np.mod(90+phi0,360.0) aoalim2 = np.mod(aoalim1+180,360.0) if(aoalim2>aoalim1):