Main Content

TPC Encoder

Turbo product code (TPC) encoder

  • TPC Encoder block

Libraries:
Communications Toolbox / Error Detection and Correction / Block

Description

The TPC Encoder block performs 2-D turbo product code (TPC) encoding of an input message. The product code is a 2-D concatenation of linear block codes. The linear block codes can be a parity check code, a Hamming code, or a BCH code capable of correcting two errors. Extended and shortened codes can be applied independently on each dimension. For a description of 2-D TPC encoding, see Turbo Product Code Construction.

For information about valid code pairs and the error-correcting capability for each valid code pair, see Component Code Pairs.

Examples

expand all

Perform error rate calculations for a transmission signal that has been TPC encoded and decoded.

A random signal is TPC encoded, QPSK modulated, filtered through an AWGN channel, and QPSK demodulated. The bipolar mapping is converted from negative to positive mapping and then the signal is TPC decoded. An error rate calculation compares the original message to the recovered message.

Open Example Model and Explore Its Contents

Several settings must be aligned with each other to synchronize encoding and decoding of the message. Start by deciding on a code rate, and aligning the TPC Encoder and TPC Decoder 2-D [N,K] pairs. For this example the default settings are used, [Nr,Kr] = [15,11] and [Nc,Kc] = [32,26].

The number of samples per frame and the sample time used by the Bernoulli Binary Generator block are determined based on the message length parameters, Number of rows in message, Kr and Number of columns in message, Kc.

  • Number of samples per frame = (Kr*Kc) = 286

  • Sample time = 1/(Kr*Kc) = 0.0035.

The white Gaussian noise the SNR setting is calculated based on the coding rate, modulation order, and Eb/N0.

  • Modulation order, M = 2

  • Eb/N0 = -11

  • rate = (Kr*Kc)/((Nr-Kr)*(Nc-Kc)) = 14.3

  • snr = 10*log10(M*rate*10^(ebn0/10)) = 3.5637

The noise variance used in the QPSK Demodulator Baseband block is calculated based on the SNR.

  • Noise variance = 1/10^(snr/10) = 1/10^(3.5637/10) = 0.4402

Run the model and observe the error rate calculation. Results will vary from run to run due to the use of random input data.

Bit error rate: 0.00042

Further Exploration

To run the model yourself, open the example using the button provided or by entering open slex_tpc_err_rate_calc at the MATLAB® command prompt. Consider modifying the model to change the signal to noise ratio. When adjusting TPC Encoder settings be sure to align settings in the TPC Decoder, Bernoulli Binary Generator, AWGN Channel, and QPSK Demodulator Baseband.

Ports

Input

expand all

Input message bits to encode, specified as a column vector.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean

Output

expand all

TPC-encoded message, returned as a column vector with the same data type as the input signal.

Parameters

expand all

To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.

Row TPC parameters

Number of rows in the product code matrix, NR. The list of integer values varies depending on the setting for Extended codes.

Number of rows in the message matrix, KR. The list of integer values varies depending on the setting for Extended codes and Number of rows in code, Nr.

Select Specify shortened message length to specify a value for Number of rows in shortened message, Sr.

Number of rows in the shortened message matrix, SR, specified as an integer less than or equal to KR. When you specify this parameter, provide full-length NR and KR values to specify the (NR,KR) code pair. This code pair is then shortened to the (NRKR+SR,SR) code pair, where:

Dependencies

To enable this parameter, select Specify shortened message length.

Column TPC parameters

Number of columns in the product code matrix, NC. The list of integer values varies depending on the setting for Extended codes.

Number of columns in the message matrix, KC. The list of integer values varies depending on the setting for Extended codes and Number of columns in code, Nc.

Select Specify shortened message length to specify a value for Number of columns in shortened message, Sc.

Number of columns in the shortened message matrix, SC, specified as an integer. When you specify this parameter, provide full-length NC and KC values to specify the (NC,KC) code pair. This code pair is then shortened to the (NCKC+SC, SC) code pair, where:

Dependencies

To enable this parameter, select Specify shortened message length.

Type of simulation to run, specified as Code generation or Interpreted execution.

  • Code generation — Simulate the model by using generated C code. The first time you run a simulation, Simulink generates C code for the block. The model reuses the C code for subsequent simulations unless the model changes. This option requires additional startup time, but the speed of the subsequent simulations is faster than with the Interpreted execution option.

  • Interpreted execution — Simulate the model by using the MATLAB® interpreter. This option shortens startup time, but the speed of subsequent simulations is slower than with the Code generation option. In this mode, you can debug the source code of the block.

For more information, see Interpreted Execution vs. Code Generation (Simulink).

Block Characteristics

Data Types

Boolean | double | integer | single

Multidimensional Signals

no

Variable-Size Signals

no

More About

expand all

References

[1] Pyndiah, R. M. "Near-Optimum Decoding of Product Codes: Block Turbo Codes." IEEE Transactions on Communications. Vol. 46, Number 8, August 1998, pp. 1003–1010.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2018b

See Also

Blocks

Functions