Skip to content

Commit 1d7419b

Browse files
committed
Fix wrong modulation for mcs 1 and 2
1 parent 169b3d3 commit 1d7419b

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

commpy/tests/test_wifi80211.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_wifi80211_siso_channel():
1717
seed(17121996)
1818
wifi80211 = Wifi80211(1)
1919
BERs = wifi80211.link_performance(SISOFlatChannel(fading_param=(1 + 0j, 0)), range(0, 9, 2), 10 ** 4, 600)[0]
20-
desired = (0.489, 0.503, 0.446, 0.31, 0.015) # From previous tests
20+
desired = (0.548, 0.508, 0.59, 0.81, 0.18) # From previous tests
2121
# for i, val in enumerate(desired):
2222
# print((BERs[i] - val) / val)
2323
assert_allclose(BERs, desired, rtol=0.3,

commpy/wifi80211.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def get_modem(self) -> mod.Modem:
5252
"""
5353
Gets the modem that is going to be used for this particular WiFi simulation according to the MCS
5454
"""
55-
qpsks = [
55+
bits_per_symbol = [
5656
2,
5757
4,
5858
4,
@@ -63,12 +63,13 @@ def get_modem(self) -> mod.Modem:
6363
256,
6464
256
6565
]
66-
if self.mcs == 0:
67-
# BPSK
68-
return mod.PSKModem(2)
66+
if self.mcs <= 2:
67+
# BPSK for mcs 0
68+
# QPSK for mcs 1 a 2
69+
return mod.PSKModem(bits_per_symbol[self.mcs])
6970
else:
70-
# Modem : QPSK
71-
return mod.QAMModem(qpsks[self.mcs])
71+
# Modem : QAMModem
72+
return mod.QAMModem(bits_per_symbol[self.mcs])
7273

7374
@staticmethod
7475
def _get_puncture_matrix(numerator: int, denominator: int) -> List:

0 commit comments

Comments
 (0)