def test_computeFssBlocking(self):
        # Mock things propag and FSS antenna. -70dBm at 30km
        wf_itm.CalcItmPropagationLoss = testutils.FakePropagationPredictor(
            dist_type='REAL', factor=1.0, offset=70 - 30.0)
        antenna.GetFssAntennaGains = mock.create_autospec(
            antenna.GetFssAntennaGains, return_value=2.8)
        # Create FSS and a CBSD at 30km
        fss_point, fss_info, _ = data.getFssInfo(TestAggInterf.fss_record)
        fss_freq_range = (3650e6, 3750e6)
        cbsd_lat, cbsd_lon, _ = vincenty.GeodesicPoint(fss_point[1],
                                                       fss_point[0], 30, 0)
        cbsd = entities.CBSD_TEMPLATE_CAT_A_OUTDOOR._replace(
            latitude=cbsd_lat, longitude=cbsd_lon)
        grant = entities.ConvertToCbsdGrantInfo([cbsd], 3640, 3680)[0]
        constraint = data.ProtectionConstraint(
            fss_point[1], fss_point[0], 3550e6, fss_freq_range[0],
            data.ProtectedEntityType.FSS_BLOCKING)

        itf = interf.computeInterferenceFssBlocking(grant, constraint,
                                                    fss_info, grant.max_eirp)
        self.assertAlmostEqual(
            itf,
            20 +  # EIRP/MHZ
            10 +  # 10MHz effective bandwidth
            -70  # pathloss
            + 2.8  # FSS antenna gain
            - 3.1634,  # FSS mask loss for adjacent 10MHz
            4)
Esempio n. 2
0
    def test_movelist_oob_purge_catb(self):
        np.random.seed(1248)
        # Configuring for -144dBm circle at 20km for OOB power -3dBm/10MHz
        wf_itm.CalcItmPropagationLoss = testutils.FakePropagationPredictor(
            dist_type='REAL',
            factor=1.0,
            offset=(144 + (-13 + 10 + 8) - 0.1) - 20.0)
        point = ProtectionPoint(latitude=36.815, longitude=-76.292)

        # Within move list for power
        grants = entities.ConvertToCbsdGrantInfo(entities.GenerateCbsdList(
            1,
            template_cbsd=entities.CBSD_TEMPLATE_CAT_B_OMNI,
            ref_latitude=36.815,
            ref_longitude=-76.292,
            min_distance_km=19.97,
            max_distance_km=19.98),
                                                 min_freq_mhz=3550,
                                                 max_freq_mhz=3570,
                                                 chunks_mhz=5)

        move_grants, nbor_grants = move_list.moveListConstraint(
            point, 3540e6, 3550e6, grants, 50, 2000, -144, 3,
            (150, 200, 0, 25))

        self.assertListEqual(nbor_grants, grants)
        self.assertListEqual(move_grants, grants)

        # However only using the last 2 would be out of move list
        grants = grants[2:]
        move_grants, nbor_grants = move_list.moveListConstraint(
            point, 3540e6, 3550e6, grants, 50, 2000, -144, 3,
            (150, 200, 0, 25))

        self.assertListEqual(nbor_grants, grants)
        self.assertListEqual(move_grants, [])

        # Slightly lower than the cutoff power -> none in move list
        grants = entities.ConvertToCbsdGrantInfo(entities.GenerateCbsdList(
            1,
            template_cbsd=entities.CBSD_TEMPLATE_CAT_B_OMNI,
            ref_latitude=36.815,
            ref_longitude=-76.292,
            min_distance_km=20.1,
            max_distance_km=20.2),
                                                 min_freq_mhz=3550,
                                                 max_freq_mhz=3570,
                                                 chunks_mhz=5)

        move_grants, nbor_grants = move_list.moveListConstraint(
            point, 3540e6, 3550e6, grants, 50, 2000, -144, 3,
            (150, 200, 0, 25))

        self.assertListEqual(nbor_grants, grants)
        self.assertListEqual(move_grants, [])
  def test_ClippedPpaByCensus(self):
    # Configuring for -96dBm circle above 40km
    wf_hybrid.CalcHybridPropagationLoss = testutils.FakePropagationPredictor(
        dist_type='REAL', factor=1.0, offset=(96+30-0.1) - 45.0)
    expected_ppa = sgeo.Polygon([(-80.3, 30.3), (-80.7, 30.3),
                                 (-80.7, 30.7), (-80.3, 30.7)])

    ppa_zone = ppa.PpaCreationModel(TestPpa.devices, TestPpa.pal_records)
    ppa_zone = json.loads(ppa_zone)

    self.assertAlmostSamePolygon(
        utils.ToShapely(ppa_zone), expected_ppa, 0.001)
