示例#1
0
    def get_snr_from_one_point(self, tilt_angle, dx, dy, dz):
        """
        This function will obtain SNR value at one point
        Parameters
        ----------
        tilt_angle: tilted angle
        dx : x vector
        dy: y vector
        dz: z vector

        Returns
        -------
        snr: SNR value taking a value with a probability, cdf_prob
        link_state[0]: a link state value representing LOS, NLOS and outage
        """

        npts = self.npts
        dvec = np.repeat([[dx, dy, dz]], npts, axis=0)
        arr_gnb_list = multi_sect_array( \
                self.arr_gnb0, sect_type='azimuth', theta0=tilt_angle, nsect=self.nsect)
        cell_type_vec = np.repeat([self.cell_type], npts, axis=0)
        cell_type_vec = cell_type_vec.reshape(-1, )
        snr = np.zeros(npts)
        chan_list, link_state = self.chan_mod.sample_path(dvec, cell_type_vec)
        aod_thetas, aoa_thetas = np.array([]), np.array([])

        pl_gain_sum = 0
        link_types = np.array([])
        for i in range(npts):
            # Generate random channels
            chan = chan_list[i]
            data = dir_path_loss_multi_sect( \
                [self.arr_ue],arr_gnb_list,  chan)
            pl_gain = data['pl_eff']
            aod_theta = data['aod_theta']
            aoa_theta = data['aoa_theta']

            pl_gain_sum += 10**(-0.1 * (pl_gain))

            aod_thetas = np.append(aod_thetas, np.std(aod_theta))
            aoa_thetas = np.append(aoa_thetas, np.std(aoa_theta))
            # Compute the  SNR
            snri = self.tx_pow - pl_gain - self.kT - self.nf - 10 * np.log10(
                self.bw)
            snr[i] = snri
        pl_gain_sum /= npts

        pl_gain_sum = 10 * np.log10(pl_gain_sum)

        snr_avg = self.tx_pow - pl_gain_sum - self.kT - self.nf - 10 * np.log10(
            self.bw)

        aoa_theta_return = np.median(aoa_thetas)

        return snr_avg, [1], aoa_theta_return  #np.median(aoa_thetas)
示例#2
0
    def set_tx_rx_antenna(self):
        # set antenna elements for UAVs and gNBs
        elem_ue = Elem3GPP(thetabw=self.thetabw, phibw=self.phibw)
        elem_gnb_t = Elem3GPP(thetabw=self.thetabw, phibw=self.phibw)
        elem_gnb_a = Elem3GPP(thetabw=self.thetabw, phibw=self.phibw)

        arr_gnb_t = URA(elem=elem_gnb_t,
                        nant=np.array([8, 8]),
                        fc=self.frequency)
        arr_gnb_a = URA(elem=elem_gnb_a,
                        nant=np.array([8, 8]),
                        fc=self.frequency)
        arr_ue0 = URA(elem=elem_ue, nant=np.array([4, 4]), fc=self.frequency)

        self.arr_ue_list.append(
            RotatedArray(arr_ue0, theta0=self.uav_elev_angle, drone=True))
        self.arr_gnb_list_a = multi_sect_array(arr_gnb_a,
                                               sect_type='azimuth',
                                               nsect=self.nsect_a,
                                               theta0=self.bs_elev_angle_a)
        self.arr_gnb_list_t = multi_sect_array(arr_gnb_t,
                                               sect_type='azimuth',
                                               nsect=self.nsect_t,
                                               theta0=self.bs_elev_angle_t)
示例#3
0
from mmwchanmod.sim.array import URA, RotatedArray, multi_sect_array
import pandas as pd
import csv
import os

elem_ue = Elem3GPP(thetabw=65, phibw=65)
elem_gnb_t = Elem3GPP(thetabw=65, phibw=65)
elem_gnb_a = Elem3GPP(thetabw=65, phibw=65)

