예제 #1
0
    def test_get_extended_ZF(self):
        a = zadoffchu.calcBaseZC(139, u=20)
        b = zadoffchu.calcBaseZC(31, u=14)
        c = zadoffchu.calcBaseZC(19, u=5)

        # Compute and test the extended root sequence a for size 150
        a_ext = zadoffchu.get_extended_ZF(a, 150)
        expected_a_ext = np.hstack([a, a[0:11]])
        self.assertEqual(a_ext.size, 150)
        np.testing.assert_almost_equal(expected_a_ext, a_ext)

        # Compute and test the extended root sequence b for size 32
        b_ext = zadoffchu.get_extended_ZF(b, 32)
        expected_b_ext = np.hstack([b, b[0]])
        self.assertEqual(b_ext.size, 32)
        np.testing.assert_almost_equal(expected_b_ext, b_ext)

        # Compute and test the extended root sequence c for size 32
        c_ext = zadoffchu.get_extended_ZF(c, 32)
        expected_c_ext = np.hstack([c, c[0:13]])
        self.assertEqual(c_ext.size, 32)
        np.testing.assert_almost_equal(expected_c_ext, c_ext)

        # Compute and test the extended root sequence c for size 64
        c_ext = zadoffchu.get_extended_ZF(c, 64)
        expected_c_ext = np.hstack([c, c, c, c[0:7]])
        self.assertEqual(c_ext.size, 64)
        np.testing.assert_almost_equal(expected_c_ext, c_ext)
예제 #2
0
    def test_seq_array(self):
        # calcBaseZC, getShiftedZF, get_extended_ZF

        expected_user_seq_no_ext1 = getShiftedZF(calcBaseZC(139, 25), 3)
        np.testing.assert_array_almost_equal(expected_user_seq_no_ext1,
                                             self.user_seq_no_ext1.seq_array())
        expected_user_seq_no_ext2 = getShiftedZF(calcBaseZC(31, 6), 1)
        np.testing.assert_array_almost_equal(expected_user_seq_no_ext2,
                                             self.user_seq_no_ext2.seq_array())
        expected_user_seq_no_ext2_other_shift = getShiftedZF(calcBaseZC(31, 6), 3)
        np.testing.assert_array_almost_equal(
            expected_user_seq_no_ext2_other_shift,
            self.user_seq_no_ext2_other.seq_array())

        expected_user_seq1 = getShiftedZF(get_extended_ZF(calcBaseZC(139, 25), 150), 7)
        np.testing.assert_array_almost_equal(self.user_seq1.seq_array(),
                                             expected_user_seq1)
        expected_user_seq2 = getShiftedZF(get_extended_ZF(calcBaseZC(139, 12), 150), 4)
        np.testing.assert_array_almost_equal(self.user_seq2.seq_array(),
                                             expected_user_seq2)
        expected_user_seq3 = getShiftedZF(get_extended_ZF(calcBaseZC(31, 25), 64), 1)
        np.testing.assert_array_almost_equal(self.user_seq3.seq_array(),
                                             expected_user_seq3)
        expected_user_seq4 = getShiftedZF(get_extended_ZF(calcBaseZC(31, 6), 64), 2)
        np.testing.assert_array_almost_equal(self.user_seq4.seq_array(),
                                             expected_user_seq4)
        expected_user_seq5 = getShiftedZF(get_extended_ZF(calcBaseZC(31, 6), 32), 3)
        np.testing.assert_array_almost_equal(self.user_seq5.seq_array(),
                                             expected_user_seq5)
        expected_user_seq6 = getShiftedZF(get_extended_ZF(calcBaseZC(31, 6), 256), 5)
        np.testing.assert_array_almost_equal(self.user_seq6.seq_array(),
                                             expected_user_seq6)
