-
Notifications
You must be signed in to change notification settings - Fork 194
Expand file tree
/
Copy pathwifi80211_conv_encode_decode_multiprocess.py
More file actions
38 lines (30 loc) · 1.15 KB
/
wifi80211_conv_encode_decode_multiprocess.py
File metadata and controls
38 lines (30 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Authors: CommPy contributors
# License: BSD 3-Clause
import math
import time
from datetime import timedelta
import matplotlib.pyplot as plt
import numpy as np
import commpy.channels as chan
# ==================================================================================================
# Complete example using Commpy Wifi 802.11 physical parameters
# ==================================================================================================
from commpy.multiprocess_links import Wifi80211
# AWGN channel
channel = chan.SISOFlatChannel(None, (1 + 0j, 0j))
w2 = Wifi80211(mcs=2)
w3 = Wifi80211(mcs=3)
# SNR range to test
SNRs2 = np.arange(0, 6) + 10 * math.log10(w2.get_modem().num_bits_symbol)
SNRs3 = np.arange(0, 6) + 10 * math.log10(w3.get_modem().num_bits_symbol)
start = time.time()
BERs = w2.link_performance_mp_mcs([2, 3], [SNRs2, SNRs3], channel, 10, 10, 600, stop_on_surpass_error=False)
print(BERs)
print(str(timedelta(seconds=(time.time() - start))))
# Test
plt.semilogy(SNRs2, BERs[2][0], 'o-', SNRs3, BERs[3][0], 'o-')
plt.grid()
plt.xlabel('Signal to Noise Ration (dB)')
plt.ylabel('Bit Error Rate')
plt.legend(('MCS 2', 'MCS 3'))
plt.show()