The turbo equalizer uses a SISO NSC module and a SISO equalizer module. Optionally a precoder can be used at the channel input (by default the precoder is enabled).
Reference: R. Koetter, A. C. Singer, and M. Tuchler, ''Turbo equalization: an iterative equalization and decoding technique for coded data transmision,`` IEEE Signal Processing Magazine, pp. 67-80, Jan. 2004
#define USE_PRECODER
using std::cout;
using std::endl;
using std::string;
int main(void)
{
double threshold_value = 50;
string map_metric = "maxlogMAP";
int constraint_length = 3;
int ch_nb_taps = 4;
int nb_errors_lim = 3000;
int nb_bits_lim = int(1e6);
int perm_len =
pow2i(14);
int nb_iter = 10;
vec EbN0_dB =
"0:0.5:10";
double R = 1.0 / 2.0;
double Ec = 1.0;
#ifdef USE_PRECODER
int prec_gen_length = 2;
#endif
int nb_bits_tail = perm_len / gen.length();
int nb_bits = nb_bits_tail - (constraint_length - 1);
int nb_blocks;
int nb_errors;
bvec nsc_coded_bits(perm_len);
vec eq_apriori_data(perm_len);
vec nsc_intrinsic_coded(perm_len);
vec nsc_apriori_data(nb_bits_tail);
nsc_apriori_data.zeros();
bvec rec_bits(nb_bits_tail);
int snr_len = EbN0_dB.length();
mat ber(nb_iter, snr_len);
ber.zeros();
register int en, n;
#ifdef USE_PRECODER
#endif
vec ch_imp_response(ch_nb_taps);
#ifdef USE_PRECODER
#endif
for (en = 0;en < snr_len;en++) {
cout << "EbN0_dB = " << EbN0_dB(en) << endl;
nb_errors = 0;
nb_blocks = 0;
while ((nb_errors < nb_errors_lim) && (nb_blocks*nb_bits < nb_bits_lim))
{
em_bits = nsc_coded_bits(perm);
#ifdef USE_PRECODER
prec.
encode(em_bits, parity_bits);
em_bits = parity_bits.get_col(0);
#endif
ch_imp_response =
randray(ch_nb_taps);
eq_apriori_data.zeros();
for (n = 0;n < nb_iter;n++)
{
siso.
equalizer(eq_extrinsic_data, rec, eq_apriori_data,
false);
nsc_intrinsic_coded = SISO::threshold(eq_extrinsic_data(inv_perm), threshold_value);
siso.
nsc(nsc_extrinsic_coded, nsc_extrinsic_data, nsc_intrinsic_coded, nsc_apriori_data,
true);
berc.
count(bits, rec_bits.left(nb_bits));
eq_apriori_data = nsc_extrinsic_coded(perm);
}
nb_blocks++;
}
ber.set_col(en, ber.get_col(en) / nb_blocks);
}
it_file ff(
"turbo_equalizer_bersim_multipath.it");
ff <<
Name(
"BER") << ber;
ff <<
Name(
"EbN0_dB") << EbN0_dB;
ff.close();
return 0;
}
Ordinary AWGN Channel for cvec or vec inputs and outputs.
void set_noise(double noisevar)
Set noise variance (for complex-valued channels the sum of real and imaginary parts)
Bit Error Rate Counter (BERC) Class.
void clear()
Clears the bit error counter.
double get_errors() const
Returns the counted number of bit errors.
double get_errorrate() const
Returns the estimated bit error rate.
void count(const bvec &in1, const bvec &in2)
Cumulative error counter.
BPSK modulator with real symbols.
void modulate_bits(const bvec &bits, vec &output) const
Modulate bits into BPSK symbols in complex domain.
void demodulate_bits(const vec &signal, bvec &output) const
Demodulate noisy BPSK symbols in complex domain into bits.
Binary Convolutional rate 1/n class.
void encode_tail(const bvec &input, bvec &output)
Encoding that starts and ends in the zero state.
void set_generator_polynomials(const ivec &gen, int constraint_length)
Set generator polynomials. Given in Proakis integer form.
Moving Average Filter Base Class.
void set_coeffs(const Vec< T2 > &b)
Set the filter coefficients.
void set_state(const Vec< T3 > &state)
Set state of filter.
Mat< double > mat
Default Matrix Type.
Automatic naming when saving.
A Recursive Systematic Convolutional Encoder/Decoder class.
void set_generator_polynomials(const ivec &gen, int constraint_length)
Set generator polynomials.
void encode(const bvec &input, bmat &parity_bits)
Encode a binary vector of inputs starting from zero state without adding of a tail.
Soft Input Soft Output (SISO) modules.
void nsc(itpp::vec &extrinsic_coded, itpp::vec &extrinsic_data, const itpp::vec &intrinsic_coded, const itpp::vec &apriori_data)
SISO decoder for NSC codes
void set_map_metric(const std::string &in_MAP_metric)
Sets the metric for MAP algorithm (convolutional codes and multipath channels)
void set_generators(const itpp::bmat &in_gen)
Sets convolutional code generator polynomials.
void set_noise(const double &in_sigma2)
Sets Additive White Gaussian Noise variance for each dimension.
void set_precoder_generator(const itpp::bvec &in_prec_gen)
Sets the precoder generator polynomial for turbo equalizer.
void set_impulse_response(const itpp::vec &h)
Sets channel impulse response for equalizer.
void equalizer(itpp::vec &extrinsic_data, const itpp::vec &rec_sig, const itpp::vec &apriori_data)
SISO equalizer
Vec< double > vec
Definition of double vector type.
ivec sort_index(const Vec< T > &data, SORTING_METHOD method=INTROSORT)
Return an index vector corresponding to a sorted vector data in increasing order.
Vec< int > ivec
Definition of integer vector type.
Vec< bin > bvec
Definition of binary vector type.
The IT++ file format reading and writing class.
vec pow(const double x, const vec &y)
Calculates x to the power of y (x^y)
int pow2i(int x)
Calculate two to the power of x (2^x); x is integer.
double inv_dB(double x)
Inverse of decibel of x.
T sum_sqr(const Vec< T > &v)
Sum of square of the elements in a vector.
vec sqrt(const vec &x)
Square root of the elements.
void RNG_randomize()
Set a random seed for all Random Number Generators in the current thread.
double randu(void)
Generates a random uniform (0,1) number.
vec randray(int size, double sigma=1.0)
Generates a random Rayleigh vector.
bin randb(void)
Generates a random bit (equally likely 0s and 1s)
ITPP_EXPORT vec ones(int size)
A float vector of ones.
Include file for the IT++ communications module.
Mat< bin > bmat
bin matrix
When you run this program, the results (BER and EbN0_dB) are saved into turbo_equalizer_bersim_multipath.it file. Using the following MATLAB script
the results can be displayed.