예제 #3
0
    def test_seq_array(self):
        expected_root__no_ext1 = calcBaseZC(139, 25)
        np.testing.assert_array_almost_equal(
            self.root_seq_no_ext1.seq_array(), expected_root__no_ext1)
        expected_root__no_ext2 = calcBaseZC(31, 6)
        np.testing.assert_array_almost_equal(
            self.root_seq_no_ext2.seq_array(), expected_root__no_ext2)

        expected_root_seq1 = calcBaseZC(139, 25)
        expected_root_seq1 = np.hstack([expected_root_seq1, expected_root_seq1[0:11]])
        np.testing.assert_array_almost_equal(
            self.root_seq1.seq_array(), expected_root_seq1)

        expected_root_seq2 = calcBaseZC(139, 12)
        expected_root_seq2 = np.hstack([expected_root_seq2, expected_root_seq2[0:11]])
        np.testing.assert_array_almost_equal(
            self.root_seq2.seq_array(), expected_root_seq2)

        expected_root_seq3 = calcBaseZC(31, 25)
        expected_root_seq3 = np.hstack(
            [expected_root_seq3, expected_root_seq3, expected_root_seq3[0:2]])
        np.testing.assert_array_almost_equal(
            self.root_seq3.seq_array(), expected_root_seq3)

        expected_root_seq4 = calcBaseZC(31, 6)
        expected_root_seq4 = np.hstack(
            [expected_root_seq4, expected_root_seq4, expected_root_seq4[0:2]])
        np.testing.assert_array_almost_equal(
            self.root_seq4.seq_array(), expected_root_seq4)

        expected_root_seq5 = calcBaseZC(31, 6)
        expected_root_seq5 = np.hstack([expected_root_seq5, expected_root_seq5[0:1]])
        np.testing.assert_array_almost_equal(
            self.root_seq5.seq_array(), expected_root_seq5)

        expected_root_seq6 = calcBaseZC(31, 6)
        expected_root_seq6 = np.hstack(
            [expected_root_seq6, expected_root_seq6, expected_root_seq6,
             expected_root_seq6, expected_root_seq6, expected_root_seq6,
             expected_root_seq6, expected_root_seq6, expected_root_seq6[0:8]])
        np.testing.assert_array_almost_equal(
            self.root_seq6.seq_array(), expected_root_seq6)
예제 #4
0
    speedTerminal = 0 / 3.6  # Speed in m/s
    fcDbl = 2.6e9  # Central carrier frequency (in Hz)
    timeTTIDbl = 1e-3  # Time of a single TTI
    subcarrierBandDbl = 15e3  # Subcarrier bandwidth (in Hz)
    numOfSubcarriersPRBInt = 12  # Number of subcarriers in each PRB
    L = 16  # The number of rays for the Jakes model.

    # Dependent parameters
    lambdaDbl = 3e8 / fcDbl  # Carrier wave length
    Fd = speedTerminal / lambdaDbl  # Doppler Frequency
    Ts = 1. / (Nsc * subcarrierBandDbl)  # Sampling time

    # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    # xxxxxxxxxxxxxxx Generate the root sequence xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    a_u1 = get_extended_ZF(calcBaseZC(Nzc, u1), Nsc / 2)
    a_u2 = get_extended_ZF(calcBaseZC(Nzc, u2), Nsc / 2)
    a_u3 = get_extended_ZF(calcBaseZC(Nzc, u3), Nsc / 2)

    print("Nsc: {0}".format(Nsc))
    print("a_u.shape: {0}".format(a_u1.shape))

    # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    # xxxxxxxxxxxxxxx Create shifted sequences for 3 users xxxxxxxxxxxxxxxxxxxx
    # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    # We arbitrarely choose some cyclic shift index and then we call
    # zadoffchu.getShiftedZF to get the shifted sequence.
    shift_index = 4
    r1 = getShiftedZF(a_u1, shift_index)
    r2 = getShiftedZF(a_u2, shift_index)
    r3 = getShiftedZF(a_u3, shift_index)