Esempio n. 1
0
    def test_best_modulation_code(self, model):
        e = model.enum
        m = model

        # Make sure it's the lowest
        m.override(e.allocation_hz, 1e9)
        m.override(e.cn0_db, 65)
        m.override(e.target_margin_db, 5)
        code = m.best_modulation_code
        assert m.best_modulation_code.name == 'BPSK'

        # Make sure it's the middle
        m.override(e.allocation_hz, 1e6)
        m.override(e.cn0_db, 70)
        m.override(e.target_margin_db, 5)
        assert m.best_modulation_code.name == 'QPSK'

        # Make sure it's the highest
        m.override(e.allocation_hz, 1e3)
        m.override(e.cn0_db, 65)
        m.override(e.target_margin_db, 5)
        assert m.best_modulation_code.name == '8PSK'

        # Verify asymmetric spectral efficiencies work
        perf = [
            pylink.Code("Usable", 1, .5, 4),
            pylink.Code("Unusable", 1e-5, 1e5, 4),
        ]
        m.override(e.modulation_performance_table, perf)
        m.override(e.allocation_hz, 1e6)
        m.override(e.target_margin_db, 3)
        m.override(e.cn0_db, 60 + 7.02 + 5)

        code = m.best_modulation_code
        assert code.name == 'Usable'
Esempio n. 2
0
    def test_modulation_code_obj(self, model):
        e = model.enum
        m = model

        perf = [pylink.Code("BPSK", .5, .5, 4)]
        m.override(e.modulation_performance_table, perf)
        code = m.best_modulation_code
        assert code

        # check the initial values
        assert code.name == 'BPSK'
        assert abs(code.esn0_db - 4.0) < 1e-5
        assert abs(code.tx_eff - .5) < 1e-5
        assert abs(code.rx_eff - .5) < 1e-5

        # check the ebn0
        assert abs(code.ebn0_db - 7.0102) < 1e-4

        # check another ebn0
        perf = [pylink.Code("8PSK", 2, 2, 12)]
        m.override(e.modulation_performance_table, perf)
        code = m.best_modulation_code
        assert abs(code.ebn0_db - 8.9898) < 1e-4
Esempio n. 3
0
@pytest.fixture
def attenuator_1db():
    return pylink.Element(gain_db=-1,
                          noise_figure_db=1,
                          name='attenuator')

@pytest.fixture
def amplifier_10db():
    return pylink.Element(gain_db=10,
                          noise_figure_db=3,
                          name='amplifier')


perf = [
    pylink.Code("BPSK", .5, .5, 4),
    pylink.Code("QPSK", 1, 1, 8),
    pylink.Code("8PSK", 2, 2, 13),
    ]


@pytest.fixture
def model():
    return pylink.DAGModel([pylink.Geometry(),
                            pylink.Antenna(is_rx=True),
                            pylink.Interconnect(is_rx=True),
                            pylink.Receiver(),
                            pylink.Transmitter(),
                            pylink.Interconnect(is_rx=False),
                            pylink.Antenna(is_rx=False),
                            pylink.Channel(),