Esempio n. 1
0
    def test_disableFSF(self):
        """Disable Frequency Selective Fading"""
        # Single cell single user
        wconf = copy.copy(self.wconf)
        wconf.hexTiers = 0
        wconf.usersPerCell = 1
        wconf.consideredTiers = 0
        wconf.sectorsPerBS = 1
        wconf.enableFrequencySelectiveFading = False
        world1 = world.World(wconf, self.phy)
        world1.associatePathlosses()
        world1.calculateSINRs()
        # There is only one pathloss, no fsf, no interference
        # So SINR == SNR == 40*SINR_Optim
        # Center_CSI = any CSI
        mob = world1.mobiles[0]
        bs = world1.baseStations[0]
        cell = bs.cells[0]
        CSI = mob.baseStations[bs]['cells'][cell]['CSI_OFDMA'][0,0,0,0] # select any, they are equal
        # pathgain
        np.testing.assert_allclose(mob.baseStations[bs]['cells'][cell]['pathgain'], CSI**2)
        # SINR 
        np.testing.assert_allclose(mob.SINR, utils.dBmTomW(46)*CSI**2/mob.noiseIfPower)
        # CSI Quant
        CSI_Quant = np.mean(np.mean(mob.baseStations[bs]['cells'][cell]['CSI_OFDMA'])) # the generated value for RCG is the average over all (four) MIMO channels. Without FSF, two tof them are zero. The CSI is therefore half of the CSI_Optim above. Since all RBs are scaled equally, the RCG outcome is unaffected 
        np.testing.assert_allclose(mob.baseStations[bs]['cells'][cell]['pathgain'], (2*CSI_Quant)**2) 

        # test that fading and CSI are now the same
        wconf = copy.copy(self.wconf)
        wconf.hexTiers = 1
        wconf.usersPerCell = 2
        wconf.consideredTiers = 1
        wconf.sectorsPerBS = 3
        wconf.enableFrequencySelectiveFading = False
        world2 = world.World(wconf, self.phy)
        world2.associatePathlosses()
        world2.calculateSINRs()
        # What do I know and can I test on a larger network?
        for mob in world2.mobiles:
            CSI = mob.baseStations[mob.BS]['cells'][mob.cell]['CSI_OFDMA'][0,0,0,0]
            SINR = mob.SINR
            pathgain = mob.baseStations[mob.BS]['cells'][mob.cell]['pathgain']
            # pathgain
            np.testing.assert_allclose(pathgain, CSI**2) # CSI is unchanged from the single user case
            # SINR 
            np.testing.assert_allclose(SINR, utils.dBmTomW(46)*CSI**2/mob.noiseIfPower) # only without fsf, this is true
            # CSI Quant
            CSI_Quant = np.mean(np.mean(mob.baseStations[mob.BS]['cells'][mob.cell]['CSI_OFDMA'])) 
            np.testing.assert_allclose(mob.baseStations[mob.BS]['cells'][mob.cell]['pathgain'], (2* CSI_Quant)**2) 
            # SINR Quant
            SINR_Quant = (2*CSI_Quant)**2/ mob.noiseIfPower
            np.testing.assert_allclose(mob.SINR, utils.dBmTomW(46)*SINR_Quant) 

        # all mobiles are known to cells
        self.assertTrue(len(set.union(*[c.mobiles for c in world2.cells]))==len(world2.mobiles))
Esempio n. 2
0
    def __init__(self,
                 center,
                 phy,
                 direction=None,
                 antennas=2,
                 initial_power='full',
                 sleep_alignment=None):
        self.antennas = antennas  # number of transmission antennas
        self.phy = phy
        self._OFDMA_power = None  # numpy array. Stores transmission power on each RB
        self._initial_power = initial_power
        self._outmap = np.ones([
            phy.numFreqChunks, phy.numTimeslots
        ])  # user allocation numpy array. Contains mobile ids.
        self._outmap[:] = np.nan
        self.pMax = utils.dBmTomW(phy.pMax)  # config file is in dB
        self._direction = direction  # direction of the antennas. Important for directional fading. Defaults to omnidirectional (None)
        self._center = center  # transitional property. Direction is from base station position to cell center.
        self.cellid = Cell.idcounter  # cosmetic, for plots
        Cell.idcounter += 1
        self._sleep_alignment = sleep_alignment
        self._sleep_slot_priority = None
        self.mobiles = set()
        self.neighbors = set()

        self.dtxs = Dtx_segregator(
            self.phy.numTimeslots)  # TODO: Only create this when it's needed
Esempio n. 3
0
    def __init__(self, center, phy, direction=None, antennas=2, initial_power="full", sleep_alignment=None):
        self.antennas = antennas  # number of transmission antennas
        self.phy = phy
        self._OFDMA_power = None  # numpy array. Stores transmission power on each RB
        self._initial_power = initial_power
        self._outmap = np.ones(
            [phy.numFreqChunks, phy.numTimeslots]
        )  # user allocation numpy array. Contains mobile ids.
        self._outmap[:] = np.nan
        self.pMax = utils.dBmTomW(phy.pMax)  # config file is in dB
        self._direction = (
            direction
        )  # direction of the antennas. Important for directional fading. Defaults to omnidirectional (None)
        self._center = center  # transitional property. Direction is from base station position to cell center.
        self.cellid = Cell.idcounter  # cosmetic, for plots
        Cell.idcounter += 1
        self._sleep_alignment = sleep_alignment
        self._sleep_slot_priority = None
        self.mobiles = set()
        self.neighbors = set()

        self.dtxs = Dtx_segregator(self.phy.numTimeslots)  # TODO: Only create this when it's needed