frequency = 28e9
nsect = 3
arr_gnb_t = URA(elem=elem_gnb_t, nant=np.array([8, 8]), fc=frequency)
arr_gnb_a = URA(elem=elem_gnb_a, nant=np.array([8, 8]), fc=frequency)
arr_ue0 = URA(elem=elem_ue, nant=np.array([4, 4]), fc=frequency)

arr_gnb_list_a = multi_sect_array( arr_gnb_a, sect_type= 'azimuth', nsect=nsect, theta0=45 )
arr_gnb_list_t = multi_sect_array(arr_gnb_t, sect_type = 'azimuth', nsect= nsect,theta0=-12)

K.clear_session()
chan_mod = load_model('uav_lon_tok', src='remote')
#self.npath_max = self.chan_mod.npaths_max
# Load the learned link classifier model
chan_mod.load_link_model()
# Load the learned path model
chan_mod.load_path_model()

bs_loc = np.array([0,0,0])
uav_loc = np.column_stack((np.linspace(0,300,10), np.repeat([0],10), np.repeat([30],10)))
dist_matrices = uav_loc - bs_loc

rx_type = np.array(chan_mod.rx_types)
示例#4
0
# UE array.  Array is pointing down.
elem_ue = Elem3GPP(thetabw=30, phibw=30)
arr_ue0 = URA(elem=elem_ue, nant=nant_ue, fc=fc)
arr_ue = RotatedArray(arr_ue0, theta0=180)

SNR_median = []
uptilt_a_list = [-10, 0, 5, 10, 30, 40, 45, 60, 80, 90]
#ptilt_a_list = [45,60,80,90]
for uptilt_a in uptilt_a_list:
    # Aerial gNB
    # First create a single uptilted array
    arr_gnb_a = RotatedArray(arr_gnb0, theta0=uptilt_a)
    # For multi-sector, create a list of arrays
    if (nsect_a > 1):
        arr_gnb_list_a = multi_sect_array(arr_gnb0,
                                          sect_type='azimuth',
                                          theta0=uptilt_a,
                                          nsect=nsect_a)

    # for terrestrial BS, we make antennas  down-tilted
    # so we don't expect any variation of SNR in this loop
    arr_gnb_t = RotatedArray(arr_gnb0, theta0=-downtilt_t)
    arr_gnb_list_t = multi_sect_array( \
        arr_gnb_t, sect_type='azimuth', nsect=nsect_t)

    SNR = np.array([])
    #rx_types =['Terrestrial']
    rx_types = ['Aerial']
    # dvec = UAV location - BS loacation = (300,0,300) - (0,0,0)
    dvec = np.column_stack(([200], [10], [100]))

    rx_type0 = rx_types[0]
示例#5
0
nx = 40
nz = 20

# Range of x and z distances to test
xlim = np.array([0, 500])
zlim = np.array([0, 130])
"""
Create the arrays
"""
# Terrestrial gNB.
# We downtilt the array and then replicate it over three sectors
elem_gnb = Elem3GPP(thetabw=82, phibw=82, theta0=90 - uptilt_a)
arr_gnb0 = URA(elem=elem_gnb, nant=nant_gnb, fc=fc)
arr_gnb1 = RotatedArray(arr_gnb0, theta0=-downtilt_t)

arr_gnb_list_t = multi_sect_array(\
        arr_gnb1, sect_type='azimuth', nsect=nsect_t)

# Aerial gNB
# First create a single uptilted array
arr_gnb_a = RotatedArray(arr_gnb0, theta0=uptilt_a)

# For multi-sector, create a list of arrays
if (nsect_a > 1):
    arr_gnb_list_a = multi_sect_array(arr_gnb_a,
                                      sect_type='azimuth',
                                      nsect=nsect_a)

# UE array.  Array is pointing down.
elem_ue = Elem3GPP(thetabw=82, phibw=82, theta0=180)
arr_ue0 = URA(elem=elem_ue, nant=nant_ue, fc=fc)
arr_ue = RotatedArray(arr_ue0, theta0=-90)