from antenna_diversity.channel import channel_models
from antenna_diversity.diversity_technique import mrc
from antenna_diversity.encoding import SymbolEncoder
from antenna_diversity import modulation
import numpy as np
from antenna_diversity.protocols import dect

ad_path.nop()

# Create DECT packet
payload = b'0123456789012345678901234567890123456789'
dect_packet = dect.Full(payload)

# Modulate DECT packet
my_pam = modulation.PSK(2)
my_symbols = SymbolEncoder(2).encode_msb(dect_packet.to_bytes())
modulated_symbols = my_pam.modulate(my_symbols)
N = 2

# Creating the channel with N antennas and 10 snr
chnl = channel_models.RayleighAWGNChannel(N, 10)
r, h = chnl.run(modulated_symbols)
print(r)
print(h)

# Using the diversity scheme and demodulate the signal
recv = mrc(r, h)
my_demodulate = my_pam.demodulate(recv)
print(my_demodulate)

if np.array_equal(my_demodulate, my_symbols):
Exemple #2
0
 def test_decode_m2(self):
     self.assertNP(SymbolEncoder(2).decode_msb(self.expected2), self.inputs)
Exemple #3
0
 def test_decode_m4(self):
     self.assertNP(SymbolEncoder(4).decode_msb(self.expected4), self.inputs)
Exemple #4
0
 def test_m3(self):
     with self.assertRaisesRegex(Exception, "SymbolEncoder created with"):
         SymbolEncoder(3)