Simulation of a baseband transmission (minimal working example)

This example generates a complex baseband signal, representing a real modulated baseband signal, demodulates it and calculates the bit error rate afterwards

Load package

[1]:
try:
    # if you installed skcomm with pypi
    import skcomm  as skc
except:
    # if you like to use skcomm directly from source.
    # Please note: If you want to import skcomm into your file using this snippet, you must ensure that the file is on a directional level below skcomm.
    import sys, os
    current_parent_folder = os.path.abspath('..')
    sys.path.append(os.path.join(current_parent_folder))
    import skcomm as skc

Set simulation parameters

[2]:
symbol_rate = 50e6
n_bits = 2**12
mod_order = 4

Transmitter subfunctions to generate a 50 GBd QPSK signal

[3]:
# construct signal
sig_tx = skc.signal.Signal(n_dims=1)
sig_tx.symbol_rate = symbol_rate

# generate bits
sig_tx.generate_bits(n_bits=n_bits, seed=1)

# set constellation (modulation format)
sig_tx.generate_constellation(format='QAM', order=mod_order)

# create symbols
sig_tx.mapper()

# generate actual sampled signal (pulseshaping)
sig_tx.pulseshaper(upsampling=1, pulseshape='rect')

Channel Functions

Distortions could be added in more complex simulation cases.

Receiver Functions

[4]:
# rx signal
sig_rx = sig_tx.copy()

# decision
sig_rx.decision()

# demapper
sig_rx.demapper()

# BER counting
ber_res = skc.rx.count_errors(sig_rx.bits[0], sig_rx.samples[0])
print(f"Bit error rate = {ber_res['ber']}")
Bit error rate = 0.0

Multiple, more advanced algorithms and procedures could now be added at transmitter (from module tx) and receiver side (from module rx). Further, also distortion effects caused by the channel (module channel) could be added.