Esempio n. 4
0
  def test_ClippedPpaByCensusWithSmallHoles(self):
    # Configuring for -96dBm circle above 40km
    wf_hybrid.CalcHybridPropagationLoss = testutils.FakePropagationPredictor(
        dist_type='REAL', factor=1.0, offset=(96+30-0.1) - 45.0)

    ppa_zone = ppa.PpaCreationModel(TestPpa.devices[1:], TestPpa.pal_records[1:])
    ppa_zone = json.loads(ppa_zone)

    census_zone = utils.ToShapely(
        drive.census_tract_driver.GetCensusTract('06027000100')
        ['features'][0]['geometry'])
    self.assertTrue(utils.ToShapely(ppa_zone).buffer(-1e-6).within(census_zone))
  def test_SimplePpaCircle(self):
    # Configuring for -96dBm circle at 16km includes
    wf_hybrid.CalcHybridPropagationLoss = testutils.FakePropagationPredictor(
        dist_type='REAL', factor=1.0, offset=(96+30-0.1) - 16.0)
    expected_ppa = sgeo.Polygon(
        [vincenty.GeodesicPoint(
            TestPpa.devices[0]['installationParam']['latitude'],
            TestPpa.devices[0]['installationParam']['longitude'],
            dist_km=16.0, bearing=angle)[1::-1]  # reverse to lng,lat
         for angle in xrange(360)])

    ppa_zone = ppa.PpaCreationModel(TestPpa.devices, TestPpa.pal_records)
    ppa_zone = json.loads(ppa_zone)

    self.assertAlmostSamePolygon(
        utils.ToShapely(ppa_zone), expected_ppa, 0.001)
Esempio n. 6
0
    def test_movelist_single_grant(self):
        np.random.seed(1248)
        # Configuring for -144dBm circle at 20km
        wf_itm.CalcItmPropagationLoss = testutils.FakePropagationPredictor(
            dist_type='REAL', factor=1.0, offset=(144 + 30 - 0.1) - 20.0)
        point = ProtectionPoint(latitude=36.815, longitude=-76.292)

        # Within the move list
        grants = entities.ConvertToCbsdGrantInfo(entities.GenerateCbsdList(
            1,
            template_cbsd=entities.CBSD_TEMPLATE_CAT_A_OUTDOOR,
            ref_latitude=36.815,
            ref_longitude=-76.292,
            min_distance_km=19.97,
            max_distance_km=19.98),
                                                 min_freq_mhz=3600,
                                                 max_freq_mhz=3610)

        move_grants, nbor_grants = move_list.moveListConstraint(
            point, 3600e6, 3610e6, grants, 50, 2000, -144, 3,
            (150, 200, 0, 25))

        self.assertListEqual(nbor_grants, grants)
        self.assertListEqual(move_grants, grants)

        # Outside the move list
        grants = entities.ConvertToCbsdGrantInfo(entities.GenerateCbsdList(
            1,
            template_cbsd=entities.CBSD_TEMPLATE_CAT_A_OUTDOOR,
            ref_latitude=36.815,
            ref_longitude=-76.292,
            min_distance_km=20.1,
            max_distance_km=20.2),
                                                 min_freq_mhz=3600,
                                                 max_freq_mhz=3610)

        move_grants, nbor_grants = move_list.moveListConstraint(
            point, 3600e6, 3610e6, grants, 50, 2000, -144, 3,
            (150, 200, 0, 25))

        self.assertListEqual(nbor_grants, grants)
        self.assertListEqual(move_grants, [])