Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Multiprocess execution #82

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Add wifi multiprocess_links tests
eSoares committed Aug 25, 2020
commit 135a480122c8b19e2c59738fc23bc76885b8323b
2 changes: 1 addition & 1 deletion commpy/multiprocess_links.py
Original file line number Diff line number Diff line change
@@ -152,7 +152,7 @@ def __init__(self, mcs: int, number_of_processes=-1):

def link_performance(self, channel: _FlatChannel, SNRs: Iterable, tx_max, err_min, send_chunk=None,
frame_aggregation=1, receiver=None, stop_on_surpass_error=True):
return self.link_performance_mp_mcs([self.mcs], SNRs, channel, tx_max, err_min, send_chunk, frame_aggregation,
return self.link_performance_mp_mcs([self.mcs], [SNRs], channel, tx_max, err_min, send_chunk, frame_aggregation,
[receiver], stop_on_surpass_error)[self.mcs]

def link_performance_mp_mcs(self, mcss: list, SNRss: Iterable[Iterable],
36 changes: 35 additions & 1 deletion commpy/tests/test_multiprocess_links.py
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@

from commpy.channels import MIMOFlatChannel, SISOFlatChannel
from commpy.modulation import QAMModem, kbest
from commpy.multiprocess_links import LinkModel
from commpy.multiprocess_links import LinkModel, Wifi80211

# from commpy.tests.test_multiprocess_links_support import QPSK, receiver

@@ -63,5 +63,39 @@ def test_link_performance():
err_msg='Wrong performance for MIMO 16QAM and 4x4 Rayleigh channel')


@dec.slow
def test_wifi80211_siso_channel():
seed(17121996)
wifi80211 = Wifi80211(1)
BERs = wifi80211.link_performance(SISOFlatChannel(fading_param=(1 + 0j, 0)), range(0, 9, 2), 10 ** 4, 600)[0]
desired = (0.489, 0.503, 0.446, 0.31, 0.015) # From previous tests
# for i, val in enumerate(desired):
# print((BERs[i] - val) / val)
assert_allclose(BERs, desired, rtol=0.3,
err_msg='Wrong performance for SISO QPSK and AWGN channel')


wifi80211 = Wifi80211(3)
modem = wifi80211.get_modem()


def receiver_mimo_wifi3(y, h, constellation, noise_var):
return modem.demodulate(kbest(y, h, constellation, 16), 'hard')


@dec.slow
def test_wifi80211_mimo_channel():
seed(17121996)
# Apply link_performance to MIMO 16QAM and 4x4 Rayleigh channel
RayleighChannel = MIMOFlatChannel(4, 4)
RayleighChannel.uncorr_rayleigh_fading(complex)

BERs = wifi80211.link_performance(RayleighChannel, arange(0, 21, 5) + 10 * log10(modem.num_bits_symbol), 10 ** 4,
600, receiver=receiver_mimo_wifi3)[0]
desired = (0.535, 0.508, 0.521, 0.554, 0.475) # From previous test
assert_allclose(BERs, desired, rtol=1.25,
err_msg='Wrong performance for MIMO 16QAM and 4x4 Rayleigh channel')


if __name__ == "__main__":
run_module_suite()